[rs-commit] r104 - in /redwax-tool/trunk: redwax_openssl.c redwax_util.c

rs-commit at redwax.eu rs-commit at redwax.eu
Thu Dec 2 11:34:31 CET 2021


Author: minfrin at redwax.eu
Date: Thu Dec  2 11:34:18 2021
New Revision: 104

Log:
Add subject ket identifier.

Modified:
    redwax-tool/trunk/redwax_openssl.c
    redwax-tool/trunk/redwax_util.c

Modified: redwax-tool/trunk/redwax_openssl.c
==============================================================================
--- redwax-tool/trunk/redwax_openssl.c	(original)
+++ redwax-tool/trunk/redwax_openssl.c	Thu Dec  2 11:34:18 2021
@@ -594,14 +594,18 @@
 #if !HAVE_X509_GET0_TBS_SIGALG
 const X509_ALGOR *X509_get0_tbs_sigalg(const X509 *x)
 {
-    return &x->cert_info.signature;
+    X509_CINF *ci = x->cert_info;
+
+    return ci->signature;
 }
 #endif
 
 #if !HAVE_X509_GET0_EXTENSIONS
 const STACK_OF(X509_EXTENSION) *X509_get0_extensions(const X509 *x)
 {
-    return x->cert_info.extensions;
+    X509_CINF *ci = x->cert_info;
+
+    return ci->extensions;
 }
 #endif
 
@@ -609,10 +613,12 @@
 void X509_get0_uids(const X509 *x, const ASN1_BIT_STRING **piuid,
                     const ASN1_BIT_STRING **psuid)
 {
+    X509_CINF *ci = x->cert_info;
+
     if (piuid != NULL)
-        *piuid = x->cert_info.issuerUID;
+        *piuid = ci->issuerUID;
     if (psuid != NULL)
-        *psuid = x->cert_info.subjectUID;
+        *psuid = ci->subjectUID;
 }
 #endif
 
@@ -3052,6 +3058,17 @@
 
         break;
     }
+    case NID_subject_key_identifier: {
+
+        ASN1_OCTET_STRING *oct = X509V3_EXT_d2i(ex);
+
+        redwax_metadata_add_string(m, "ID",
+                redwax_pencode_base16_binary(m->pool,
+                        oct->data, oct->length,
+                        REDWAX_ENCODE_LOWER | REDWAX_ENCODE_COLON, NULL));
+
+        break;
+    }
     default:
 
         /*
@@ -3199,7 +3216,7 @@
             }
 
             /* signature algorithm */
-            tsig_alg = X509_get0_tbs_sigalg(x);
+            tsig_alg = (X509_ALGOR *)X509_get0_tbs_sigalg(x);
             if (tsig_alg) {
 
                 redwax_openssl_signature_metadata(r, m, tsig_alg, NULL);

Modified: redwax-tool/trunk/redwax_util.c
==============================================================================
--- redwax-tool/trunk/redwax_util.c	(original)
+++ redwax-tool/trunk/redwax_util.c	Thu Dec  2 11:34:18 2021
@@ -1822,7 +1822,7 @@
 
     redwax_metadata_prefix(m, -1);
 
-    return APR_SUCCESS;
+    return status;
 }
 
 apr_status_t redwax_metadata_add_long(redwax_metadata_t *m, const char *key, long val)



More information about the rs-commit mailing list