Add new X509 accessors
authorDr. Stephen Henson <steve@openssl.org>
Tue, 22 Sep 2015 22:40:43 +0000 (23:40 +0100)
committerDr. Stephen Henson <steve@openssl.org>
Sat, 14 Nov 2015 00:13:08 +0000 (00:13 +0000)
Reviewed-by: Tim Hudson <tjh@openssl.org>
crypto/x509/x509_set.c
crypto/x509/x_x509a.c
include/openssl/x509.h

index 38ec0dbc54171b217866f88408c5c065a1fd7291..dbd9057f2ac5f42f03386d37b802e4165c3e4c7e 100644 (file)
@@ -176,3 +176,21 @@ X509_PUBKEY *X509_get_X509_PUBKEY(const X509 *x)
 {
     return x->cert_info.key;
 }
+
+STACK_OF(X509_EXTENSION) *X509_get0_extensions(const X509 *x)
+{
+    return x->cert_info.extensions;
+}
+
+void X509_get0_uids(ASN1_BIT_STRING **piuid, ASN1_BIT_STRING **psuid, X509 *x)
+{
+    if (piuid != NULL)
+        *piuid = x->cert_info.issuerUID;
+    if (psuid != NULL)
+        *psuid = x->cert_info.subjectUID;
+}
+
+X509_ALGOR *X509_get0_tbs_sigalg(X509 *x)
+{
+    return &x->cert_info.signature;
+}
index 76608b669fc7f1307347f60801f8f94ec09a1e56..f79e5e773e1b008041248b05cde6dddce29449e6 100644 (file)
@@ -83,6 +83,11 @@ ASN1_SEQUENCE(X509_CERT_AUX) = {
 
 IMPLEMENT_ASN1_FUNCTIONS(X509_CERT_AUX)
 
+int X509_trusted(const X509 *x)
+{
+    return x->aux ? 1 : 0;
+}
+
 static X509_CERT_AUX *aux_get(X509 *x)
 {
     if (x == NULL)
@@ -198,3 +203,17 @@ void X509_reject_clear(X509 *x)
         x->aux->reject = NULL;
     }
 }
+
+STACK_OF(ASN1_OBJECT) *X509_get0_trust_objects(X509 *x)
+{
+    if (x->aux != NULL)
+        return x->aux->trust;
+    return NULL;
+}
+
+STACK_OF(ASN1_OBJECT) *X509_get0_reject_objects(X509 *x)
+{
+    if (x->aux != NULL)
+        return x->aux->reject;
+    return NULL;
+}
index 32bec25d690a82296923cd5cbabdaacc56d23fb6..d9ad95f6d00dac364edb68e439c9235120832be0 100644 (file)
@@ -627,6 +627,7 @@ int i2d_re_X509_tbs(X509 *x, unsigned char **pp);
 void X509_get0_signature(ASN1_BIT_STRING **psig, X509_ALGOR **palg, X509 *x);
 int X509_get_signature_nid(const X509 *x);
 
+int X509_trusted(const X509 *x);
 int X509_alias_set1(X509 *x, unsigned char *name, int len);
 int X509_keyid_set1(X509 *x, unsigned char *id, int len);
 unsigned char *X509_alias_get0(X509 *x, int *len);
@@ -639,6 +640,9 @@ int X509_add1_reject_object(X509 *x, ASN1_OBJECT *obj);
 void X509_trust_clear(X509 *x);
 void X509_reject_clear(X509 *x);
 
+STACK_OF(ASN1_OBJECT) *X509_get0_trust_objects(X509 *x);
+STACK_OF(ASN1_OBJECT) *X509_get0_reject_objects(X509 *x);
+
 DECLARE_ASN1_FUNCTIONS(X509_REVOKED)
 DECLARE_ASN1_FUNCTIONS(X509_CRL_INFO)
 DECLARE_ASN1_FUNCTIONS(X509_CRL)
@@ -702,6 +706,9 @@ int X509_get_signature_type(const X509 *x);
  * i2d_X509_NAME(X509_get_X509_PUBKEY(x),&buf)
  */
 X509_PUBKEY *X509_get_X509_PUBKEY(const X509 *x);
+STACK_OF(X509_EXTENSION) *X509_get0_extensions(const X509 *x);
+void X509_get0_uids(ASN1_BIT_STRING **piuid, ASN1_BIT_STRING **psuid, X509 *x);
+X509_ALGOR *X509_get0_tbs_sigalg(X509 *x);
 
 EVP_PKEY *X509_get_pubkey(X509 *x);
 ASN1_BIT_STRING *X509_get0_pubkey_bitstr(const X509 *x);