summaryrefslogtreecommitdiffstats
path: root/crypto/x509/x_pubkey.c
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2021-05-21 15:50:09 +0100
committerPauli <pauli@openssl.org>2021-06-05 17:39:10 +1000
commitd6ded941c94803adf090f17093c8ff905f259ca8 (patch)
tree4473beee1adb9b5624093e6b05b98e171cb1e3df /crypto/x509/x_pubkey.c
parentf43f9d6313e31e90bb33a7f6f2fc0c657ef8495a (diff)
Provide the ability to create an X509_PUBKEY with a libctx/propq
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_pubkey.c')
-rw-r--r--crypto/x509/x_pubkey.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/crypto/x509/x_pubkey.c b/crypto/x509/x_pubkey.c
index c21184d964..502caaa9a8 100644
--- a/crypto/x509/x_pubkey.c
+++ b/crypto/x509/x_pubkey.c
@@ -201,6 +201,18 @@ static const ASN1_EXTERN_FUNCS x509_pubkey_ff = {
IMPLEMENT_EXTERN_ASN1(X509_PUBKEY, V_ASN1_SEQUENCE, x509_pubkey_ff)
IMPLEMENT_ASN1_FUNCTIONS(X509_PUBKEY)
+X509_PUBKEY *X509_PUBKEY_new_ex(OSSL_LIB_CTX *libctx, const char *propq)
+{
+ X509_PUBKEY *pubkey = NULL;
+
+ pubkey = (X509_PUBKEY *)ASN1_item_new((X509_PUBKEY_it()));
+ if (!x509_pubkey_set0_libctx(pubkey, libctx, propq)) {
+ X509_PUBKEY_free(pubkey);
+ pubkey = NULL;
+ }
+ return pubkey;
+}
+
/*
* X509_PUBKEY_dup() must be implemented manually, because there is no
* support for it in ASN1_EXTERN_FUNCS.