Browse Source

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

+ 10 - 7
CHANGES.md

@@ -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

+ 1 - 1
NEWS.md

@@ -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,

+ 1 - 1
apps/cmp_mock_srv.c

@@ -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();

+ 2 - 1
apps/cmp_mock_srv.h

@@ -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);

+ 5 - 4
apps/cms.c

@@ -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;

+ 1 - 1
apps/fipsinstall.c

@@ -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);
 }
 
 /*

+ 4 - 4
apps/genpkey.c

@@ -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;

+ 5 - 5
apps/include/apps.h

@@ -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

+ 1 - 1
apps/lib/app_provider.c

@@ -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;
 

+ 6 - 6
apps/lib/apps.c

@@ -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)

+ 1 - 1
apps/openssl.c

@@ -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();
 }
 

+ 1 - 1
apps/pkcs7.c

@@ -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);

+ 3 - 3
apps/pkeyutl.c

@@ -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;

+ 1 - 1
apps/smime.c

@@ -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)

+ 3 - 3
apps/storeutl.c

@@ -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;

+ 1 - 1
apps/ts.c

@@ -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();

+ 1 - 1
crypto/asn1/a_digest.c

@@ -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;

+ 1 - 1
crypto/asn1/a_sign.c

@@ -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;

+ 1 - 1
crypto/asn1/a_verify.c

@@ -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;

+ 1 - 1
crypto/asn1/asn_mime.c

@@ -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;

+ 3 - 2
crypto/asn1/d2i_pr.c

@@ -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;

+ 5 - 5
crypto/async/async.c

@@ -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:

+ 1 - 1
crypto/async/async_local.h

@@ -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 {

+ 4 - 4
crypto/bn/bn_ctx.c

@@ -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;

+ 2 - 2
crypto/bn/bn_rand.c

@@ -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;

+ 1 - 1
crypto/cmp/cmp_ctx.c

@@ -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));
 

+ 2 - 2
crypto/cmp/cmp_local.h

@@ -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);
 

+ 1 - 1
crypto/cmp/cmp_server.c

@@ -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));
 

+ 1 - 1
crypto/cmp/cmp_util.c

@@ -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)
 {

+ 1 - 1
crypto/cms/cms_cd.c

@@ -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;

+ 2 - 1
crypto/cms/cms_dd.c

@@ -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;

+ 1 - 1
crypto/cms/cms_ec.c

@@ -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;

+ 2 - 2
crypto/cms/cms_env.c

@@ -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;

+ 1 - 1
crypto/cms/cms_ess.c

@@ -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;
 

+ 3 - 3
crypto/cms/cms_lib.c

@@ -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);
 

+ 8 - 6
crypto/cms/cms_local.h

@@ -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);
 

+ 5 - 5
crypto/cms/cms_smime.c

@@ -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;

+ 1 - 1
crypto/conf/conf_lib.c

@@ -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;
 

+ 1 - 1
crypto/conf/conf_mod.c

@@ -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;

+ 63 - 63
crypto/context.c

@@ -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);
+                                     ossl_lib_ctx_generic_new,
+                                     NULL, ossl_lib_ctx_generic_free);
     if (idx < 0)
         return 0;
 
@@ -263,13 +263,13 @@ static int openssl_ctx_init_index(OPENSSL_CTX *ctx, int static_index,
     return 1;
 }
 
-void *openssl_ctx_get_data(OPENSSL_CTX *ctx, int index,
-                           const OPENSSL_CTX_METHOD *meth)
+void *ossl_lib_ctx_get_data(OSSL_LIB_CTX *ctx, int index,
+                            const OSSL_LIB_CTX_METHOD *meth)
 {
     void *data = NULL;
     int dynidx;
 
-    ctx = openssl_ctx_get_concrete(ctx);
+    ctx = ossl_lib_ctx_get_concrete(ctx);
     if (ctx == NULL)
         return NULL;
 
@@ -295,7 +295,7 @@ void *openssl_ctx_get_data(OPENSSL_CTX *ctx, int index,
         return data;
     }
 
-    if (!openssl_ctx_init_index(ctx, index, meth)) {
+    if (!ossl_lib_ctx_init_index(ctx, index, meth)) {
         CRYPTO_THREAD_unlock(ctx->lock);
         CRYPTO_THREAD_unlock(ctx->index_locks[index]);
         return NULL;
@@ -304,7 +304,7 @@ void *openssl_ctx_get_data(OPENSSL_CTX *ctx, int index,
     CRYPTO_THREAD_unlock(ctx->lock);
 
     /* The alloc call ensures there's a value there */
