Rename OPENSSL_CTX prefix to OSSL_LIB_CTX

Many of the new types introduced by OpenSSL 3.0 have an OSSL_ prefix,
e.g., OSSL_CALLBACK, OSSL_PARAM, OSSL_ALGORITHM, OSSL_SERIALIZER.

The OPENSSL_CTX type stands out a little by using a different prefix.
For consistency reasons, this type is renamed to OSSL_LIB_CTX.

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/12621)
master
Dr. Matthias St. Pierre 2 years ago committed by Matt Caswell
parent 29000e43ea
commit b425001010
  1. 17
      CHANGES.md
  2. 2
      NEWS.md
  3. 2
      apps/cmp_mock_srv.c
  4. 3
      apps/cmp_mock_srv.h
  5. 9
      apps/cms.c
  6. 2
      apps/fipsinstall.c
  7. 8
      apps/genpkey.c
  8. 10
      apps/include/apps.h
  9. 2
      apps/lib/app_provider.c
  10. 12
      apps/lib/apps.c
  11. 2
      apps/openssl.c
  12. 2
      apps/pkcs7.c
  13. 6
      apps/pkeyutl.c
  14. 2
      apps/smime.c
  15. 6
      apps/storeutl.c
  16. 2
      apps/ts.c
  17. 2
      crypto/asn1/a_digest.c
  18. 2
      crypto/asn1/a_sign.c
  19. 2
      crypto/asn1/a_verify.c
  20. 2
      crypto/asn1/asn_mime.c
  21. 5
      crypto/asn1/d2i_pr.c
  22. 10
      crypto/async/async.c
  23. 2
      crypto/async/async_local.h
  24. 8
      crypto/bn/bn_ctx.c
  25. 4
      crypto/bn/bn_rand.c
  26. 2
      crypto/cmp/cmp_ctx.c
  27. 4
      crypto/cmp/cmp_local.h
  28. 2
      crypto/cmp/cmp_server.c
  29. 2
      crypto/cmp/cmp_util.c
  30. 2
      crypto/cms/cms_cd.c
  31. 3
      crypto/cms/cms_dd.c
  32. 2
      crypto/cms/cms_ec.c
  33. 4
      crypto/cms/cms_env.c
  34. 2
      crypto/cms/cms_ess.c
  35. 6
      crypto/cms/cms_lib.c
  36. 14
      crypto/cms/cms_local.h
  37. 10
      crypto/cms/cms_smime.c
  38. 2
      crypto/conf/conf_lib.c
  39. 2
      crypto/conf/conf_mod.c
  40. 126
      crypto/context.c
  41. 4
      crypto/core_algorithm.c
  42. 4
      crypto/core_fetch.c
  43. 12
      crypto/core_namemap.c
  44. 8
      crypto/crmf/crmf_lib.c
  45. 4
      crypto/crmf/crmf_pbm.c
  46. 2
      crypto/ct/ct_b64.c
  47. 6
      crypto/ct/ct_local.h
  48. 8
      crypto/ct/ct_log.c
  49. 2
      crypto/ct/ct_policy.c
  50. 2
      crypto/ct/ct_sct_ctx.c
  51. 2
      crypto/dh/dh_ameth.c
  52. 2
      crypto/dh/dh_gen.c
  53. 6
      crypto/dh/dh_group_params.c
  54. 4
      crypto/dh/dh_kdf.c
  55. 6
      crypto/dh/dh_lib.c
  56. 2
      crypto/dh/dh_local.h
  57. 2
      crypto/dh/dh_pmeth.c
  58. 2
      crypto/dsa/dsa_ameth.c
  59. 6
      crypto/dsa/dsa_lib.c
  60. 2
      crypto/dsa/dsa_local.h
  61. 6
      crypto/ec/curve25519.c
  62. 4
      crypto/ec/curve448/curve448_local.h
  63. 12
      crypto/ec/curve448/ed448.h
  64. 26
      crypto/ec/curve448/eddsa.c
  65. 8
      crypto/ec/ec_ameth.c
  66. 3
      crypto/ec/ec_backend.c
  67. 4
      crypto/ec/ec_curve.c
  68. 6
      crypto/ec/ec_key.c
  69. 2
      crypto/ec/ec_kmeth.c
  70. 8
      crypto/ec/ec_lib.c
  71. 8
      crypto/ec/ec_local.h
  72. 2
      crypto/ec/ecdh_kdf.c
  73. 2
      crypto/ec/ecx_key.c
  74. 6
      crypto/ec/ecx_meth.c
  75. 2
      crypto/encode_decode/decoder_lib.c
  76. 34
      crypto/encode_decode/decoder_meth.c
  77. 4
      crypto/encode_decode/decoder_pkey.c
  78. 2
      crypto/encode_decode/encoder_lib.c
  79. 34
      crypto/encode_decode/encoder_meth.c
  80. 4
      crypto/encode_decode/encoder_pkey.c
  81. 4
      crypto/evp/asymcipher.c
  82. 6
      crypto/evp/digest.c
  83. 8
      crypto/evp/evp_enc.c
  84. 58
      crypto/evp/evp_fetch.c
  85. 8
      crypto/evp/evp_local.h
  86. 2
      crypto/evp/evp_pkey.c
  87. 4
      crypto/evp/evp_rand.c
  88. 4
      crypto/evp/exchange.c
  89. 4
      crypto/evp/kdf_meth.c
  90. 4
      crypto/evp/kem.c
  91. 6
      crypto/evp/keymgmt_meth.c
  92. 6
      crypto/evp/m_sigver.c
  93. 4
      crypto/evp/mac_meth.c
  94. 5
      crypto/evp/names.c
  95. 2
      crypto/evp/p5_crpt2.c
  96. 19
      crypto/evp/p_lib.c
  97. 2
      crypto/evp/p_sign.c
  98. 2
      crypto/evp/p_verify.c
  99. 2
      crypto/evp/pbe_scrypt.c
  100. 8
      crypto/evp/pmeth_lib.c
  101. Some files were not shown because too many files have changed in this diff Show More

@ -112,9 +112,9 @@ OpenSSL 3.0
*Rich Salz and Richard Levitte*
* Added a library context that applications as well as other
libraries can use to form a separate context within which libcrypto
operations are performed.
* Added a library context `OSSL_LIB_CTX` that applications as well as
other libraries can use to form a separate context within which
libcrypto operations are performed.
There are two ways this can be used:
@ -122,16 +122,19 @@ OpenSSL 3.0
such an argument, such as `EVP_CIPHER_fetch` and similar algorithm
fetching functions.
- Indirectly, by creating a new library context and then assigning
it as the new default, with `OPENSSL_CTX_set0_default`.
it as the new default, with `OSSL_LIB_CTX_set0_default`.
All public OpenSSL functions that take an `OPENSSL_CTX` pointer,
apart from the functions directly related to `OPENSSL_CTX`, accept
All public OpenSSL functions that take an `OSSL_LIB_CTX` pointer,
apart from the functions directly related to `OSSL_LIB_CTX`, accept
NULL to indicate that the default library context should be used.
Library code that changes the default library context using
`OPENSSL_CTX_set0_default` should take care to restore it with a
`OSSL_LIB_CTX_set0_default` should take care to restore it with a
second call before returning to the caller.
_(Note: the library context was initially called `OPENSSL_CTX` and
renamed to `OSSL_LIB_CTX` in version 3.0.0 alpha7.)_
*Richard Levitte*
* Handshake now fails if Extended Master Secret extension is dropped

@ -22,7 +22,7 @@ OpenSSL 3.0
* Remove the `RAND_DRBG` API.
* Deprecated the `ENGINE` API.
* Added `OPENSSL_CTX`, a libcrypto library context.
* Added `OSSL_LIB_CTX`, a libcrypto library context.
* Interactive mode is removed from the 'openssl' program.
* The X25519, X448, Ed25519, Ed448 and SHAKE256 algorithms are included in
the FIPS provider. None have the "fips=yes" property set and, as such,

