summaryrefslogtreecommitdiffstats
path: root/crypto/cmp
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2021-05-27 10:56:02 +0100
committerPauli <pauli@openssl.org>2021-06-05 17:39:27 +1000
commit7be04a3ac40fb6cf83be2c619dc30625988c6742 (patch)
tree1fa067011552138e104b42eb78dcdc3894572f00 /crypto/cmp
parent6282d6c28456543734defc45f653adeec1362958 (diff)
Give ASN.1 objects the ability to report their libctx/propq
Some ASN.1 objects have an embedded libctx/propq. If they have one we give the ASN.1 code the ability to find these values and use them where needed. This is used for OSSL_CMP_MSG_dup() and X509_dup(). 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/cmp')
-rw-r--r--crypto/cmp/cmp_asn.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/crypto/cmp/cmp_asn.c b/crypto/cmp/cmp_asn.c
index 1d17f77bd6..31b67178d8 100644
--- a/crypto/cmp/cmp_asn.c
+++ b/crypto/cmp/cmp_asn.c
@@ -211,21 +211,35 @@ int ossl_cmp_asn1_get_int(const ASN1_INTEGER *a)
static int ossl_cmp_msg_cb(int operation, ASN1_VALUE **pval,
const ASN1_ITEM *it, void *exarg)
{
- OSSL_CMP_MSG *ret = (OSSL_CMP_MSG *)*pval;
+ OSSL_CMP_MSG *msg = (OSSL_CMP_MSG *)*pval;
switch (operation) {
case ASN1_OP_FREE_POST:
- OPENSSL_free(ret->propq);
+ OPENSSL_free(msg->propq);
break;
case ASN1_OP_DUP_POST:
{
OSSL_CMP_MSG *old = exarg;
- if (!ossl_cmp_msg_set0_libctx(ret, old->libctx, old->propq))
+ if (!ossl_cmp_msg_set0_libctx(msg, old->libctx, old->propq))
return 0;
}
break;
+ case ASN1_OP_GET0_LIBCTX:
+ {
+ OSSL_LIB_CTX **libctx = exarg;
+
+ *libctx = msg->libctx;
+ }
+ break;
+ case ASN1_OP_GET0_PROPQ:
+ {
+ const char **propq = exarg;
+
+ *propq = msg->propq;
+ }
+ break;
default:
break;
}