From a8f1aabd4b44db668bca638c111598b2e0688cc4 Mon Sep 17 00:00:00 2001 From: "Dr. Matthias St. Pierre" Date: Fri, 12 Jul 2019 12:42:39 +0200 Subject: [PATCH] x509: publish X509_PUBKEY_dup Reviewed-by: Richard Levitte (Merged from https://github.com/openssl/openssl/pull/9353) --- crypto/crmf/crmf_lib.c | 3 --- crypto/x509/x_pubkey.c | 1 + doc/man3/X509_PUBKEY_new.pod | 6 ++++-- include/openssl/x509.h | 1 + util/libcrypto.num | 1 + 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/crypto/crmf/crmf_lib.c b/crypto/crmf/crmf_lib.c index e777a34e67..e519c50677 100644 --- a/crypto/crmf/crmf_lib.c +++ b/crypto/crmf/crmf_lib.c @@ -200,10 +200,7 @@ OSSL_CRMF_CERTID *OSSL_CRMF_CERTID_gen(const X509_NAME *issuer, /* * id-regCtrl-protocolEncrKey Control (section 6.6) * - * For some reason X509_PUBKEY_dup() is not implemented in OpenSSL X509 - * TODO: check whether that should go elsewhere */ -static IMPLEMENT_ASN1_DUP_FUNCTION(X509_PUBKEY) IMPLEMENT_CRMF_CTRL_FUNC(protocolEncrKey, X509_PUBKEY, regCtrl) /*- diff --git a/crypto/x509/x_pubkey.c b/crypto/x509/x_pubkey.c index eb5ea27b2e..d81f53844f 100644 --- a/crypto/x509/x_pubkey.c +++ b/crypto/x509/x_pubkey.c @@ -56,6 +56,7 @@ ASN1_SEQUENCE_cb(X509_PUBKEY, pubkey_cb) = { } ASN1_SEQUENCE_END_cb(X509_PUBKEY, X509_PUBKEY) IMPLEMENT_ASN1_FUNCTIONS(X509_PUBKEY) +IMPLEMENT_ASN1_DUP_FUNCTION(X509_PUBKEY) /* TODO should better be called X509_PUBKEY_set1 */ int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey) diff --git a/doc/man3/X509_PUBKEY_new.pod b/doc/man3/X509_PUBKEY_new.pod index 2d65be6bc4..551031b82b 100644 --- a/doc/man3/X509_PUBKEY_new.pod +++ b/doc/man3/X509_PUBKEY_new.pod @@ -2,8 +2,9 @@ =head1 NAME -X509_PUBKEY_new, X509_PUBKEY_free, X509_PUBKEY_set, X509_PUBKEY_get0, -X509_PUBKEY_get, d2i_PUBKEY, i2d_PUBKEY, d2i_PUBKEY_bio, d2i_PUBKEY_fp, +X509_PUBKEY_new, X509_PUBKEY_free, X509_PUBKEY_dup, +X509_PUBKEY_set, X509_PUBKEY_get0, X509_PUBKEY_get, +d2i_PUBKEY, i2d_PUBKEY, d2i_PUBKEY_bio, d2i_PUBKEY_fp, i2d_PUBKEY_fp, i2d_PUBKEY_bio, X509_PUBKEY_set0_param, X509_PUBKEY_get0_param - SubjectPublicKeyInfo public key functions @@ -13,6 +14,7 @@ X509_PUBKEY_get0_param - SubjectPublicKeyInfo public key functions X509_PUBKEY *X509_PUBKEY_new(void); void X509_PUBKEY_free(X509_PUBKEY *a); + X509_PUBKEY *X509_PUBKEY_dup(const X509_PUBKEY *a); int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey); EVP_PKEY *X509_PUBKEY_get0(X509_PUBKEY *key); diff --git a/include/openssl/x509.h b/include/openssl/x509.h index 66b44f4e06..d2466f2972 100644 --- a/include/openssl/x509.h +++ b/include/openssl/x509.h @@ -470,6 +470,7 @@ DECLARE_ASN1_DUP_FUNCTION(X509_ALGOR) DECLARE_ASN1_DUP_FUNCTION(X509_ATTRIBUTE) DECLARE_ASN1_DUP_FUNCTION(X509_CRL) DECLARE_ASN1_DUP_FUNCTION(X509_EXTENSION) +DECLARE_ASN1_DUP_FUNCTION(X509_PUBKEY) DECLARE_ASN1_DUP_FUNCTION(X509_REQ) DECLARE_ASN1_DUP_FUNCTION(X509_REVOKED) int X509_ALGOR_set0(X509_ALGOR *alg, ASN1_OBJECT *aobj, int ptype, diff --git a/util/libcrypto.num b/util/libcrypto.num index 1992504c91..c062a99f4f 100644 --- a/util/libcrypto.num +++ b/util/libcrypto.num @@ -4689,3 +4689,4 @@ EVP_KEYMGMT_fetch 4794 3_0_0 EXIST::FUNCTION: EVP_KEYMGMT_up_ref 4795 3_0_0 EXIST::FUNCTION: EVP_KEYMGMT_free 4796 3_0_0 EXIST::FUNCTION: EVP_KEYMGMT_provider 4797 3_0_0 EXIST::FUNCTION: +X509_PUBKEY_dup 4798 3_0_0 EXIST::FUNCTION: -- 2.25.1