mirror of
https://github.com/openssl/openssl.git
synced 2024-11-27 05:21:51 +08:00
Use the new ASN.1 libctx aware functions in CMS
Make sure we pass the libctx around when working with CMS structures Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15591)
This commit is contained in:
parent
dea2878fac
commit
5dca2afca3
@ -36,8 +36,11 @@ int CMS_stream(unsigned char ***boundary, CMS_ContentInfo *cms)
|
||||
CMS_ContentInfo *d2i_CMS_bio(BIO *bp, CMS_ContentInfo **cms)
|
||||
{
|
||||
CMS_ContentInfo *ci;
|
||||
const CMS_CTX *ctx = ossl_cms_get0_cmsctx(cms == NULL ? NULL : *cms);
|
||||
|
||||
ci = ASN1_item_d2i_bio(ASN1_ITEM_rptr(CMS_ContentInfo), bp, cms);
|
||||
ci = ASN1_item_d2i_bio_ex(ASN1_ITEM_rptr(CMS_ContentInfo), bp, cms,
|
||||
ossl_cms_ctx_get0_libctx(ctx),
|
||||
ossl_cms_ctx_get0_propq(ctx));
|
||||
if (ci != NULL)
|
||||
ossl_cms_resolve_libctx(ci);
|
||||
return ci;
|
||||
@ -90,13 +93,17 @@ int SMIME_write_CMS(BIO *bio, CMS_ContentInfo *cms, BIO *data, int flags)
|
||||
ossl_cms_ctx_get0_propq(ctx));
|
||||
}
|
||||
|
||||
CMS_ContentInfo *SMIME_read_CMS_ex(BIO *bio, int flags, BIO **bcont, CMS_ContentInfo **cms)
|
||||
CMS_ContentInfo *SMIME_read_CMS_ex(BIO *bio, int flags, BIO **bcont,
|
||||
CMS_ContentInfo **cms)
|
||||
{
|
||||
CMS_ContentInfo *ci;
|
||||
const CMS_CTX *ctx = ossl_cms_get0_cmsctx(cms == NULL ? NULL : *cms);
|
||||
|
||||
ci = (CMS_ContentInfo *)SMIME_read_ASN1_ex(bio, flags, bcont,
|
||||
ASN1_ITEM_rptr(CMS_ContentInfo),
|
||||
(ASN1_VALUE **)cms);
|
||||
(ASN1_VALUE **)cms,
|
||||
ossl_cms_ctx_get0_libctx(ctx),
|
||||
ossl_cms_ctx_get0_propq(ctx));
|
||||
if (ci != NULL)
|
||||
ossl_cms_resolve_libctx(ci);
|
||||
return ci;
|
||||
|
@ -28,9 +28,12 @@ CMS_ContentInfo *d2i_CMS_ContentInfo(CMS_ContentInfo **a,
|
||||
const unsigned char **in, long len)
|
||||
{
|
||||
CMS_ContentInfo *ci;
|
||||
const CMS_CTX *ctx = ossl_cms_get0_cmsctx(a == NULL ? NULL : *a);
|
||||
|
||||
ci = (CMS_ContentInfo *)ASN1_item_d2i((ASN1_VALUE **)a, in, len,
|
||||
(CMS_ContentInfo_it()));
|
||||
ci = (CMS_ContentInfo *)ASN1_item_d2i_ex((ASN1_VALUE **)a, in, len,
|
||||
(CMS_ContentInfo_it()),
|
||||
ossl_cms_ctx_get0_libctx(ctx),
|
||||
ossl_cms_ctx_get0_propq(ctx));
|
||||
if (ci != NULL)
|
||||
ossl_cms_resolve_libctx(ci);
|
||||
return ci;
|
||||
@ -45,7 +48,8 @@ CMS_ContentInfo *CMS_ContentInfo_new_ex(OSSL_LIB_CTX *libctx, const char *propq)
|
||||
{
|
||||
CMS_ContentInfo *ci;
|
||||
|
||||
ci = (CMS_ContentInfo *)ASN1_item_new(ASN1_ITEM_rptr(CMS_ContentInfo));
|
||||
ci = (CMS_ContentInfo *)ASN1_item_new_ex(ASN1_ITEM_rptr(CMS_ContentInfo),
|
||||
libctx, propq);
|
||||
if (ci != NULL) {
|
||||
ci->ctx.libctx = libctx;
|
||||
ci->ctx.propq = NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user