[rt-commit] r146 - /redwax-tool/trunk/redwax_openssl.c

rt-commit at redwax.eu rt-commit at redwax.eu
Tue Aug 22 14:35:28 CEST 2023


Author: minfrin at redwax.eu
Date: Tue Aug 22 14:35:27 2023
New Revision: 146

Log:
Only output parameters if param_out is set.

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	Tue Aug 22 14:35:27 2023
@@ -2241,10 +2241,16 @@
             redwax_print_error(r, "pem-out: private key\n");
 #endif
 
-            if ((r->text && !EVP_PKEY_print_private(bio, pkey, 0, NULL)) ||
-                (r->param_out && !PEM_write_bio_Parameters(bio, pkey)) ||
-                    !PEM_write_bio_PKCS8_PRIV_KEY_INFO(bio, p8inf)) {
-
+            if ((r->text && !EVP_PKEY_print_private(bio, pkey, 0, NULL))) {
+                redwax_openssl_print_errors(r);
+                return APR_ENOENT;
+            }
+
+            if (r->param_out) {
+            	PEM_write_bio_Parameters(bio, pkey);
+            }
+
+            if (!PEM_write_bio_PKCS8_PRIV_KEY_INFO(bio, p8inf)) {
                 redwax_openssl_print_errors(r);
                 return APR_ENOENT;
             }
@@ -2288,10 +2294,16 @@
     redwax_print_error(r, "pem-out: private key\n");
 #endif
 
-    if ((r->text && !EVP_PKEY_print_private(bio, pkey, 0, NULL)) ||
-        (r->param_out && !PEM_write_bio_Parameters(bio, pkey)) ||
-            !PEM_write_bio_PKCS8_PRIV_KEY_INFO(bio, p8inf)) {
-
+    if ((r->text && !EVP_PKEY_print_private(bio, pkey, 0, NULL))) {
+        redwax_openssl_print_errors(r);
+        return APR_ENOENT;
+    }
+
+    if (r->param_out) {
+    	PEM_write_bio_Parameters(bio, pkey);
+    }
+
+    if (!PEM_write_bio_PKCS8_PRIV_KEY_INFO(bio, p8inf)) {
         redwax_openssl_print_errors(r);
         return APR_ENOENT;
     }



More information about the rt-commit mailing list