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@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6051)
(cherry picked from commit
10b37541dc7f27b0ca74102970691ce4636cc0bd)
goto end;
}
# endif
+
+ out = bio_open_default(outfile, 'w', outformat);
+ if (out == NULL)
+ goto end;
+
/* DH parameters */
if (num && !g)
g = 2;
/* dh != NULL */
}
- out = bio_open_default(outfile, 'w', outformat);
- if (out == NULL)
- goto end;
-
if (text) {
DHparams_print(out, dh);
}