@ -384,7 +384,7 @@ static int process_pollReq(OSSL_CMP_SRV_CTX *srv_ctx,
return 1;
}
OSSL_CMP_SRV_CTX *ossl_cmp_mock_srv_new(OPENSSL_CTX *libctx, const char *propq)
OSSL_CMP_SRV_CTX *ossl_cmp_mock_srv_new(OSSL_LIB_CTX *libctx, const char *propq)
{
OSSL_CMP_SRV_CTX *srv_ctx = OSSL_CMP_SRV_CTX_new(libctx, propq);
mock_srv_ctx *ctx = mock_srv_ctx_new();

@ -16,7 +16,8 @@
# include <openssl/cmp.h>
OSSL_CMP_SRV_CTX *ossl_cmp_mock_srv_new(OPENSSL_CTX *libctx, const char *propq);
OSSL_CMP_SRV_CTX *ossl_cmp_mock_srv_new(OSSL_LIB_CTX *libctx,
const char *propq);
void ossl_cmp_mock_srv_free(OSSL_CMP_SRV_CTX *srv_ctx);
int ossl_cmp_mock_srv_set1_certOut(OSSL_CMP_SRV_CTX *srv_ctx, X509 *cert);

@ -28,7 +28,7 @@ static int cms_cb(int ok, X509_STORE_CTX *ctx);
static void receipt_request_print(CMS_ContentInfo *cms);
static CMS_ReceiptRequest *make_receipt_request(
STACK_OF(OPENSSL_STRING) *rr_to, int rr_allorfirst,
STACK_OF(OPENSSL_STRING) *rr_from, OPENSSL_CTX *libctx, const char *propq);
STACK_OF(OPENSSL_STRING) *rr_from, OSSL_LIB_CTX *libctx, const char *propq);
static int cms_set_pkey_param(EVP_PKEY_CTX *pctx,
STACK_OF(OPENSSL_STRING) *param);
@ -233,7 +233,8 @@ const OPTIONS cms_options[] = {
static CMS_ContentInfo *load_content_info(int informat, BIO *in, BIO **indata,
const char *name,
OPENSSL_CTX *libctx, const char *propq)
OSSL_LIB_CTX *libctx,
const char *propq)
{
CMS_ContentInfo *ret, *ci;
@ -301,7 +302,7 @@ int cms_main(int argc, char **argv)
long ltmp;
const char *mime_eol = "\n";
OPTION_CHOICE o;
OPENSSL_CTX *libctx = app_get0_libctx();
OSSL_LIB_CTX *libctx = app_get0_libctx();
const char *propq = app_get0_propq();
if ((vpm = X509_VERIFY_PARAM_new()) == NULL)
@ -1389,7 +1390,7 @@ static STACK_OF(GENERAL_NAMES) *make_names_stack(STACK_OF(OPENSSL_STRING) *ns)
static CMS_ReceiptRequest *make_receipt_request(
STACK_OF(OPENSSL_STRING) *rr_to, int rr_allorfirst,
STACK_OF(OPENSSL_STRING) *rr_from,
OPENSSL_CTX *libctx, const char *propq)
OSSL_LIB_CTX *libctx, const char *propq)
{
STACK_OF(GENERAL_NAMES) *rct_to = NULL, *rct_from = NULL;
CMS_ReceiptRequest *rr;

@ -220,7 +220,7 @@ static void free_config_and_unload(CONF *conf)
static int verify_module_load(const char *parent_config_file)
{
return OPENSSL_CTX_load_config(NULL, parent_config_file);
return OSSL_LIB_CTX_load_config(NULL, parent_config_file);
}
/*

@ -22,7 +22,7 @@
#endif
static int init_keygen_file(EVP_PKEY_CTX **pctx, const char *file, ENGINE *e,
OPENSSL_CTX *libctx, const char *propq);
OSSL_LIB_CTX *libctx, const char *propq);
static int genpkey_cb(EVP_PKEY_CTX *ctx);
typedef enum OPTION_choice {
@ -73,7 +73,7 @@ int genpkey_main(int argc, char **argv)
OPTION_CHOICE o;
int outformat = FORMAT_PEM, text = 0, ret = 1, rv, do_param = 0;
int private = 0;
OPENSSL_CTX *libctx = app_get0_libctx();
OSSL_LIB_CTX *libctx = app_get0_libctx();
const char *propq = app_get0_propq();
prog = opt_init(argc, argv, genpkey_options);
@ -240,7 +240,7 @@ int genpkey_main(int argc, char **argv)
}
static int init_keygen_file(EVP_PKEY_CTX **pctx, const char *file, ENGINE *e,
OPENSSL_CTX *libctx, const char *propq)
OSSL_LIB_CTX *libctx, const char *propq)
{
BIO *pbio;
EVP_PKEY *pkey = NULL;
@ -287,7 +287,7 @@ static int init_keygen_file(EVP_PKEY_CTX **pctx, const char *file, ENGINE *e,
int init_gen_str(EVP_PKEY_CTX **pctx,
const char *algname, ENGINE *e, int do_param,
OPENSSL_CTX *libctx, const char *propq)
OSSL_LIB_CTX *libctx, const char *propq)
{
EVP_PKEY_CTX *ctx = NULL;
const EVP_PKEY_ASN1_METHOD *ameth;

@ -225,7 +225,7 @@ int x509_ctrl_string(X509 *x, const char *value);
int x509_req_ctrl_string(X509_REQ *x, const char *value);
int init_gen_str(EVP_PKEY_CTX **pctx,
const char *algname, ENGINE *e, int do_param,
OPENSSL_CTX *libctx, const char *propq);
OSSL_LIB_CTX *libctx, const char *propq);
int do_X509_sign(X509 *x, EVP_PKEY *pkey, const EVP_MD *md,
STACK_OF(OPENSSL_STRING) *sigopts);
int do_X509_verify(X509 *x, EVP_PKEY *pkey, STACK_OF(OPENSSL_STRING) *vfyopts);
@ -308,15 +308,15 @@ typedef struct verify_options_st {
extern VERIFY_CB_ARGS verify_args;
OPENSSL_CTX *app_create_libctx(void);
OPENSSL_CTX *app_get0_libctx(void);
OSSL_LIB_CTX *app_create_libctx(void);
OSSL_LIB_CTX *app_get0_libctx(void);
OSSL_PARAM *app_params_new_from_opts(STACK_OF(OPENSSL_STRING) *opts,
const OSSL_PARAM *paramdefs);
void app_params_free(OSSL_PARAM *params);
int app_provider_load(OPENSSL_CTX *libctx, const char *provider_name);
int app_provider_load(OSSL_LIB_CTX *libctx, const char *provider_name);
void app_providers_cleanup(void);
OPENSSL_CTX *app_get0_libctx(void);
OSSL_LIB_CTX *app_get0_libctx(void);
const char *app_get0_propq(void);
#endif

@ -27,7 +27,7 @@ static void provider_free(OSSL_PROVIDER *prov)
OSSL_PROVIDER_unload(prov);
}
int app_provider_load(OPENSSL_CTX *libctx, const char *provider_name)
int app_provider_load(OSSL_LIB_CTX *libctx, const char *provider_name)
{
OSSL_PROVIDER *prov;

@ -63,7 +63,7 @@ typedef struct {
unsigned long mask;
} NAME_EX_TBL;
static OPENSSL_CTX *app_libctx = NULL;
static OSSL_LIB_CTX *app_libctx = NULL;
static int set_table_opts(unsigned long *flags, const char *arg,
const NAME_EX_TBL * in_tbl);
@ -322,7 +322,7 @@ static char *app_get_pass(const char *arg, int keepbio)
return OPENSSL_strdup(tpass);
}
OPENSSL_CTX *app_get0_libctx(void)
OSSL_LIB_CTX *app_get0_libctx(void)
{
return app_libctx;
}
@ -333,7 +333,7 @@ const char *app_get0_propq(void)
return NULL;
}
OPENSSL_CTX *app_create_libctx(void)
OSSL_LIB_CTX *app_create_libctx(void)
{
/*
* Load the NULL provider into the default library context and create a
@ -345,7 +345,7 @@ OPENSSL_CTX *app_create_libctx(void)
BIO_puts(bio_err, "Failed to create null provider\n");
return NULL;
}
app_libctx = OPENSSL_CTX_new();
app_libctx = OSSL_LIB_CTX_new();
}
if (app_libctx == NULL)
BIO_puts(bio_err, "Failed to create library context\n");
@ -676,7 +676,7 @@ int load_key_certs_crls(const char *uri, int maybe_stdin,
{
PW_CB_DATA uidata;
OSSL_STORE_CTX *ctx = NULL;
OPENSSL_CTX *libctx = app_get0_libctx();
OSSL_LIB_CTX *libctx = app_get0_libctx();
const char *propq = app_get0_propq();
int ncerts = 0;
int ncrls = 0;
@ -1077,7 +1077,7 @@ X509_STORE *setup_verify(const char *CAfile, int noCAfile,
{
X509_STORE *store = X509_STORE_new();
X509_LOOKUP *lookup;
OPENSSL_CTX *libctx = app_get0_libctx();
OSSL_LIB_CTX *libctx = app_get0_libctx();
const char *propq = app_get0_propq();
if (store == NULL)

@ -88,7 +88,7 @@ static int apps_startup(void)
static void apps_shutdown(void)
{
app_providers_cleanup();
OPENSSL_CTX_free(app_get0_libctx());
OSSL_LIB_CTX_free(app_get0_libctx());
destroy_ui_method();
}

@ -60,7 +60,7 @@ int pkcs7_main(int argc, char **argv)
char *infile = NULL, *outfile = NULL, *prog;
int i, print_certs = 0, text = 0, noout = 0, p7_print = 0, ret = 1;
OPTION_CHOICE o;
OPENSSL_CTX *libctx = app_get0_libctx();
OSSL_LIB_CTX *libctx = app_get0_libctx();
const char *propq = app_get0_propq();
prog = opt_init(argc, argv, pkcs7_options);

@ -24,7 +24,7 @@ static EVP_PKEY_CTX *init_ctx(const char *kdfalg, int *pkeysize,
const char *keyfile, int keyform, int key_type,
char *passinarg, int pkey_op, ENGINE *e,
const int impl, int rawin, EVP_PKEY **ppkey,
OPENSSL_CTX *libctx, const char *propq);
OSSL_LIB_CTX *libctx, const char *propq);
static int setup_peer(EVP_PKEY_CTX *ctx, int peerform, const char *file,
ENGINE *e);
@ -124,7 +124,7 @@ int pkeyutl_main(int argc, char **argv)
int rawin = 0;
const EVP_MD *md = NULL;
int filesize = -1;
OPENSSL_CTX *libctx = app_get0_libctx();
OSSL_LIB_CTX *libctx = app_get0_libctx();
const char *propq = NULL;
prog = opt_init(argc, argv, pkeyutl_options);
@ -512,7 +512,7 @@ static EVP_PKEY_CTX *init_ctx(const char *kdfalg, int *pkeysize,
char *passinarg, int pkey_op, ENGINE *e,
const int engine_impl, int rawin,
EVP_PKEY **ppkey,
OPENSSL_CTX *libctx, const char *propq)
OSSL_LIB_CTX *libctx, const char *propq)
{
EVP_PKEY *pkey = NULL;
EVP_PKEY_CTX *ctx = NULL;

@ -154,7 +154,7 @@ int smime_main(int argc, char **argv)
int vpmtouched = 0, rv = 0;
ENGINE *e = NULL;
const char *mime_eol = "\n";
OPENSSL_CTX *libctx = app_get0_libctx();
OSSL_LIB_CTX *libctx = app_get0_libctx();
const char *propq = app_get0_propq();
if ((vpm = X509_VERIFY_PARAM_new()) == NULL)

@ -19,7 +19,7 @@
static int process(const char *uri, const UI_METHOD *uimeth, PW_CB_DATA *uidata,
int expected, int criterion, OSSL_STORE_SEARCH *search,
int text, int noout, int recursive, int indent, BIO *out,
const char *prog, OPENSSL_CTX *libctx, const char *propq);
const char *prog, OSSL_LIB_CTX *libctx, const char *propq);
typedef enum OPTION_choice {
OPT_ERR = -1, OPT_EOF = 0, OPT_HELP, OPT_ENGINE, OPT_OUT, OPT_PASSIN,
@ -84,7 +84,7 @@ int storeutl_main(int argc, char *argv[])
char *alias = NULL;
OSSL_STORE_SEARCH *search = NULL;
const EVP_MD *digest = NULL;
OPENSSL_CTX *libctx = app_get0_libctx();
OSSL_LIB_CTX *libctx = app_get0_libctx();
const char *propq = app_get0_propq();
while ((o = opt_next()) != OPT_EOF) {
@ -351,7 +351,7 @@ static int indent_printf(int indent, BIO *bio, const char *format, ...)
static int process(const char *uri, const UI_METHOD *uimeth, PW_CB_DATA *uidata,
int expected, int criterion, OSSL_STORE_SEARCH *search,
int text, int noout, int recursive, int indent, BIO *out,
const char *prog, OPENSSL_CTX *libctx, const char *propq)
const char *prog, OSSL_LIB_CTX *libctx, const char *propq)
{
OSSL_STORE_CTX *store_ctx = NULL;
int ret = 1, items = 0;

@ -957,7 +957,7 @@ static X509_STORE *create_cert_store(const char *CApath, const char *CAfile,
{
X509_STORE *cert_ctx = NULL;
X509_LOOKUP *lookup = NULL;
OPENSSL_CTX *libctx = app_get0_libctx();
OSSL_LIB_CTX *libctx = app_get0_libctx();
const char *propq = app_get0_propq();
cert_ctx = X509_STORE_new();

@ -55,7 +55,7 @@ int ASN1_digest(i2d_of_void *i2d, const EVP_MD *type, char *data,
int asn1_item_digest_ex(const ASN1_ITEM *it, const EVP_MD *md, void *asn,
unsigned char *data, unsigned int *len,
OPENSSL_CTX *libctx, const char *propq)
OSSL_LIB_CTX *libctx, const char *propq)
{
int i, ret = 0;
unsigned char *str = NULL;

@ -126,7 +126,7 @@ int ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2,
int ASN1_item_sign_ex(const ASN1_ITEM *it, X509_ALGOR *algor1,
X509_ALGOR *algor2, ASN1_BIT_STRING *signature,
const void *data, const ASN1_OCTET_STRING *id,
EVP_PKEY *pkey, const EVP_MD *md, OPENSSL_CTX *libctx,
EVP_PKEY *pkey, const EVP_MD *md, OSSL_LIB_CTX *libctx,
const char *propq)
{
int rv = 0;

@ -95,7 +95,7 @@ int ASN1_item_verify(const ASN1_ITEM *it, const X509_ALGOR *alg,
int ASN1_item_verify_ex(const ASN1_ITEM *it, const X509_ALGOR *alg,
const ASN1_BIT_STRING *signature, const void *data,
const ASN1_OCTET_STRING *id, EVP_PKEY *pkey,
OPENSSL_CTX *libctx, const char *propq)
OSSL_LIB_CTX *libctx, const char *propq)
{
EVP_MD_CTX *ctx;
int rv = -1;

@ -232,7 +232,7 @@ static int asn1_write_micalg(BIO *out, STACK_OF(X509_ALGOR) *mdalgs)
int SMIME_write_ASN1_ex(BIO *bio, ASN1_VALUE *val, BIO *data, int flags,
int ctype_nid, int econt_nid,
STACK_OF(X509_ALGOR) *mdalgs, const ASN1_ITEM *it,
OPENSSL_CTX *libctx, const char *propq)
OSSL_LIB_CTX *libctx, const char *propq)
{
char bound[33], c;
int i;

@ -22,7 +22,8 @@
#include "crypto/evp.h"
EVP_PKEY *d2i_PrivateKey_ex(int type, EVP_PKEY **a, const unsigned char **pp,
long length, OPENSSL_CTX *libctx, const char *propq)
long length, OSSL_LIB_CTX *libctx,
const char *propq)
{
EVP_PKEY *ret;
const unsigned char *p = *pp;
@ -98,7 +99,7 @@ EVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **a, const unsigned char **pp,
*/
EVP_PKEY *d2i_AutoPrivateKey_ex(EVP_PKEY **a, const unsigned char **pp,
long length, OPENSSL_CTX *libctx,
long length, OSSL_LIB_CTX *libctx,
const char *propq)
{
STACK_OF(ASN1_TYPE) *inkey;

@ -170,7 +170,7 @@ int ASYNC_start_job(ASYNC_JOB **job, ASYNC_WAIT_CTX *wctx, int *ret,
int (*func)(void *), void *args, size_t size)
{
async_ctx *ctx;
OPENSSL_CTX *libctx;
OSSL_LIB_CTX *libctx;
if (!OPENSSL_init_crypto(OPENSSL_INIT_ASYNC, NULL))
return ASYNC_ERR;
@ -208,7 +208,7 @@ int ASYNC_start_job(ASYNC_JOB **job, ASYNC_WAIT_CTX *wctx, int *ret,
* Restore the default libctx to what it was the last time the
* fibre ran
*/
libctx = OPENSSL_CTX_set0_default(ctx->currjob->libctx);
libctx = OSSL_LIB_CTX_set0_default(ctx->currjob->libctx);
/* Resume previous job */
if (!async_fibre_swapcontext(&ctx->dispatcher,
&ctx->currjob->fibrectx, 1)) {
@ -221,7 +221,7 @@ int ASYNC_start_job(ASYNC_JOB **job, ASYNC_WAIT_CTX *wctx, int *ret,
* again to what it was originally, and remember what it had
* been changed to.
*/
ctx->currjob->libctx = OPENSSL_CTX_set0_default(libctx);
ctx->currjob->libctx = OSSL_LIB_CTX_set0_default(libctx);
continue;
}
@ -252,7 +252,7 @@ int ASYNC_start_job(ASYNC_JOB **job, ASYNC_WAIT_CTX *wctx, int *ret,
ctx->currjob->func = func;
ctx->currjob->waitctx = wctx;
libctx = openssl_ctx_get_concrete(NULL);
libctx = ossl_lib_ctx_get_concrete(NULL);
if (!async_fibre_swapcontext(&ctx->dispatcher,
&ctx->currjob->fibrectx, 1)) {
ASYNCerr(ASYNC_F_ASYNC_START_JOB, ASYNC_R_FAILED_TO_SWAP_CONTEXT);
@ -262,7 +262,7 @@ int ASYNC_start_job(ASYNC_JOB **job, ASYNC_WAIT_CTX *wctx, int *ret,
* In case the fibre changed the default libctx we set it back again
* to what it was, and remember what it had been changed to.
*/
ctx->currjob->libctx = OPENSSL_CTX_set0_default(libctx);
ctx->currjob->libctx = OSSL_LIB_CTX_set0_default(libctx);
}
err:

@ -43,7 +43,7 @@ struct async_job_st {
int ret;
int status;
ASYNC_WAIT_CTX *waitctx;
OPENSSL_CTX *libctx;
OSSL_LIB_CTX *libctx;
};
struct fd_lookup_st {

@ -87,7 +87,7 @@ struct bignum_ctx {
/* Flags. */
int flags;
/* The library context */
OPENSSL_CTX *libctx;
OSSL_LIB_CTX *libctx;
};
#ifndef FIPS_MODULE
@ -128,7 +128,7 @@ static void ctxdbg(BIO *channel, const char *text, BN_CTX *ctx)
# define CTXDBG(str, ctx) do {} while(0)
#endif /* FIPS_MODULE */
BN_CTX *BN_CTX_new_ex(OPENSSL_CTX *ctx)
BN_CTX *BN_CTX_new_ex(OSSL_LIB_CTX *ctx)
{
BN_CTX *ret;
@ -150,7 +150,7 @@ BN_CTX *BN_CTX_new(void)
}
#endif
BN_CTX *BN_CTX_secure_new_ex(OPENSSL_CTX *ctx)
BN_CTX *BN_CTX_secure_new_ex(OSSL_LIB_CTX *ctx)
{
BN_CTX *ret = BN_CTX_new_ex(ctx);
@ -249,7 +249,7 @@ BIGNUM *BN_CTX_get(BN_CTX *ctx)
return ret;
}
OPENSSL_CTX *bn_get_lib_ctx(BN_CTX *ctx)
OSSL_LIB_CTX *bn_get_lib_ctx(BN_CTX *ctx)
{
if (ctx == NULL)
return NULL;

@ -25,7 +25,7 @@ static int bnrand(BNRAND_FLAG flag, BIGNUM *rnd, int bits, int top, int bottom,
{
unsigned char *buf = NULL;
int b, ret = 0, bit, bytes, mask;
OPENSSL_CTX *libctx = bn_get_lib_ctx(ctx);
OSSL_LIB_CTX *libctx = bn_get_lib_ctx(ctx);
if (bits == 0) {
if (top != BN_RAND_TOP_ANY || bottom != BN_RAND_BOTTOM_ANY)
@ -254,7 +254,7 @@ int BN_generate_dsa_nonce(BIGNUM *out, const BIGNUM *range,
unsigned char *k_bytes = NULL;
int ret = 0;
EVP_MD *md = NULL;
OPENSSL_CTX *libctx = bn_get_lib_ctx(ctx);
OSSL_LIB_CTX *libctx = bn_get_lib_ctx(ctx);
if (mdctx == NULL)
goto err;

@ -101,7 +101,7 @@ static int cmp_ctx_set_md(OSSL_CMP_CTX *ctx, EVP_MD **pmd, int nid)
* Allocates and initializes OSSL_CMP_CTX context structure with default values.
* Returns new context on success, NULL on error
*/
OSSL_CMP_CTX *OSSL_CMP_CTX_new(OPENSSL_CTX *libctx, const char *propq)
OSSL_CMP_CTX *OSSL_CMP_CTX_new(OSSL_LIB_CTX *libctx, const char *propq)
{
OSSL_CMP_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx));

@ -28,7 +28,7 @@
* this structure is used to store the context for CMP sessions
*/
struct ossl_cmp_ctx_st {
OPENSSL_CTX *libctx;
OSSL_LIB_CTX *libctx;
const char *propq;
OSSL_CMP_log_cb_t log_cb; /* log callback for error/debug/etc. output */
OSSL_CMP_severity log_verbosity; /* level of verbosity of log output */
@ -747,7 +747,7 @@ int ossl_cmp_asn1_octet_string_set1(ASN1_OCTET_STRING **tgt,
int ossl_cmp_asn1_octet_string_set1_bytes(ASN1_OCTET_STRING **tgt,
const unsigned char *bytes, int len);
STACK_OF(X509)
*ossl_cmp_build_cert_chain(OPENSSL_CTX *libctx, const char *propq,
*ossl_cmp_build_cert_chain(OSSL_LIB_CTX *libctx, const char *propq,
X509_STORE *store,
STACK_OF(X509) *certs, X509 *cert);

@ -48,7 +48,7 @@ void OSSL_CMP_SRV_CTX_free(OSSL_CMP_SRV_CTX *srv_ctx)
OPENSSL_free(srv_ctx);
}
OSSL_CMP_SRV_CTX *OSSL_CMP_SRV_CTX_new(OPENSSL_CTX *libctx, const char *propq)
OSSL_CMP_SRV_CTX *OSSL_CMP_SRV_CTX_new(OSSL_LIB_CTX *libctx, const char *propq)
{
OSSL_CMP_SRV_CTX *ctx = OPENSSL_zalloc(sizeof(OSSL_CMP_SRV_CTX));

@ -217,7 +217,7 @@ int ossl_cmp_X509_STORE_add1_certs(X509_STORE *store, STACK_OF(X509) *certs,
*/
/* TODO this should be of more general interest and thus be exported. */
STACK_OF(X509)
*ossl_cmp_build_cert_chain(OPENSSL_CTX *libctx, const char *propq,
*ossl_cmp_build_cert_chain(OSSL_LIB_CTX *libctx, const char *propq,
X509_STORE *store,
STACK_OF(X509) *certs, X509 *cert)
{

@ -21,7 +21,7 @@
/* CMS CompressedData Utilities */
CMS_ContentInfo *cms_CompressedData_create(int comp_nid, OPENSSL_CTX *libctx,
CMS_ContentInfo *cms_CompressedData_create(int comp_nid, OSSL_LIB_CTX *libctx,
const char *propq)
{
CMS_ContentInfo *cms;

@ -18,7 +18,8 @@
/* CMS DigestedData Utilities */
CMS_ContentInfo *cms_DigestedData_create(const EVP_MD *md,
OPENSSL_CTX *libctx, const char *propq)
OSSL_LIB_CTX *libctx,
const char *propq)
{
CMS_ContentInfo *cms;
CMS_DigestedData *dd;

@ -16,7 +16,7 @@
#ifndef OPENSSL_NO_EC
static EVP_PKEY *pkey_type2param(int ptype, const void *pval,
OPENSSL_CTX *libctx, const char *propq)
OSSL_LIB_CTX *libctx, const char *propq)
{
EVP_PKEY *pkey = NULL;
EVP_PKEY_CTX *pctx = NULL;

@ -219,7 +219,7 @@ EVP_PKEY_CTX *CMS_RecipientInfo_get0_pkey_ctx(CMS_RecipientInfo *ri)
}
CMS_ContentInfo *CMS_EnvelopedData_create_ex(const EVP_CIPHER *cipher,
OPENSSL_CTX *libctx,
OSSL_LIB_CTX *libctx,
const char *propq)
{
CMS_ContentInfo *cms;
@ -248,7 +248,7 @@ CMS_ContentInfo *CMS_EnvelopedData_create(const EVP_CIPHER *cipher)
}
CMS_ContentInfo *
CMS_AuthEnvelopedData_create_ex(const EVP_CIPHER *cipher, OPENSSL_CTX *libctx,
CMS_AuthEnvelopedData_create_ex(const EVP_CIPHER *cipher, OSSL_LIB_CTX *libctx,
const char *propq)
{
CMS_ContentInfo *cms;

@ -117,7 +117,7 @@ int ess_check_signing_certs(CMS_SignerInfo *si, STACK_OF(X509) *chain)
CMS_ReceiptRequest *CMS_ReceiptRequest_create0_ex(
unsigned char *id, int idlen, int allorfirst,
STACK_OF(GENERAL_NAMES) *receiptList, STACK_OF(GENERAL_NAMES) *receiptsTo,
OPENSSL_CTX *libctx, const char *propq)
OSSL_LIB_CTX *libctx, const char *propq)
{
CMS_ReceiptRequest *rr;

@ -40,7 +40,7 @@ int i2d_CMS_ContentInfo(const CMS_ContentInfo *a, unsigned char **out)
return ASN1_item_i2d((const ASN1_VALUE *)a, out, (CMS_ContentInfo_it()));
}
CMS_ContentInfo *CMS_ContentInfo_new_ex(OPENSSL_CTX *libctx, const char *propq)
CMS_ContentInfo *CMS_ContentInfo_new_ex(OSSL_LIB_CTX *libctx, const char *propq)
{
CMS_ContentInfo *ci;
@ -78,7 +78,7 @@ const CMS_CTX *cms_get0_cmsctx(const CMS_ContentInfo *cms)
return cms != NULL ? &cms->ctx : NULL;
}
OPENSSL_CTX *cms_ctx_get0_libctx(const CMS_CTX *ctx)
OSSL_LIB_CTX *cms_ctx_get0_libctx(const CMS_CTX *ctx)
{
return ctx->libctx;
}
@ -117,7 +117,7 @@ const ASN1_OBJECT *CMS_get0_type(const CMS_ContentInfo *cms)
return cms->contentType;
}
CMS_ContentInfo *cms_Data_create(OPENSSL_CTX *libctx, const char *propq)
CMS_ContentInfo *cms_Data_create(OSSL_LIB_CTX *libctx, const char *propq)
{
CMS_ContentInfo *cms = CMS_ContentInfo_new_ex(libctx, propq);

@ -47,7 +47,7 @@ typedef struct CMS_ReceiptsFrom_st CMS_ReceiptsFrom;
typedef struct CMS_CTX_st CMS_CTX;
struct CMS_CTX_st {
OPENSSL_CTX *libctx;
OSSL_LIB_CTX *libctx;
char *propq;
};
@ -390,16 +390,18 @@ DECLARE_ASN1_ALLOC_FUNCTIONS(CMS_IssuerAndSerialNumber)
BIO *cms_content_bio(CMS_ContentInfo *cms);
const CMS_CTX *cms_get0_cmsctx(const CMS_ContentInfo *cms);
OPENSSL_CTX *cms_ctx_get0_libctx(const CMS_CTX *ctx);
OSSL_LIB_CTX *cms_ctx_get0_libctx(const CMS_CTX *ctx);
const char *cms_ctx_get0_propq(const CMS_CTX *ctx);
void cms_resolve_libctx(CMS_ContentInfo *ci);
CMS_ContentInfo *cms_Data_create(OPENSSL_CTX *ctx, const char *propq);
CMS_ContentInfo *cms_Data_create(OSSL_LIB_CTX *ctx, const char *propq);
CMS_ContentInfo *cms_DigestedData_create(const EVP_MD *md,
OPENSSL_CTX *libctx, const char *propq);
OSSL_LIB_CTX *libctx,
const char *propq);
BIO *cms_DigestedData_init_bio(const CMS_ContentInfo *cms);
int cms_DigestedData_do_final(const CMS_ContentInfo *cms, BIO *chain, int verify);
int cms_DigestedData_do_final(const CMS_ContentInfo *cms,
BIO *chain, int verify);
BIO *cms_SignedData_init_bio(CMS_ContentInfo *cms);
int cms_SignedData_final(CMS_ContentInfo *cms, BIO *chain);
@ -411,7 +413,7 @@ int cms_SignerIdentifier_get0_signer_id(CMS_SignerIdentifier *sid,
ASN1_INTEGER **sno);
int cms_SignerIdentifier_cert_cmp(CMS_SignerIdentifier *sid, X509 *cert);
CMS_ContentInfo *cms_CompressedData_create(int comp_nid, OPENSSL_CTX *libctx,
CMS_ContentInfo *cms_CompressedData_create(int comp_nid, OSSL_LIB_CTX *libctx,
const char *propq);
BIO *cms_CompressedData_init_bio(const CMS_ContentInfo *cms);

@ -119,7 +119,7 @@ int CMS_data(CMS_ContentInfo *cms, BIO *out, unsigned int flags)
}
CMS_ContentInfo *CMS_data_create_ex(BIO *in, unsigned int flags,
OPENSSL_CTX *libctx, const char *propq)
OSSL_LIB_CTX *libctx, const char *propq)
{
CMS_ContentInfo *cms = cms_Data_create(libctx, propq);
@ -164,7 +164,7 @@ int CMS_digest_verify(CMS_ContentInfo *cms, BIO *dcont, BIO *out,
}
CMS_ContentInfo *CMS_digest_create_ex(BIO *in, const EVP_MD *md,
unsigned int flags, OPENSSL_CTX *ctx,
unsigned int flags, OSSL_LIB_CTX *ctx,
const char *propq)
{
CMS_ContentInfo *cms;
@ -220,7 +220,7 @@ int CMS_EncryptedData_decrypt(CMS_ContentInfo *cms,
CMS_ContentInfo *CMS_EncryptedData_encrypt_ex(BIO *in, const EVP_CIPHER *cipher,
const unsigned char *key,
size_t keylen, unsigned int flags,
OPENSSL_CTX *libctx,
OSSL_LIB_CTX *libctx,
const char *propq)
{
CMS_ContentInfo *cms;
@ -500,7 +500,7 @@ int CMS_verify_receipt(CMS_ContentInfo *rcms, CMS_ContentInfo *ocms,
CMS_ContentInfo *CMS_sign_ex(X509 *signcert, EVP_PKEY *pkey,
STACK_OF(X509) *certs, BIO *data,
unsigned int flags, OPENSSL_CTX *libctx,
unsigned int flags, OSSL_LIB_CTX *libctx,
const char *propq)
{
CMS_ContentInfo *cms;
@ -619,7 +619,7 @@ CMS_ContentInfo *CMS_sign_receipt(CMS_SignerInfo *si,
CMS_ContentInfo *CMS_encrypt_ex(STACK_OF(X509) *certs, BIO *data,
const EVP_CIPHER *cipher, unsigned int flags,
OPENSSL_CTX *libctx, const char *propq)
OSSL_LIB_CTX *libctx, const char *propq)
{
CMS_ContentInfo *cms;
int i;

@ -178,7 +178,7 @@ int CONF_dump_bio(LHASH_OF(CONF_VALUE) *conf, BIO *out)
* the "CONF classic" functions, for consistency.
*/
CONF *NCONF_new_ex(OPENSSL_CTX *libctx, CONF_METHOD *meth)
CONF *NCONF_new_ex(OSSL_LIB_CTX *libctx, CONF_METHOD *meth)
{
CONF *ret;

@ -148,7 +148,7 @@ int CONF_modules_load(const CONF *cnf, const char *appname,
}
int CONF_modules_load_file_ex(OPENSSL_CTX *libctx, const char *filename,
int CONF_modules_load_file_ex(OSSL_LIB_CTX *libctx, const char *filename,
const char *appname, unsigned long flags)
{
char *file = NULL;

@ -12,34 +12,34 @@
#include "internal/thread_once.h"
#include "internal/property.h"
struct openssl_ctx_onfree_list_st {
openssl_ctx_onfree_fn *fn;
struct openssl_ctx_onfree_list_st *next;
struct ossl_lib_ctx_onfree_list_st {
ossl_lib_ctx_onfree_fn *fn;
struct ossl_lib_ctx_onfree_list_st *next;
};
struct openssl_ctx_st {
struct ossl_lib_ctx_st {
CRYPTO_RWLOCK *lock;
CRYPTO_EX_DATA data;
/*
* For most data in the OPENSSL_CTX we just use ex_data to store it. But
* For most data in the OSSL_LIB_CTX we just use ex_data to store it. But
* that doesn't work for ex_data itself - so we store that directly.
*/
OSSL_EX_DATA_GLOBAL global;
/* Map internal static indexes to dynamically created indexes */
int dyn_indexes[OPENSSL_CTX_MAX_INDEXES];
int dyn_indexes[OSSL_LIB_CTX_MAX_INDEXES];
/* Keep a separate lock for each index */
CRYPTO_RWLOCK *index_locks[OPENSSL_CTX_MAX_INDEXES];
CRYPTO_RWLOCK *index_locks[OSSL_LIB_CTX_MAX_INDEXES];
CRYPTO_RWLOCK *oncelock;
int run_once_done[OPENSSL_CTX_MAX_RUN_ONCE];
int run_once_ret[OPENSSL_CTX_MAX_RUN_ONCE];
struct openssl_ctx_onfree_list_st *onfreelist;
int run_once_done[OSSL_LIB_CTX_MAX_RUN_ONCE];
int run_once_ret[OSSL_LIB_CTX_MAX_RUN_ONCE];
struct ossl_lib_ctx_onfree_list_st *onfreelist;
};
static int context_init(OPENSSL_CTX *ctx)
static int context_init(OSSL_LIB_CTX *ctx)
{
size_t i;
int exdata_done = 0;
@ -52,19 +52,19 @@ static int context_init(OPENSSL_CTX *ctx)
if (ctx->oncelock == NULL)
goto err;
for (i = 0; i < OPENSSL_CTX_MAX_INDEXES; i++) {
for (i = 0; i < OSSL_LIB_CTX_MAX_INDEXES; i++) {
ctx->index_locks[i] = CRYPTO_THREAD_lock_new();
ctx->dyn_indexes[i] = -1;
if (ctx->index_locks[i] == NULL)
goto err;
}
/* OPENSSL_CTX is built on top of ex_data so we initialise that directly */
/* OSSL_LIB_CTX is built on top of ex_data so we initialise that directly */
if (!do_ex_data_init(ctx))
goto err;
exdata_done = 1;
if (!crypto_new_ex_data_ex(ctx, CRYPTO_EX_INDEX_OPENSSL_CTX, NULL,
if (!crypto_new_ex_data_ex(ctx, CRYPTO_EX_INDEX_OSSL_LIB_CTX, NULL,
&ctx->data)) {
crypto_cleanup_all_ex_data_int(ctx);
goto err;
@ -84,9 +84,9 @@ static int context_init(OPENSSL_CTX *ctx)
return 0;
}
static int context_deinit(OPENSSL_CTX *ctx)
static int context_deinit(OSSL_LIB_CTX *ctx)
{
struct openssl_ctx_onfree_list_st *tmp, *onfree;
struct ossl_lib_ctx_onfree_list_st *tmp, *onfree;
int i;
if (ctx == NULL)
@ -101,9 +101,9 @@ static int context_deinit(OPENSSL_CTX *ctx)
onfree = onfree->next;
OPENSSL_free(tmp);
}
CRYPTO_free_ex_data(CRYPTO_EX_INDEX_OPENSSL_CTX, NULL, &ctx->data);
CRYPTO_free_ex_data(CRYPTO_EX_INDEX_OSSL_LIB_CTX, NULL, &ctx->data);
crypto_cleanup_all_ex_data_int(ctx);
for (i = 0; i < OPENSSL_CTX_MAX_INDEXES; i++)
for (i = 0; i < OSSL_LIB_CTX_MAX_INDEXES; i++)
CRYPTO_THREAD_lock_free(ctx->index_locks[i]);
CRYPTO_THREAD_lock_free(ctx->oncelock);
@ -114,7 +114,7 @@ static int context_deinit(OPENSSL_CTX *ctx)
#ifndef FIPS_MODULE
/* The default default context */
static OPENSSL_CTX default_context_int;
static OSSL_LIB_CTX default_context_int;
static CRYPTO_ONCE default_context_init = CRYPTO_ONCE_STATIC_INIT;
static CRYPTO_THREAD_LOCAL default_context_thread_local;
@ -125,12 +125,12 @@ DEFINE_RUN_ONCE_STATIC(default_context_do_init)
&& context_init(&default_context_int);
}
void openssl_ctx_default_deinit(void)
void ossl_lib_ctx_default_deinit(void)
{
context_deinit(&default_context_int);
}
static OPENSSL_CTX *get_thread_default_context(void)
static OSSL_LIB_CTX *get_thread_default_context(void)
{
if (!RUN_ONCE(&default_context_init, default_context_do_init))
return NULL;
@ -138,16 +138,16 @@ static OPENSSL_CTX *get_thread_default_context(void)
return CRYPTO_THREAD_get_local(&default_context_thread_local);
}
static OPENSSL_CTX *get_default_context(void)
static OSSL_LIB_CTX *get_default_context(void)
{
OPENSSL_CTX *current_defctx = get_thread_default_context();
OSSL_LIB_CTX *current_defctx = get_thread_default_context();
if (current_defctx == NULL)
current_defctx = &default_context_int;
return current_defctx;
}
static int set_default_context(OPENSSL_CTX *defctx)
static int set_default_context(OSSL_LIB_CTX *defctx)
{
if (defctx == &default_context_int)
defctx = NULL;
@ -156,37 +156,37 @@ static int set_default_context(OPENSSL_CTX *defctx)
}
#endif
OPENSSL_CTX *OPENSSL_CTX_new(void)
OSSL_LIB_CTX *OSSL_LIB_CTX_new(void)
{
OPENSSL_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx));
OSSL_LIB_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx));
if (ctx != NULL && !context_init(ctx)) {
OPENSSL_CTX_free(ctx);
OSSL_LIB_CTX_free(ctx);
ctx = NULL;
}
return ctx;
}
#ifndef FIPS_MODULE
int OPENSSL_CTX_load_config(OPENSSL_CTX *ctx, const char *config_file)
int OSSL_LIB_CTX_load_config(OSSL_LIB_CTX *ctx, const char *config_file)
{
return CONF_modules_load_file_ex(ctx, config_file, NULL, 0) > 0;
}
#endif
void OPENSSL_CTX_free(OPENSSL_CTX *ctx)
void OSSL_LIB_CTX_free(OSSL_LIB_CTX *ctx)
{
if (openssl_ctx_is_default(ctx))
if (ossl_lib_ctx_is_default(ctx))
return;
context_deinit(ctx);
OPENSSL_free(ctx);
}
OPENSSL_CTX *OPENSSL_CTX_set0_default(OPENSSL_CTX *libctx)
OSSL_LIB_CTX *OSSL_LIB_CTX_set0_default(OSSL_LIB_CTX *libctx)
{
#ifndef FIPS_MODULE
OPENSSL_CTX *current_defctx;
OSSL_LIB_CTX *current_defctx;
if ((current_defctx = get_default_context()) != NULL
&& set_default_context(libctx))
@ -196,7 +196,7 @@ OPENSSL_CTX *OPENSSL_CTX_set0_default(OPENSSL_CTX *libctx)
return NULL;
}
OPENSSL_CTX *openssl_ctx_get_concrete(OPENSSL_CTX *ctx)
OSSL_LIB_CTX *ossl_lib_ctx_get_concrete(OSSL_LIB_CTX *ctx)
{
#ifndef FIPS_MODULE
if (ctx == NULL)
@ -205,7 +205,7 @@ OPENSSL_CTX *openssl_ctx_get_concrete(OPENSSL_CTX *ctx)
return ctx;
}
int openssl_ctx_is_default(OPENSSL_CTX *ctx)
int ossl_lib_ctx_is_default(OSSL_LIB_CTX *ctx)
{
#ifndef FIPS_MODULE
if (ctx == NULL || ctx == get_default_context())
@ -214,48 +214,48 @@ int openssl_ctx_is_default(OPENSSL_CTX *ctx)
return 0;
}
int openssl_ctx_is_global_default(OPENSSL_CTX *ctx)
int ossl_lib_ctx_is_global_default(OSSL_LIB_CTX *ctx)
{
#ifndef FIPS_MODULE
if (openssl_ctx_get_concrete(ctx) == &default_context_int)
if (ossl_lib_ctx_get_concrete(ctx) == &default_context_int)
return 1;
#endif
return 0;
}
static void openssl_ctx_generic_new(void *parent_ign, void *ptr_ign,
CRYPTO_EX_DATA *ad, int index,
long argl_ign, void *argp)
static void ossl_lib_ctx_generic_new(void *parent_ign, void *ptr_ign,
CRYPTO_EX_DATA *ad, int index,
long argl_ign, void *argp)
{
const OPENSSL_CTX_METHOD *meth = argp;
void *ptr = meth->new_func(crypto_ex_data_get_openssl_ctx(ad));
const OSSL_LIB_CTX_METHOD *meth = argp;
void *ptr = meth->new_func(crypto_ex_data_get_ossl_lib_ctx(ad));
if (ptr != NULL)
CRYPTO_set_ex_data(ad, index, ptr);
}
static void openssl_ctx_generic_free(void *parent_ign, void *ptr,
CRYPTO_EX_DATA *ad, int index,
long argl_ign, void *argp)
static void ossl_lib_ctx_generic_free(void *parent_ign, void *ptr,
CRYPTO_EX_DATA *ad, int index,
long argl_ign, void *argp)
{
const OPENSSL_CTX_METHOD *meth = argp;
const OSSL_LIB_CTX_METHOD *meth = argp;
meth->free_func(ptr);
}
/* Non-static so we can use it in context_internal_test */
static int openssl_ctx_init_index(OPENSSL_CTX *ctx, int static_index,
const OPENSSL_CTX_METHOD *meth)
static int ossl_lib_ctx_init_index(OSSL_LIB_CTX *ctx, int static_index,
const OSSL_LIB_CTX_METHOD *meth)
{
int idx;
ctx = openssl_ctx_get_concrete(ctx);
ctx = ossl_lib_ctx_get_concrete(ctx);
if (ctx == NULL)
return 0;
idx = crypto_get_ex_new_index_ex(ctx, CRYPTO_EX_INDEX_OPENSSL_CTX, 0,
idx = crypto_get_ex_new_index_ex(ctx, CRYPTO_EX_INDEX_OSSL_LIB_CTX, 0,
(void *)meth,
openssl_ctx_generic_new,
NULL, openssl_ctx_generic_free);