in each application (since there is no longer a non-monolithic mode).
In typical OpenSSL fashion, the code is inconsistent and there are multiple
ways that bio_err was initialised - none of them actually checked to see if
the initialisation actually succeeded. Additionally, it is worth noting
that in at least two cases bio_err was also being used before it would have
been initialised.
ok miod@
signal(SIGPIPE, SIG_IGN);
- if (bio_err == NULL)
- if ((bio_err = BIO_new(BIO_s_file())) != NULL)
- BIO_set_fp(bio_err, stderr, BIO_NOCLOSE | BIO_FP_TEXT);
-
if (!load_config(bio_err, NULL))
goto end;
preserve = 0;
msie_hack = 0;
- if (bio_err == NULL)
- if ((bio_err = BIO_new(BIO_s_file())) != NULL)
- BIO_set_fp(bio_err, stderr, BIO_NOCLOSE | BIO_FP_TEXT);
argc--;
argv++;
signal(SIGPIPE, SIG_IGN);
- if (bio_err == NULL)
- bio_err = BIO_new_fp(stderr, BIO_NOCLOSE);
STDout = BIO_new_fp(stdout, BIO_NOCLOSE);
if (!load_config(bio_err, NULL))
goto end;
signal(SIGPIPE, SIG_IGN);
- if (bio_err == NULL) {
- if ((bio_err = BIO_new(BIO_s_file())) != NULL)
- BIO_set_fp(bio_err, stderr, BIO_NOCLOSE | BIO_FP_TEXT);
- }
if (!load_config(bio_err, NULL))
goto end;
signal(SIGPIPE, SIG_IGN);
- if (bio_err == NULL)
- if ((bio_err = BIO_new(BIO_s_file())) != NULL)
- BIO_set_fp(bio_err, stderr, BIO_NOCLOSE | BIO_FP_TEXT);
-
if (!load_config(bio_err, NULL))
goto end;
signal(SIGPIPE, SIG_IGN);
- if (bio_err == NULL)
- if ((bio_err = BIO_new(BIO_s_file())) != NULL)
- BIO_set_fp(bio_err, stderr, BIO_NOCLOSE | BIO_FP_TEXT);
-
infile = NULL;
outfile = NULL;
informat = FORMAT_PEM;
BIO_printf(bio_err, "out of memory\n");
goto end;
}
- if (bio_err == NULL)
- if ((bio_err = BIO_new(BIO_s_file())) != NULL)
- BIO_set_fp(bio_err, stderr, BIO_NOCLOSE | BIO_FP_TEXT);
if (!load_config(bio_err, NULL))
goto end;
signal(SIGPIPE, SIG_IGN);
- if (bio_err == NULL)
- if ((bio_err = BIO_new(BIO_s_file())) != NULL)
- BIO_set_fp(bio_err, stderr, BIO_NOCLOSE | BIO_FP_TEXT);
-
if (!load_config(bio_err, NULL))
goto end;
signal(SIGPIPE, SIG_IGN);
- if (bio_err == NULL)
- if ((bio_err = BIO_new(BIO_s_file())) != NULL)
- BIO_set_fp(bio_err, stderr, BIO_NOCLOSE | BIO_FP_TEXT);
-
if (!load_config(bio_err, NULL))
goto end;
signal(SIGPIPE, SIG_IGN);
- if (bio_err == NULL)
- if ((bio_err = BIO_new(BIO_s_file())) != NULL)
- BIO_set_fp(bio_err, stderr, BIO_NOCLOSE | BIO_FP_TEXT);
-
if (!load_config(bio_err, NULL))
goto end;
signal(SIGPIPE, SIG_IGN);
- if (bio_err == NULL)
- if ((bio_err = BIO_new(BIO_s_file())) != NULL)
- BIO_set_fp(bio_err, stderr, BIO_NOCLOSE | BIO_FP_TEXT);
-
if (!load_config(bio_err, NULL))
goto end;
signal(SIGPIPE, SIG_IGN);
- if (bio_err == NULL)
- if ((bio_err = BIO_new(BIO_s_file())) != NULL)
- BIO_set_fp(bio_err, stderr, BIO_NOCLOSE | BIO_FP_TEXT);
-
if (!load_config(bio_err, NULL))
goto end;
signal(SIGPIPE, SIG_IGN);
- if (bio_err == NULL)
- if ((bio_err = BIO_new(BIO_s_file())) != NULL)
- BIO_set_fp(bio_err, stderr, BIO_NOCLOSE | BIO_FP_TEXT);
-
if (!load_config(bio_err, NULL))
goto end;
signal(SIGPIPE, SIG_IGN);
- if (bio_err == NULL)
- if ((bio_err = BIO_new(BIO_s_file())) != NULL)
- BIO_set_fp(bio_err, stderr, BIO_NOCLOSE | BIO_FP_TEXT);
-
if (!load_config(bio_err, NULL))
goto end;
signal(SIGPIPE, SIG_IGN);
SSL_load_error_strings();
- if (bio_err == NULL)
- bio_err = BIO_new_fp(stderr, BIO_NOCLOSE);
-
if (!load_config(bio_err, NULL))
goto end;
+
bio_out = BIO_new_fp(stdout, BIO_NOCLOSE);
argc--;
signal(SIGPIPE, SIG_IGN);
- if (bio_err == NULL)
- if ((bio_err = BIO_new(BIO_s_file())) != NULL)
- BIO_set_fp(bio_err, stderr, BIO_NOCLOSE | BIO_FP_TEXT);
-
SSL_load_error_strings();
if ((argc > 1) && (strcmp(argv[1], "-stats") == 0)) {
signal(SIGPIPE, SIG_IGN);
BN_GENCB_set(&cb, dh_cb, bio_err);
- if (bio_err == NULL)
- if ((bio_err = BIO_new(BIO_s_file())) != NULL)
- BIO_set_fp(bio_err, stderr, BIO_NOCLOSE | BIO_FP_TEXT);
if (!load_config(bio_err, NULL))
goto end;
signal(SIGPIPE, SIG_IGN);
- if (bio_err == NULL)
- if ((bio_err = BIO_new(BIO_s_file())) != NULL)
- BIO_set_fp(bio_err, stderr, BIO_NOCLOSE | BIO_FP_TEXT);
-
if (!load_config(bio_err, NULL))
goto end;
int do_param = 0;
- if (bio_err == NULL)
- bio_err = BIO_new_fp(stderr, BIO_NOCLOSE);
-
if (!load_config(bio_err, NULL))
goto end;
signal(SIGPIPE, SIG_IGN);
BN_GENCB_set(&cb, genrsa_cb, bio_err);
- if (bio_err == NULL)
- if ((bio_err = BIO_new(BIO_s_file())) != NULL)
- BIO_set_fp(bio_err, stderr, BIO_NOCLOSE | BIO_FP_TEXT);
-
if (!load_config(bio_err, NULL))
goto err;
+
if ((out = BIO_new(BIO_s_file())) == NULL) {
BIO_printf(bio_err, "unable to create BIO for output\n");
goto err;
NETSCAPE_CERT_SEQUENCE *seq = NULL;
int i, ret = 1;
int badarg = 0;
- if (bio_err == NULL)
- bio_err = BIO_new_fp(stderr, BIO_NOCLOSE);
+
ERR_load_crypto_strings();
+
args = argv + 1;
while (!badarg && *args && *args[0] == '-') {
if (!strcmp(*args, "-toseq"))
int ignore_err = 0;
STACK_OF(OPENSSL_STRING) * reqnames = NULL;
STACK_OF(OCSP_CERTID) * ids = NULL;
-
X509 *rca_cert = NULL;
char *ridx_filename = NULL;
char *rca_filename = NULL;
int nmin = 0, ndays = -1;
const EVP_MD *cert_id_md = NULL;
- if (bio_err == NULL)
- bio_err = BIO_new_fp(stderr, BIO_NOCLOSE);
-
if (!load_config(bio_err, NULL))
goto end;
+
SSL_load_error_strings();
OpenSSL_add_ssl_algorithms();
+
args = argv + 1;
reqnames = sk_OPENSSL_STRING_new_null();
ids = sk_OCSP_CERTID_new_null();
*
*/
+#include <err.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
arg.data = NULL;
arg.count = 0;
+ bio_err = BIO_new_fp(stderr, BIO_NOCLOSE);
if (bio_err == NULL)
- if ((bio_err = BIO_new(BIO_s_file())) != NULL)
- BIO_set_fp(bio_err, stderr, BIO_NOCLOSE | BIO_FP_TEXT);
+ errx(1, "failed to initialise bio_err");
CRYPTO_set_locking_callback(lock_dbg_cb);
signal(SIGPIPE, SIG_IGN);
- if (bio_err == NULL)
- if ((bio_err = BIO_new(BIO_s_file())) != NULL)
- BIO_set_fp(bio_err, stderr, BIO_NOCLOSE | BIO_FP_TEXT);
-
if (!load_config(bio_err, NULL))
goto err;
+
out = BIO_new(BIO_s_file());
if (out == NULL)
goto err;
cert_pbe = NID_pbe_WithSHA1And40BitRC2_CBC;
enc = EVP_des_ede3_cbc();
- if (bio_err == NULL)
- bio_err = BIO_new_fp(stderr, BIO_NOCLOSE);
if (!load_config(bio_err, NULL))
goto end;
args = argv + 1;
-
while (*args) {
if (*args[0] == '-') {
if (!strcmp(*args, "-nokeys"))
signal(SIGPIPE, SIG_IGN);
- if (bio_err == NULL)
- if ((bio_err = BIO_new(BIO_s_file())) != NULL)
- BIO_set_fp(bio_err, stderr, BIO_NOCLOSE | BIO_FP_TEXT);
-
if (!load_config(bio_err, NULL))
goto end;
char *engine = NULL;
#endif
- if (bio_err == NULL)
- bio_err = BIO_new_fp(stderr, BIO_NOCLOSE);
-
if (!load_config(bio_err, NULL))
goto end;
#endif
int ret = 1;
- if (bio_err == NULL)
- bio_err = BIO_new_fp(stderr, BIO_NOCLOSE);
-
if (!load_config(bio_err, NULL))
goto end;
#endif
int ret = 1;
- if (bio_err == NULL)
- bio_err = BIO_new_fp(stderr, BIO_NOCLOSE);
-
if (!load_config(bio_err, NULL))
goto end;
argc--;
argv++;
- if (!bio_err)
- bio_err = BIO_new_fp(stderr, BIO_NOCLOSE);
-
if (!load_config(bio_err, NULL))
goto end;
+
ERR_load_crypto_strings();
OpenSSL_add_all_algorithms();
signal(SIGPIPE, SIG_IGN);
- if (bio_err == NULL)
- if ((bio_err = BIO_new(BIO_s_file())) != NULL)
- BIO_set_fp(bio_err, stderr, BIO_NOCLOSE | BIO_FP_TEXT);
-
--argc;
++argv;
while (argc >= 1 && **argv == '-') {
signal(SIGPIPE, SIG_IGN);
- if (bio_err == NULL)
- if ((bio_err = BIO_new(BIO_s_file())) != NULL)
- BIO_set_fp(bio_err, stderr, BIO_NOCLOSE | BIO_FP_TEXT);
-
if (!load_config(bio_err, NULL))
goto err;
#endif
signal(SIGPIPE, SIG_IGN);
- if (bio_err == NULL)
- if ((bio_err = BIO_new(BIO_s_file())) != NULL)
- BIO_set_fp(bio_err, stderr, BIO_NOCLOSE | BIO_FP_TEXT);
-
infile = NULL;
outfile = NULL;
informat = FORMAT_PEM;
signal(SIGPIPE, SIG_IGN);
- if (bio_err == NULL)
- if ((bio_err = BIO_new(BIO_s_file())) != NULL)
- BIO_set_fp(bio_err, stderr, BIO_NOCLOSE | BIO_FP_TEXT);
-
if (!load_config(bio_err, NULL))
goto end;
argc--;
argv++;
- if (!bio_err)
- bio_err = BIO_new_fp(stderr, BIO_NOCLOSE);
-
if (!load_config(bio_err, NULL))
goto end;
+
ERR_load_crypto_strings();
OpenSSL_add_all_algorithms();
pad = RSA_PKCS1_PADDING;
c_msg = 0;
c_showcerts = 0;
- if (bio_err == NULL)
- bio_err = BIO_new_fp(stderr, BIO_NOCLOSE);
-
if (!load_config(bio_err, NULL))
goto end;
signal(SIGPIPE, SIG_IGN);
s_server_init();
- if (bio_err == NULL)
- bio_err = BIO_new_fp(stderr, BIO_NOCLOSE);
-
if (!load_config(bio_err, NULL))
goto end;
signal(SIGPIPE, SIG_IGN);
s_time_init();
- if (bio_err == NULL)
- bio_err = BIO_new_fp(stderr, BIO_NOCLOSE);
-
s_time_meth = SSLv23_client_method();
/* parse the command line arguments */
signal(SIGPIPE, SIG_IGN);
- if (bio_err == NULL)
- if ((bio_err = BIO_new(BIO_s_file())) != NULL)
- BIO_set_fp(bio_err, stderr, BIO_NOCLOSE | BIO_FP_TEXT);
-
informat = FORMAT_PEM;
outformat = FORMAT_PEM;
signal(SIGPIPE, SIG_IGN);
- if (bio_err == NULL) {
- if ((bio_err = BIO_new(BIO_s_file())) != NULL)
- BIO_set_fp(bio_err, stderr, BIO_NOCLOSE | BIO_FP_TEXT);
- }
if (!load_config(bio_err, NULL))
goto end;
}
#endif
-
- if (bio_err == NULL)
- if ((bio_err = BIO_new(BIO_s_file())) != NULL)
- BIO_set_fp(bio_err, stderr, BIO_NOCLOSE | BIO_FP_TEXT);
-
if (!load_config(bio_err, NULL))
goto end;
signal(SIGPIPE, SIG_IGN);
- if (!bio_err)
- bio_err = BIO_new_fp(stderr, BIO_NOCLOSE);
-
if (!load_config(bio_err, NULL))
goto end;
int token_in = 0;
/* Output is ContentInfo instead of TimeStampResp. */
int token_out = 0;
- int free_bio_err = 0;
ERR_load_crypto_strings();
+
signal(SIGPIPE, SIG_IGN);
- if (bio_err == NULL && (bio_err = BIO_new(BIO_s_file())) != NULL) {
- free_bio_err = 1;
- BIO_set_fp(bio_err, stderr, BIO_NOCLOSE | BIO_FP_TEXT);
- }
if (!load_config(bio_err, NULL))
goto cleanup;
"-in response.tsr [-token_in] "
"-CApath ca_path -CAfile ca_file.pem "
"-untrusted cert_file.pem\n");
+
cleanup:
/* Clean up. */
NCONF_free(conf);
free(password);
OBJ_cleanup();
- if (free_bio_err) {
- BIO_free_all(bio_err);
- bio_err = NULL;
- }
+
return (ret);
}
signal(SIGPIPE, SIG_IGN);
- if (bio_err == NULL)
- if ((bio_err = BIO_new(BIO_s_file())) != NULL)
- BIO_set_fp(bio_err, stderr, BIO_NOCLOSE | BIO_FP_TEXT);
-
if (!load_config(bio_err, NULL))
goto end;
signal(SIGPIPE, SIG_IGN);
- if (bio_err == NULL)
- if ((bio_err = BIO_new(BIO_s_file())) != NULL)
- BIO_set_fp(bio_err, stderr, BIO_NOCLOSE | BIO_FP_TEXT);
-
if (argc == 1)
version = 1;
for (i = 1; i < argc; i++) {
signal(SIGPIPE, SIG_IGN);
- if (bio_err == NULL)
- bio_err = BIO_new_fp(stderr, BIO_NOCLOSE);
-
if (!load_config(bio_err, NULL))
goto end;
+
STDout = BIO_new_fp(stdout, BIO_NOCLOSE);
informat = FORMAT_PEM;