-    if (CRYPTO_alloc_ex_data(CRYPTO_EX_INDEX_OPENSSL_CTX, NULL,
+    if (CRYPTO_alloc_ex_data(CRYPTO_EX_INDEX_OSSL_LIB_CTX, NULL,
                              &ctx->data, ctx->dyn_indexes[index]))
         data = CRYPTO_get_ex_data(&ctx->data, ctx->dyn_indexes[index]);
 
@@ -313,20 +313,20 @@ void *openssl_ctx_get_data(OPENSSL_CTX *ctx, int index,
     return data;
 }
 
-OSSL_EX_DATA_GLOBAL *openssl_ctx_get_ex_data_global(OPENSSL_CTX *ctx)
+OSSL_EX_DATA_GLOBAL *ossl_lib_ctx_get_ex_data_global(OSSL_LIB_CTX *ctx)
 {
-    ctx = openssl_ctx_get_concrete(ctx);
+    ctx = ossl_lib_ctx_get_concrete(ctx);
     if (ctx == NULL)
         return NULL;
     return &ctx->global;
 }
 
-int openssl_ctx_run_once(OPENSSL_CTX *ctx, unsigned int idx,
-                         openssl_ctx_run_once_fn run_once_fn)
+int ossl_lib_ctx_run_once(OSSL_LIB_CTX *ctx, unsigned int idx,
+                          ossl_lib_ctx_run_once_fn run_once_fn)
 {
     int done = 0, ret = 0;
 
-    ctx = openssl_ctx_get_concrete(ctx);
+    ctx = ossl_lib_ctx_get_concrete(ctx);
     if (ctx == NULL)
         return 0;
 
@@ -354,9 +354,9 @@ int openssl_ctx_run_once(OPENSSL_CTX *ctx, unsigned int idx,
     return ret;
 }
 
-int openssl_ctx_onfree(OPENSSL_CTX *ctx, openssl_ctx_onfree_fn onfreefn)
+int ossl_lib_ctx_onfree(OSSL_LIB_CTX *ctx, ossl_lib_ctx_onfree_fn onfreefn)
 {
-    struct openssl_ctx_onfree_list_st *newonfree
+    struct ossl_lib_ctx_onfree_list_st *newonfree
         = OPENSSL_malloc(sizeof(*newonfree));
 
     if (newonfree == NULL)

+ 2 - 2
crypto/core_algorithm.c

@@ -14,7 +14,7 @@
 #include "internal/provider.h"
 
 struct algorithm_data_st {
-    OPENSSL_CTX *libctx;
+    OSSL_LIB_CTX *libctx;
     int operation_id;            /* May be zero for finding them all */
     int (*pre)(OSSL_PROVIDER *, int operation_id, void *data, int *result);
     void (*fn)(OSSL_PROVIDER *, const OSSL_ALGORITHM *, int no_store,
@@ -85,7 +85,7 @@ static int algorithm_do_this(OSSL_PROVIDER *provider, void *cbdata)
     return ok;
 }
 
-void ossl_algorithm_do_all(OPENSSL_CTX *libctx, int operation_id,
+void ossl_algorithm_do_all(OSSL_LIB_CTX *libctx, int operation_id,
                            OSSL_PROVIDER *provider,
                            int (*pre)(OSSL_PROVIDER *, int operation_id,
                                       void *data, int *result),

+ 2 - 2
crypto/core_fetch.c

@@ -16,7 +16,7 @@
 #include "internal/provider.h"
 
 struct construct_data_st {
-    OPENSSL_CTX *libctx;
+    OSSL_LIB_CTX *libctx;
     OSSL_METHOD_STORE *store;
     int operation_id;
     int force_store;
@@ -100,7 +100,7 @@ static void ossl_method_construct_this(OSSL_PROVIDER *provider,
     data->mcm->destruct(method, data->mcm_data);
 }
 
-void *ossl_method_construct(OPENSSL_CTX *libctx, int operation_id,
+void *ossl_method_construct(OSSL_LIB_CTX *libctx, int operation_id,
                             int force_store,
                             OSSL_METHOD_CONSTRUCT_METHOD *mcm, void *mcm_data)
 {

+ 6 - 6
crypto/core_namemap.c

@@ -62,9 +62,9 @@ static void namenum_free(NAMENUM_ENTRY *n)
     OPENSSL_free(n);
 }
 
-/* OPENSSL_CTX_METHOD functions for a namemap stored in a library context */
+/* OSSL_LIB_CTX_METHOD functions for a namemap stored in a library context */
 
-static void *stored_namemap_new(OPENSSL_CTX *libctx)
+static void *stored_namemap_new(OSSL_LIB_CTX *libctx)
 {
     OSSL_NAMEMAP *namemap = ossl_namemap_new();
 
@@ -85,7 +85,7 @@ static void stored_namemap_free(void *vnamemap)
     }
 }
 
-static const OPENSSL_CTX_METHOD stored_namemap_method = {
+static const OSSL_LIB_CTX_METHOD stored_namemap_method = {
     stored_namemap_new,
     stored_namemap_free,
 };
@@ -390,11 +390,11 @@ static void get_legacy_md_names(const OBJ_NAME *on, void *arg)
  * ==========================
  */
 
-OSSL_NAMEMAP *ossl_namemap_stored(OPENSSL_CTX *libctx)
+OSSL_NAMEMAP *ossl_namemap_stored(OSSL_LIB_CTX *libctx)
 {
     OSSL_NAMEMAP *namemap =
-        openssl_ctx_get_data(libctx, OPENSSL_CTX_NAMEMAP_INDEX,
-                             &stored_namemap_method);
+        ossl_lib_ctx_get_data(libctx, OSSL_LIB_CTX_NAMEMAP_INDEX,
+                              &stored_namemap_method);
 
 #ifndef FIPS_MODULE
     if (namemap != NULL && ossl_namemap_empty(namemap)) {

+ 4 - 4
crypto/crmf/crmf_lib.c

@@ -353,7 +353,7 @@ int OSSL_CRMF_MSG_push0_extension(OSSL_CRMF_MSG *crm,
 static int create_popo_signature(OSSL_CRMF_POPOSIGNINGKEY *ps,
                                  const OSSL_CRMF_CERTREQUEST *cr,
                                  EVP_PKEY *pkey, const EVP_MD *digest,
-                                 OPENSSL_CTX *libctx, const char *propq)
+                                 OSSL_LIB_CTX *libctx, const char *propq)
 {
     if (ps == NULL || cr == NULL || pkey == NULL) {
         CRMFerr(0, CRMF_R_NULL_ARGUMENT);
@@ -373,7 +373,7 @@ static int create_popo_signature(OSSL_CRMF_POPOSIGNINGKEY *ps,
 
 int OSSL_CRMF_MSG_create_popo(int meth, OSSL_CRMF_MSG *crm,
                               EVP_PKEY *pkey, const EVP_MD *digest,
-                              OPENSSL_CTX *libctx, const char *propq)
+                              OSSL_LIB_CTX *libctx, const char *propq)
 {
     OSSL_CRMF_POPO *pp = NULL;
     ASN1_INTEGER *tag = NULL;
@@ -441,7 +441,7 @@ int OSSL_CRMF_MSG_create_popo(int meth, OSSL_CRMF_MSG *crm,
 /* verifies the Proof-of-Possession of the request with the given rid in reqs */
 int OSSL_CRMF_MSGS_verify_popo(const OSSL_CRMF_MSGS *reqs,
                                int rid, int acceptRAVerified,
-                               OPENSSL_CTX *libctx, const char *propq)
+                               OSSL_LIB_CTX *libctx, const char *propq)
 {
     OSSL_CRMF_MSG *req = NULL;
     X509_PUBKEY *pubkey = NULL;
@@ -587,7 +587,7 @@ int OSSL_CRMF_CERTTEMPLATE_fill(OSSL_CRMF_CERTTEMPLATE *tmpl,
  */
 X509
 *OSSL_CRMF_ENCRYPTEDVALUE_get1_encCert(const OSSL_CRMF_ENCRYPTEDVALUE *ecert,
-                                       OPENSSL_CTX *libctx, const char *propq,
+                                       OSSL_LIB_CTX *libctx, const char *propq,
                                        EVP_PKEY *pkey)
 {
     X509 *cert = NULL; /* decrypted certificate */

+ 2 - 2
crypto/crmf/crmf_pbm.c

@@ -35,7 +35,7 @@
  * |macnid| e.g., NID_hmac_sha1
  * returns pointer to OSSL_CRMF_PBMPARAMETER on success, NULL on error
  */
-OSSL_CRMF_PBMPARAMETER *OSSL_CRMF_pbmp_new(OPENSSL_CTX *libctx, size_t slen,
+OSSL_CRMF_PBMPARAMETER *OSSL_CRMF_pbmp_new(OSSL_LIB_CTX *libctx, size_t slen,
                                            int owfnid, size_t itercnt,
                                            int macnid)
 {
@@ -123,7 +123,7 @@ OSSL_CRMF_PBMPARAMETER *OSSL_CRMF_pbmp_new(OPENSSL_CTX *libctx, size_t slen,
  * returns 1 on success, 0 on error
  */
 /* TODO try to combine with other MAC calculations in the libray */
-int OSSL_CRMF_pbm_new(OPENSSL_CTX *libctx, const char *propq,
+int OSSL_CRMF_pbm_new(OSSL_LIB_CTX *libctx, const char *propq,
                       const OSSL_CRMF_PBMPARAMETER *pbmp,
                       const unsigned char *msg, size_t msglen,
                       const unsigned char *sec, size_t seclen,

+ 1 - 1
crypto/ct/ct_b64.c

@@ -133,7 +133,7 @@ SCT *SCT_new_from_base64(unsigned char version, const char *logid_base64,
  * -1 on internal (malloc) failure
  */
 int CTLOG_new_from_base64_ex(CTLOG **ct_log, const char *pkey_base64,
-                             const char *name, OPENSSL_CTX *libctx,
+                             const char *name, OSSL_LIB_CTX *libctx,
                              const char *propq)
 {
     unsigned char *pkey_der = NULL;

+ 3 - 3
crypto/ct/ct_local.h

@@ -101,7 +101,7 @@ struct sct_ctx_st {
     /* milliseconds since epoch (to check that the SCT isn't from the future) */
     uint64_t epoch_time_in_ms;
 
-    OPENSSL_CTX *libctx;
+    OSSL_LIB_CTX *libctx;
     char *propq;
 };
 
@@ -113,14 +113,14 @@ struct ct_policy_eval_ctx_st {
     /* milliseconds since epoch (to check that SCTs aren't from the future) */
     uint64_t epoch_time_in_ms;
 
-    OPENSSL_CTX *libctx;
+    OSSL_LIB_CTX *libctx;
     char *propq;
 };
 
 /*
  * Creates a new context for verifying an SCT.
  */
-SCT_CTX *SCT_CTX_new(OPENSSL_CTX *ctx, const char *propq);
+SCT_CTX *SCT_CTX_new(OSSL_LIB_CTX *ctx, const char *propq);
 /*
  * Deletes an SCT verification context.
  */

+ 4 - 4
crypto/ct/ct_log.c

@@ -22,7 +22,7 @@
  * Information about a CT log server.
  */
 struct ctlog_st {
-    OPENSSL_CTX *libctx;
+    OSSL_LIB_CTX *libctx;
     char *propq;
     char *name;
     uint8_t log_id[CT_V1_HASHLEN];
@@ -34,7 +34,7 @@ struct ctlog_st {
  * It takes ownership of any CTLOG instances added to it.
  */
 struct ctlog_store_st {
-    OPENSSL_CTX *libctx;
+    OSSL_LIB_CTX *libctx;
     char *propq;
     STACK_OF(CTLOG) *logs;
 };
@@ -100,7 +100,7 @@ err:
     return ret;
 }
 
-CTLOG_STORE *CTLOG_STORE_new_ex(OPENSSL_CTX *libctx, const char *propq)
+CTLOG_STORE *CTLOG_STORE_new_ex(OSSL_LIB_CTX *libctx, const char *propq)
 {
     CTLOG_STORE *ret = OPENSSL_zalloc(sizeof(*ret));
 
@@ -264,7 +264,7 @@ end:
  * Takes ownership of the public key.
  * Copies the name.
  */
-CTLOG *CTLOG_new_ex(EVP_PKEY *public_key, const char *name, OPENSSL_CTX *libctx,
+CTLOG *CTLOG_new_ex(EVP_PKEY *public_key, const char *name, OSSL_LIB_CTX *libctx,
                     const char *propq)
 {
     CTLOG *ret = OPENSSL_zalloc(sizeof(*ret));

+ 1 - 1
crypto/ct/ct_policy.c

@@ -25,7 +25,7 @@
  */
 static const time_t SCT_CLOCK_DRIFT_TOLERANCE = 300;
 
-CT_POLICY_EVAL_CTX *CT_POLICY_EVAL_CTX_new_ex(OPENSSL_CTX *libctx,
+CT_POLICY_EVAL_CTX *CT_POLICY_EVAL_CTX_new_ex(OSSL_LIB_CTX *libctx,
                                               const char *propq)
 {
     CT_POLICY_EVAL_CTX *ctx = OPENSSL_zalloc(sizeof(CT_POLICY_EVAL_CTX));

+ 1 - 1
crypto/ct/ct_sct_ctx.c

@@ -20,7 +20,7 @@
 
 #include "ct_local.h"
 
-SCT_CTX *SCT_CTX_new(OPENSSL_CTX *libctx, const char *propq)
+SCT_CTX *SCT_CTX_new(OSSL_LIB_CTX *libctx, const char *propq)
 {
     SCT_CTX *sctx = OPENSSL_zalloc(sizeof(*sctx));
 

+ 1 - 1
crypto/dh/dh_ameth.c

@@ -479,7 +479,7 @@ static size_t dh_pkey_dirty_cnt(const EVP_PKEY *pkey)
 }
 
 static int dh_pkey_export_to(const EVP_PKEY *from, void *to_keydata,
-                             EVP_KEYMGMT *to_keymgmt, OPENSSL_CTX *libctx,
+                             EVP_KEYMGMT *to_keymgmt, OSSL_LIB_CTX *libctx,
                              const char *propq)
 {
     DH *dh = from->pkey.dh;

+ 1 - 1
crypto/dh/dh_gen.c

@@ -91,7 +91,7 @@ int dh_get_named_group_uid_from_size(int pbits)
 
 #ifdef FIPS_MODULE
 
-static int dh_gen_named_group(OPENSSL_CTX *libctx, DH *ret, int prime_len)
+static int dh_gen_named_group(OSSL_LIB_CTX *libctx, DH *ret, int prime_len)
 {
     DH *dh;
     int ok = 0;

+ 3 - 3
crypto/dh/dh_group_params.c

@@ -100,7 +100,7 @@ const char *ossl_ffc_named_group_from_uid(int uid)
     return NULL;
 }
 
-static DH *dh_param_init(OPENSSL_CTX *libctx, int uid, const BIGNUM *p,
+static DH *dh_param_init(OSSL_LIB_CTX *libctx, int uid, const BIGNUM *p,
                          const BIGNUM *q, const BIGNUM *g)
 {
     DH *dh = dh_new_ex(libctx);
@@ -117,7 +117,7 @@ static DH *dh_param_init(OPENSSL_CTX *libctx, int uid, const BIGNUM *p,
     return dh;
 }
 
-static DH *dh_new_by_group_name(OPENSSL_CTX *libctx, const char *name)
+static DH *dh_new_by_group_name(OSSL_LIB_CTX *libctx, const char *name)
 {
     int i;
 
@@ -136,7 +136,7 @@ static DH *dh_new_by_group_name(OPENSSL_CTX *libctx, const char *name)
     return NULL;
 }
 
-DH *dh_new_by_nid_ex(OPENSSL_CTX *libctx, int nid)
+DH *dh_new_by_nid_ex(OSSL_LIB_CTX *libctx, int nid)
 {
     const char *name = ossl_ffc_named_group_from_uid(nid);
 

+ 2 - 2
crypto/dh/dh_kdf.c

@@ -29,7 +29,7 @@ int dh_KDF_X9_42_asn1(unsigned char *out, size_t outlen,
                       const unsigned char *Z, size_t Zlen,
                       const char *cek_alg,
                       const unsigned char *ukm, size_t ukmlen, const EVP_MD *md,
-                      OPENSSL_CTX *libctx, const char *propq)
+                      OSSL_LIB_CTX *libctx, const char *propq)
 {
     int ret = 0;
     EVP_KDF_CTX *kctx = NULL;
@@ -69,7 +69,7 @@ int DH_KDF_X9_42(unsigned char *out, size_t outlen,
     int nid;
     const char *key_alg = NULL;
     const OSSL_PROVIDER *prov = EVP_MD_provider(md);
-    OPENSSL_CTX *libctx = ossl_provider_library_context(prov);
+    OSSL_LIB_CTX *libctx = ossl_provider_library_context(prov);
 
     nid = OBJ_obj2nid(key_oid);
     if (nid == NID_undef)

+ 3 - 3
crypto/dh/dh_lib.c

@@ -24,7 +24,7 @@
 #include "crypto/dh.h"
 #include "dh_local.h"
 
-static DH *dh_new_intern(ENGINE *engine, OPENSSL_CTX *libctx);
+static DH *dh_new_intern(ENGINE *engine, OSSL_LIB_CTX *libctx);
 
 #ifndef FIPS_MODULE
 int DH_set_method(DH *dh, const DH_METHOD *meth)
@@ -63,12 +63,12 @@ DH *DH_new_method(ENGINE *engine)
 }
 #endif /* !FIPS_MODULE */
 
-DH *dh_new_ex(OPENSSL_CTX *libctx)
+DH *dh_new_ex(OSSL_LIB_CTX *libctx)
 {
     return dh_new_intern(NULL, libctx);
 }
 
-static DH *dh_new_intern(ENGINE *engine, OPENSSL_CTX *libctx)
+static DH *dh_new_intern(ENGINE *engine, OSSL_LIB_CTX *libctx)
 {
     DH *ret = OPENSSL_zalloc(sizeof(*ret));
 

+ 1 - 1
crypto/dh/dh_local.h

@@ -32,7 +32,7 @@ struct dh_st {
     CRYPTO_EX_DATA ex_data;
     ENGINE *engine;
 #endif
-    OPENSSL_CTX *libctx;
+    OSSL_LIB_CTX *libctx;
     const DH_METHOD *meth;
     CRYPTO_RWLOCK *lock;
 

+ 1 - 1
crypto/dh/dh_pmeth.c

@@ -274,7 +274,7 @@ static int pkey_dh_ctrl_str(EVP_PKEY_CTX *ctx,
     return -2;
 }
 
-static DH *ffc_params_generate(OPENSSL_CTX *libctx, DH_PKEY_CTX *dctx,
+static DH *ffc_params_generate(OSSL_LIB_CTX *libctx, DH_PKEY_CTX *dctx,
                                BN_GENCB *pcb)
 {
     DH *ret;

+ 1 - 1
crypto/dsa/dsa_ameth.c

@@ -498,7 +498,7 @@ static size_t dsa_pkey_dirty_cnt(const EVP_PKEY *pkey)
 }
 
 static int dsa_pkey_export_to(const EVP_PKEY *from, void *to_keydata,
-                              EVP_KEYMGMT *to_keymgmt, OPENSSL_CTX *libctx,
+                              EVP_KEYMGMT *to_keymgmt, OSSL_LIB_CTX *libctx,
                               const char *propq)
 {
     DSA *dsa = from->pkey.dsa;

+ 3 - 3
crypto/dsa/dsa_lib.c

@@ -25,7 +25,7 @@
 #include "crypto/dsa.h"
 #include "crypto/dh.h" /* required by DSA_dup_DH() */
 
-static DSA *dsa_new_intern(ENGINE *engine, OPENSSL_CTX *libctx);
+static DSA *dsa_new_intern(ENGINE *engine, OSSL_LIB_CTX *libctx);
 
 #ifndef FIPS_MODULE
 
@@ -132,7 +132,7 @@ const DSA_METHOD *DSA_get_method(DSA *d)
     return d->meth;
 }
 
-static DSA *dsa_new_intern(ENGINE *engine, OPENSSL_CTX *libctx)
+static DSA *dsa_new_intern(ENGINE *engine, OSSL_LIB_CTX *libctx)
 {
     DSA *ret = OPENSSL_zalloc(sizeof(*ret));
 
@@ -194,7 +194,7 @@ DSA *DSA_new_method(ENGINE *engine)
     return dsa_new_intern(engine, NULL);
 }
 
-DSA *dsa_new_with_ctx(OPENSSL_CTX *libctx)
+DSA *dsa_new_with_ctx(OSSL_LIB_CTX *libctx)
 {
     return dsa_new_intern(NULL, libctx);
 }

+ 1 - 1
crypto/dsa/dsa_local.h

@@ -32,7 +32,7 @@ struct dsa_st {
     /* functional reference if 'meth' is ENGINE-provided */
     ENGINE *engine;
     CRYPTO_RWLOCK *lock;
-    OPENSSL_CTX *libctx;
+    OSSL_LIB_CTX *libctx;
 
     /* Provider data */
     size_t dirty_cnt; /* If any key material changes, increment this */

+ 3 - 3
crypto/ec/curve25519.c

@@ -5439,7 +5439,7 @@ static void sc_muladd(uint8_t *s, const uint8_t *a, const uint8_t *b,
 
 int ED25519_sign(uint8_t *out_sig, const uint8_t *message, size_t message_len,
                  const uint8_t public_key[32], const uint8_t private_key[32],
-                 OPENSSL_CTX *libctx, const char *propq)
+                 OSSL_LIB_CTX *libctx, const char *propq)
 {
     uint8_t az[SHA512_DIGEST_LENGTH];
     uint8_t nonce[SHA512_DIGEST_LENGTH];
@@ -5495,7 +5495,7 @@ static const char allzeroes[15];
 
 int ED25519_verify(const uint8_t *message, size_t message_len,
                    const uint8_t signature[64], const uint8_t public_key[32],
-                   OPENSSL_CTX *libctx, const char *propq)
+                   OSSL_LIB_CTX *libctx, const char *propq)
 {
     int i;
     ge_p3 A;
@@ -5577,7 +5577,7 @@ err:
     return res;
 }
 
-int ED25519_public_from_private(OPENSSL_CTX *ctx, uint8_t out_public_key[32],
+int ED25519_public_from_private(OSSL_LIB_CTX *ctx, uint8_t out_public_key[32],
                                 const uint8_t private_key[32], const char *propq)
 {
     uint8_t az[SHA512_DIGEST_LENGTH];

+ 2 - 2
crypto/ec/curve448/curve448_local.h

@@ -10,11 +10,11 @@
 # define OSSL_CRYPTO_EC_CURVE448_LOCAL_H
 # include "curve448utils.h"
 
-int ED448ph_sign(OPENSSL_CTX *ctx, uint8_t *out_sig, const uint8_t hash[64],
+int ED448ph_sign(OSSL_LIB_CTX *ctx, uint8_t *out_sig, const uint8_t hash[64],
                  const uint8_t public_key[57], const uint8_t private_key[57],
                  const uint8_t *context, size_t context_len, const char *propq);
 
-int ED448ph_verify(OPENSSL_CTX *ctx, const uint8_t hash[64],
+int ED448ph_verify(OSSL_LIB_CTX *ctx, const uint8_t hash[64],
                    const uint8_t signature[114], const uint8_t public_key[57],
                    const uint8_t *context, size_t context_len, const char *propq);
 

+ 6 - 6
crypto/ec/curve448/ed448.h

@@ -38,7 +38,7 @@
  * privkey (in): The private key.
  */
 c448_error_t c448_ed448_derive_public_key(
-                        OPENSSL_CTX *ctx,
+                        OSSL_LIB_CTX *ctx,
                         uint8_t pubkey [EDDSA_448_PUBLIC_BYTES],
                         const uint8_t privkey [EDDSA_448_PRIVATE_BYTES],
                         const char *propq);
@@ -61,7 +61,7 @@ c448_error_t c448_ed448_derive_public_key(
  * disambiguation.  For Ed448 it is safe.
  */
 c448_error_t c448_ed448_sign(
-                        OPENSSL_CTX *ctx,
+                        OSSL_LIB_CTX *ctx,
                         uint8_t signature[EDDSA_448_SIGNATURE_BYTES],
                         const uint8_t privkey[EDDSA_448_PRIVATE_BYTES],
                         const uint8_t pubkey[EDDSA_448_PUBLIC_BYTES],
@@ -87,7 +87,7 @@ c448_error_t c448_ed448_sign(
  * disambiguation.  For Ed448 it is safe.
  */
 c448_error_t c448_ed448_sign_prehash(
-                        OPENSSL_CTX *ctx,
+                        OSSL_LIB_CTX *ctx,
                         uint8_t signature[EDDSA_448_SIGNATURE_BYTES],
                         const uint8_t privkey[EDDSA_448_PRIVATE_BYTES],
                         const uint8_t pubkey[EDDSA_448_PUBLIC_BYTES],
@@ -114,7 +114,7 @@ c448_error_t c448_ed448_sign_prehash(
  * non-prehashed messages, at least without some very careful protocol-level
  * disambiguation.  For Ed448 it is safe.
  */
-c448_error_t c448_ed448_verify(OPENSSL_CTX *ctx,
+c448_error_t c448_ed448_verify(OSSL_LIB_CTX *ctx,
                                const uint8_t
                                signature[EDDSA_448_SIGNATURE_BYTES],
                                const uint8_t
@@ -142,7 +142,7 @@ c448_error_t c448_ed448_verify(OPENSSL_CTX *ctx,
  * disambiguation.  For Ed448 it is safe.
  */
 c448_error_t c448_ed448_verify_prehash(
-                    OPENSSL_CTX *ctx,
+                    OSSL_LIB_CTX *ctx,
                     const uint8_t signature[EDDSA_448_SIGNATURE_BYTES],
                     const uint8_t pubkey[EDDSA_448_PUBLIC_BYTES],
                     const uint8_t hash[64],
@@ -199,7 +199,7 @@ c448_error_t curve448_point_decode_like_eddsa_and_mul_by_ratio(
  * ed (in): The EdDSA private key
  */
 c448_error_t c448_ed448_convert_private_key_to_x448(
-                            OPENSSL_CTX *ctx,
+                            OSSL_LIB_CTX *ctx,
                             uint8_t x[X448_PRIVATE_BYTES],
                             const uint8_t ed[EDDSA_448_PRIVATE_BYTES],
                             const char *propq);

+ 13 - 13
crypto/ec/curve448/eddsa.c

@@ -20,7 +20,7 @@
 
 #define COFACTOR 4
 
-static c448_error_t oneshot_hash(OPENSSL_CTX *ctx, uint8_t *out, size_t outlen,
+static c448_error_t oneshot_hash(OSSL_LIB_CTX *ctx, uint8_t *out, size_t outlen,
                                  const uint8_t *in, size_t inlen,
                                  const char *propq)
 {
@@ -54,7 +54,7 @@ static void clamp(uint8_t secret_scalar_ser[EDDSA_448_PRIVATE_BYTES])
     secret_scalar_ser[EDDSA_448_PRIVATE_BYTES - 2] |= 0x80;
 }
 
-static c448_error_t hash_init_with_dom(OPENSSL_CTX *ctx, EVP_MD_CTX *hashctx,
+static c448_error_t hash_init_with_dom(OSSL_LIB_CTX *ctx, EVP_MD_CTX *hashctx,
                                        uint8_t prehashed,
                                        uint8_t for_prehash,
                                        const uint8_t *context,
@@ -95,7 +95,7 @@ static c448_error_t hash_init_with_dom(OPENSSL_CTX *ctx, EVP_MD_CTX *hashctx,
 
 /* In this file because it uses the hash */
 c448_error_t c448_ed448_convert_private_key_to_x448(
-                            OPENSSL_CTX *ctx,
+                            OSSL_LIB_CTX *ctx,
                             uint8_t x[X448_PRIVATE_BYTES],
                             const uint8_t ed [EDDSA_448_PRIVATE_BYTES],
                             const char *propq)
@@ -107,7 +107,7 @@ c448_error_t c448_ed448_convert_private_key_to_x448(
 }
 
 c448_error_t c448_ed448_derive_public_key(
-                        OPENSSL_CTX *ctx,
+                        OSSL_LIB_CTX *ctx,
                         uint8_t pubkey[EDDSA_448_PUBLIC_BYTES],
                         const uint8_t privkey[EDDSA_448_PRIVATE_BYTES],
                         const char *propq)
@@ -153,7 +153,7 @@ c448_error_t c448_ed448_derive_public_key(
 }
 
 c448_error_t c448_ed448_sign(
-                        OPENSSL_CTX *ctx,
+                        OSSL_LIB_CTX *ctx,
                         uint8_t signature[EDDSA_448_SIGNATURE_BYTES],
                         const uint8_t privkey[EDDSA_448_PRIVATE_BYTES],
                         const uint8_t pubkey[EDDSA_448_PUBLIC_BYTES],
@@ -261,7 +261,7 @@ c448_error_t c448_ed448_sign(
 }
 
 c448_error_t c448_ed448_sign_prehash(
-                        OPENSSL_CTX *ctx,
+                        OSSL_LIB_CTX *ctx,
                         uint8_t signature[EDDSA_448_SIGNATURE_BYTES],
                         const uint8_t privkey[EDDSA_448_PRIVATE_BYTES],
                         const uint8_t pubkey[EDDSA_448_PUBLIC_BYTES],
@@ -273,7 +273,7 @@ c448_error_t c448_ed448_sign_prehash(
 }
 
 c448_error_t c448_ed448_verify(
-                    OPENSSL_CTX *ctx,
+                    OSSL_LIB_CTX *ctx,
                     const uint8_t signature[EDDSA_448_SIGNATURE_BYTES],
                     const uint8_t pubkey[EDDSA_448_PUBLIC_BYTES],
                     const uint8_t *message, size_t message_len,
@@ -356,7 +356,7 @@ c448_error_t c448_ed448_verify(
 }
 
 c448_error_t c448_ed448_verify_prehash(
-                    OPENSSL_CTX *ctx,
+                    OSSL_LIB_CTX *ctx,
                     const uint8_t signature[EDDSA_448_SIGNATURE_BYTES],
                     const uint8_t pubkey[EDDSA_448_PUBLIC_BYTES],
                     const uint8_t hash[64], const uint8_t *context,
@@ -366,7 +366,7 @@ c448_error_t c448_ed448_verify_prehash(
                              context_len, propq);
 }
 
-int ED448_sign(OPENSSL_CTX *ctx, uint8_t *out_sig, const uint8_t *message,
+int ED448_sign(OSSL_LIB_CTX *ctx, uint8_t *out_sig, const uint8_t *message,
                size_t message_len, const uint8_t public_key[57],
                const uint8_t private_key[57], const uint8_t *context,
                size_t context_len, const char *propq)
@@ -376,7 +376,7 @@ int ED448_sign(OPENSSL_CTX *ctx, uint8_t *out_sig, const uint8_t *message,
         == C448_SUCCESS;
 }
 
-int ED448_verify(OPENSSL_CTX *ctx, const uint8_t *message, size_t message_len,
+int ED448_verify(OSSL_LIB_CTX *ctx, const uint8_t *message, size_t message_len,
                  const uint8_t signature[114], const uint8_t public_key[57],
                  const uint8_t *context, size_t context_len, const char *propq)
 {
@@ -385,7 +385,7 @@ int ED448_verify(OPENSSL_CTX *ctx, const uint8_t *message, size_t message_len,
                              propq) == C448_SUCCESS;
 }
 
-int ED448ph_sign(OPENSSL_CTX *ctx, uint8_t *out_sig, const uint8_t hash[64],
+int ED448ph_sign(OSSL_LIB_CTX *ctx, uint8_t *out_sig, const uint8_t hash[64],
                  const uint8_t public_key[57], const uint8_t private_key[57],
                  const uint8_t *context, size_t context_len, const char *propq)
 {
@@ -394,7 +394,7 @@ int ED448ph_sign(OPENSSL_CTX *ctx, uint8_t *out_sig, const uint8_t hash[64],
 
 }
 
-int ED448ph_verify(OPENSSL_CTX *ctx, const uint8_t hash[64],
+int ED448ph_verify(OSSL_LIB_CTX *ctx, const uint8_t hash[64],
                    const uint8_t signature[114], const uint8_t public_key[57],
                    const uint8_t *context, size_t context_len, const char *propq)
 {
@@ -402,7 +402,7 @@ int ED448ph_verify(OPENSSL_CTX *ctx, const uint8_t hash[64],
                                      (uint8_t)context_len, propq) == C448_SUCCESS;
 }
 
-int ED448_public_from_private(OPENSSL_CTX *ctx, uint8_t out_public_key[57],
+int ED448_public_from_private(OSSL_LIB_CTX *ctx, uint8_t out_public_key[57],
                               const uint8_t private_key[57], const char *propq)
 {
     return c448_ed448_derive_public_key(ctx, out_public_key, private_key, propq)

+ 4 - 4
crypto/ec/ec_ameth.c

@@ -101,7 +101,7 @@ static int eckey_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey)
 }
 
 static EC_KEY *eckey_type2param(int ptype, const void *pval,
-                                OPENSSL_CTX *libctx, const char *propq)
+                                OSSL_LIB_CTX *libctx, const char *propq)
 {
     EC_KEY *eckey = NULL;
     EC_GROUP *group = NULL;
@@ -155,7 +155,7 @@ static int eckey_pub_decode(EVP_PKEY *pkey, const X509_PUBKEY *pubkey)
     int ptype, pklen;
     EC_KEY *eckey = NULL;
     X509_ALGOR *palg;
-    OPENSSL_CTX *libctx = NULL;
+    OSSL_LIB_CTX *libctx = NULL;
     const char *propq = NULL;
 
     if (!X509_PUBKEY_get0_libctx(&libctx, &propq, pubkey)
@@ -200,7 +200,7 @@ static int eckey_pub_cmp(const EVP_PKEY *a, const EVP_PKEY *b)
 }
 
 static int eckey_priv_decode_ex(EVP_PKEY *pkey, const PKCS8_PRIV_KEY_INFO *p8,
-                                OPENSSL_CTX *libctx, const char *propq)
+                                OSSL_LIB_CTX *libctx, const char *propq)
 {
     const unsigned char *p = NULL;
     const void *pval;
@@ -562,7 +562,7 @@ size_t ec_pkey_dirty_cnt(const EVP_PKEY *pkey)
 
 static
 int ec_pkey_export_to(const EVP_PKEY *from, void *to_keydata,
-                      EVP_KEYMGMT *to_keymgmt, OPENSSL_CTX *libctx,
+                      EVP_KEYMGMT *to_keymgmt, OSSL_LIB_CTX *libctx,
                       const char *propq)
 {
     const EC_KEY *eckey = NULL;

+ 2 - 1
crypto/ec/ec_backend.c

@@ -50,7 +50,8 @@ static char *ec_param_encoding_id2name(int id)
 }
 
 int ec_group_todata(const EC_GROUP *group, OSSL_PARAM_BLD *tmpl,
-                    OSSL_PARAM params[], OPENSSL_CTX *libctx, const char *propq,
+                    OSSL_PARAM params[], OSSL_LIB_CTX *libctx,
+                    const char *propq,
                     BN_CTX *bnctx, unsigned char **genbuf)
 {
     int ret = 0, curve_nid, encoding_flag;

+ 2 - 2
crypto/ec/ec_curve.c

@@ -3180,7 +3180,7 @@ int ec_curve_name2nid(const char *name)
     return NID_undef;
 }
 
-static EC_GROUP *ec_group_new_from_data(OPENSSL_CTX *libctx,
+static EC_GROUP *ec_group_new_from_data(OSSL_LIB_CTX *libctx,
                                         const char *propq,
                                         const ec_list_element curve)
 {
@@ -3290,7 +3290,7 @@ static EC_GROUP *ec_group_new_from_data(OPENSSL_CTX *libctx,
     return group;
 }
 
-EC_GROUP *EC_GROUP_new_by_curve_name_ex(OPENSSL_CTX *libctx, const char *propq,
+EC_GROUP *EC_GROUP_new_by_curve_name_ex(OSSL_LIB_CTX *libctx, const char *propq,
                                         int nid)
 {
     EC_GROUP *ret = NULL;

+ 3 - 3
crypto/ec/ec_key.c

@@ -34,12 +34,12 @@ EC_KEY *EC_KEY_new(void)
 }
 #endif
 
-EC_KEY *EC_KEY_new_ex(OPENSSL_CTX *ctx, const char *propq)
+EC_KEY *EC_KEY_new_ex(OSSL_LIB_CTX *ctx, const char *propq)
 {
     return ec_key_new_method_int(ctx, propq, NULL);
 }
 
-EC_KEY *EC_KEY_new_by_curve_name_ex(OPENSSL_CTX *ctx, const char *propq,
+EC_KEY *EC_KEY_new_by_curve_name_ex(OSSL_LIB_CTX *ctx, const char *propq,
                                     int nid)
 {
     EC_KEY *ret = EC_KEY_new_ex(ctx, propq);
@@ -651,7 +651,7 @@ int EC_KEY_set_public_key_affine_coordinates(EC_KEY *key, BIGNUM *x,
 
 }
 
-OPENSSL_CTX *ec_key_get_libctx(const EC_KEY *key)
+OSSL_LIB_CTX *ec_key_get_libctx(const EC_KEY *key)
 {
     return key->libctx;
 }

+ 1 - 1
crypto/ec/ec_kmeth.c

@@ -76,7 +76,7 @@ int EC_KEY_set_method(EC_KEY *key, const EC_KEY_METHOD *meth)
     return 1;
 }
 
-EC_KEY *ec_key_new_method_int(OPENSSL_CTX *libctx, const char *propq,
+EC_KEY *ec_key_new_method_int(OSSL_LIB_CTX *libctx, const char *propq,
                               ENGINE *engine)
 {
     EC_KEY *ret = OPENSSL_zalloc(sizeof(*ret));

+ 4 - 4
crypto/ec/ec_lib.c

@@ -26,7 +26,7 @@
 
 /* functions for EC_GROUP objects */
 
-EC_GROUP *ec_group_new_ex(OPENSSL_CTX *libctx, const char *propq,
+EC_GROUP *ec_group_new_ex(OSSL_LIB_CTX *libctx, const char *propq,
                           const EC_METHOD *meth)
 {
     EC_GROUP *ret;
@@ -1403,7 +1403,7 @@ int EC_GROUP_get_pentanomial_basis(const EC_GROUP *group, unsigned int *k1,
  * mathematically wrong anyway and should not be used.
  */
 static EC_GROUP *ec_group_explicit_to_named(const EC_GROUP *group,
-                                            OPENSSL_CTX *libctx,
+                                            OSSL_LIB_CTX *libctx,
                                             const char *propq,
                                             BN_CTX *ctx)
 {
@@ -1499,7 +1499,7 @@ static int ec_encoding_param2id(const OSSL_PARAM *p, int *id)
 }
 
 static EC_GROUP *group_new_from_name(const OSSL_PARAM *p,
-                                     OPENSSL_CTX *libctx, const char *propq)
+                                     OSSL_LIB_CTX *libctx, const char *propq)
 {
     int ok = 0, nid;
     const char *curve_name = NULL;
@@ -1528,7 +1528,7 @@ static EC_GROUP *group_new_from_name(const OSSL_PARAM *p,
 }
 
 EC_GROUP *EC_GROUP_new_from_params(const OSSL_PARAM params[],
-                                   OPENSSL_CTX *libctx, const char *propq)
+                                   OSSL_LIB_CTX *libctx, const char *propq)
 {
     const OSSL_PARAM *ptmp, *pa, *pb;
     int ok = 0;

+ 4 - 4
crypto/ec/ec_local.h

@@ -275,7 +275,7 @@ struct ec_group_st {
         EC_PRE_COMP *ec;
     } pre_comp;
 
-    OPENSSL_CTX *libctx;
+    OSSL_LIB_CTX *libctx;
     char *propq;
 };
 
@@ -299,7 +299,7 @@ struct ec_key_st {
     CRYPTO_EX_DATA ex_data;
 #endif
     CRYPTO_RWLOCK *lock;
-    OPENSSL_CTX *libctx;
+    OSSL_LIB_CTX *libctx;
     char *propq;
 
     /* Provider data */
@@ -601,7 +601,7 @@ int ec_group_simple_order_bits(const EC_GROUP *group);
  *  \param   meth   EC_METHOD to use
  *  \return  newly created EC_GROUP object or NULL in case of an error.
  */
-EC_GROUP *ec_group_new_ex(OPENSSL_CTX *libctx, const char *propq,
+EC_GROUP *ec_group_new_ex(OSSL_LIB_CTX *libctx, const char *propq,
                           const EC_METHOD *meth);
 
 #ifdef ECP_NISTZ256_ASM
@@ -657,7 +657,7 @@ struct ec_key_method_st {
 
 #define EC_KEY_METHOD_DYNAMIC   1
 
-EC_KEY *ec_key_new_method_int(OPENSSL_CTX *libctx, const char *propq,
+EC_KEY *ec_key_new_method_int(OSSL_LIB_CTX *libctx, const char *propq,
                               ENGINE *engine);
 
 int ossl_ec_key_gen(EC_KEY *eckey);

+ 1 - 1
crypto/ec/ecdh_kdf.c

@@ -25,7 +25,7 @@ int ecdh_KDF_X9_63(unsigned char *out, size_t outlen,
                    const unsigned char *Z, size_t Zlen,
                    const unsigned char *sinfo, size_t sinfolen,
                    const EVP_MD *md,
-                   OPENSSL_CTX *libctx, const char *propq)
+                   OSSL_LIB_CTX *libctx, const char *propq)
 {
     int ret = 0;
     EVP_KDF_CTX *kctx = NULL;

+ 1 - 1
crypto/ec/ecx_key.c

@@ -10,7 +10,7 @@
 #include <openssl/err.h>
 #include "crypto/ecx.h"
 
-ECX_KEY *ecx_key_new(OPENSSL_CTX *libctx, ECX_KEY_TYPE type, int haspubkey,
+ECX_KEY *ecx_key_new(OSSL_LIB_CTX *libctx, ECX_KEY_TYPE type, int haspubkey,
                      const char *propq)
 {
     ECX_KEY *ret = OPENSSL_zalloc(sizeof(*ret));

+ 3 - 3
crypto/ec/ecx_meth.c

@@ -36,7 +36,7 @@ typedef enum {
 /* Setup EVP_PKEY using public, private or generation */
 static int ecx_key_op(EVP_PKEY *pkey, int id, const X509_ALGOR *palg,
                       const unsigned char *p, int plen, ecx_key_op_t op,
-                      OPENSSL_CTX *libctx, const char *propq)
+                      OSSL_LIB_CTX *libctx, const char *propq)
 {
     ECX_KEY *key = NULL;
     unsigned char *privkey, *pubkey;
@@ -150,7 +150,7 @@ static int ecx_pub_cmp(const EVP_PKEY *a, const EVP_PKEY *b)
 }
 
 static int ecx_priv_decode_ex(EVP_PKEY *pkey, const PKCS8_PRIV_KEY_INFO *p8,
-                              OPENSSL_CTX *libctx, const char *propq)
+                              OSSL_LIB_CTX *libctx, const char *propq)
 {
     const unsigned char *p;
     int plen;
@@ -396,7 +396,7 @@ static size_t ecx_pkey_dirty_cnt(const EVP_PKEY *pkey)
 }
 
 static int ecx_pkey_export_to(const EVP_PKEY *from, void *to_keydata,
-                              EVP_KEYMGMT *to_keymgmt, OPENSSL_CTX *libctx,
+                              EVP_KEYMGMT *to_keymgmt, OSSL_LIB_CTX *libctx,
                               const char *propq)
 {
     const ECX_KEY *key = from->pkey.ecx;

+ 1 - 1
crypto/encode_decode/decoder_lib.c

@@ -217,7 +217,7 @@ int OSSL_DECODER_CTX_add_decoder(OSSL_DECODER_CTX *ctx, OSSL_DECODER *decoder)
 }
 
 int OSSL_DECODER_CTX_add_extra(OSSL_DECODER_CTX *ctx,
-                               OPENSSL_CTX *libctx, const char *propq)
+                               OSSL_LIB_CTX *libctx, const char *propq)
 {
     /*
      * This function goes through existing decoder methods in

+ 17 - 17
crypto/encode_decode/decoder_meth.c

@@ -69,20 +69,20 @@ static void decoder_store_free(void *vstore)
     ossl_method_store_free(vstore);
 }
 
-static void *decoder_store_new(OPENSSL_CTX *ctx)
+static void *decoder_store_new(OSSL_LIB_CTX *ctx)
 {
     return ossl_method_store_new(ctx);
 }
 
 
-static const OPENSSL_CTX_METHOD decoder_store_method = {
+static const OSSL_LIB_CTX_METHOD decoder_store_method = {
     decoder_store_new,
     decoder_store_free,
 };
 
 /* Data to be passed through ossl_method_construct() */
 struct decoder_data_st {
-    OPENSSL_CTX *libctx;
+    OSSL_LIB_CTX *libctx;
     OSSL_METHOD_CONSTRUCT_METHOD *mcm;
     int id;                      /* For get_decoder_from_store() */
     const char *names;           /* For get_decoder_from_store() */
@@ -95,7 +95,7 @@ struct decoder_data_st {
  */
 
 /* Temporary decoder method store, constructor and destructor */
-static void *alloc_tmp_decoder_store(OPENSSL_CTX *ctx)
+static void *alloc_tmp_decoder_store(OSSL_LIB_CTX *ctx)
 {
     return ossl_method_store_new(ctx);
 }
@@ -107,14 +107,14 @@ static void dealloc_tmp_decoder_store(void *store)
 }
 
 /* Get the permanent decoder store */
-static OSSL_METHOD_STORE *get_decoder_store(OPENSSL_CTX *libctx)
+static OSSL_METHOD_STORE *get_decoder_store(OSSL_LIB_CTX *libctx)
 {
-    return openssl_ctx_get_data(libctx, OPENSSL_CTX_DECODER_STORE_INDEX,
-                                &decoder_store_method);
+    return ossl_lib_ctx_get_data(libctx, OSSL_LIB_CTX_DECODER_STORE_INDEX,
+                                 &decoder_store_method);
 }
 
 /* Get decoder methods from a store, or put one in */
-static void *get_decoder_from_store(OPENSSL_CTX *libctx, void *store,
+static void *get_decoder_from_store(OSSL_LIB_CTX *libctx, void *store,
                                     void *data)
 {
     struct decoder_data_st *methdata = data;
@@ -136,7 +136,7 @@ static void *get_decoder_from_store(OPENSSL_CTX *libctx, void *store,
     return method;
 }
 
-static int put_decoder_in_store(OPENSSL_CTX *libctx, void *store,
+static int put_decoder_in_store(OSSL_LIB_CTX *libctx, void *store,
                                 void *method, const OSSL_PROVIDER *prov,
                                 int operation_id, const char *names,
                                 const char *propdef, void *unused)
@@ -245,7 +245,7 @@ static void *construct_decoder(const OSSL_ALGORITHM *algodef,
      * namemap entry, this is it.  Should the name already exist there, we
      * know that ossl_namemap_add() will return its corresponding number.
      */
-    OPENSSL_CTX *libctx = ossl_provider_library_context(prov);
+    OSSL_LIB_CTX *libctx = ossl_provider_library_context(prov);
     OSSL_NAMEMAP *namemap = ossl_namemap_stored(libctx);
     const char *names = algodef->algorithm_names;
     int id = ossl_namemap_add_names(namemap, 0, names, NAME_SEPARATOR);
@@ -274,7 +274,7 @@ static void free_decoder(void *method)
 }
 
 /* Fetching support.  Can fetch by numeric identity or by name */
-static OSSL_DECODER *inner_ossl_decoder_fetch(OPENSSL_CTX *libctx, int id,
+static OSSL_DECODER *inner_ossl_decoder_fetch(OSSL_LIB_CTX *libctx, int id,
                                               const char *name,
                                               const char *properties)
 {
@@ -331,13 +331,13 @@ static OSSL_DECODER *inner_ossl_decoder_fetch(OPENSSL_CTX *libctx, int id,
     return method;
 }
 
-OSSL_DECODER *OSSL_DECODER_fetch(OPENSSL_CTX *libctx, const char *name,
+OSSL_DECODER *OSSL_DECODER_fetch(OSSL_LIB_CTX *libctx, const char *name,
                                  const char *properties)
 {
     return inner_ossl_decoder_fetch(libctx, 0, name, properties);
 }
 
-OSSL_DECODER *ossl_decoder_fetch_by_number(OPENSSL_CTX *libctx, int id,
+OSSL_DECODER *ossl_decoder_fetch_by_number(OSSL_LIB_CTX *libctx, int id,
                                            const char *properties)
 {
     return inner_ossl_decoder_fetch(libctx, id, NULL, properties);
@@ -380,7 +380,7 @@ int OSSL_DECODER_number(const OSSL_DECODER *decoder)
 int OSSL_DECODER_is_a(const OSSL_DECODER *decoder, const char *name)
 {
     if (decoder->base.prov != NULL) {
-        OPENSSL_CTX *libctx = ossl_provider_library_context(decoder->base.prov);
+        OSSL_LIB_CTX *libctx = ossl_provider_library_context(decoder->base.prov);
         OSSL_NAMEMAP *namemap = ossl_namemap_stored(libctx);
 
         return ossl_namemap_name2num(namemap, name) == decoder->base.id;
@@ -398,7 +398,7 @@ static void decoder_do_one(OSSL_PROVIDER *provider,
                            int no_store, void *vdata)
 {
     struct decoder_do_all_data_st *data = vdata;
-    OPENSSL_CTX *libctx = ossl_provider_library_context(provider);
+    OSSL_LIB_CTX *libctx = ossl_provider_library_context(provider);
     OSSL_NAMEMAP *namemap = ossl_namemap_stored(libctx);
     const char *names = algodef->algorithm_names;
     int id = ossl_namemap_add_names(namemap, 0, names, NAME_SEPARATOR);
@@ -413,7 +413,7 @@ static void decoder_do_one(OSSL_PROVIDER *provider,
     }
 }
 
-void OSSL_DECODER_do_all_provided(OPENSSL_CTX *libctx,
+void OSSL_DECODER_do_all_provided(OSSL_LIB_CTX *libctx,
                                   void (*fn)(OSSL_DECODER *decoder, void *arg),
                                   void *arg)
 {
@@ -434,7 +434,7 @@ void OSSL_DECODER_names_do_all(const OSSL_DECODER *decoder,
         return;
 
     if (decoder->base.prov != NULL) {
-        OPENSSL_CTX *libctx = ossl_provider_library_context(decoder->base.prov);
+        OSSL_LIB_CTX *libctx = ossl_provider_library_context(decoder->base.prov);
         OSSL_NAMEMAP *namemap = ossl_namemap_stored(libctx);
 
         ossl_namemap_doall_names(namemap, decoder->base.id, fn, data);

+ 2 - 2
crypto/encode_decode/decoder_pkey.c

@@ -257,7 +257,7 @@ static void collect_decoder(OSSL_DECODER *decoder, void *arg)
 
 int ossl_decoder_ctx_setup_for_EVP_PKEY(OSSL_DECODER_CTX *ctx,
                                         EVP_PKEY **pkey, const char *keytype,
-                                        OPENSSL_CTX *libctx,
+                                        OSSL_LIB_CTX *libctx,
                                         const char *propquery)
 {
     struct collected_data_st *data = NULL;
@@ -326,7 +326,7 @@ int ossl_decoder_ctx_setup_for_EVP_PKEY(OSSL_DECODER_CTX *ctx,
 OSSL_DECODER_CTX *
 OSSL_DECODER_CTX_new_by_EVP_PKEY(EVP_PKEY **pkey,
                                  const char *input_type, const char *keytype,
-                                 OPENSSL_CTX *libctx, const char *propquery)
+                                 OSSL_LIB_CTX *libctx, const char *propquery)
 {
     OSSL_DECODER_CTX *ctx = NULL;
 

+ 1 - 1
crypto/encode_decode/encoder_lib.c

@@ -235,7 +235,7 @@ int OSSL_ENCODER_CTX_add_encoder(OSSL_ENCODER_CTX *ctx, OSSL_ENCODER *encoder)
 }
 
 int OSSL_ENCODER_CTX_add_extra(OSSL_ENCODER_CTX *ctx,
-                               OPENSSL_CTX *libctx, const char *propq)
+                               OSSL_LIB_CTX *libctx, const char *propq)
 {
     return 1;
 }

+ 17 - 17
crypto/encode_decode/encoder_meth.c

@@ -69,20 +69,20 @@ static void encoder_store_free(void *vstore)
     ossl_method_store_free(vstore);
 }
 
-static void *encoder_store_new(OPENSSL_CTX *ctx)
+static void *encoder_store_new(OSSL_LIB_CTX *ctx)
 {
     return ossl_method_store_new(ctx);
 }
 
 
-static const OPENSSL_CTX_METHOD encoder_store_method = {
+static const OSSL_LIB_CTX_METHOD encoder_store_method = {
     encoder_store_new,
     encoder_store_free,
 };
 
 /* Data to be passed through ossl_method_construct() */
 struct encoder_data_st {
-    OPENSSL_CTX *libctx;
+    OSSL_LIB_CTX *libctx;
     OSSL_METHOD_CONSTRUCT_METHOD *mcm;
     int id;                      /* For get_encoder_from_store() */
     const char *names;           /* For get_encoder_from_store() */
@@ -95,7 +95,7 @@ struct encoder_data_st {
  */
 
 /* Temporary encoder method store, constructor and destructor */
-static void *alloc_tmp_encoder_store(OPENSSL_CTX *ctx)
+static void *alloc_tmp_encoder_store(OSSL_LIB_CTX *ctx)
 {
     return ossl_method_store_new(ctx);
 }
@@ -107,14 +107,14 @@ static void dealloc_tmp_encoder_store(void *store)
 }
 
 /* Get the permanent encoder store */
-static OSSL_METHOD_STORE *get_encoder_store(OPENSSL_CTX *libctx)
+static OSSL_METHOD_STORE *get_encoder_store(OSSL_LIB_CTX *libctx)
 {
-    return openssl_ctx_get_data(libctx, OPENSSL_CTX_ENCODER_STORE_INDEX,
-                                &encoder_store_method);
+    return ossl_lib_ctx_get_data(libctx, OSSL_LIB_CTX_ENCODER_STORE_INDEX,
+                                 &encoder_store_method);
 }
 
 /* Get encoder methods from a store, or put one in */
-static void *get_encoder_from_store(OPENSSL_CTX *libctx, void *store,
+static void *get_encoder_from_store(OSSL_LIB_CTX *libctx, void *store,
                                     void *data)
 {
     struct encoder_data_st *methdata = data;
@@ -136,7 +136,7 @@ static void *get_encoder_from_store(OPENSSL_CTX *libctx, void *store,
     return method;
 }
 
-static int put_encoder_in_store(OPENSSL_CTX *libctx, void *store,
+static int put_encoder_in_store(OSSL_LIB_CTX *libctx, void *store,
                                 void *method, const OSSL_PROVIDER *prov,
                                 int operation_id, const char *names,
                                 const char *propdef, void *unused)
@@ -257,7 +257,7 @@ static void *construct_encoder(const OSSL_ALGORITHM *algodef,
      * namemap entry, this is it.  Should the name already exist there, we
      * know that ossl_namemap_add() will return its corresponding number.
      */
-    OPENSSL_CTX *libctx = ossl_provider_library_context(prov);
+    OSSL_LIB_CTX *libctx = ossl_provider_library_context(prov);
     OSSL_NAMEMAP *namemap = ossl_namemap_stored(libctx);
     const char *names = algodef->algorithm_names;
     int id = ossl_namemap_add_names(namemap, 0, names, NAME_SEPARATOR);
@@ -286,7 +286,7 @@ static void free_encoder(void *method)
 }
 
 /* Fetching support.  Can fetch by numeric identity or by name */
-static OSSL_ENCODER *inner_ossl_encoder_fetch(OPENSSL_CTX *libctx,
+static OSSL_ENCODER *inner_ossl_encoder_fetch(OSSL_LIB_CTX *libctx,
                                               int id, const char *name,
                                               const char *properties)
 {
@@ -343,13 +343,13 @@ static OSSL_ENCODER *inner_ossl_encoder_fetch(OPENSSL_CTX *libctx,
     return method;
 }
 
-OSSL_ENCODER *OSSL_ENCODER_fetch(OPENSSL_CTX *libctx, const char *name,
+OSSL_ENCODER *OSSL_ENCODER_fetch(OSSL_LIB_CTX *libctx, const char *name,
                                  const char *properties)
 {
     return inner_ossl_encoder_fetch(libctx, 0, name, properties);
 }
 
-OSSL_ENCODER *ossl_encoder_fetch_by_number(OPENSSL_CTX *libctx, int id,
+OSSL_ENCODER *ossl_encoder_fetch_by_number(OSSL_LIB_CTX *libctx, int id,
                                            const char *properties)
 {
     return inner_ossl_encoder_fetch(libctx, id, NULL, properties);
@@ -392,7 +392,7 @@ int OSSL_ENCODER_number(const OSSL_ENCODER *encoder)
 int OSSL_ENCODER_is_a(const OSSL_ENCODER *encoder, const char *name)
 {
     if (encoder->base.prov != NULL) {
-        OPENSSL_CTX *libctx = ossl_provider_library_context(encoder->base.prov);
+        OSSL_LIB_CTX *libctx = ossl_provider_library_context(encoder->base.prov);
         OSSL_NAMEMAP *namemap = ossl_namemap_stored(libctx);
 
         return ossl_namemap_name2num(namemap, name) == encoder->base.id;
@@ -410,7 +410,7 @@ static void encoder_do_one(OSSL_PROVIDER *provider,
                            int no_store, void *vdata)
 {
     struct encoder_do_all_data_st *data = vdata;
-    OPENSSL_CTX *libctx = ossl_provider_library_context(provider);
+    OSSL_LIB_CTX *libctx = ossl_provider_library_context(provider);
     OSSL_NAMEMAP *namemap = ossl_namemap_stored(libctx);
     const char *names = algodef->algorithm_names;
     int id = ossl_namemap_add_names(namemap, 0, names, NAME_SEPARATOR);
@@ -426,7 +426,7 @@ static void encoder_do_one(OSSL_PROVIDER *provider,
     }
 }
 
-void OSSL_ENCODER_do_all_provided(OPENSSL_CTX *libctx,
+void OSSL_ENCODER_do_all_provided(OSSL_LIB_CTX *libctx,
                                   void (*fn)(OSSL_ENCODER *encoder, void *arg),
                                   void *arg)
 {
@@ -451,7 +451,7 @@ void OSSL_ENCODER_names_do_all(const OSSL_ENCODER *encoder,
         return;
 
     if (encoder->base.prov != NULL) {
-        OPENSSL_CTX *libctx = ossl_provider_library_context(encoder->base.prov);
+        OSSL_LIB_CTX *libctx = ossl_provider_library_context(encoder->base.prov);
         OSSL_NAMEMAP *namemap = ossl_namemap_stored(libctx);
 
         ossl_namemap_doall_names(namemap, encoder->base.id, fn, data);

+ 2 - 2
crypto/encode_decode/encoder_pkey.c

@@ -206,7 +206,7 @@ static void encoder_destruct_EVP_PKEY(void *arg)
 static int ossl_encoder_ctx_setup_for_EVP_PKEY(OSSL_ENCODER_CTX *ctx,
                                                const EVP_PKEY *pkey,
                                                int selection,
-                                               OPENSSL_CTX *libctx,
+                                               OSSL_LIB_CTX *libctx,
                                                const char *propquery)
 {
     struct construct_data_st *data = NULL;
@@ -337,7 +337,7 @@ static int ossl_encoder_ctx_setup_for_EVP_PKEY(OSSL_ENCODER_CTX *ctx,
 OSSL_ENCODER_CTX *OSSL_ENCODER_CTX_new_by_EVP_PKEY(const EVP_PKEY *pkey,
                                                    const char *output_type,
                                                    int selection,
-                                                   OPENSSL_CTX *libctx,
+                                                   OSSL_LIB_CTX *libctx,
                                                    const char *propquery)
 {
     OSSL_ENCODER_CTX *ctx = NULL;

+ 2 - 2
crypto/evp/asymcipher.c

@@ -405,7 +405,7 @@ OSSL_PROVIDER *EVP_ASYM_CIPHER_provider(const EVP_ASYM_CIPHER *cipher)
     return cipher->prov;
 }
 
-EVP_ASYM_CIPHER *EVP_ASYM_CIPHER_fetch(OPENSSL_CTX *ctx, const char *algorithm,
+EVP_ASYM_CIPHER *EVP_ASYM_CIPHER_fetch(OSSL_LIB_CTX *ctx, const char *algorithm,
                                        const char *properties)
 {
     return evp_generic_fetch(ctx, OSSL_OP_ASYM_CIPHER, algorithm, properties,
@@ -424,7 +424,7 @@ int EVP_ASYM_CIPHER_number(const EVP_ASYM_CIPHER *cipher)
     return cipher->name_id;
 }
 
-void EVP_ASYM_CIPHER_do_all_provided(OPENSSL_CTX *libctx,
+void EVP_ASYM_CIPHER_do_all_provided(OSSL_LIB_CTX *libctx,
                                      void (*fn)(EVP_ASYM_CIPHER *cipher,
                                                 void *arg),
                                      void *arg)

+ 3 - 3
crypto/evp/digest.c

@@ -83,7 +83,7 @@ int EVP_MD_CTX_reset(EVP_MD_CTX *ctx)
 
 #ifndef FIPS_MODULE
 EVP_MD_CTX *evp_md_ctx_new_ex(EVP_PKEY *pkey, const ASN1_OCTET_STRING *id,
-                              OPENSSL_CTX *libctx, const char *propq)
+                              OSSL_LIB_CTX *libctx, const char *propq)
 {
     EVP_MD_CTX *ctx;
     EVP_PKEY_CTX *pctx = NULL;
@@ -954,7 +954,7 @@ static void evp_md_free(void *md)
     EVP_MD_free(md);
 }
 
-EVP_MD *EVP_MD_fetch(OPENSSL_CTX *ctx, const char *algorithm,
+EVP_MD *EVP_MD_fetch(OSSL_LIB_CTX *ctx, const char *algorithm,
                      const char *properties)
 {
     EVP_MD *md =
@@ -987,7 +987,7 @@ void EVP_MD_free(EVP_MD *md)
     OPENSSL_free(md);
 }
 
-void EVP_MD_do_all_provided(OPENSSL_CTX *libctx,
+void EVP_MD_do_all_provided(OSSL_LIB_CTX *libctx,
                             void (*fn)(EVP_MD *mac, void *arg),
                             void *arg)
 {

+ 4 - 4
crypto/evp/evp_enc.c

@@ -1174,7 +1174,7 @@ const OSSL_PARAM *EVP_CIPHER_gettable_ctx_params(const EVP_CIPHER *cipher)
 }
 
 #ifndef FIPS_MODULE
-static OPENSSL_CTX *EVP_CIPHER_CTX_get_libctx(EVP_CIPHER_CTX *ctx)
+static OSSL_LIB_CTX *EVP_CIPHER_CTX_get_libctx(EVP_CIPHER_CTX *ctx)
 {
     const EVP_CIPHER *cipher = ctx->cipher;
     const OSSL_PROVIDER *prov;
@@ -1197,7 +1197,7 @@ int EVP_CIPHER_CTX_rand_key(EVP_CIPHER_CTX *ctx, unsigned char *key)
 #else
     {
         int kl;
-        OPENSSL_CTX *libctx = EVP_CIPHER_CTX_get_libctx(ctx);
+        OSSL_LIB_CTX *libctx = EVP_CIPHER_CTX_get_libctx(ctx);
 
         kl = EVP_CIPHER_CTX_key_length(ctx);
         if (kl <= 0 || RAND_priv_bytes_ex(libctx, key, kl) <= 0)
@@ -1456,7 +1456,7 @@ static void evp_cipher_free(void *cipher)
     EVP_CIPHER_free(cipher);
 }
 
-EVP_CIPHER *EVP_CIPHER_fetch(OPENSSL_CTX *ctx, const char *algorithm,
+EVP_CIPHER *EVP_CIPHER_fetch(OSSL_LIB_CTX *ctx, const char *algorithm,
                              const char *properties)
 {
     EVP_CIPHER *cipher =
@@ -1494,7 +1494,7 @@ void EVP_CIPHER_free(EVP_CIPHER *cipher)
     OPENSSL_free(cipher);
 }
 
-void EVP_CIPHER_do_all_provided(OPENSSL_CTX *libctx,
+void EVP_CIPHER_do_all_provided(OSSL_LIB_CTX *libctx,
                                 void (*fn)(EVP_CIPHER *mac, void *arg),
                                 void *arg)
 {

+ 29 - 29
crypto/evp/evp_fetch.c

@@ -28,20 +28,20 @@ static void evp_method_store_free(void *vstore)
     ossl_method_store_free(vstore);
 }
 
-static void *evp_method_store_new(OPENSSL_CTX *ctx)
+static void *evp_method_store_new(OSSL_LIB_CTX *ctx)
 {
     return ossl_method_store_new(ctx);
 }
 
 
-static const OPENSSL_CTX_METHOD evp_method_store_method = {
+static const OSSL_LIB_CTX_METHOD evp_method_store_method = {
     evp_method_store_new,
     evp_method_store_free,
 };
 
 /* Data to be passed through ossl_method_construct() */
 struct evp_method_data_st {
-    OPENSSL_CTX *libctx;
+    OSSL_LIB_CTX *libctx;
     OSSL_METHOD_CONSTRUCT_METHOD *mcm;
     int operation_id;            /* For get_evp_method_from_store() */
     int name_id;                 /* For get_evp_method_from_store() */
@@ -59,7 +59,7 @@ struct evp_method_data_st {
 /*
  * Generic routines to fetch / create EVP methods with ossl_method_construct()
  */
-static void *alloc_tmp_evp_method_store(OPENSSL_CTX *ctx)
+static void *alloc_tmp_evp_method_store(OSSL_LIB_CTX *ctx)
 {
     return ossl_method_store_new(ctx);
 }
@@ -70,10 +70,10 @@ static void *alloc_tmp_evp_method_store(OPENSSL_CTX *ctx)
         ossl_method_store_free(store);
 }
 
-static OSSL_METHOD_STORE *get_evp_method_store(OPENSSL_CTX *libctx)
+static OSSL_METHOD_STORE *get_evp_method_store(OSSL_LIB_CTX *libctx)
 {
-    return openssl_ctx_get_data(libctx, OPENSSL_CTX_EVP_METHOD_STORE_INDEX,
-                                &evp_method_store_method);
+    return ossl_lib_ctx_get_data(libctx, OSSL_LIB_CTX_EVP_METHOD_STORE_INDEX,
+                                 &evp_method_store_method);
 }
 
 /*
@@ -95,7 +95,7 @@ static uint32_t evp_method_id(int name_id, unsigned int operation_id)
     return ((name_id << 8) & 0xFFFFFF00) | (operation_id & 0x000000FF);
 }
 
-static void *get_evp_method_from_store(OPENSSL_CTX *libctx, void *store,
+static void *get_evp_method_from_store(OSSL_LIB_CTX *libctx, void *store,
                                        void *data)
 {
     struct evp_method_data_st *methdata = data;
@@ -133,7 +133,7 @@ static void *get_evp_method_from_store(OPENSSL_CTX *libctx, void *store,
     return method;
 }
 
-static int put_evp_method_in_store(OPENSSL_CTX *libctx, void *store,
+static int put_evp_method_in_store(OSSL_LIB_CTX *libctx, void *store,
                                    void *method, const OSSL_PROVIDER *prov,
                                    int operation_id, const char *names,
                                    const char *propdef, void *data)
@@ -185,7 +185,7 @@ static void *construct_evp_method(const OSSL_ALGORITHM *algodef,
      * number.
      */
     struct evp_method_data_st *methdata = data;
-    OPENSSL_CTX *libctx = ossl_provider_library_context(prov);
+    OSSL_LIB_CTX *libctx = ossl_provider_library_context(prov);
     OSSL_NAMEMAP *namemap = ossl_namemap_stored(libctx);
     const char *names = algodef->algorithm_names;
     int name_id = ossl_namemap_add_names(namemap, 0, names, NAME_SEPARATOR);
@@ -215,21 +215,21 @@ static void destruct_evp_method(void *method, void *data)
     methdata->destruct_method(method);
 }
 
-static const char *libctx_descriptor(OPENSSL_CTX *libctx)
+static const char *libctx_descriptor(OSSL_LIB_CTX *libctx)
 {
 #ifdef FIPS_MODULE
     return "FIPS internal library context";
 #else
-    if (openssl_ctx_is_global_default(libctx))
+    if (ossl_lib_ctx_is_global_default(libctx))
         return "Global default library context";
-    if (openssl_ctx_is_default(libctx))
+    if (ossl_lib_ctx_is_default(libctx))
         return "Thread-local default library context";
     return "Non-default library context";
 #endif
 }
 
 static void *
-inner_evp_generic_fetch(OPENSSL_CTX *libctx, int operation_id,
+inner_evp_generic_fetch(OSSL_LIB_CTX *libctx, int operation_id,
                         int name_id, const char *name,
                         const char *properties,
                         void *(*new_method)(int name_id,
@@ -352,7 +352,7 @@ inner_evp_generic_fetch(OPENSSL_CTX *libctx, int operation_id,
     return method;
 }
 
-void *evp_generic_fetch(OPENSSL_CTX *libctx, int operation_id,
+void *evp_generic_fetch(OSSL_LIB_CTX *libctx, int operation_id,
                         const char *name, const char *properties,
                         void *(*new_method)(int name_id,
                                             const OSSL_DISPATCH *fns,
@@ -372,7 +372,7 @@ void *evp_generic_fetch(OPENSSL_CTX *libctx, int operation_id,
  * This is meant to be used when one method needs to fetch an associated
  * other method.
  */
-void *evp_generic_fetch_by_number(OPENSSL_CTX *libctx, int operation_id,
+void *evp_generic_fetch_by_number(OSSL_LIB_CTX *libctx, int operation_id,
                                   int name_id, const char *properties,
                                   void *(*new_method)(int name_id,
                                                       const OSSL_DISPATCH *fns,
@@ -386,7 +386,7 @@ void *evp_generic_fetch_by_number(OPENSSL_CTX *libctx, int operation_id,
                                    free_method);
 }
 
-void evp_method_store_flush(OPENSSL_CTX *libctx)
+void evp_method_store_flush(OSSL_LIB_CTX *libctx)
 {
     OSSL_METHOD_STORE *store = get_evp_method_store(libctx);
 
@@ -394,7 +394,7 @@ void evp_method_store_flush(OPENSSL_CTX *libctx)
         ossl_method_store_flush_cache(store, 1);
 }
 
-static int evp_set_parsed_default_properties(OPENSSL_CTX *libctx,
+static int evp_set_parsed_default_properties(OSSL_LIB_CTX *libctx,
                                              OSSL_PROPERTY_LIST *def_prop,
                                              int loadconfig)
 {
@@ -412,7 +412,7 @@ static int evp_set_parsed_default_properties(OPENSSL_CTX *libctx,
     return 0;
 }
 
-int evp_set_default_properties_int(OPENSSL_CTX *libctx, const char *propq,
+int evp_set_default_properties_int(OSSL_LIB_CTX *libctx, const char *propq,
                                    int loadconfig)
 {
     OSSL_PROPERTY_LIST *pl = NULL;
@@ -424,12 +424,12 @@ int evp_set_default_properties_int(OPENSSL_CTX *libctx, const char *propq,
     return evp_set_parsed_default_properties(libctx, pl, loadconfig);
 }
 
-int EVP_set_default_properties(OPENSSL_CTX *libctx, const char *propq)
+int EVP_set_default_properties(OSSL_LIB_CTX *libctx, const char *propq)
 {
     return evp_set_default_properties_int(libctx, propq, 1);
 }
 
-static int evp_default_properties_merge(OPENSSL_CTX *libctx, const char *propq)
+static int evp_default_properties_merge(OSSL_LIB_CTX *libctx, const char *propq)
 {
     OSSL_PROPERTY_LIST **plp = ossl_ctx_global_properties(libctx, 1);
     OSSL_PROPERTY_LIST *pl1, *pl2;
@@ -451,7 +451,7 @@ static int evp_default_properties_merge(OPENSSL_CTX *libctx, const char *propq)
     return evp_set_parsed_default_properties(libctx, pl2, 0);
 }
 
-static int evp_default_property_is_enabled(OPENSSL_CTX *libctx,
+static int evp_default_property_is_enabled(OSSL_LIB_CTX *libctx,
                                            const char *prop_name)
 {
     OSSL_PROPERTY_LIST **plp = ossl_ctx_global_properties(libctx, 1);
@@ -459,12 +459,12 @@ static int evp_default_property_is_enabled(OPENSSL_CTX *libctx,
     return plp != NULL && ossl_property_is_enabled(libctx, prop_name, *plp);
 }
 
-int EVP_default_properties_is_fips_enabled(OPENSSL_CTX *libctx)
+int EVP_default_properties_is_fips_enabled(OSSL_LIB_CTX *libctx)
 {
     return evp_default_property_is_enabled(libctx, "fips");
 }
 
-int EVP_default_properties_enable_fips(OPENSSL_CTX *libctx, int enable)
+int EVP_default_properties_enable_fips(OSSL_LIB_CTX *libctx, int enable)
 {
     const char *query = (enable != 0) ? "fips=yes" : "-fips";
 
@@ -484,7 +484,7 @@ static void do_one(OSSL_PROVIDER *provider, const OSSL_ALGORITHM *algo,
                    int no_store, void *vdata)
 {
     struct do_all_data_st *data = vdata;
-    OPENSSL_CTX *libctx = ossl_provider_library_context(provider);
+    OSSL_LIB_CTX *libctx = ossl_provider_library_context(provider);
     OSSL_NAMEMAP *namemap = ossl_namemap_stored(libctx);
     int name_id = ossl_namemap_add_names(namemap, 0, algo->algorithm_names,
                                          NAME_SEPARATOR);
@@ -499,7 +499,7 @@ static void do_one(OSSL_PROVIDER *provider, const OSSL_ALGORITHM *algo,
     }
 }
 
-void evp_generic_do_all(OPENSSL_CTX *libctx, int operation_id,
+void evp_generic_do_all(OSSL_LIB_CTX *libctx, int operation_id,
                         void (*user_fn)(void *method, void *arg),
                         void *user_arg,
                         void *(*new_method)(int name_id,
@@ -524,7 +524,7 @@ void evp_generic_do_all(OPENSSL_CTX *libctx, int operation_id,
 
 const char *evp_first_name(const OSSL_PROVIDER *prov, int name_id)
 {
-    OPENSSL_CTX *libctx = ossl_provider_library_context(prov);
+    OSSL_LIB_CTX *libctx = ossl_provider_library_context(prov);
     OSSL_NAMEMAP *namemap = ossl_namemap_stored(libctx);
 
     return ossl_namemap_num2name(namemap, name_id, 0);
@@ -536,7 +536,7 @@ int evp_is_a(OSSL_PROVIDER *prov, int number,
     /*
      * For a |prov| that is NULL, the library context will be NULL
      */
-    OPENSSL_CTX *libctx = ossl_provider_library_context(prov);
+    OSSL_LIB_CTX *libctx = ossl_provider_library_context(prov);
     OSSL_NAMEMAP *namemap = ossl_namemap_stored(libctx);
 
     if (prov == NULL)
@@ -548,7 +548,7 @@ void evp_names_do_all(OSSL_PROVIDER *prov, int number,
                       void (*fn)(const char *name, void *data),
                       void *data)
 {
-    OPENSSL_CTX *libctx = ossl_provider_library_context(prov);
+    OSSL_LIB_CTX *libctx = ossl_provider_library_context(prov);
     OSSL_NAMEMAP *namemap = ossl_namemap_stored(libctx);
 
     ossl_namemap_doall_names(namemap, number, fn, data);

+ 4 - 4
crypto/evp/evp_local.h

@@ -232,21 +232,21 @@ int is_partially_overlapping(const void *ptr1, const void *ptr2, int len);
 #include <openssl/types.h>
 #include <openssl/core.h>
 
-void *evp_generic_fetch(OPENSSL_CTX *ctx, int operation_id,
+void *evp_generic_fetch(OSSL_LIB_CTX *ctx, int operation_id,
                         const char *name, const char *properties,
                         void *(*new_method)(int name_id,
                                             const OSSL_DISPATCH *fns,
                                             OSSL_PROVIDER *prov),
                         int (*up_ref_method)(void *),
                         void (*free_method)(void *));
-void *evp_generic_fetch_by_number(OPENSSL_CTX *ctx, int operation_id,
+void *evp_generic_fetch_by_number(OSSL_LIB_CTX *ctx, int operation_id,
                                   int name_id, const char *properties,
                                   void *(*new_method)(int name_id,
                                                       const OSSL_DISPATCH *fns,
                                                       OSSL_PROVIDER *prov),
                                   int (*up_ref_method)(void *),
                                   void (*free_method)(void *));
-void evp_generic_do_all(OPENSSL_CTX *libctx, int operation_id,
+void evp_generic_do_all(OSSL_LIB_CTX *libctx, int operation_id,
                         void (*user_fn)(void *method, void *arg),
                         void *user_arg,
                         void *(*new_method)(int name_id,
@@ -255,7 +255,7 @@ void evp_generic_do_all(OPENSSL_CTX *libctx, int operation_id,
                         void (*free_method)(void *));
 
 /* Internal fetchers for method types that are to be combined with others */
-EVP_KEYMGMT *evp_keymgmt_fetch_by_number(OPENSSL_CTX *ctx, int name_id,
+EVP_KEYMGMT *evp_keymgmt_fetch_by_number(OSSL_LIB_CTX *ctx, int name_id,
                                          const char *properties);
 
 /* Internal structure constructors for fetched methods */

+ 1 - 1
crypto/evp/evp_pkey.c

@@ -18,7 +18,7 @@
 
 /* Extract a private key from a PKCS8 structure */
 
-EVP_PKEY *EVP_PKCS82PKEY_ex(const PKCS8_PRIV_KEY_INFO *p8, OPENSSL_CTX *libctx,
+EVP_PKEY *EVP_PKCS82PKEY_ex(const PKCS8_PRIV_KEY_INFO *p8, OSSL_LIB_CTX *libctx,
                             const char *propq)
 {
     EVP_PKEY *pkey = NULL;

+ 2 - 2
crypto/evp/evp_rand.c

@@ -263,7 +263,7 @@ static void *evp_rand_from_dispatch(int name_id,
     return rand;
 }
 
-EVP_RAND *EVP_RAND_fetch(OPENSSL_CTX *libctx, const char *algorithm,
+EVP_RAND *EVP_RAND_fetch(OSSL_LIB_CTX *libctx, const char *algorithm,
                          const char *properties)
 {
     return evp_generic_fetch(libctx, OSSL_OP_RAND, algorithm, properties,
@@ -447,7 +447,7 @@ const OSSL_PARAM *EVP_RAND_settable_ctx_params(const EVP_RAND *rand)
                ossl_provider_ctx(EVP_RAND_provider(rand)));
 }
 
-void EVP_RAND_do_all_provided(OPENSSL_CTX *libctx,
+void EVP_RAND_do_all_provided(OSSL_LIB_CTX *libctx,
                               void (*fn)(EVP_RAND *rand, void *arg),
                               void *arg)
 {

+ 2 - 2
crypto/evp/exchange.c

@@ -166,7 +166,7 @@ OSSL_PROVIDER *EVP_KEYEXCH_provider(const EVP_KEYEXCH *exchange)
     return exchange->prov;
 }
 
-EVP_KEYEXCH *EVP_KEYEXCH_fetch(OPENSSL_CTX *ctx, const char *algorithm,
+EVP_KEYEXCH *EVP_KEYEXCH_fetch(OSSL_LIB_CTX *ctx, const char *algorithm,
                                const char *properties)
 {
     return evp_generic_fetch(ctx, OSSL_OP_KEYEXCH, algorithm, properties,
@@ -457,7 +457,7 @@ int EVP_KEYEXCH_is_a(const EVP_KEYEXCH *keyexch, const char *name)
     return evp_is_a(keyexch->prov, keyexch->name_id, NULL, name);
 }
 
-void EVP_KEYEXCH_do_all_provided(OPENSSL_CTX *libctx,
+void EVP_KEYEXCH_do_all_provided(OSSL_LIB_CTX *libctx,
                                  void (*fn)(EVP_KEYEXCH *keyexch, void *arg),
                                  void *arg)
 {

+ 2 - 2
crypto/evp/kdf_meth.c

@@ -147,7 +147,7 @@ static void *evp_kdf_from_dispatch(int name_id,
     return kdf;
 }
 
-EVP_KDF *EVP_KDF_fetch(OPENSSL_CTX *libctx, const char *algorithm,
+EVP_KDF *EVP_KDF_fetch(OSSL_LIB_CTX *libctx, const char *algorithm,
                        const char *properties)
 {
     return evp_generic_fetch(libctx, OSSL_OP_KDF, algorithm, properties,
@@ -186,7 +186,7 @@ const OSSL_PARAM *EVP_KDF_settable_ctx_params(const EVP_KDF *kdf)
     return kdf->settable_ctx_params(ossl_provider_ctx(EVP_KDF_provider(kdf)));
 }
 
-void EVP_KDF_do_all_provided(OPENSSL_CTX *libctx,
+void EVP_KDF_do_all_provided(OSSL_LIB_CTX *libctx,
                              void (*fn)(EVP_KDF *kdf, void *arg),
                              void *arg)
 {

+ 2 - 2
crypto/evp/kem.c

@@ -321,7 +321,7 @@ OSSL_PROVIDER *EVP_KEM_provider(const EVP_KEM *kem)
     return kem->prov;
 }
 
-EVP_KEM *EVP_KEM_fetch(OPENSSL_CTX *ctx, const char *algorithm,
+EVP_KEM *EVP_KEM_fetch(OSSL_LIB_CTX *ctx, const char *algorithm,
                        const char *properties)
 {
     return evp_generic_fetch(ctx, OSSL_OP_KEM, algorithm, properties,
@@ -340,7 +340,7 @@ int EVP_KEM_number(const EVP_KEM *kem)
     return kem->name_id;
 }
 
-void EVP_KEM_do_all_provided(OPENSSL_CTX *libctx,
+void EVP_KEM_do_all_provided(OSSL_LIB_CTX *libctx,
                              void (*fn)(EVP_KEM *kem, void *arg),
                              void *arg)
 {

+ 3 - 3
crypto/evp/keymgmt_meth.c

@@ -197,7 +197,7 @@ static void *keymgmt_from_dispatch(int name_id,
     return keymgmt;
 }
 
-EVP_KEYMGMT *evp_keymgmt_fetch_by_number(OPENSSL_CTX *ctx, int name_id,
+EVP_KEYMGMT *evp_keymgmt_fetch_by_number(OSSL_LIB_CTX *ctx, int name_id,
                                          const char *properties)
 {
     return evp_generic_fetch_by_number(ctx,
@@ -207,7 +207,7 @@ EVP_KEYMGMT *evp_keymgmt_fetch_by_number(OPENSSL_CTX *ctx, int name_id,
                                        (void (*)(void *))EVP_KEYMGMT_free);
 }
 
-EVP_KEYMGMT *EVP_KEYMGMT_fetch(OPENSSL_CTX *ctx, const char *algorithm,
+EVP_KEYMGMT *EVP_KEYMGMT_fetch(OSSL_LIB_CTX *ctx, const char *algorithm,
                                const char *properties)
 {
     return evp_generic_fetch(ctx, OSSL_OP_KEYMGMT, algorithm, properties,
@@ -259,7 +259,7 @@ int EVP_KEYMGMT_is_a(const EVP_KEYMGMT *keymgmt, const char *name)
     return evp_is_a(keymgmt->prov, keymgmt->name_id, NULL, name);
 }
 
-void EVP_KEYMGMT_do_all_provided(OPENSSL_CTX *libctx,
+void EVP_KEYMGMT_do_all_provided(OSSL_LIB_CTX *libctx,
                                  void (*fn)(EVP_KEYMGMT *keymgmt, void *arg),
                                  void *arg)
 {

+ 3 - 3
crypto/evp/m_sigver.c

@@ -38,7 +38,7 @@ static const char *canon_mdname(const char *mdname)
 
 static int do_sigver_init(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,
                           const EVP_MD *type, const char *mdname,
-                          OPENSSL_CTX *libctx, const char *props,
+                          OSSL_LIB_CTX *libctx, const char *props,
                           ENGINE *e, EVP_PKEY *pkey, int ver)
 {
     EVP_PKEY_CTX *locpctx = NULL;
@@ -311,7 +311,7 @@ static int do_sigver_init(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,
 }
 
 int EVP_DigestSignInit_ex(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,
-                          const char *mdname, OPENSSL_CTX *libctx,
+                          const char *mdname, OSSL_LIB_CTX *libctx,
                           const char *props, EVP_PKEY *pkey)
 {
     return do_sigver_init(ctx, pctx, NULL, mdname, libctx, props, NULL, pkey, 0);
@@ -324,7 +324,7 @@ int EVP_DigestSignInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,
 }
 
 int EVP_DigestVerifyInit_ex(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,
-                            const char *mdname, OPENSSL_CTX *libctx,
+                            const char *mdname, OSSL_LIB_CTX *libctx,
                             const char *props, EVP_PKEY *pkey)
 {
     return do_sigver_init(ctx, pctx, NULL, mdname, libctx, props, NULL, pkey, 1);

+ 2 - 2
crypto/evp/mac_meth.c

@@ -149,7 +149,7 @@ static void *evp_mac_from_dispatch(int name_id,
     return mac;
 }
 
-EVP_MAC *EVP_MAC_fetch(OPENSSL_CTX *libctx, const char *algorithm,
+EVP_MAC *EVP_MAC_fetch(OSSL_LIB_CTX *libctx, const char *algorithm,
                        const char *properties)
 {
     return evp_generic_fetch(libctx, OSSL_OP_MAC, algorithm, properties,
@@ -193,7 +193,7 @@ const OSSL_PARAM *EVP_MAC_settable_ctx_params(const EVP_MAC *mac)
     return mac->settable_ctx_params(ossl_provider_ctx(EVP_MAC_provider(mac)));
 }
 
-void EVP_MAC_do_all_provided(OPENSSL_CTX *libctx,
+void EVP_MAC_do_all_provided(OSSL_LIB_CTX *libctx,
                              void (*fn)(EVP_MAC *mac, void *arg),
                              void *arg)
 {

+ 3 - 2
crypto/evp/names.c

@@ -72,7 +72,8 @@ const EVP_CIPHER *EVP_get_cipherbyname(const char *name)
     return evp_get_cipherbyname_ex(NULL, name);
 }
 
-const EVP_CIPHER *evp_get_cipherbyname_ex(OPENSSL_CTX *libctx, const char *name)
+const EVP_CIPHER *evp_get_cipherbyname_ex(OSSL_LIB_CTX *libctx,
+                                          const char *name)
 {
     const EVP_CIPHER *cp;
     OSSL_NAMEMAP *namemap;
@@ -117,7 +118,7 @@ const EVP_MD *EVP_get_digestbyname(const char *name)
     return evp_get_digestbyname_ex(NULL, name);
 }
 
-const EVP_MD *evp_get_digestbyname_ex(OPENSSL_CTX *libctx, const char *name)
+const EVP_MD *evp_get_digestbyname_ex(OSSL_LIB_CTX *libctx, const char *name)
 {
     const EVP_MD *dp;
     OSSL_NAMEMAP *namemap;

+ 1 - 1
crypto/evp/p5_crpt2.c

@@ -22,7 +22,7 @@
 int pkcs5_pbkdf2_hmac_ex(const char *pass, int passlen,
                          const unsigned char *salt, int saltlen, int iter,
                          const EVP_MD *digest, int keylen, unsigned char *out,
-                         OPENSSL_CTX *libctx, const char *propq)
+                         OSSL_LIB_CTX *libctx, const char *propq)
 {
     const char *empty = "";
     int rv = 1, mode = 1;

+ 10 - 9
crypto/evp/p_lib.c

@@ -335,7 +335,7 @@ int EVP_PKEY_eq(const EVP_PKEY *a, const EVP_PKEY *b)
 }
 
 
-static EVP_PKEY *new_raw_key_int(OPENSSL_CTX *libctx,
+static EVP_PKEY *new_raw_key_int(OSSL_LIB_CTX *libctx,
                                  const char *strtype,
                                  const char *propq,
                                  int nidtype,
@@ -450,7 +450,7 @@ static EVP_PKEY *new_raw_key_int(OPENSSL_CTX *libctx,
     return pkey;
 }
 
-EVP_PKEY *EVP_PKEY_new_raw_private_key_ex(OPENSSL_CTX *libctx,
+EVP_PKEY *EVP_PKEY_new_raw_private_key_ex(OSSL_LIB_CTX *libctx,
                                           const char *keytype,
                                           const char *propq,
                                           const unsigned char *priv, size_t len)
@@ -466,7 +466,7 @@ EVP_PKEY *EVP_PKEY_new_raw_private_key(int type, ENGINE *e,
     return new_raw_key_int(NULL, NULL, NULL, type, e, priv, len, 1);
 }
 
-EVP_PKEY *EVP_PKEY_new_raw_public_key_ex(OPENSSL_CTX *libctx,
+EVP_PKEY *EVP_PKEY_new_raw_public_key_ex(OSSL_LIB_CTX *libctx,
                                          const char *keytype, const char *propq,
                                          const unsigned char *pub, size_t len)
 {
@@ -576,7 +576,8 @@ int EVP_PKEY_get_raw_public_key(const EVP_PKEY *pkey, unsigned char *pub,
 
 static EVP_PKEY *new_cmac_key_int(const unsigned char *priv, size_t len,
                                   const char *cipher_name,
-                                  const EVP_CIPHER *cipher, OPENSSL_CTX *libctx,
+                                  const EVP_CIPHER *cipher,
+                                  OSSL_LIB_CTX *libctx,
                                   const char *propq, ENGINE *e)
 {
 # ifndef OPENSSL_NO_CMAC
@@ -634,7 +635,7 @@ static EVP_PKEY *new_cmac_key_int(const unsigned char *priv, size_t len,
 }
 
 EVP_PKEY *EVP_PKEY_new_CMAC_key_ex(const unsigned char *priv, size_t len,
-                                   const char *cipher_name, OPENSSL_CTX *libctx,
+                                   const char *cipher_name, OSSL_LIB_CTX *libctx,
                                    const char *propq)
 {
     return new_cmac_key_int(priv, len, cipher_name, NULL, libctx, propq, NULL);
@@ -1069,7 +1070,7 @@ int EVP_PKEY_can_sign(const EVP_PKEY *pkey)
         }
     } else {
         const OSSL_PROVIDER *prov = EVP_KEYMGMT_provider(pkey->keymgmt);
-        OPENSSL_CTX *libctx = ossl_provider_library_context(prov);
+        OSSL_LIB_CTX *libctx = ossl_provider_library_context(prov);
         const char *supported_sig =
             pkey->keymgmt->query_operation_name != NULL
             ? pkey->keymgmt->query_operation_name(OSSL_OP_SIGNATURE)
@@ -1171,7 +1172,7 @@ static int unsup_alg(BIO *out, const EVP_PKEY *pkey, int indent,
 
 static int print_pkey(const EVP_PKEY *pkey, BIO *out, int indent,
                       int selection /* For provided encoding */,
-                      OPENSSL_CTX *libctx /* For provided encoding */,
+                      OSSL_LIB_CTX *libctx /* For provided encoding */,
                       const char *propquery /* For provided encoding */,
                       int (*legacy_print)(BIO *out, const EVP_PKEY *pkey,
                                           int indent, ASN1_PCTX *pctx),
@@ -1687,7 +1688,7 @@ int EVP_PKEY_size(const EVP_PKEY *pkey)
     return size;
 }
 
-void *evp_pkey_export_to_provider(EVP_PKEY *pk, OPENSSL_CTX *libctx,
+void *evp_pkey_export_to_provider(EVP_PKEY *pk, OSSL_LIB_CTX *libctx,
                                   EVP_KEYMGMT **keymgmt,
                                   const char *propquery)
 {
@@ -1884,7 +1885,7 @@ int evp_pkey_copy_downgraded(EVP_PKEY **dest, const EVP_PKEY *src)
                  * We perform the export in the same libctx as the keymgmt
                  * that we are using.
                  */
-                OPENSSL_CTX *libctx =
+                OSSL_LIB_CTX *libctx =
                     ossl_provider_library_context(keymgmt->prov);
                 EVP_PKEY_CTX *pctx =
                     EVP_PKEY_CTX_new_from_pkey(libctx, *dest, NULL);

+ 1 - 1
crypto/evp/p_sign.c

@@ -15,7 +15,7 @@
 #include "crypto/evp.h"
 
 int EVP_SignFinal_ex(EVP_MD_CTX *ctx, unsigned char *sigret,
-                     unsigned int *siglen, EVP_PKEY *pkey, OPENSSL_CTX *libctx,
+                     unsigned int *siglen, EVP_PKEY *pkey, OSSL_LIB_CTX *libctx,
                      const char *propq)
 {
     unsigned char m[EVP_MAX_MD_SIZE];

+ 1 - 1
crypto/evp/p_verify.c

@@ -15,7 +15,7 @@
 #include "crypto/evp.h"
 
 int EVP_VerifyFinal_ex(EVP_MD_CTX *ctx, const unsigned char *sigbuf,
-                       unsigned int siglen, EVP_PKEY *pkey, OPENSSL_CTX *libctx,
+                       unsigned int siglen, EVP_PKEY *pkey, OSSL_LIB_CTX *libctx,
                        const char *propq)
 {
     unsigned char m[EVP_MAX_MD_SIZE];

+ 1 - 1
crypto/evp/pbe_scrypt.c

@@ -62,7 +62,7 @@ int EVP_PBE_scrypt(const char *pass, size_t passlen,
     if (maxmem == 0)
         maxmem = SCRYPT_MAX_MEM;
 
-    /* Use OPENSSL_CTX_set0_default() if you need a library context */
+    /* Use OSSL_LIB_CTX_set0_default() if you need a library context */
     kdf = EVP_KDF_fetch(NULL, OSSL_KDF_NAME_SCRYPT, NULL);
     kctx = EVP_KDF_CTX_new(kdf);
     EVP_KDF_free(kdf);

+ 4 - 4
crypto/evp/pmeth_lib.c

@@ -172,7 +172,7 @@ static int get_legacy_alg_type_from_keymgmt(const EVP_KEYMGMT *keymgmt)
 }
 #endif /* FIPS_MODULE */
 
-static EVP_PKEY_CTX *int_ctx_new(OPENSSL_CTX *libctx,
+static EVP_PKEY_CTX *int_ctx_new(OSSL_LIB_CTX *libctx,
                                  EVP_PKEY *pkey, ENGINE *e,
                                  const char *keytype, const char *propquery,
                                  int id)
@@ -338,14 +338,14 @@ static EVP_PKEY_CTX *int_ctx_new(OPENSSL_CTX *libctx,
 
 /*- All methods below can also be used in FIPS_MODULE */
 
-EVP_PKEY_CTX *EVP_PKEY_CTX_new_from_name(OPENSSL_CTX *libctx,
+EVP_PKEY_CTX *EVP_PKEY_CTX_new_from_name(OSSL_LIB_CTX *libctx,
                                          const char *name,
                                          const char *propquery)
 {
     return int_ctx_new(libctx, NULL, NULL, name, propquery, -1);
 }
 
-EVP_PKEY_CTX *EVP_PKEY_CTX_new_from_pkey(OPENSSL_CTX *libctx, EVP_PKEY *pkey,
+EVP_PKEY_CTX *EVP_PKEY_CTX_new_from_pkey(OSSL_LIB_CTX *libctx, EVP_PKEY *pkey,
                                          const char *propquery)
 {
     return int_ctx_new(libctx, pkey, NULL, NULL, propquery, -1);
@@ -1762,7 +1762,7 @@ int evp_pkey_ctx_use_cached_data(EVP_PKEY_CTX *ctx)
     return ret;
 }
 
-OPENSSL_CTX *EVP_PKEY_CTX_get0_libctx(EVP_PKEY_CTX *ctx)
+OSSL_LIB_CTX *EVP_PKEY_CTX_get0_libctx(EVP_PKEY_CTX *ctx)
 {
     return ctx->libctx;
 }

Some files were not shown because too many files changed in this diff