Provide X509_get0_pubkey().
authorjsing <jsing@openbsd.org>
Thu, 22 Feb 2018 17:05:35 +0000 (17:05 +0000)
committerjsing <jsing@openbsd.org>
Thu, 22 Feb 2018 17:05:35 +0000 (17:05 +0000)
lib/libcrypto/Symbols.list
lib/libcrypto/x509/x509.h
lib/libcrypto/x509/x509_cmp.c

index bd821d7..15cc471 100644 (file)
@@ -2955,6 +2955,7 @@ X509_free
 X509_get0_extensions
 X509_get0_notAfter
 X509_get0_notBefore
+X509_get0_pubkey
 X509_get0_pubkey_bitstr
 X509_get0_signature
 X509_get1_email
index 906cada..1dafabe 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: x509.h,v 1.37 2018/02/22 17:01:44 jsing Exp $ */
+/* $OpenBSD: x509.h,v 1.38 2018/02/22 17:05:35 jsing Exp $ */
 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
  * All rights reserved.
  *
@@ -994,7 +994,8 @@ const ASN1_TIME *X509_get0_notAfter(const X509 *x);
 ASN1_TIME *X509_getm_notAfter(const X509 *x);
 int            X509_set_pubkey(X509 *x, EVP_PKEY *pkey);
 EVP_PKEY *     X509_get_pubkey(X509 *x);
-ASN1_BIT_STRING * X509_get0_pubkey_bitstr(const X509 *x);
+EVP_PKEY *     X509_get0_pubkey(X509 *x);
+ASN1_BIT_STRING *X509_get0_pubkey_bitstr(const X509 *x);
 int            X509_certificate_type(X509 *x,EVP_PKEY *pubkey /* optional */);
 
 int            X509_REQ_set_version(X509_REQ *x,long version);
index 72fbef1..4404675 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: x509_cmp.c,v 1.27 2017/01/29 17:49:23 beck Exp $ */
+/* $OpenBSD: x509_cmp.c,v 1.28 2018/02/22 17:05:35 jsing Exp $ */
 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
  * All rights reserved.
  *
@@ -321,11 +321,17 @@ X509_find_by_subject(STACK_OF(X509) *sk, X509_NAME *name)
 EVP_PKEY *
 X509_get_pubkey(X509 *x)
 {
-       if ((x == NULL) || (x->cert_info == NULL))
+       if (x == NULL || x->cert_info == NULL)
                return (NULL);
        return (X509_PUBKEY_get(x->cert_info->key));
 }
 
+EVP_PKEY *
+X509_get0_pubkey(X509 *x)
+{
+       return X509_get_pubkey(x);
+}
+
 ASN1_BIT_STRING *
 X509_get0_pubkey_bitstr(const X509 *x)
 {