[openssl-commits] [openssl] OpenSSL_1_1_0-stable update

Richard Levitte levitte at openssl.org
Mon Apr 23 08:52:51 UTC 2018


The branch OpenSSL_1_1_0-stable has been updated
       via  7afe18bd003ff7477168626d99efb5a297f2df39 (commit)
      from  bf21fe935a979c08292d06553ef8c9a49382208c (commit)


- Log -----------------------------------------------------------------
commit 7afe18bd003ff7477168626d99efb5a297f2df39
Author: Richard Levitte <levitte at openssl.org>
Date:   Mon Apr 23 10:26:05 2018 +0200

    Fix late opening of output file
    
    For 'openssl dhparams', the output file was opened after calculations
    were made, which is a waste of cycles and time if the output file
    turns out not to be writable.
    
    Fixes #3404
    
    Reviewed-by: Matt Caswell <matt at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/6051)
    
    (cherry picked from commit 10b37541dc7f27b0ca74102970691ce4636cc0bd)

-----------------------------------------------------------------------

Summary of changes:
 apps/dhparam.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/apps/dhparam.c b/apps/dhparam.c
index 94322e3..ae2279e 100644
--- a/apps/dhparam.c
+++ b/apps/dhparam.c
@@ -151,6 +151,11 @@ int dhparam_main(int argc, char **argv)
         goto end;
     }
 # endif
+
+    out = bio_open_default(outfile, 'w', outformat);
+    if (out == NULL)
+        goto end;
+
     /* DH parameters */
     if (num && !g)
         g = 2;
@@ -266,10 +271,6 @@ int dhparam_main(int argc, char **argv)
         /* dh != NULL */
     }
 
-    out = bio_open_default(outfile, 'w', outformat);
-    if (out == NULL)
-        goto end;
-
     if (text) {
         DHparams_print(out, dh);
     }


More information about the openssl-commits mailing list