diff options
author | Dr. Matthias St. Pierre <matthias.st.pierre@ncp-e.com> | 2020-10-15 11:55:50 +0200 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2020-10-15 12:59:53 +0200 |
commit | b425001010044adbdbcd98f8682694b30b73bbf4 (patch) | |
tree | e87a5b512d7869cb6a500ecc74b706281be762cf /providers/fips | |
parent | Make evp_pkey_ctx_get0_libctx/propq public API (diff) | |
download | openssl-b425001010044adbdbcd98f8682694b30b73bbf4.tar.xz openssl-b425001010044adbdbcd98f8682694b30b73bbf4.zip |
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/fips')
-rw-r--r-- | providers/fips/fipsprov.c | 34 | ||||
-rw-r--r-- | providers/fips/self_test.c | 6 | ||||
-rw-r--r-- | providers/fips/self_test.h | 4 | ||||
-rw-r--r-- | providers/fips/self_test_kats.c | 30 |
4 files changed, 37 insertions, 37 deletions
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; |