Browse Source

Rename some occurrences of 'library_context' and 'lib_ctx' to 'libctx'

This change makes the naming more consistent, because three different terms
were used for the same thing. (The term libctx was used by far most often.)

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/12621)
master
Dr. Matthias St. Pierre 2 years ago
committed by Matt Caswell
parent
commit
a829b735b6
70 changed files with 136 additions and 137 deletions
  1. +1
    -1
      crypto/bn/bn_ctx.c
  2. +2
    -2
      crypto/bn/bn_rand.c
  3. +1
    -1
      crypto/dh/dh_kdf.c
  4. +2
    -2
      crypto/ec/ec_cvt.c
  5. +4
    -4
      crypto/encode_decode/decoder_meth.c
  6. +4
    -4
      crypto/encode_decode/encoder_meth.c
  7. +1
    -1
      crypto/evp/evp_enc.c
  8. +5
    -5
      crypto/evp/evp_fetch.c
  9. +2
    -2
      crypto/evp/p_lib.c
  10. +2
    -2
      crypto/ffc/ffc_params_generate.c
  11. +1
    -1
      crypto/pkcs12/p12_key.c
  12. +5
    -5
      crypto/provider_core.c
  13. +4
    -4
      crypto/store/store_meth.c
  14. +1
    -1
      crypto/store/store_result.c
  15. +2
    -2
      crypto/x509/x_pubkey.c
  16. +4
    -4
      doc/internal/man3/ossl_provider_new.pod
  17. +3
    -3
      doc/man7/provider-base.pod
  18. +1
    -1
      include/crypto/bn.h
  19. +1
    -1
      include/internal/provider.h
  20. +2
    -2
      include/openssl/core_dispatch.h
  21. +4
    -4
      providers/baseprov.c
  22. +4
    -4
      providers/common/include/prov/provider_ctx.h
  23. +2
    -2
      providers/common/provider_ctx.c
  24. +4
    -4
      providers/defltprov.c
  25. +10
    -11
      providers/fips/fipsprov.c
  26. +1
    -1
      providers/implementations/asymciphers/rsa_enc.c
  27. +1
    -1
      providers/implementations/asymciphers/sm2_enc.c
  28. +1
    -1
      providers/implementations/ciphers/cipher_aes_siv.c
  29. +1
    -1
      providers/implementations/ciphers/ciphercommon.c
  30. +1
    -1
      providers/implementations/ciphers/ciphercommon_gcm.c
  31. +1
    -1
      providers/implementations/encode_decode/decode_der2key.c
  32. +1
    -1
      providers/implementations/encode_decode/encode_key2any.c
  33. +1
    -1
      providers/implementations/exchange/dh_exch.c
  34. +1
    -1
      providers/implementations/exchange/ecdh_exch.c
  35. +2
    -2
      providers/implementations/exchange/kdf_exch.c
  36. +1
    -1
      providers/implementations/kdfs/hkdf.c
  37. +1
    -1
      providers/implementations/kdfs/kbkdf.c
  38. +1
    -1
      providers/implementations/kdfs/krb5kdf.c
  39. +2
    -2
      providers/implementations/kdfs/pbkdf2.c
  40. +1
    -1
      providers/implementations/kdfs/pkcs12kdf.c
  41. +1
    -1
      providers/implementations/kdfs/scrypt.c
  42. +1
    -1
      providers/implementations/kdfs/sshkdf.c
  43. +1
    -1
      providers/implementations/kdfs/sskdf.c
  44. +1
    -1
      providers/implementations/kdfs/tls1_prf.c
  45. +1
    -1
      providers/implementations/kdfs/x942kdf.c
  46. +1
    -1
      providers/implementations/kem/rsa_kem.c
  47. +3
    -3
      providers/implementations/keymgmt/dh_kmgmt.c
  48. +2
    -2
      providers/implementations/keymgmt/dsa_kmgmt.c
  49. +2
    -2
      providers/implementations/keymgmt/ec_kmgmt.c
  50. +5
    -5
      providers/implementations/keymgmt/ecx_kmgmt.c
  51. +1
    -1
      providers/implementations/keymgmt/kdf_legacy_kmgmt.c
  52. +3
    -3
      providers/implementations/keymgmt/mac_legacy_kmgmt.c
  53. +3
    -3
      providers/implementations/keymgmt/rsa_kmgmt.c
  54. +1
    -1
      providers/implementations/macs/cmac_prov.c
  55. +1
    -1
      providers/implementations/macs/gmac_prov.c
  56. +1
    -1
      providers/implementations/macs/hmac_prov.c
  57. +1
    -1
      providers/implementations/macs/kmac_prov.c
  58. +1
    -1
      providers/implementations/rands/crngt.c
  59. +1
    -1
      providers/implementations/rands/drbg.c
  60. +1
    -1
      providers/implementations/rands/drbg_ctr.c
  61. +1
    -1
      providers/implementations/rands/drbg_hash.c
  62. +1
    -1
      providers/implementations/rands/drbg_hmac.c
  63. +1
    -1
      providers/implementations/signature/dsa.c
  64. +1
    -1
      providers/implementations/signature/ecdsa.c
  65. +1
    -1
      providers/implementations/signature/eddsa.c
  66. +2
    -2
      providers/implementations/signature/mac_legacy.c
  67. +1
    -1
      providers/implementations/signature/rsa.c
  68. +1
    -1
      providers/implementations/signature/sm2sig.c
  69. +1
    -1
      providers/implementations/storemgmt/file_store.c
  70. +5
    -5
      providers/legacyprov.c

+ 1
- 1
crypto/bn/bn_ctx.c View File

