diff options
Diffstat (limited to 'crypto/cms/cms_env.c')
-rw-r--r-- | crypto/cms/cms_env.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/crypto/cms/cms_env.c b/crypto/cms/cms_env.c index 15ebe1b86b..d2f630146e 100644 --- a/crypto/cms/cms_env.c +++ b/crypto/cms/cms_env.c @@ -181,7 +181,8 @@ void cms_RecipientInfos_set_cmsctx(CMS_ContentInfo *cms) break; case CMS_RECIPINFO_TRANS: ri->d.ktri->cms_ctx = ctx; - x509_set0_libctx(ri->d.ktri->recip, ctx->libctx, ctx->propq); + x509_set0_libctx(ri->d.ktri->recip, cms_ctx_get0_libctx(ctx), + cms_ctx_get0_propq(ctx)); break; case CMS_RECIPINFO_KEK: ri->d.kekri->cms_ctx = ctx; @@ -310,8 +311,9 @@ static int cms_RecipientInfo_ktri_init(CMS_RecipientInfo *ri, X509 *recip, ktri->recip = recip; if (flags & CMS_KEY_PARAM) { - ktri->pctx = EVP_PKEY_CTX_new_from_pkey(ctx->libctx, ktri->pkey, - ctx->propq); + ktri->pctx = EVP_PKEY_CTX_new_from_pkey(cms_ctx_get0_libctx(ctx), + ktri->pkey, + cms_ctx_get0_propq(ctx)); if (ktri->pctx == NULL) return 0; if (EVP_PKEY_encrypt_init(ktri->pctx) <= 0) @@ -470,7 +472,8 @@ static int cms_RecipientInfo_ktri_encrypt(const CMS_ContentInfo *cms, if (!cms_env_asn1_ctrl(ri, 0)) goto err; } else { - pctx = EVP_PKEY_CTX_new_from_pkey(ctx->libctx, ktri->pkey, ctx->propq); + pctx = EVP_PKEY_CTX_new_from_pkey(cms_ctx_get0_libctx(ctx), ktri->pkey, + cms_ctx_get0_propq(ctx)); if (pctx == NULL) return 0; @@ -524,6 +527,8 @@ static int cms_RecipientInfo_ktri_decrypt(CMS_ContentInfo *cms, EVP_CIPHER *fetched_cipher = NULL; CMS_EncryptedContentInfo *ec; const CMS_CTX *ctx = cms_get0_cmsctx(cms); + OSSL_LIB_CTX *libctx = cms_ctx_get0_libctx(ctx); + const char *propq = cms_ctx_get0_propq(ctx); ec = cms_get0_env_enc_content(cms); @@ -538,7 +543,7 @@ static int cms_RecipientInfo_ktri_decrypt(CMS_ContentInfo *cms, const char *name = OBJ_nid2sn(OBJ_obj2nid(calg->algorithm)); (void)ERR_set_mark(); - fetched_cipher = EVP_CIPHER_fetch(ctx->libctx, name, ctx->propq); + fetched_cipher = EVP_CIPHER_fetch(libctx, name, propq); if (fetched_cipher != NULL) cipher = fetched_cipher; @@ -555,7 +560,7 @@ static int cms_RecipientInfo_ktri_decrypt(CMS_ContentInfo *cms, EVP_CIPHER_free(fetched_cipher); } - ktri->pctx = EVP_PKEY_CTX_new_from_pkey(ctx->libctx, pkey, ctx->propq); + ktri->pctx = EVP_PKEY_CTX_new_from_pkey(libctx, pkey, propq); if (ktri->pctx == NULL) goto err; @@ -808,7 +813,8 @@ static EVP_CIPHER *cms_get_key_wrap_cipher(size_t keylen, const CMS_CTX *ctx) default: return NULL; } - return EVP_CIPHER_fetch(ctx->libctx, alg, ctx->propq); + return EVP_CIPHER_fetch(cms_ctx_get0_libctx(ctx), alg, + cms_ctx_get0_propq(ctx)); } |