]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Provide the ability to create an X509_PUBKEY with a libctx/propq
authorMatt Caswell <matt@openssl.org>
Fri, 21 May 2021 14:50:09 +0000 (15:50 +0100)
committerPauli <pauli@openssl.org>
Sat, 5 Jun 2021 07:39:10 +0000 (17:39 +1000)
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15591)

crypto/x509/x_pubkey.c
include/openssl/x509.h.in
util/libcrypto.num

index c21184d96496b4bade413ff6e117b54aac9815e3..502caaa9a8944db923ac8f537aba26a8d1fc30ad 100644 (file)
@@ -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.
index d5d3cdb719d0ee1ab7140a035408a7b11859e13a..38c7b42c22734125319901e80788f90193a0f7e7 100644 (file)
@@ -550,6 +550,7 @@ DECLARE_ASN1_FUNCTIONS(X509_VAL)
 
 DECLARE_ASN1_FUNCTIONS(X509_PUBKEY)
 
+X509_PUBKEY *X509_PUBKEY_new_ex(OSSL_LIB_CTX *libctx, const char *propq);
 int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey);
 EVP_PKEY *X509_PUBKEY_get0(const X509_PUBKEY *key);
 EVP_PKEY *X509_PUBKEY_get(const X509_PUBKEY *key);
index 6f763f10631e4648c9cea7ac53000080a5e3fcac..42211e4caa9c9a5ec14b5fc5fa00271729a7eea1 100644 (file)
@@ -5407,3 +5407,4 @@ b2i_PVK_bio_ex                          ? 3_0_0   EXIST::FUNCTION:
 i2b_PVK_bio_ex                          ?      3_0_0   EXIST::FUNCTION:
 NCONF_get0_libctx                       ?      3_0_0   EXIST::FUNCTION:
 NCONF_get_section_names                 ?      3_0_0   EXIST::FUNCTION:
+X509_PUBKEY_new_ex                      ?      3_0_0   EXIST::FUNCTION: