summaryrefslogtreecommitdiffstats
path: root/crypto/x509/x_all.c
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2021-05-25 17:16:18 +0100
committerPauli <pauli@openssl.org>2021-06-05 17:39:10 +1000
commitdea2878fac8bde549fa0dd3b8e895703b174391b (patch)
tree8e0b77927b65d77397e6294086b2aabe5b851e7f /crypto/x509/x_all.c
parentc8a9af97c928118ae4626d793d0b73552648b7ea (diff)
Teach more of the ASN.1 code about libctx/propq
Make sure we pass libctx/propq down to all the layers so that objects that are created during parsing have the right values. Then use this new capability for PKCS7. Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15591)
Diffstat (limited to 'crypto/x509/x_all.c')
-rw-r--r--crypto/x509/x_all.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/crypto/x509/x_all.c b/crypto/x509/x_all.c
index ba400d1103..92b659d009 100644
--- a/crypto/x509/x_all.c
+++ b/crypto/x509/x_all.c
@@ -182,8 +182,15 @@ int i2d_X509_CRL_bio(BIO *bp, const X509_CRL *crl)
PKCS7 *d2i_PKCS7_fp(FILE *fp, PKCS7 **p7)
{
PKCS7 *ret;
+ OSSL_LIB_CTX *libctx = NULL;
+ const char *propq = NULL;
- ret = ASN1_item_d2i_fp(ASN1_ITEM_rptr(PKCS7), fp, p7);
+ if (p7 != NULL && *p7 != NULL) {
+ libctx = (*p7)->ctx.libctx;
+ propq = (*p7)->ctx.propq;
+ }
+
+ ret = ASN1_item_d2i_fp_ex(ASN1_ITEM_rptr(PKCS7), fp, p7, libctx, propq);
if (ret != NULL)
ossl_pkcs7_resolve_libctx(ret);
return ret;
@@ -198,8 +205,16 @@ int i2d_PKCS7_fp(FILE *fp, const PKCS7 *p7)
PKCS7 *d2i_PKCS7_bio(BIO *bp, PKCS7 **p7)
{
PKCS7 *ret;
+ OSSL_LIB_CTX *libctx = NULL;
+ const char *propq = NULL;
+
+ if (p7 != NULL && *p7 != NULL) {
+ libctx = (*p7)->ctx.libctx;
+ propq = (*p7)->ctx.propq;
+ }
+
- ret = ASN1_item_d2i_bio(ASN1_ITEM_rptr(PKCS7), bp, p7);
+ ret = ASN1_item_d2i_bio_ex(ASN1_ITEM_rptr(PKCS7), bp, p7, libctx, propq);
if (ret != NULL)
ossl_pkcs7_resolve_libctx(ret);
return ret;