[rs-commit] r69 - /redwax-tool/trunk/redwax_openssl.c

rs-commit at redwax.eu rs-commit at redwax.eu
Wed Nov 24 17:48:46 CET 2021


Author: minfrin at redwax.eu
Date: Wed Nov 24 17:48:45 2021
New Revision: 69

Log:
Copy everything about a certificate and key on search.

Modified:
    redwax-tool/trunk/redwax_openssl.c

Modified: redwax-tool/trunk/redwax_openssl.c
==============================================================================
--- redwax-tool/trunk/redwax_openssl.c	(original)
+++ redwax-tool/trunk/redwax_openssl.c	Wed Nov 24 17:48:45 2021
@@ -1207,9 +1207,7 @@
             redwax_certificate_t *ncert;
             redwax_certificate_t tcert = { 0 };
 
-            tcert.header = cert->header;
-            tcert.der = cert->der;
-            tcert.len = cert->len;
+            memcpy(&tcert, cert, sizeof(tcert));
 
             if (r->current && r->certs_out->nelts) {
 
@@ -1261,9 +1259,7 @@
 
             redwax_certificate_t *ncert = apr_array_push(r->intermediates_out);
 
-            ncert->header = cert->header;
-            ncert->der = cert->der;
-            ncert->len = cert->len;
+            memcpy(ncert, cert, sizeof(redwax_certificate_t));
 
             rt_run_search_chain(r, cert, NULL);
             rt_run_search_key(r, cert);
@@ -1280,9 +1276,7 @@
 
             redwax_certificate_t *ncert = apr_array_push(r->trusted_out);
 
-            ncert->header = cert->header;
-            ncert->der = cert->der;
-            ncert->len = cert->len;
+            memcpy(ncert, cert, sizeof(redwax_certificate_t));
 
             rt_run_search_chain(r, cert, NULL);
             rt_run_search_key(r, cert);
@@ -2396,9 +2390,7 @@
 
                 ncert = apr_array_push(r->trusted_out);
 
-                ncert->header = chain->header;
-                ncert->der = chain->der;
-                ncert->len = chain->len;
+                memcpy(ncert, chain, sizeof(redwax_certificate_t));
 
                 if (X509_NAME_cmp(X509_get_issuer_name(x),
                         X509_get_subject_name(x))) {
@@ -2421,9 +2413,7 @@
 
                 ncert = apr_array_push(r->intermediates_out);
 
-                ncert->header = chain->header;
-                ncert->der = chain->der;
-                ncert->len = chain->len;
+                memcpy(ncert, chain, sizeof(redwax_certificate_t));
 
                 if (X509_NAME_cmp(X509_get_issuer_name(x),
                         X509_get_subject_name(x))) {
@@ -2457,9 +2447,7 @@
 
         redwax_key_t *nkey = apr_array_push(r->keys_out);
 
-        nkey->header = key->header;
-        nkey->der = key->der;
-        nkey->len = key->len;
+        memcpy(nkey, key, sizeof(redwax_key_t));
 
     }
     else {



More information about the rs-commit mailing list