Provide X509_get0_extensions() and X509_get0_signature()
authorjsing <jsing@openbsd.org>
Sat, 17 Feb 2018 15:50:42 +0000 (15:50 +0000)
committerjsing <jsing@openbsd.org>
Sat, 17 Feb 2018 15:50:42 +0000 (15:50 +0000)
lib/libcrypto/Symbols.list
lib/libcrypto/asn1/x_x509.c
lib/libcrypto/x509/x509.h
lib/libcrypto/x509/x509_set.c

index d633575..85c65a8 100644 (file)
@@ -1352,13 +1352,13 @@ EVP_PKEY_encrypt_init
 EVP_PKEY_encrypt_old
 EVP_PKEY_free
 EVP_PKEY_get0
-EVP_PKEY_get0_asn1
 EVP_PKEY_get0_DH
-EVP_PKEY_get1_DH
 EVP_PKEY_get0_DSA
+EVP_PKEY_get0_RSA
+EVP_PKEY_get0_asn1
+EVP_PKEY_get1_DH
 EVP_PKEY_get1_DSA
 EVP_PKEY_get1_EC_KEY
-EVP_PKEY_get0_RSA
 EVP_PKEY_get1_RSA
 EVP_PKEY_get_attr
 EVP_PKEY_get_attr_by_NID
@@ -2885,9 +2885,11 @@ X509_email_free
 X509_find_by_issuer_and_serial
 X509_find_by_subject
 X509_free
+X509_get0_extensions
 X509_get0_notAfter
 X509_get0_notBefore
 X509_get0_pubkey_bitstr
+X509_get0_signature
 X509_get1_email
 X509_get1_ocsp
 X509_get_default_cert_area
index c82301a..6a56a79 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: x_x509.c,v 1.25 2018/02/14 16:18:10 jsing Exp $ */
+/* $OpenBSD: x_x509.c,v 1.26 2018/02/17 15:50:42 jsing Exp $ */
 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
  * All rights reserved.
  *
@@ -345,6 +345,16 @@ i2d_X509_AUX(X509 *a, unsigned char **pp)
        return length;
 }
 
+void
+X509_get0_signature(const ASN1_BIT_STRING **psig, const X509_ALGOR **palg,
+    const X509 *x)
+{
+       if (psig != NULL)
+               *psig = x->signature;
+       if (palg != NULL)
+               *palg = x->sig_alg;
+}
+
 int
 X509_get_signature_nid(const X509 *x)
 {
index 0cb9e28..6d64511 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: x509.h,v 1.28 2018/02/14 16:57:25 jsing Exp $ */
+/* $OpenBSD: x509.h,v 1.29 2018/02/17 15:50:42 jsing Exp $ */
 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
  * All rights reserved.
  *
@@ -887,7 +887,8 @@ int X509_set_ex_data(X509 *r, int idx, void *arg);
 void *X509_get_ex_data(X509 *r, int idx);
 int            i2d_X509_AUX(X509 *a,unsigned char **pp);
 X509 *         d2i_X509_AUX(X509 **a,const unsigned char **pp,long length);
-
+void X509_get0_signature(const ASN1_BIT_STRING **psig,
+    const X509_ALGOR **palg, const X509 *x);
 int X509_get_signature_nid(const X509 *x);
 
 int X509_alias_set1(X509 *x, unsigned char *name, int len);
@@ -960,6 +961,7 @@ int ASN1_item_sign_ctx(const ASN1_ITEM *it,
                ASN1_BIT_STRING *signature, void *asn, EVP_MD_CTX *ctx);
 #endif
 
+const STACK_OF(X509_EXTENSION) *X509_get0_extensions(const X509 *x);
 int            X509_set_version(X509 *x,long version);
 int            X509_set_serialNumber(X509 *x, ASN1_INTEGER *serial);
 ASN1_INTEGER * X509_get_serialNumber(X509 *x);
index e60d6f9..a43f009 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: x509_set.c,v 1.13 2018/02/14 16:57:25 jsing Exp $ */
+/* $OpenBSD: x509_set.c,v 1.14 2018/02/17 15:50:42 jsing Exp $ */
 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
  * All rights reserved.
  *
 #include <openssl/objects.h>
 #include <openssl/x509.h>
 
+const STACK_OF(X509_EXTENSION) *
+X509_get0_extensions(const X509 *x)
+{
+       return x->cert_info->extensions;
+}
+
 int
 X509_set_version(X509 *x, long version)
 {