@ -249,7 +249,7 @@ BIGNUM *BN_CTX_get(BN_CTX *ctx)
return ret;
}
OSSL_LIB_CTX *bn_get_lib_ctx(BN_CTX *ctx)
OSSL_LIB_CTX *bn_get_libctx(BN_CTX *ctx)
{
if (ctx == NULL)
return NULL;


+ 2
- 2
crypto/bn/bn_rand.c View File

@ -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;
OSSL_LIB_CTX *libctx = bn_get_lib_ctx(ctx);
OSSL_LIB_CTX *libctx = bn_get_libctx(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;
OSSL_LIB_CTX *libctx = bn_get_lib_ctx(ctx);
OSSL_LIB_CTX *libctx = bn_get_libctx(ctx);
if (mdctx == NULL)
goto err;


+ 1
- 1
crypto/dh/dh_kdf.c View File

@ -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);
OSSL_LIB_CTX *libctx = ossl_provider_library_context(prov);
OSSL_LIB_CTX *libctx = ossl_provider_libctx(prov);
nid = OBJ_obj2nid(key_oid);
if (nid == NID_undef)


+ 2
- 2
crypto/ec/ec_cvt.c View File

@ -54,7 +54,7 @@ EC_GROUP *EC_GROUP_new_curve_GFp(const BIGNUM *p, const BIGNUM *a,
meth = EC_GFp_mont_method();
#endif
ret = ec_group_new_ex(bn_get_lib_ctx(ctx), NULL, meth);
ret = ec_group_new_ex(bn_get_libctx(ctx), NULL, meth);
if (ret == NULL)
return NULL;
@ -75,7 +75,7 @@ EC_GROUP *EC_GROUP_new_curve_GF2m(const BIGNUM *p, const BIGNUM *a,
meth = EC_GF2m_simple_method();
ret = ec_group_new_ex(bn_get_lib_ctx(ctx), NULL, meth);
ret = ec_group_new_ex(bn_get_libctx(ctx), NULL, meth);
if (ret == NULL)
return NULL;


+ 4
- 4
crypto/encode_decode/decoder_meth.c View File

@ -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.
*/
OSSL_LIB_CTX *libctx = ossl_provider_library_context(prov);
OSSL_LIB_CTX *libctx = ossl_provider_libctx(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);
@ -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) {
OSSL_LIB_CTX *libctx = ossl_provider_library_context(decoder->base.prov);
OSSL_LIB_CTX *libctx = ossl_provider_libctx(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;
OSSL_LIB_CTX *libctx = ossl_provider_library_context(provider);
OSSL_LIB_CTX *libctx = ossl_provider_libctx(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);
@ -434,7 +434,7 @@ void OSSL_DECODER_names_do_all(const OSSL_DECODER *decoder,
return;
if (decoder->base.prov != NULL) {
OSSL_LIB_CTX *libctx = ossl_provider_library_context(decoder->base.prov);
OSSL_LIB_CTX *libctx = ossl_provider_libctx(decoder->base.prov);
OSSL_NAMEMAP *namemap = ossl_namemap_stored(libctx);
ossl_namemap_doall_names(namemap, decoder->base.id, fn, data);


+ 4
- 4
crypto/encode_decode/encoder_meth.c View File

@ -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.
*/
OSSL_LIB_CTX *libctx = ossl_provider_library_context(prov);
OSSL_LIB_CTX *libctx = ossl_provider_libctx(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);
@ -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) {
OSSL_LIB_CTX *libctx = ossl_provider_library_context(encoder->base.prov);
OSSL_LIB_CTX *libctx = ossl_provider_libctx(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;
OSSL_LIB_CTX *libctx = ossl_provider_library_context(provider);
OSSL_LIB_CTX *libctx = ossl_provider_libctx(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);
@ -451,7 +451,7 @@ void OSSL_ENCODER_names_do_all(const OSSL_ENCODER *encoder,
return;
if (encoder->base.prov != NULL) {
OSSL_LIB_CTX *libctx = ossl_provider_library_context(encoder->base.prov);
OSSL_LIB_CTX *libctx = ossl_provider_libctx(encoder->base.prov);
OSSL_NAMEMAP *namemap = ossl_namemap_stored(libctx);
ossl_namemap_doall_names(namemap, encoder->base.id, fn, data);


+ 1
- 1
crypto/evp/evp_enc.c View File

@ -1183,7 +1183,7 @@ static OSSL_LIB_CTX *EVP_CIPHER_CTX_get_libctx(EVP_CIPHER_CTX *ctx)
return NULL;
prov = EVP_CIPHER_provider(cipher);
return ossl_provider_library_context(prov);
return ossl_provider_libctx(prov);
}
#endif


+ 5
- 5
crypto/evp/evp_fetch.c View File

@ -185,7 +185,7 @@ static void *construct_evp_method(const OSSL_ALGORITHM *algodef,
* number.
*/
struct evp_method_data_st *methdata = data;
OSSL_LIB_CTX *libctx = ossl_provider_library_context(prov);
OSSL_LIB_CTX *libctx = ossl_provider_libctx(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);
@ -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;
OSSL_LIB_CTX *libctx = ossl_provider_library_context(provider);
OSSL_LIB_CTX *libctx = ossl_provider_libctx(provider);
OSSL_NAMEMAP *namemap = ossl_namemap_stored(libctx);
int name_id = ossl_namemap_add_names(namemap, 0, algo->algorithm_names,
NAME_SEPARATOR);
@ -524,7 +524,7 @@ void evp_generic_do_all(OSSL_LIB_CTX *libctx, int operation_id,
const char *evp_first_name(const OSSL_PROVIDER *prov, int name_id)
{
OSSL_LIB_CTX *libctx = ossl_provider_library_context(prov);
OSSL_LIB_CTX *libctx = ossl_provider_libctx(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
*/
OSSL_LIB_CTX *libctx = ossl_provider_library_context(prov);
OSSL_LIB_CTX *libctx = ossl_provider_libctx(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)
{
OSSL_LIB_CTX *libctx = ossl_provider_library_context(prov);
OSSL_LIB_CTX *libctx = ossl_provider_libctx(prov);
OSSL_NAMEMAP *namemap = ossl_namemap_stored(libctx);
ossl_namemap_doall_names(namemap, number, fn, data);


+ 2
- 2
crypto/evp/p_lib.c View File

@ -1070,7 +1070,7 @@ int EVP_PKEY_can_sign(const EVP_PKEY *pkey)
}
} else {
const OSSL_PROVIDER *prov = EVP_KEYMGMT_provider(pkey->keymgmt);
OSSL_LIB_CTX *libctx = ossl_provider_library_context(prov);
OSSL_LIB_CTX *libctx = ossl_provider_libctx(prov);
const char *supported_sig =
pkey->keymgmt->query_operation_name != NULL
? pkey->keymgmt->query_operation_name(OSSL_OP_SIGNATURE)
@ -1886,7 +1886,7 @@ int evp_pkey_copy_downgraded(EVP_PKEY **dest, const EVP_PKEY *src)
* that we are using.
*/
OSSL_LIB_CTX *libctx =
ossl_provider_library_context(keymgmt->prov);
ossl_provider_libctx(keymgmt->prov);
EVP_PKEY_CTX *pctx =
EVP_PKEY_CTX_new_from_pkey(libctx, *dest, NULL);


+ 2
- 2
crypto/ffc/ffc_params_generate.c View File

@ -320,7 +320,7 @@ static int generate_q_fips186_4(BN_CTX *ctx, BIGNUM *q, const EVP_MD *evpmd,
unsigned char md[EVP_MAX_MD_SIZE];
int mdsize = EVP_MD_size(evpmd);
unsigned char *pmd;
OSSL_LIB_CTX *libctx = bn_get_lib_ctx(ctx);
OSSL_LIB_CTX *libctx = bn_get_libctx(ctx);
/* find q */
for (;;) {
@ -391,7 +391,7 @@ static int generate_q_fips186_2(BN_CTX *ctx, BIGNUM *q, const EVP_MD *evpmd,
unsigned char buf2[EVP_MAX_MD_SIZE];
unsigned char md[EVP_MAX_MD_SIZE];
int i, r, ret = 0, m = *retm;
OSSL_LIB_CTX *libctx = bn_get_lib_ctx(ctx);
OSSL_LIB_CTX *libctx = bn_get_libctx(ctx);
/* find q */
for (;;) {


+ 1
- 1
crypto/pkcs12/p12_key.c View File

@ -74,7 +74,7 @@ int PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt,
* The parameter query isn't available but the library context can be
* extracted from the passed digest.
*/
kdf = EVP_KDF_fetch(ossl_provider_library_context(EVP_MD_provider(md_type)),
kdf = EVP_KDF_fetch(ossl_provider_libctx(EVP_MD_provider(md_type)),
"PKCS12KDF", NULL);
if (kdf == NULL)
return 0;


+ 5
- 5
crypto/provider_core.c View File

@ -817,7 +817,7 @@ void *ossl_provider_prov_ctx(const OSSL_PROVIDER *prov)
return NULL;
}
OSSL_LIB_CTX *ossl_provider_library_context(const OSSL_PROVIDER *prov)
OSSL_LIB_CTX *ossl_provider_libctx(const OSSL_PROVIDER *prov)
{
/* TODO(3.0) just: return prov->libctx; */
return prov != NULL ? prov->libctx : NULL;
@ -850,7 +850,7 @@ int ossl_provider_self_test(const OSSL_PROVIDER *prov)
return 1;
ret = prov->self_test(prov->provctx);
if (ret == 0)
evp_method_store_flush(ossl_provider_library_context(prov));
evp_method_store_flush(ossl_provider_libctx(prov));
return ret;
}
@ -941,7 +941,7 @@ static const OSSL_PARAM param_types[] = {
static OSSL_FUNC_core_gettable_params_fn core_gettable_params;
static OSSL_FUNC_core_get_params_fn core_get_params;
static OSSL_FUNC_core_thread_start_fn core_thread_start;
static OSSL_FUNC_core_get_library_context_fn core_get_libctx;
static OSSL_FUNC_core_get_libctx_fn core_get_libctx;
#ifndef FIPS_MODULE
static OSSL_FUNC_core_new_error_fn core_new_error;
static OSSL_FUNC_core_set_error_debug_fn core_set_error_debug;
@ -997,7 +997,7 @@ static OPENSSL_CORE_CTX *core_get_libctx(const OSSL_CORE_HANDLE *handle)
*/
OSSL_PROVIDER *prov = (OSSL_PROVIDER *)handle;
return (OPENSSL_CORE_CTX *)ossl_provider_library_context(prov);
return (OPENSSL_CORE_CTX *)ossl_provider_libctx(prov);
}
static int core_thread_start(const OSSL_CORE_HANDLE *handle,
@ -1080,7 +1080,7 @@ static int core_pop_error_to_mark(const OSSL_CORE_HANDLE *handle)
static const OSSL_DISPATCH core_dispatch_[] = {
{ OSSL_FUNC_CORE_GETTABLE_PARAMS, (void (*)(void))core_gettable_params },
{ OSSL_FUNC_CORE_GET_PARAMS, (void (*)(void))core_get_params },
{ OSSL_FUNC_CORE_GET_LIBRARY_CONTEXT, (void (*)(void))core_get_libctx },
{ OSSL_FUNC_CORE_GET_LIBCTX, (void (*)(void))core_get_libctx },
{ OSSL_FUNC_CORE_THREAD_START, (void (*)(void))core_thread_start },
#ifndef FIPS_MODULE
{ OSSL_FUNC_CORE_NEW_ERROR, (void (*)(void))core_new_error },


+ 4
- 4
crypto/store/store_meth.c View File

@ -235,7 +235,7 @@ static void *construct_loader(const OSSL_ALGORITHM *algodef,
* namemap entry, this is it. Should the scheme already exist there, we
* know that ossl_namemap_add() will return its corresponding number.
*/
OSSL_LIB_CTX *libctx = ossl_provider_library_context(prov);
OSSL_LIB_CTX *libctx = ossl_provider_libctx(prov);
OSSL_NAMEMAP *namemap = ossl_namemap_stored(libctx);
const char *scheme = algodef->algorithm_names;
int id = ossl_namemap_add_name(namemap, 0, scheme);
@ -361,7 +361,7 @@ int OSSL_STORE_LOADER_number(const OSSL_STORE_LOADER *loader)
int OSSL_STORE_LOADER_is_a(const OSSL_STORE_LOADER *loader, const char *name)
{
if (loader->prov != NULL) {
OSSL_LIB_CTX *libctx = ossl_provider_library_context(loader->prov);
OSSL_LIB_CTX *libctx = ossl_provider_libctx(loader->prov);
OSSL_NAMEMAP *namemap = ossl_namemap_stored(libctx);
return ossl_namemap_name2num(namemap, name) == loader->scheme_id;
@ -379,7 +379,7 @@ static void loader_do_one(OSSL_PROVIDER *provider,
int no_store, void *vdata)
{
struct loader_do_all_data_st *data = vdata;
OSSL_LIB_CTX *libctx = ossl_provider_library_context(provider);
OSSL_LIB_CTX *libctx = ossl_provider_libctx(provider);
OSSL_NAMEMAP *namemap = ossl_namemap_stored(libctx);
const char *name = algodef->algorithm_names;
int id = ossl_namemap_add_name(namemap, 0, name);
@ -417,7 +417,7 @@ void OSSL_STORE_LOADER_names_do_all(const OSSL_STORE_LOADER *loader,
return;
if (loader->prov != NULL) {
OSSL_LIB_CTX *libctx = ossl_provider_library_context(loader->prov);
OSSL_LIB_CTX *libctx = ossl_provider_libctx(loader->prov);
OSSL_NAMEMAP *namemap = ossl_namemap_stored(libctx);
ossl_namemap_doall_names(namemap, loader->scheme_id, fn, data);


+ 1
- 1
crypto/store/store_result.c View File

@ -107,7 +107,7 @@ int ossl_store_handle_load_result(const OSSL_PARAM params[], void *arg)
OSSL_STORE_CTX *ctx = cbdata->ctx;
const OSSL_PROVIDER *provider =
OSSL_STORE_LOADER_provider(ctx->fetched_loader);
OSSL_LIB_CTX *libctx = ossl_provider_library_context(provider);
OSSL_LIB_CTX *libctx = ossl_provider_libctx(provider);
const char *propq = ctx->properties;
const OSSL_PARAM *p;
struct extracted_param_data_st helper_data;


+ 2
- 2
crypto/x509/x_pubkey.c View File

@ -100,7 +100,7 @@ int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey)
}
} else if (evp_pkey_is_provided(pkey)) {
const OSSL_PROVIDER *pkprov = EVP_KEYMGMT_provider(pkey->keymgmt);
OSSL_LIB_CTX *libctx = ossl_provider_library_context(pkprov);
OSSL_LIB_CTX *libctx = ossl_provider_libctx(pkprov);
unsigned char *der = NULL;
size_t derlen = 0;
int selection = (OSSL_KEYMGMT_SELECT_PUBLIC_KEY
@ -309,7 +309,7 @@ int i2d_PUBKEY(const EVP_PKEY *a, unsigned char **pp)
X509_PUBKEY_free(xpk);
} else if (a->keymgmt != NULL) {
const OSSL_PROVIDER *pkprov = EVP_KEYMGMT_provider(a->keymgmt);
OSSL_LIB_CTX *libctx = ossl_provider_library_context(pkprov);
OSSL_LIB_CTX *libctx = ossl_provider_libctx(pkprov);
int selection = (OSSL_KEYMGMT_SELECT_PUBLIC_KEY
| OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS);
OSSL_ENCODER_CTX *ctx =


+ 4
- 4
doc/internal/man3/ossl_provider_new.pod View File

@ -11,7 +11,7 @@ ossl_provider_ctx,
ossl_provider_forall_loaded,
ossl_provider_name, ossl_provider_dso,
ossl_provider_module_name, ossl_provider_module_path,
ossl_provider_library_context,
ossl_provider_libctx,
ossl_provider_teardown, ossl_provider_gettable_params,
ossl_provider_get_params, ossl_provider_query_operation,
ossl_provider_set_operation_bit, ossl_provider_test_operation_bit,
@ -55,7 +55,7 @@ ossl_provider_get_capabilities
const DSO *ossl_provider_dso(OSSL_PROVIDER *prov);
const char *ossl_provider_module_name(OSSL_PROVIDER *prov);
const char *ossl_provider_module_path(OSSL_PROVIDER *prov);
OSSL_LIB_CTX *ossl_provider_library_context(const OSSL_PROVIDER *prov);
OSSL_LIB_CTX *ossl_provider_libctx(const OSSL_PROVIDER *prov);
/* Thin wrappers around calls to the provider */
void ossl_provider_teardown(const OSSL_PROVIDER *prov);
@ -144,7 +144,7 @@ This will be used in preference to automatically trying to figure out
the path from the provider name and the default module directory (more
on this in L</NOTES>).
ossl_provider_library_context() returns the library context the given
ossl_provider_libctx() returns the library context the given
provider I<prov> is registered in.
ossl_provider_add_parameter() adds a global parameter for the provider
@ -280,7 +280,7 @@ ossl_provider_module_name(), and ossl_provider_module_path() return a
pointer to their respective data if it's available, otherwise NULL
is returned.
ossl_provider_library_context() return a pointer to the library context.
ossl_provider_libctx() return a pointer to the library context.
This may be NULL, and is perfectly valid, as it denotes the default
global library context.


+ 3
- 3
doc/man7/provider-base.pod View File

@ -20,7 +20,7 @@ provider-base
int core_get_params(const OSSL_CORE_HANDLE *handle, OSSL_PARAM params[]);
int core_thread_start(const OSSL_CORE_HANDLE *handle,
OSSL_thread_stop_handler_fn handfn);
OPENSSL_CORE_CTX *core_get_library_context(const OSSL_CORE_HANDLE *handle);
OPENSSL_CORE_CTX *core_get_libctx(const OSSL_CORE_HANDLE *handle);
void core_new_error(const OSSL_CORE_HANDLE *handle);
void core_set_error_debug(const OSSL_CORE_HANDLE *handle,
const char *file, int line, const char *func);
@ -104,7 +104,7 @@ provider):
core_gettable_params OSSL_FUNC_CORE_GETTABLE_PARAMS
core_get_params OSSL_FUNC_CORE_GET_PARAMS
core_thread_start OSSL_FUNC_CORE_THREAD_START
core_get_library_context OSSL_FUNC_CORE_GET_LIBRARY_CONTEXT
core_get_libctx OSSL_FUNC_CORE_GET_LIBCTX
core_new_error OSSL_FUNC_CORE_NEW_ERROR
core_set_error_debug OSSL_FUNC_CORE_SET_ERROR_DEBUG
core_set_error OSSL_FUNC_CORE_SET_ERROR
@ -152,7 +152,7 @@ parameters.
=for comment core_thread_start() TBA
core_get_library_context() retrieves the library context in which the library
core_get_libctx() retrieves the library context in which the library
object for the current provider is stored, accessible through the I<handle>.
This may sometimes be useful if the provider wishes to store a
reference to its context in the same library context.


+ 1
- 1
include/crypto/bn.h View File

@ -110,7 +110,7 @@ int bn_rsa_fips186_4_derive_prime(BIGNUM *Y, BIGNUM *X, const BIGNUM *Xin,
const BIGNUM *r1, const BIGNUM *r2, int nlen,
const BIGNUM *e, BN_CTX *ctx, BN_GENCB *cb);
OSSL_LIB_CTX *bn_get_lib_ctx(BN_CTX *ctx);
OSSL_LIB_CTX *bn_get_libctx(BN_CTX *ctx);
extern const BIGNUM bn_inv_sqrt_2;


+ 1
- 1
include/internal/provider.h View File

@ -68,7 +68,7 @@ const DSO *ossl_provider_dso(const OSSL_PROVIDER *prov);
const char *ossl_provider_module_name(const OSSL_PROVIDER *prov);
const char *ossl_provider_module_path(const OSSL_PROVIDER *prov);
void *ossl_provider_prov_ctx(const OSSL_PROVIDER *prov);
OSSL_LIB_CTX *ossl_provider_library_context(const OSSL_PROVIDER *prov);
OSSL_LIB_CTX *ossl_provider_libctx(const OSSL_PROVIDER *prov);
/* Thin wrappers around calls to the provider */
void ossl_provider_teardown(const OSSL_PROVIDER *prov);


+ 2
- 2
include/openssl/core_dispatch.h View File

@ -66,8 +66,8 @@ OSSL_CORE_MAKE_FUNC(int,core_get_params,(const OSSL_CORE_HANDLE *prov,
# define OSSL_FUNC_CORE_THREAD_START 3
OSSL_CORE_MAKE_FUNC(int,core_thread_start,(const OSSL_CORE_HANDLE *prov,
OSSL_thread_stop_handler_fn handfn))
# define OSSL_FUNC_CORE_GET_LIBRARY_CONTEXT 4
OSSL_CORE_MAKE_FUNC(OPENSSL_CORE_CTX *,core_get_library_context,
# define OSSL_FUNC_CORE_GET_LIBCTX 4
OSSL_CORE_MAKE_FUNC(OPENSSL_CORE_CTX *,core_get_libctx,
(const OSSL_CORE_HANDLE *prov))
# define OSSL_FUNC_CORE_NEW_ERROR 5
OSSL_CORE_MAKE_FUNC(void,core_new_error,(const OSSL_CORE_HANDLE *prov))


+ 4
- 4
providers/baseprov.c View File

@ -136,7 +136,7 @@ int ossl_base_provider_init(const OSSL_CORE_HANDLE *handle,
const OSSL_DISPATCH *in, const OSSL_DISPATCH **out,
void **provctx)
{
OSSL_FUNC_core_get_library_context_fn *c_get_libctx = NULL;
OSSL_FUNC_core_get_libctx_fn *c_get_libctx = NULL;
BIO_METHOD *corebiometh;
if (!ossl_prov_bio_from_dispatch(in))
@ -149,8 +149,8 @@ int ossl_base_provider_init(const OSSL_CORE_HANDLE *handle,
case OSSL_FUNC_CORE_GET_PARAMS:
c_get_params = OSSL_FUNC_core_get_params(in);
break;
case OSSL_FUNC_CORE_GET_LIBRARY_CONTEXT:
c_get_libctx = OSSL_FUNC_core_get_library_context(in);
case OSSL_FUNC_CORE_GET_LIBCTX:
c_get_libctx = OSSL_FUNC_core_get_libctx(in);
break;
default:
/* Just ignore anything we don't understand */
@ -175,7 +175,7 @@ int ossl_base_provider_init(const OSSL_CORE_HANDLE *handle,
*provctx = NULL;
return 0;
}
ossl_prov_ctx_set0_library_context(*provctx,
ossl_prov_ctx_set0_libctx(*provctx,
(OSSL_LIB_CTX *)c_get_libctx(handle));
ossl_prov_ctx_set0_handle(*provctx, handle);
ossl_prov_ctx_set0_core_bio_method(*provctx, corebiometh);


+ 4
- 4
providers/common/include/prov/provider_ctx.h View File

@ -25,15 +25,15 @@ typedef struct prov_ctx_st {
* To be used anywhere the library context needs to be passed, such as to
* fetching functions.
*/
# define PROV_LIBRARY_CONTEXT_OF(provctx) \
ossl_prov_ctx_get0_library_context((provctx))
# define PROV_LIBCTX_OF(provctx) \
ossl_prov_ctx_get0_libctx((provctx))
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, OSSL_LIB_CTX *libctx);
void ossl_prov_ctx_set0_libctx(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);
OSSL_LIB_CTX *ossl_prov_ctx_get0_library_context(PROV_CTX *ctx);
OSSL_LIB_CTX *ossl_prov_ctx_get0_libctx(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);


+ 2
- 2
providers/common/provider_ctx.c View File

@ -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, OSSL_LIB_CTX *libctx)
void ossl_prov_ctx_set0_libctx(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;
}
OSSL_LIB_CTX *ossl_prov_ctx_get0_library_context(PROV_CTX *ctx)
OSSL_LIB_CTX *ossl_prov_ctx_get0_libctx(PROV_CTX *ctx)
{
if (ctx == NULL)
return NULL;


+ 4
- 4
providers/defltprov.c View File

@ -523,7 +523,7 @@ int ossl_default_provider_init(const OSSL_CORE_HANDLE *handle,
const OSSL_DISPATCH **out,
void **provctx)
{
OSSL_FUNC_core_get_library_context_fn *c_get_libctx = NULL;
OSSL_FUNC_core_get_libctx_fn *c_get_libctx = NULL;
BIO_METHOD *corebiometh;
if (!ossl_prov_bio_from_dispatch(in))
@ -536,8 +536,8 @@ int ossl_default_provider_init(const OSSL_CORE_HANDLE *handle,
case OSSL_FUNC_CORE_GET_PARAMS:
c_get_params = OSSL_FUNC_core_get_params(in);
break;
case OSSL_FUNC_CORE_GET_LIBRARY_CONTEXT:
c_get_libctx = OSSL_FUNC_core_get_library_context(in);
case OSSL_FUNC_CORE_GET_LIBCTX:
c_get_libctx = OSSL_FUNC_core_get_libctx(in);
break;
default:
/* Just ignore anything we don't understand */
@ -562,7 +562,7 @@ int ossl_default_provider_init(const OSSL_CORE_HANDLE *handle,
*provctx = NULL;
return 0;
}
ossl_prov_ctx_set0_library_context(*provctx,
ossl_prov_ctx_set0_libctx(*provctx,
(OSSL_LIB_CTX *)c_get_libctx(handle));
ossl_prov_ctx_set0_handle(*provctx, handle);
ossl_prov_ctx_set0_core_bio_method(*provctx, corebiometh);


+ 10
- 11
providers/fips/fipsprov.c View File

@ -73,7 +73,7 @@ static OSSL_FUNC_CRYPTO_secure_clear_free_fn *c_CRYPTO_secure_clear_free;
static OSSL_FUNC_CRYPTO_secure_allocated_fn *c_CRYPTO_secure_allocated;
static OSSL_FUNC_BIO_vsnprintf_fn *c_BIO_vsnprintf;
static OSSL_FUNC_self_test_cb_fn *c_stcbfn = NULL;
static OSSL_FUNC_core_get_library_context_fn *c_get_libctx = NULL;
static OSSL_FUNC_core_get_libctx_fn *c_get_libctx = NULL;
typedef struct fips_global_st {
const OSSL_CORE_HANDLE *handle;
@ -544,7 +544,7 @@ static const OSSL_ALGORITHM *fips_query(void *provctx, int operation_id,
static void fips_teardown(void *provctx)
{
OSSL_LIB_CTX_free(PROV_LIBRARY_CONTEXT_OF(provctx));
OSSL_LIB_CTX_free(PROV_LIBCTX_OF(provctx));
ossl_prov_ctx_free(provctx);
}
@ -586,8 +586,8 @@ int OSSL_provider_init(const OSSL_CORE_HANDLE *handle,
for (; in->function_id != 0; in++) {
switch (in->function_id) {
case OSSL_FUNC_CORE_GET_LIBRARY_CONTEXT:
c_get_libctx = OSSL_FUNC_core_get_library_context(in);
case OSSL_FUNC_CORE_GET_LIBCTX:
c_get_libctx = OSSL_FUNC_core_get_libctx(in);
break;
case OSSL_FUNC_CORE_GETTABLE_PARAMS:
c_gettable_params = OSSL_FUNC_core_gettable_params(in);
@ -701,7 +701,7 @@ int OSSL_provider_init(const OSSL_CORE_HANDLE *handle,
OSSL_LIB_CTX_free(libctx);
goto err;
}
ossl_prov_ctx_set0_library_context(*provctx, libctx);
ossl_prov_ctx_set0_libctx(*provctx, libctx);
ossl_prov_ctx_set0_handle(*provctx, handle);
if ((fgbl = ossl_lib_ctx_get_data(libctx, OSSL_LIB_CTX_FIPS_PROV_INDEX,
@ -740,12 +740,12 @@ int fips_intern_provider_init(const OSSL_CORE_HANDLE *handle,
const OSSL_DISPATCH **out,
void **provctx)
{
OSSL_FUNC_core_get_library_context_fn *c_internal_get_libctx = NULL;
OSSL_FUNC_core_get_libctx_fn *c_internal_get_libctx = NULL;
for (; in->function_id != 0; in++) {
switch (in->function_id) {
case OSSL_FUNC_CORE_GET_LIBRARY_CONTEXT:
c_internal_get_libctx = OSSL_FUNC_core_get_library_context(in);
case OSSL_FUNC_CORE_GET_LIBCTX:
c_internal_get_libctx = OSSL_FUNC_core_get_libctx(in);
break;
default:
break;
@ -763,9 +763,8 @@ int fips_intern_provider_init(const OSSL_CORE_HANDLE *handle,
* internal provider. This is not something that most providers would be
* able to do.
*/
ossl_prov_ctx_set0_library_context(
*provctx, (OSSL_LIB_CTX *)c_internal_get_libctx(handle)
);
ossl_prov_ctx_set0_libctx(*provctx,
(OSSL_LIB_CTX *)c_internal_get_libctx(handle));
ossl_prov_ctx_set0_handle(*provctx, handle);
*out = intern_dispatch_table;


+ 1
- 1
providers/implementations/asymciphers/rsa_enc.c View File

@ -87,7 +87,7 @@ static void *rsa_newctx(void *provctx)
prsactx = OPENSSL_zalloc(sizeof(PROV_RSA_CTX));
if (prsactx == NULL)
return NULL;
prsactx->libctx = PROV_LIBRARY_CONTEXT_OF(provctx);
prsactx->libctx = PROV_LIBCTX_OF(provctx);
return prsactx;
}


+ 1
- 1
providers/implementations/asymciphers/sm2_enc.c View File

@ -49,7 +49,7 @@ static void *sm2_newctx(void *provctx)
if (psm2ctx == NULL)
return NULL;
psm2ctx->libctx = PROV_LIBRARY_CONTEXT_OF(provctx);
psm2ctx->libctx = PROV_LIBCTX_OF(provctx);
return psm2ctx;
}


+ 1
- 1
providers/implementations/ciphers/cipher_aes_siv.c View File

@ -40,7 +40,7 @@ static void *aes_siv_newctx(void *provctx, size_t keybits, unsigned int mode,
ctx->flags = flags;
ctx->keylen = keybits / 8;
ctx->hw = ossl_prov_cipher_hw_aes_siv(keybits);
ctx->libctx = PROV_LIBRARY_CONTEXT_OF(provctx);
ctx->libctx = PROV_LIBCTX_OF(provctx);
}
return ctx;
}


+ 1
- 1
providers/implementations/ciphers/ciphercommon.c View File

@ -595,5 +595,5 @@ void ossl_cipher_generic_initkey(void *vctx, size_t kbits, size_t blkbits,
ctx->mode = mode;
ctx->blocksize = blkbits / 8;
if (provctx != NULL)
ctx->libctx = PROV_LIBRARY_CONTEXT_OF(provctx); /* used for rand */
ctx->libctx = PROV_LIBCTX_OF(provctx); /* used for rand */
}

+ 1
- 1
providers/implementations/ciphers/ciphercommon_gcm.c View File

@ -36,7 +36,7 @@ void gcm_initctx(void *provctx, PROV_GCM_CTX *ctx, size_t keybits,
ctx->ivlen = (EVP_GCM_TLS_FIXED_IV_LEN + EVP_GCM_TLS_EXPLICIT_IV_LEN);
ctx->keylen = keybits / 8;
ctx->hw = hw;
ctx->libctx = PROV_LIBRARY_CONTEXT_OF(provctx);
ctx->libctx = PROV_LIBCTX_OF(provctx);
}
static int gcm_init(void *vctx, const unsigned char *key, size_t keylen,


+ 1
- 1
providers/implementations/encode_decode/decode_der2key.c View File

@ -176,7 +176,7 @@ static int der2key_decode(void *vctx, OSSL_CORE_BIO *cin,
OSSL_PASSPHRASE_CALLBACK *pw_cb, void *pw_cbarg)
{
struct der2key_ctx_st *ctx = vctx;
void *libctx = PROV_LIBRARY_CONTEXT_OF(ctx->provctx);
void *libctx = PROV_LIBCTX_OF(ctx->provctx);
unsigned char *der = NULL;
const unsigned char *derp;
long der_len = 0;


+ 1
- 1
providers/implementations/encode_decode/encode_key2any.c View File

@ -789,7 +789,7 @@ static const OSSL_PARAM *key2any_settable_ctx_params(ossl_unused void *provctx)
static int key2any_set_ctx_params(void *vctx, const OSSL_PARAM params[])
{
struct key2any_ctx_st *ctx = vctx;
OSSL_LIB_CTX *libctx = ossl_prov_ctx_get0_library_context(ctx->provctx);
OSSL_LIB_CTX *libctx = ossl_prov_ctx_get0_libctx(ctx->provctx);
const OSSL_PARAM *cipherp =
OSSL_PARAM_locate_const(params, OSSL_ENCODER_PARAM_CIPHER);
const OSSL_PARAM *propsp =


+ 1
- 1
providers/implementations/exchange/dh_exch.c View File

@ -87,7 +87,7 @@ static void *dh_newctx(void *provctx)
pdhctx = OPENSSL_zalloc(sizeof(PROV_DH_CTX));
if (pdhctx == NULL)
return NULL;
pdhctx->libctx = PROV_LIBRARY_CONTEXT_OF(provctx);
pdhctx->libctx = PROV_LIBCTX_OF(provctx);
pdhctx->kdf_type = PROV_DH_KDF_NONE;
return pdhctx;
}


+ 1
- 1
providers/implementations/exchange/ecdh_exch.c View File

@ -90,7 +90,7 @@ void *ecdh_newctx(void *provctx)
if (pectx == NULL)
return NULL;
pectx->libctx = PROV_LIBRARY_CONTEXT_OF(provctx);
pectx->libctx = PROV_LIBCTX_OF(provctx);
pectx->cofactor_mode = -1;
pectx->kdf_type = PROV_ECDH_KDF_NONE;


+ 2
- 2
providers/implementations/exchange/kdf_exch.c View File

@ -49,7 +49,7 @@ static void *kdf_newctx(const char *kdfname, void *provctx)
kdfctx->provctx = provctx;
kdf = EVP_KDF_fetch(PROV_LIBRARY_CONTEXT_OF(provctx), kdfname, NULL);
kdf = EVP_KDF_fetch(PROV_LIBCTX_OF(provctx), kdfname, NULL);
if (kdf == NULL)
goto err;
kdfctx->kdfctx = EVP_KDF_CTX_new(kdf);
@ -146,7 +146,7 @@ static int kdf_set_ctx_params(void *vpkdfctx, const OSSL_PARAM params[])
static const OSSL_PARAM *kdf_settable_ctx_params(void *provctx,
const char *kdfname)
{
EVP_KDF *kdf = EVP_KDF_fetch(PROV_LIBRARY_CONTEXT_OF(provctx), kdfname,
EVP_KDF *kdf = EVP_KDF_fetch(PROV_LIBCTX_OF(provctx), kdfname,
NULL);
const OSSL_PARAM *params;


+ 1
- 1
providers/implementations/kdfs/hkdf.c View File

@ -168,7 +168,7 @@ static int kdf_hkdf_set_ctx_params(void *vctx, const OSSL_PARAM params[])
{
const OSSL_PARAM *p;
KDF_HKDF *ctx = vctx;
OSSL_LIB_CTX *provctx = PROV_LIBRARY_CONTEXT_OF(ctx->provctx);
OSSL_LIB_CTX *provctx = PROV_LIBCTX_OF(ctx->provctx);
int n;
if (!ossl_prov_digest_load_from_params(&ctx->digest, params, provctx))


+ 1
- 1
providers/implementations/kdfs/kbkdf.c View File

@ -254,7 +254,7 @@ static int kbkdf_set_buffer(unsigned char **out, size_t *out_len,
static int kbkdf_set_ctx_params(void *vctx, const OSSL_PARAM params[])
{
KBKDF *ctx = (KBKDF *)vctx;
OSSL_LIB_CTX *libctx = PROV_LIBRARY_CONTEXT_OF(ctx->provctx);
OSSL_LIB_CTX *libctx = PROV_LIBCTX_OF(ctx->provctx);
const OSSL_PARAM *p;
OSSL_PARAM mparams[2];


+ 1
- 1
providers/implementations/kdfs/krb5kdf.c View File

@ -132,7 +132,7 @@ static int krb5kdf_set_ctx_params(void *vctx, const OSSL_PARAM params[])
{
const OSSL_PARAM *p;
KRB5KDF_CTX *ctx = vctx;
OSSL_LIB_CTX *provctx = PROV_LIBRARY_CONTEXT_OF(ctx->provctx);
OSSL_LIB_CTX *provctx = PROV_LIBCTX_OF(ctx->provctx);
if (!ossl_prov_cipher_load_from_params(&ctx->cipher, params, provctx))
return 0;


+ 2
- 2
providers/implementations/kdfs/pbkdf2.c View File

@ -111,7 +111,7 @@ static void kdf_pbkdf2_reset(void *vctx)
static void kdf_pbkdf2_init(KDF_PBKDF2 *ctx)
{
OSSL_PARAM params[2] = { OSSL_PARAM_END, OSSL_PARAM_END };
OSSL_LIB_CTX *provctx = PROV_LIBRARY_CONTEXT_OF(ctx->provctx);
OSSL_LIB_CTX *provctx = PROV_LIBCTX_OF(ctx->provctx);
params[0] = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_DIGEST,
SN_sha1, 0);
@ -168,7 +168,7 @@ static int kdf_pbkdf2_set_ctx_params(void *vctx, const OSSL_PARAM params[])
{
const OSSL_PARAM *p;
KDF_PBKDF2 *ctx = vctx;
OSSL_LIB_CTX *provctx = PROV_LIBRARY_CONTEXT_OF(ctx->provctx);
OSSL_LIB_CTX *provctx = PROV_LIBCTX_OF(ctx->provctx);
int pkcs5;
uint64_t iter, min_iter;


+ 1
- 1
providers/implementations/kdfs/pkcs12kdf.c View File

@ -223,7 +223,7 @@ static int kdf_pkcs12_set_ctx_params(void *vctx, const OSSL_PARAM params[])
{
const OSSL_PARAM *p;
KDF_PKCS12 *ctx = vctx;
OSSL_LIB_CTX *provctx = PROV_LIBRARY_CONTEXT_OF(ctx->provctx);
OSSL_LIB_CTX *provctx = PROV_LIBCTX_OF(ctx->provctx);
if (!ossl_prov_digest_load_from_params(&ctx->digest, params, provctx))
return 0;


+ 1
- 1
providers/implementations/kdfs/scrypt.c View File

@ -66,7 +66,7 @@ static void *kdf_scrypt_new(void *provctx)
ERR_raise(ERR_LIB_PROV, ERR_R_MALLOC_FAILURE);
return NULL;
}
ctx->libctx = PROV_LIBRARY_CONTEXT_OF(provctx);
ctx->libctx = PROV_LIBCTX_OF(provctx);
kdf_scrypt_init(ctx);
return ctx;
}


+ 1
- 1
providers/implementations/kdfs/sshkdf.c View File

@ -134,7 +134,7 @@ static int kdf_sshkdf_set_ctx_params(void *vctx, const OSSL_PARAM params[])
{
const OSSL_PARAM *p;
KDF_SSHKDF *ctx = vctx;
OSSL_LIB_CTX *provctx = PROV_LIBRARY_CONTEXT_OF(ctx->provctx);
OSSL_LIB_CTX *provctx = PROV_LIBCTX_OF(ctx->provctx);
int t;
if (!ossl_prov_digest_load_from_params(&ctx->digest, params, provctx))


+ 1
- 1
providers/implementations/kdfs/sskdf.c View File

@ -452,7 +452,7 @@ static int sskdf_set_ctx_params(void *vctx, const OSSL_PARAM params[])
{
const OSSL_PARAM *p;
KDF_SSKDF *ctx = vctx;
OSSL_LIB_CTX *libctx = PROV_LIBRARY_CONTEXT_OF(ctx->provctx);
OSSL_LIB_CTX *libctx = PROV_LIBCTX_OF(ctx->provctx);
size_t sz;
if (!ossl_prov_digest_load_from_params(&ctx->digest, params, libctx))


+ 1
- 1
providers/implementations/kdfs/tls1_prf.c View File

@ -166,7 +166,7 @@ static int kdf_tls1_prf_set_ctx_params(void *vctx, const OSSL_PARAM params[])
{
const OSSL_PARAM *p;
TLS1_PRF *ctx = vctx;
OSSL_LIB_CTX *libctx = PROV_LIBRARY_CONTEXT_OF(ctx->provctx);
OSSL_LIB_CTX *libctx = PROV_LIBCTX_OF(ctx->provctx);
if ((p = OSSL_PARAM_locate_const(params, OSSL_KDF_PARAM_DIGEST)) != NULL) {
if (strcasecmp(p->data, SN_md5_sha1) == 0) {


+ 1
- 1
providers/implementations/kdfs/x942kdf.c View File

@ -387,7 +387,7 @@ static int x942kdf_set_ctx_params(void *vctx, const OSSL_PARAM params[])
{
const OSSL_PARAM *p, *pq;
KDF_X942 *ctx = vctx;
OSSL_LIB_CTX *provctx = PROV_LIBRARY_CONTEXT_OF(ctx->provctx);
OSSL_LIB_CTX *provctx = PROV_LIBCTX_OF(ctx->provctx);
const char *propq = NULL;
size_t id;


+ 1
- 1
providers/implementations/kem/rsa_kem.c View File

@ -86,7 +86,7 @@ static void *rsakem_newctx(void *provctx)
if (prsactx == NULL)
return NULL;
prsactx->libctx = PROV_LIBRARY_CONTEXT_OF(provctx);
prsactx->libctx = PROV_LIBCTX_OF(provctx);
prsactx->op = KEM_OP_UNDEFINED;
return prsactx;


+ 3
- 3
providers/implementations/keymgmt/dh_kmgmt.c View File

@ -136,7 +136,7 @@ static void *dh_newdata(void *provctx)
DH *dh = NULL;
if (ossl_prov_is_running()) {
dh = dh_new_ex(PROV_LIBRARY_CONTEXT_OF(provctx));
dh = dh_new_ex(PROV_LIBCTX_OF(provctx));
if (dh != NULL) {
DH_clear_flags(dh, DH_FLAG_TYPE_MASK);
DH_set_flags(dh, DH_FLAG_TYPE_DH);
@ -149,7 +149,7 @@ static void *dhx_newdata(void *provctx)
{
DH *dh = NULL;
dh = dh_new_ex(PROV_LIBRARY_CONTEXT_OF(provctx));
dh = dh_new_ex(PROV_LIBCTX_OF(provctx));
if (dh != NULL) {
DH_clear_flags(dh, DH_FLAG_TYPE_MASK);
DH_set_flags(dh, DH_FLAG_TYPE_DHX);
@ -430,7 +430,7 @@ static int dh_validate(void *keydata, int selection)
static void *dh_gen_init_base(void *provctx, int selection, int type)
{
OSSL_LIB_CTX *libctx = PROV_LIBRARY_CONTEXT_OF(provctx);
OSSL_LIB_CTX *libctx = PROV_LIBCTX_OF(provctx);
struct dh_gen_ctx *gctx = NULL;
if (!ossl_prov_is_running())


+ 2
- 2
providers/implementations/keymgmt/dsa_kmgmt.c View File

@ -113,7 +113,7 @@ static void *dsa_newdata(void *provctx)
{
if (!ossl_prov_is_running())
return NULL;
return dsa_new_with_ctx(PROV_LIBRARY_CONTEXT_OF(provctx));
return dsa_new_with_ctx(PROV_LIBCTX_OF(provctx));
}
static void dsa_freedata(void *keydata)
@ -363,7 +363,7 @@ static int dsa_validate(void *keydata, int selection)
static void *dsa_gen_init(void *provctx, int selection)
{
OSSL_LIB_CTX *libctx = PROV_LIBRARY_CONTEXT_OF(provctx);
OSSL_LIB_CTX *libctx = PROV_LIBCTX_OF(provctx);
struct dsa_gen_ctx *gctx = NULL;
if (!ossl_prov_is_running() || (selection & DSA_POSSIBLE_SELECTIONS) == 0)


+ 2
- 2
providers/implementations/keymgmt/ec_kmgmt.c View File

@ -236,7 +236,7 @@ void *ec_newdata(void *provctx)
{
if (!ossl_prov_is_running())
return NULL;
return EC_KEY_new_ex(PROV_LIBRARY_CONTEXT_OF(provctx), NULL);
return EC_KEY_new_ex(PROV_LIBCTX_OF(provctx), NULL);
}
static
@ -831,7 +831,7 @@ struct ec_gen_ctx {
static void *ec_gen_init(void *provctx, int selection)
{
OSSL_LIB_CTX *libctx = PROV_LIBRARY_CONTEXT_OF(provctx);
OSSL_LIB_CTX *libctx = PROV_LIBCTX_OF(provctx);
struct ec_gen_ctx *gctx = NULL;
if (!ossl_prov_is_running() || (selection & (EC_POSSIBLE_SELECTIONS)) == 0)


+ 5
- 5
providers/implementations/keymgmt/ecx_kmgmt.c View File

@ -85,7 +85,7 @@ static void *x25519_new_key(void *provctx)
{
if (!ossl_prov_is_running())
return 0;
return ecx_key_new(PROV_LIBRARY_CONTEXT_OF(provctx), ECX_KEY_TYPE_X25519, 0,
return ecx_key_new(PROV_LIBCTX_OF(provctx), ECX_KEY_TYPE_X25519, 0,
NULL);
}
@ -93,7 +93,7 @@ static void *x448_new_key(void *provctx)
{
if (!ossl_prov_is_running())
return 0;
return ecx_key_new(PROV_LIBRARY_CONTEXT_OF(provctx), ECX_KEY_TYPE_X448, 0,
return ecx_key_new(PROV_LIBCTX_OF(provctx), ECX_KEY_TYPE_X448, 0,
NULL);
}
@ -101,7 +101,7 @@ static void *ed25519_new_key(void *provctx)
{
if (!ossl_prov_is_running())
return 0;
return ecx_key_new(PROV_LIBRARY_CONTEXT_OF(provctx), ECX_KEY_TYPE_ED25519, 0,
return ecx_key_new(PROV_LIBCTX_OF(provctx), ECX_KEY_TYPE_ED25519, 0,
NULL);
}
@ -109,7 +109,7 @@ static void *ed448_new_key(void *provctx)
{
if (!ossl_prov_is_running())
return 0;
return ecx_key_new(PROV_LIBRARY_CONTEXT_OF(provctx), ECX_KEY_TYPE_ED448, 0,
return ecx_key_new(PROV_LIBCTX_OF(provctx), ECX_KEY_TYPE_ED448, 0,
NULL);
}
@ -443,7 +443,7 @@ static const OSSL_PARAM *ed448_settable_params(void *provctx)
static void *ecx_gen_init(void *provctx, int selection, ECX_KEY_TYPE type)
{
OSSL_LIB_CTX *libctx = PROV_LIBRARY_CONTEXT_OF(provctx);
OSSL_LIB_CTX *libctx = PROV_LIBCTX_OF(provctx);
struct ecx_gen_ctx *gctx = NULL;
if (!ossl_prov_is_running())


+ 1
- 1
providers/implementations/keymgmt/kdf_legacy_kmgmt.c View File

@ -42,7 +42,7 @@ KDF_DATA *kdf_data_new(void *provctx)
OPENSSL_free(kdfdata);
return NULL;
}
kdfdata->libctx = PROV_LIBRARY_CONTEXT_OF(provctx);
kdfdata->libctx = PROV_LIBCTX_OF(provctx);
kdfdata->refcnt = 1;
return kdfdata;


+ 3
- 3
providers/implementations/keymgmt/mac_legacy_kmgmt.c View File

@ -118,12 +118,12 @@ int mac_key_up_ref(MAC_KEY *mackey)
static void *mac_new(void *provctx)
{
return mac_key_new(PROV_LIBRARY_CONTEXT_OF(provctx), 0);
return mac_key_new(PROV_LIBCTX_OF(provctx), 0);
}
static void *mac_new_cmac(void *provctx)
{
return mac_key_new(PROV_LIBRARY_CONTEXT_OF(provctx), 1);
return mac_key_new(PROV_LIBCTX_OF(provctx), 1);
}
static void mac_free(void *mackey)
@ -372,7 +372,7 @@ static const OSSL_PARAM *mac_settable_params(void *provctx)
static void *mac_gen_init(void *provctx, int selection)
{
OSSL_LIB_CTX *libctx = PROV_LIBRARY_CONTEXT_OF(provctx);
OSSL_LIB_CTX *libctx = PROV_LIBCTX_OF(provctx);
struct mac_gen_ctx *gctx = NULL;
if (!ossl_prov_is_running())


+ 3
- 3
providers/implementations/keymgmt/rsa_kmgmt.c View File

@ -73,7 +73,7 @@ static int pss_params_fromdata(RSA_PSS_PARAMS_30 *pss_params,
static void *rsa_newdata(void *provctx)
{
OSSL_LIB_CTX *libctx = PROV_LIBRARY_CONTEXT_OF(provctx);
OSSL_LIB_CTX *libctx = PROV_LIBCTX_OF(provctx);
RSA *rsa;
if (!ossl_prov_is_running())
@ -89,7 +89,7 @@ static void *rsa_newdata(void *provctx)
static void *rsapss_newdata(void *provctx)
{
OSSL_LIB_CTX *libctx = PROV_LIBRARY_CONTEXT_OF(provctx);
OSSL_LIB_CTX *libctx = PROV_LIBCTX_OF(provctx);
RSA *rsa;
if (!ossl_prov_is_running())
@ -416,7 +416,7 @@ static int rsa_gencb(int p, int n, BN_GENCB *cb)
static void *gen_init(void *provctx, int selection, int rsa_type)
{
OSSL_LIB_CTX *libctx = PROV_LIBRARY_CONTEXT_OF(provctx);
OSSL_LIB_CTX *libctx = PROV_LIBCTX_OF(provctx);
struct rsa_gen_ctx *gctx = NULL;
if (!ossl_prov_is_running())


+ 1
- 1
providers/implementations/macs/cmac_prov.c View File

@ -173,7 +173,7 @@ static const OSSL_PARAM *cmac_settable_ctx_params(ossl_unused void *provctx)
static int cmac_set_ctx_params(void *vmacctx, const OSSL_PARAM params[])
{
struct cmac_data_st *macctx = vmacctx;
OSSL_LIB_CTX *ctx = PROV_LIBRARY_CONTEXT_OF(macctx->provctx);
OSSL_LIB_CTX *ctx = PROV_LIBCTX_OF(macctx->provctx);
const OSSL_PARAM *p;
if (!ossl_prov_cipher_load_from_params(&macctx->cipher, params, ctx))


+ 1
- 1
providers/implementations/macs/gmac_prov.c View File

@ -184,7 +184,7 @@ static int gmac_set_ctx_params(void *vmacctx, const OSSL_PARAM params[])
{
struct gmac_data_st *macctx = vmacctx;
EVP_CIPHER_CTX *ctx = macctx->ctx;
OSSL_LIB_CTX *provctx = PROV_LIBRARY_CONTEXT_OF(macctx->provctx);
OSSL_LIB_CTX *provctx = PROV_LIBCTX_OF(macctx->provctx);
const OSSL_PARAM *p;
if (ctx == NULL


+ 1
- 1
providers/implementations/macs/hmac_prov.c View File

@ -256,7 +256,7 @@ static const OSSL_PARAM *hmac_settable_ctx_params(ossl_unused void *provctx)
static int hmac_set_ctx_params(void *vmacctx, const OSSL_PARAM params[])
{
struct hmac_data_st *macctx = vmacctx;
OSSL_LIB_CTX *ctx = PROV_LIBRARY_CONTEXT_OF(macctx->provctx);
OSSL_LIB_CTX *ctx = PROV_LIBCTX_OF(macctx->provctx);
const OSSL_PARAM *p;
if (!ossl_prov_digest_load_from_params(&macctx->digest, params, ctx))


+ 1
- 1
providers/implementations/macs/kmac_prov.c View File

@ -178,7 +178,7 @@ static void *kmac_fetch_new(void *provctx, const OSSL_PARAM *params)
if (kctx == NULL)
return 0;
if (!ossl_prov_digest_load_from_params(&kctx->digest, params,
PROV_LIBRARY_CONTEXT_OF(provctx))) {
PROV_LIBCTX_OF(provctx))) {
kmac_free(kctx);
return 0;
}


+ 1
- 1
providers/implementations/rands/crngt.c View File

@ -114,7 +114,7 @@ size_t prov_crngt_get_entropy(PROV_DRBG *drbg,
RAND_POOL *pool;
size_t q, r = 0, s, t = 0;
int attempts = 3, crng_test_pass = 1;
OSSL_LIB_CTX *libctx = PROV_LIBRARY_CONTEXT_OF(drbg->provctx);
OSSL_LIB_CTX *libctx = PROV_LIBCTX_OF(drbg->provctx);
CRNG_TEST_GLOBAL *crngt_glob
= ossl_lib_ctx_get_data(libctx, OSSL_LIB_CTX_RAND_CRNGT_INDEX,
&rand_crng_ossl_ctx_method);


+ 1
- 1
providers/implementations/rands/drbg.c View File

@ -318,7 +318,7 @@ static size_t prov_drbg_get_nonce(PROV_DRBG *drbg,
size_t ret = 0, n;
RAND_POOL *pool;
unsigned char *buf = NULL;
OSSL_LIB_CTX *libctx = PROV_LIBRARY_CONTEXT_OF(drbg->provctx);
OSSL_LIB_CTX *libctx = PROV_LIBCTX_OF(drbg->provctx);
PROV_DRBG_NONCE_GLOBAL *dngbl
= ossl_lib_ctx_get_data(libctx, OSSL_LIB_CTX_DRBG_NONCE_INDEX,
&drbg_nonce_ossl_ctx_method);


+ 1
- 1
providers/implementations/rands/drbg_ctr.c View File

@ -663,7 +663,7 @@ static int drbg_ctr_set_ctx_params(void *vctx, const OSSL_PARAM params[])
{
PROV_DRBG *ctx = (PROV_DRBG *)vctx;
PROV_DRBG_CTR *ctr = (PROV_DRBG_CTR *)ctx->data;
OSSL_LIB_CTX *libctx = PROV_LIBRARY_CONTEXT_OF(ctx->provctx);
OSSL_LIB_CTX *libctx = PROV_LIBCTX_OF(ctx->provctx);
const OSSL_PARAM *p;
char *ecb;
const char *propquery = NULL;


+ 1
- 1
providers/implementations/rands/drbg_hash.c View File

@ -456,7 +456,7 @@ static int drbg_hash_set_ctx_params(void *vctx, const OSSL_PARAM params[])
{
PROV_DRBG *ctx = (PROV_DRBG *)vctx;
PROV_DRBG_HASH *hash = (PROV_DRBG_HASH *)ctx->data;
OSSL_LIB_CTX *libctx = PROV_LIBRARY_CONTEXT_OF(ctx->provctx);
OSSL_LIB_CTX *libctx = PROV_LIBCTX_OF(ctx->provctx);
const EVP_MD *md;
if (!ossl_prov_digest_load_from_params(&hash->digest, params, libctx))


+ 1
- 1
providers/implementations/rands/drbg_hmac.c View File

@ -364,7 +364,7 @@ static int drbg_hmac_set_ctx_params(void *vctx, const OSSL_PARAM params[])
{
PROV_DRBG *ctx = (PROV_DRBG *)vctx;
PROV_DRBG_HMAC *hmac = (PROV_DRBG_HMAC *)ctx->data;
OSSL_LIB_CTX *libctx = PROV_LIBRARY_CONTEXT_OF(ctx->provctx);