diff options
author | Dr. Matthias St. Pierre <matthias.st.pierre@ncp-e.com> | 2020-10-15 12:55:50 +0300 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2020-10-15 11:59:53 +0100 |
commit | b425001010044adbdbcd98f8682694b30b73bbf4 (patch) | |
tree | e87a5b512d7869cb6a500ecc74b706281be762cf /providers | |
parent | 29000e43ea257bf54f6ccb2064b3744853b821b2 (diff) |
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)
Diffstat (limited to 'providers')
58 files changed, 132 insertions, 132 deletions
diff --git a/providers/baseprov.c b/providers/baseprov.c index 41dc65655e..d707f45558 100644 --- a/providers/baseprov.c +++ b/providers/baseprov.c @@ -176,7 +176,7 @@ int ossl_base_provider_init(const OSSL_CORE_HANDLE *handle, return 0; } ossl_prov_ctx_set0_library_context(*provctx, - (OPENSSL_CTX *)c_get_libctx(handle)); + (OSSL_LIB_CTX *)c_get_libctx(handle)); ossl_prov_ctx_set0_handle(*provctx, handle); ossl_prov_ctx_set0_core_bio_method(*provctx, corebiometh); diff --git a/providers/common/include/prov/provider_ctx.h b/providers/common/include/prov/provider_ctx.h index c650777280..6abc8d2111 100644 --- a/providers/common/include/prov/provider_ctx.h +++ b/providers/common/include/prov/provider_ctx.h @@ -17,7 +17,7 @@ typedef struct prov_ctx_st { const OSSL_CORE_HANDLE *handle; - OPENSSL_CTX *libctx; /* For all provider modules */ + OSSL_LIB_CTX *libctx; /* For all provider modules */ BIO_METHOD *corebiometh; } PROV_CTX; @@ -30,10 +30,10 @@ typedef struct prov_ctx_st { PROV_CTX *ossl_prov_ctx_new(void); void ossl_prov_ctx_free(PROV_CTX *ctx); -void ossl_prov_ctx_set0_library_context(PROV_CTX *ctx, OPENSSL_CTX *libctx); +void ossl_prov_ctx_set0_library_context(PROV_CTX *ctx, OSSL_LIB_CTX *libctx); void ossl_prov_ctx_set0_handle(PROV_CTX *ctx, const OSSL_CORE_HANDLE *handle); void ossl_prov_ctx_set0_core_bio_method(PROV_CTX *ctx, BIO_METHOD *corebiometh); -OPENSSL_CTX *ossl_prov_ctx_get0_library_context(PROV_CTX *ctx); +OSSL_LIB_CTX *ossl_prov_ctx_get0_library_context(PROV_CTX *ctx); const OSSL_CORE_HANDLE *ossl_prov_ctx_get0_handle(PROV_CTX *ctx); BIO_METHOD *ossl_prov_ctx_get0_core_bio_method(PROV_CTX *ctx); diff --git a/providers/common/include/prov/provider_util.h b/providers/common/include/prov/provider_util.h index 83f6d63ed7..1f6f4687ad 100644 --- a/providers/common/include/prov/provider_util.h +++ b/providers/common/include/prov/provider_util.h @@ -45,7 +45,7 @@ typedef struct { */ int ossl_prov_cipher_load_from_params(PROV_CIPHER *pc, const OSSL_PARAM params[], - OPENSSL_CTX *ctx); + OSSL_LIB_CTX *ctx); /* Reset the PROV_CIPHER fields and free any allocated cipher reference */ void ossl_prov_cipher_reset(PROV_CIPHER *pc); @@ -63,7 +63,7 @@ ENGINE *ossl_prov_cipher_engine(const PROV_CIPHER *pc); * Fetch a digest from the specified libctx using the provided mdname and * propquery. Store the result in the PROV_DIGEST and return the fetched md. */ -const EVP_MD *ossl_prov_digest_fetch(PROV_DIGEST *pd, OPENSSL_CTX *libctx, +const EVP_MD *ossl_prov_digest_fetch(PROV_DIGEST *pd, OSSL_LIB_CTX *libctx, const char *mdname, const char *propquery); /* @@ -74,7 +74,7 @@ const EVP_MD *ossl_prov_digest_fetch(PROV_DIGEST *pd, OPENSSL_CTX *libctx, */ int ossl_prov_digest_load_from_params(PROV_DIGEST *pd, const OSSL_PARAM params[], - OPENSSL_CTX *ctx); + OSSL_LIB_CTX *ctx); /* Reset the PROV_DIGEST fields and free any allocated digest reference */ void ossl_prov_digest_reset(PROV_DIGEST *pd); @@ -123,7 +123,7 @@ int ossl_prov_macctx_load_from_params(EVP_MAC_CTX **macctx, const char *macname, const char *ciphername, const char *mdname, - OPENSSL_CTX *ctx); + OSSL_LIB_CTX *ctx); typedef struct ag_capable_st { OSSL_ALGORITHM alg; diff --git a/providers/common/include/prov/providercommon.h b/providers/common/include/prov/providercommon.h index d90492c723..622fe1977e 100644 --- a/providers/common/include/prov/providercommon.h +++ b/providers/common/include/prov/providercommon.h @@ -10,7 +10,7 @@ #include <openssl/provider.h> #include <openssl/core_dispatch.h> -const OSSL_CORE_HANDLE *FIPS_get_core_handle(OPENSSL_CTX *ctx); +const OSSL_CORE_HANDLE *FIPS_get_core_handle(OSSL_LIB_CTX *ctx); const char *ossl_prov_util_nid_to_name(int nid); diff --git a/providers/common/provider_ctx.c b/providers/common/provider_ctx.c index 6d81c20981..f978a5812f 100644 --- a/providers/common/provider_ctx.c +++ b/providers/common/provider_ctx.c @@ -21,7 +21,7 @@ void ossl_prov_ctx_free(PROV_CTX *ctx) OPENSSL_free(ctx); } -void ossl_prov_ctx_set0_library_context(PROV_CTX *ctx, OPENSSL_CTX *libctx) +void ossl_prov_ctx_set0_library_context(PROV_CTX *ctx, OSSL_LIB_CTX *libctx) { if (ctx != NULL) ctx->libctx = libctx; @@ -39,7 +39,7 @@ void ossl_prov_ctx_set0_core_bio_method(PROV_CTX *ctx, BIO_METHOD *corebiometh) ctx->corebiometh = corebiometh; } -OPENSSL_CTX *ossl_prov_ctx_get0_library_context(PROV_CTX *ctx) +OSSL_LIB_CTX *ossl_prov_ctx_get0_library_context(PROV_CTX *ctx) { if (ctx == NULL) return NULL; diff --git a/providers/common/provider_util.c b/providers/common/provider_util.c index 2e9fe8d5da..2499d1534e 100644 --- a/providers/common/provider_util.c +++ b/providers/common/provider_util.c @@ -67,7 +67,7 @@ static int load_common(const OSSL_PARAM params[], const char **propquery, int ossl_prov_cipher_load_from_params(PROV_CIPHER *pc, const OSSL_PARAM params[], - OPENSSL_CTX *ctx) + OSSL_LIB_CTX *ctx) { const OSSL_PARAM *p; const char *propquery; @@ -124,7 +124,7 @@ int ossl_prov_digest_copy(PROV_DIGEST *dst, const PROV_DIGEST *src) return 1; } -const EVP_MD *ossl_prov_digest_fetch(PROV_DIGEST *pd, OPENSSL_CTX *libctx, +const EVP_MD *ossl_prov_digest_fetch(PROV_DIGEST *pd, OSSL_LIB_CTX *libctx, const char *mdname, const char *propquery) { EVP_MD_free(pd->alloc_md); @@ -135,7 +135,7 @@ const EVP_MD *ossl_prov_digest_fetch(PROV_DIGEST *pd, OPENSSL_CTX *libctx, int ossl_prov_digest_load_from_params(PROV_DIGEST *pd, const OSSL_PARAM params[], - OPENSSL_CTX *ctx) + OSSL_LIB_CTX *ctx) { const OSSL_PARAM *p; const char *propquery; @@ -245,7 +245,7 @@ int ossl_prov_macctx_load_from_params(EVP_MAC_CTX **macctx, const char *macname, const char *ciphername, const char *mdname, - OPENSSL_CTX *libctx) + OSSL_LIB_CTX *libctx) { const OSSL_PARAM *p; const char *properties = NULL; diff --git a/providers/defltprov.c b/providers/defltprov.c index 48f0c88098..253089a2d4 100644 --- a/providers/defltprov.c +++ b/providers/defltprov.c @@ -563,7 +563,7 @@ int ossl_default_provider_init(const OSSL_CORE_HANDLE *handle, return 0; } ossl_prov_ctx_set0_library_context(*provctx, - (OPENSSL_CTX *)c_get_libctx(handle)); + (OSSL_LIB_CTX *)c_get_libctx(handle)); ossl_prov_ctx_set0_handle(*provctx, handle); ossl_prov_ctx_set0_core_bio_method(*provctx, corebiometh); diff --git a/providers/fips/fipsprov.c b/providers/fips/fipsprov.c index 005ad2bb54..a75a0d3cdf 100644 --- a/providers/fips/fipsprov.c +++ b/providers/fips/fipsprov.c @@ -43,7 +43,7 @@ int FIPS_security_check_enabled(void); * TODO(3.0): Should these be stored in the provider side provctx? Could they * ever be different from one init to the next? Unfortunately we can't do this * at the moment because c_put_error/c_add_error_vdata do not provide - * us with the OPENSSL_CTX as a parameter. + * us with the OSSL_LIB_CTX as a parameter. */ static SELF_TEST_POST_PARAMS selftest_params; @@ -79,7 +79,7 @@ typedef struct fips_global_st { const OSSL_CORE_HANDLE *handle; } FIPS_GLOBAL; -static void *fips_prov_ossl_ctx_new(OPENSSL_CTX *libctx) +static void *fips_prov_ossl_ctx_new(OSSL_LIB_CTX *libctx) { FIPS_GLOBAL *fgbl = OPENSSL_zalloc(sizeof(*fgbl)); @@ -91,7 +91,7 @@ static void fips_prov_ossl_ctx_free(void *fgbl) OPENSSL_free(fgbl); } -static const OPENSSL_CTX_METHOD fips_prov_ossl_ctx_method = { +static const OSSL_LIB_CTX_METHOD fips_prov_ossl_ctx_method = { fips_prov_ossl_ctx_new, fips_prov_ossl_ctx_free, }; @@ -544,7 +544,7 @@ static const OSSL_ALGORITHM *fips_query(void *provctx, int operation_id, static void fips_teardown(void *provctx) { - OPENSSL_CTX_free(PROV_LIBRARY_CONTEXT_OF(provctx)); + OSSL_LIB_CTX_free(PROV_LIBRARY_CONTEXT_OF(provctx)); ossl_prov_ctx_free(provctx); } @@ -582,7 +582,7 @@ int OSSL_provider_init(const OSSL_CORE_HANDLE *handle, void **provctx) { FIPS_GLOBAL *fgbl; - OPENSSL_CTX *libctx = NULL; + OSSL_LIB_CTX *libctx = NULL; for (; in->function_id != 0; in++) { switch (in->function_id) { @@ -692,20 +692,20 @@ int OSSL_provider_init(const OSSL_CORE_HANDLE *handle, /* Create a context. */ if ((*provctx = ossl_prov_ctx_new()) == NULL - || (libctx = OPENSSL_CTX_new()) == NULL) { + || (libctx = OSSL_LIB_CTX_new()) == NULL) { /* * We free libctx separately here and only here because it hasn't * been attached to *provctx. All other error paths below rely * solely on fips_teardown. */ - OPENSSL_CTX_free(libctx); + OSSL_LIB_CTX_free(libctx); goto err; } ossl_prov_ctx_set0_library_context(*provctx, libctx); ossl_prov_ctx_set0_handle(*provctx, handle); - if ((fgbl = openssl_ctx_get_data(libctx, OPENSSL_CTX_FIPS_PROV_INDEX, - &fips_prov_ossl_ctx_method)) == NULL) + if ((fgbl = ossl_lib_ctx_get_data(libctx, OSSL_LIB_CTX_FIPS_PROV_INDEX, + &fips_prov_ossl_ctx_method)) == NULL) goto err; fgbl->handle = handle; @@ -764,7 +764,7 @@ int fips_intern_provider_init(const OSSL_CORE_HANDLE *handle, * able to do. */ ossl_prov_ctx_set0_library_context( - *provctx, (OPENSSL_CTX *)c_internal_get_libctx(handle) + *provctx, (OSSL_LIB_CTX *)c_internal_get_libctx(handle) ); ossl_prov_ctx_set0_handle(*provctx, handle); @@ -814,15 +814,15 @@ int ERR_pop_to_mark(void) /* * This must take a library context, since it's called from the depths * of crypto/initthread.c code, where it's (correctly) assumed that the - * passed caller argument is an OPENSSL_CTX pointer (since the same routine + * passed caller argument is an OSSL_LIB_CTX pointer (since the same routine * is also called from other parts of libcrypto, which all pass around a - * OPENSSL_CTX pointer) + * OSSL_LIB_CTX pointer) */ -const OSSL_CORE_HANDLE *FIPS_get_core_handle(OPENSSL_CTX *libctx) +const OSSL_CORE_HANDLE *FIPS_get_core_handle(OSSL_LIB_CTX *libctx) { - FIPS_GLOBAL *fgbl = openssl_ctx_get_data(libctx, - OPENSSL_CTX_FIPS_PROV_INDEX, - &fips_prov_ossl_ctx_method); + FIPS_GLOBAL *fgbl = ossl_lib_ctx_get_data(libctx, + OSSL_LIB_CTX_FIPS_PROV_INDEX, + &fips_prov_ossl_ctx_method); if (fgbl == NULL) return NULL; @@ -902,7 +902,7 @@ int FIPS_security_check_enabled(void) return fips_security_checks; } -void OSSL_SELF_TEST_get_callback(OPENSSL_CTX *libctx, OSSL_CALLBACK **cb, +void OSSL_SELF_TEST_get_callback(OSSL_LIB_CTX *libctx, OSSL_CALLBACK **cb, void **cbarg) { if (libctx == NULL) diff --git a/providers/fips/self_test.c b/providers/fips/self_test.c index 4bc562f822..4d8e640c38 100644 --- a/providers/fips/self_test.c +++ b/providers/fips/self_test.c @@ -20,8 +20,8 @@ /* * We're cheating here. Normally we don't allow RUN_ONCE usage inside the FIPS * module because all such initialisation should be associated with an - * individual OPENSSL_CTX. That doesn't work with the self test though because - * it should be run once regardless of the number of OPENSSL_CTXs we have. + * individual OSSL_LIB_CTX. That doesn't work with the self test though because + * it should be run once regardless of the number of OSSL_LIB_CTXs we have. */ #define ALLOW_RUN_ONCE_IN_FIPS #include <internal/thread_once.h> @@ -160,7 +160,7 @@ DEP_FINI_ATTRIBUTE void cleanup(void) */ static int verify_integrity(OSSL_CORE_BIO *bio, OSSL_FUNC_BIO_read_ex_fn read_ex_cb, unsigned char *expected, size_t expected_len, - OPENSSL_CTX *libctx, OSSL_SELF_TEST *ev, + OSSL_LIB_CTX *libctx, OSSL_SELF_TEST *ev, const char *event_type) { int ret = 0, status; diff --git a/providers/fips/self_test.h b/providers/fips/self_test.h index 205623cc3d..ff5928eeb4 100644 --- a/providers/fips/self_test.h +++ b/providers/fips/self_test.h @@ -31,11 +31,11 @@ typedef struct self_test_post_params_st { OSSL_FUNC_BIO_free_fn *bio_free_cb; OSSL_CALLBACK *cb; void *cb_arg; - OPENSSL_CTX *libctx; + OSSL_LIB_CTX *libctx; } SELF_TEST_POST_PARAMS; int SELF_TEST_post(SELF_TEST_POST_PARAMS *st, int on_demand_test); -int SELF_TEST_kats(OSSL_SELF_TEST *event, OPENSSL_CTX *libctx); +int SELF_TEST_kats(OSSL_SELF_TEST *event, OSSL_LIB_CTX *libctx); void SELF_TEST_disable_conditional_error_state(void); diff --git a/providers/fips/self_test_kats.c b/providers/fips/self_test_kats.c index 5e76a1c84d..c61646aafe 100644 --- a/providers/fips/self_test_kats.c +++ b/providers/fips/self_test_kats.c @@ -18,7 +18,7 @@ #include "self_test_data.inc" static int self_test_digest(const ST_KAT_DIGEST *t, OSSL_SELF_TEST *st, - OPENSSL_CTX *libctx) + OSSL_LIB_CTX *libctx) { int ok = 0; unsigned char out[EVP_MAX_MD_SIZE]; @@ -83,7 +83,7 @@ static int cipher_init(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, /* Test a single KAT for encrypt/decrypt */ static int self_test_cipher(const ST_KAT_CIPHER *t, OSSL_SELF_TEST *st, - OPENSSL_CTX *libctx) + OSSL_LIB_CTX *libctx) { int ret = 0, encrypt = 1, len, ct_len = 0, pt_len = 0; EVP_CIPHER_CTX *ctx = NULL; @@ -179,7 +179,7 @@ err: } static int self_test_kdf(const ST_KAT_KDF *t, OSSL_SELF_TEST *st, - OPENSSL_CTX *libctx) + OSSL_LIB_CTX *libctx) { int ret = 0; unsigned char out[64]; @@ -236,7 +236,7 @@ err: } static int self_test_drbg(const ST_KAT_DRBG *t, OSSL_SELF_TEST *st, - OPENSSL_CTX *libctx) + OSSL_LIB_CTX *libctx) { int ret = 0; unsigned char out[256]; @@ -347,7 +347,7 @@ err: } static int self_test_ka(const ST_KAT_KAS *t, - OSSL_SELF_TEST *st, OPENSSL_CTX *libctx) + OSSL_SELF_TEST *st, OSSL_LIB_CTX *libctx) { int ret = 0; EVP_PKEY_CTX *kactx = NULL, *dctx = NULL; @@ -423,7 +423,7 @@ err: } static int self_test_sign(const ST_KAT_SIGN *t, - OSSL_SELF_TEST *st, OPENSSL_CTX *libctx) + OSSL_SELF_TEST *st, OSSL_LIB_CTX *libctx) { int ret = 0; OSSL_PARAM *params = NULL, *params_sig = NULL; @@ -513,7 +513,7 @@ err: * and decrypt.. */ static int self_test_asym_cipher(const ST_KAT_ASYM_CIPHER *t, OSSL_SELF_TEST *st, - OPENSSL_CTX *libctx) + OSSL_LIB_CTX *libctx) { int ret = 0; OSSL_PARAM *keyparams = NULL, *initparams = NULL; @@ -598,7 +598,7 @@ err: * All tests are run regardless of if they fail or not. * Return 0 if any test fails. */ -static int self_test_digests(OSSL_SELF_TEST *st, OPENSSL_CTX *libctx) +static int self_test_digests(OSSL_SELF_TEST *st, OSSL_LIB_CTX *libctx) { int i, ret = 1; @@ -609,7 +609,7 @@ static int self_test_digests(OSSL_SELF_TEST *st, OPENSSL_CTX *libctx) return ret; } -static int self_test_ciphers(OSSL_SELF_TEST *st, OPENSSL_CTX *libctx) +static int self_test_ciphers(OSSL_SELF_TEST *st, OSSL_LIB_CTX *libctx) { int i, ret = 1; @@ -620,7 +620,7 @@ static int self_test_ciphers(OSSL_SELF_TEST *st, OPENSSL_CTX *libctx) return ret; } -static int self_test_asym_ciphers(OSSL_SELF_TEST *st, OPENSSL_CTX *libctx) +static int self_test_asym_ciphers(OSSL_SELF_TEST *st, OSSL_LIB_CTX *libctx) { int i, ret = 1; @@ -631,7 +631,7 @@ static int self_test_asym_ciphers(OSSL_SELF_TEST *st, OPENSSL_CTX *libctx) return ret; } -static int self_test_kdfs(OSSL_SELF_TEST *st, OPENSSL_CTX *libctx) +static int self_test_kdfs(OSSL_SELF_TEST *st, OSSL_LIB_CTX *libctx) { int i, ret = 1; @@ -642,7 +642,7 @@ static int self_test_kdfs(OSSL_SELF_TEST *st, OPENSSL_CTX *libctx) return ret; } -static int self_test_drbgs(OSSL_SELF_TEST *st, OPENSSL_CTX *libctx) +static int self_test_drbgs(OSSL_SELF_TEST *st, OSSL_LIB_CTX *libctx) { int i, ret = 1; @@ -653,7 +653,7 @@ static int self_test_drbgs(OSSL_SELF_TEST *st, OPENSSL_CTX *libctx) return ret; } -static int self_test_kas(OSSL_SELF_TEST *st, OPENSSL_CTX *libctx) +static int self_test_kas(OSSL_SELF_TEST *st, OSSL_LIB_CTX *libctx) { int i, ret = 1; @@ -664,7 +664,7 @@ static int self_test_kas(OSSL_SELF_TEST *st, OPENSSL_CTX *libctx) return ret; } -static int self_test_signatures(OSSL_SELF_TEST *st, OPENSSL_CTX *libctx) +static int self_test_signatures(OSSL_SELF_TEST *st, OSSL_LIB_CTX *libctx) { int i, ret = 1; @@ -680,7 +680,7 @@ static int self_test_signatures(OSSL_SELF_TEST *st, OPENSSL_CTX *libctx) * Return 1 is successful, otherwise return 0. * This runs all the tests regardless of if any fail. */ -int SELF_TEST_kats(OSSL_SELF_TEST *st, OPENSSL_CTX *libctx) +int SELF_TEST_kats(OSSL_SELF_TEST *st, OSSL_LIB_CTX *libctx) { int ret = 1; diff --git a/providers/implementations/asymciphers/rsa_enc.c b/providers/implementations/asymciphers/rsa_enc.c index 6241ce5fcf..296289d9b4 100644 --- a/providers/implementations/asymciphers/rsa_enc.c +++ b/providers/implementations/asymciphers/rsa_enc.c @@ -62,7 +62,7 @@ static OSSL_ITEM padding_item[] = { */ typedef struct { - OPENSSL_CTX *libctx; + OSSL_LIB_CTX *libctx; RSA *rsa; int pad_mode; int operation; diff --git a/providers/implementations/asymciphers/sm2_enc.c b/providers/implementations/asymciphers/sm2_enc.c index 4f2f64bb1a..ee63da7818 100644 --- a/providers/implementations/asymciphers/sm2_enc.c +++ b/providers/implementations/asymciphers/sm2_enc.c @@ -38,7 +38,7 @@ static |