summaryrefslogtreecommitdiffstats
path: root/crypto/asn1/asn_pack.c
diff options
context:
space:
mode:
authorslontis <shane.lontis@oracle.com>2022-12-21 14:39:07 +1000
committerTomas Mraz <tomas@openssl.org>2023-01-16 17:17:31 +0100
commitfe2a7341b50450dc6acd6f8a17d4420511a5aefe (patch)
treeb7ebedf8881759406bff879c5826cb182eccc5e7 /crypto/asn1/asn_pack.c
parent76aa4f3ac0d76e58f2111cbf87ae7f25c8766190 (diff)
PKCS12 - Add additional libctx and propq support.
Fixes #19718 Fixes #19716 Added PKCS12_SAFEBAG_get1_cert_ex(), PKCS12_SAFEBAG_get1_crl_ex() and ASN1_item_unpack_ex(). parse_bag and parse_bags now use the libctx/propq stored in the P7_CTX. PKCS12_free() needed to be manually constructed in order to free the propq. pkcs12_api_test.c changed so that it actually tests the libctx, propq. Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19942)
Diffstat (limited to 'crypto/asn1/asn_pack.c')
-rw-r--r--crypto/asn1/asn_pack.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/crypto/asn1/asn_pack.c b/crypto/asn1/asn_pack.c
index 0744e7b434..0d1f3406db 100644
--- a/crypto/asn1/asn_pack.c
+++ b/crypto/asn1/asn_pack.c
@@ -59,3 +59,16 @@ void *ASN1_item_unpack(const ASN1_STRING *oct, const ASN1_ITEM *it)
ERR_raise(ERR_LIB_ASN1, ASN1_R_DECODE_ERROR);
return ret;
}
+
+void *ASN1_item_unpack_ex(const ASN1_STRING *oct, const ASN1_ITEM *it,
+ OSSL_LIB_CTX *libctx, const char *propq)
+{
+ const unsigned char *p;
+ void *ret;
+
+ p = oct->data;
+ if ((ret = ASN1_item_d2i_ex(NULL, &p, oct->length, it,\
+ libctx, propq)) == NULL)
+ ERR_raise(ERR_LIB_ASN1, ASN1_R_DECODE_ERROR);
+ return ret;
+}