From 3923f0cde7ff47fab943dfb9c39d3295a3b3ac1e Mon Sep 17 00:00:00 2001 From: jsing Date: Sat, 12 Jul 2014 19:31:21 +0000 Subject: [PATCH] In openssl_startup(), call SSL_library_init() and SSL_load_error_strings(). This allows us to remove the ERR_load_crypto_strings() call, along with the various SSL_load_error_strings() and OpenSSL_add_ssl_algorithms() calls scattered around the place. ok beck@ --- lib/libssl/src/apps/ciphers.c | 5 +---- lib/libssl/src/apps/engine.c | 4 +--- lib/libssl/src/apps/errstr.c | 4 +--- lib/libssl/src/apps/ocsp.c | 5 +---- lib/libssl/src/apps/openssl.c | 5 +++-- lib/libssl/src/apps/s_client.c | 5 +---- lib/libssl/src/apps/s_server.c | 5 +---- lib/libssl/src/apps/s_time.c | 5 +---- 8 files changed, 10 insertions(+), 28 deletions(-) diff --git a/lib/libssl/src/apps/ciphers.c b/lib/libssl/src/apps/ciphers.c index 0d791b25222..d63fca6c7a3 100644 --- a/lib/libssl/src/apps/ciphers.c +++ b/lib/libssl/src/apps/ciphers.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ciphers.c,v 1.24 2014/07/12 17:54:31 jsing Exp $ */ +/* $OpenBSD: ciphers.c,v 1.25 2014/07/12 19:31:21 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -123,7 +123,6 @@ ciphers_main(int argc, char **argv) BIO_printf(bio_err, "%s", *pp); goto end; } - OpenSSL_add_ssl_algorithms(); ctx = SSL_CTX_new(meth); if (ctx == NULL) @@ -138,7 +137,6 @@ ciphers_main(int argc, char **argv) if (ssl == NULL) goto err; - if (!verbose) { for (i = 0; ; i++) { p = SSL_get_cipher_list(ssl, i); @@ -179,7 +177,6 @@ ciphers_main(int argc, char **argv) ret = 0; if (0) { err: - SSL_load_error_strings(); ERR_print_errors(bio_err); } diff --git a/lib/libssl/src/apps/engine.c b/lib/libssl/src/apps/engine.c index f6a30784f9a..90404b57491 100644 --- a/lib/libssl/src/apps/engine.c +++ b/lib/libssl/src/apps/engine.c @@ -1,4 +1,4 @@ -/* $OpenBSD: engine.c,v 1.25 2014/07/12 17:54:31 jsing Exp $ */ +/* $OpenBSD: engine.c,v 1.26 2014/07/12 19:31:21 jsing Exp $ */ /* Written by Richard Levitte for the OpenSSL * project 2000. */ @@ -333,8 +333,6 @@ engine_main(int argc, char **argv) BIO *bio_out = NULL; const char *indent = " "; - SSL_load_error_strings(); - bio_out = BIO_new_fp(stdout, BIO_NOCLOSE); argc--; diff --git a/lib/libssl/src/apps/errstr.c b/lib/libssl/src/apps/errstr.c index 2d7f26538aa..fd81818490e 100644 --- a/lib/libssl/src/apps/errstr.c +++ b/lib/libssl/src/apps/errstr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: errstr.c,v 1.17 2014/06/12 15:49:27 deraadt Exp $ */ +/* $OpenBSD: errstr.c,v 1.18 2014/07/12 19:31:21 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -76,8 +76,6 @@ errstr_main(int argc, char **argv) char buf[256]; unsigned long l; - SSL_load_error_strings(); - if ((argc > 1) && (strcmp(argv[1], "-stats") == 0)) { BIO *out = NULL; diff --git a/lib/libssl/src/apps/ocsp.c b/lib/libssl/src/apps/ocsp.c index 6a6f5e225fa..b431a3c9fdb 100644 --- a/lib/libssl/src/apps/ocsp.c +++ b/lib/libssl/src/apps/ocsp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ocsp.c,v 1.28 2014/07/12 17:54:31 jsing Exp $ */ +/* $OpenBSD: ocsp.c,v 1.29 2014/07/12 19:31:21 jsing Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2000. */ @@ -147,9 +147,6 @@ ocsp_main(int argc, char **argv) const EVP_MD *cert_id_md = NULL; const char *errstr = NULL; - SSL_load_error_strings(); - OpenSSL_add_ssl_algorithms(); - args = argv + 1; reqnames = sk_OPENSSL_STRING_new_null(); ids = sk_OCSP_CERTID_new_null(); diff --git a/lib/libssl/src/apps/openssl.c b/lib/libssl/src/apps/openssl.c index d35c8d8e19a..ae45d159338 100644 --- a/lib/libssl/src/apps/openssl.c +++ b/lib/libssl/src/apps/openssl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: openssl.c,v 1.40 2014/07/12 17:54:31 jsing Exp $ */ +/* $OpenBSD: openssl.c,v 1.41 2014/07/12 19:31:21 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -208,8 +208,9 @@ openssl_startup(void) signal(SIGPIPE, SIG_IGN); CRYPTO_malloc_init(); - ERR_load_crypto_strings(); OpenSSL_add_all_algorithms(); + SSL_library_init(); + SSL_load_error_strings(); #ifndef OPENSSL_NO_ENGINE ENGINE_load_builtin_engines(); diff --git a/lib/libssl/src/apps/s_client.c b/lib/libssl/src/apps/s_client.c index b3fcbf17a02..355a66fd9b3 100644 --- a/lib/libssl/src/apps/s_client.c +++ b/lib/libssl/src/apps/s_client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: s_client.c,v 1.67 2014/07/12 17:54:31 jsing Exp $ */ +/* $OpenBSD: s_client.c,v 1.68 2014/07/12 19:31:21 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -656,9 +656,6 @@ bad: goto end; } - OpenSSL_add_ssl_algorithms(); - SSL_load_error_strings(); - #if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG) next_proto.status = -1; if (next_proto_neg_in) { diff --git a/lib/libssl/src/apps/s_server.c b/lib/libssl/src/apps/s_server.c index 136025ce63d..75e7d833542 100644 --- a/lib/libssl/src/apps/s_server.c +++ b/lib/libssl/src/apps/s_server.c @@ -1,4 +1,4 @@ -/* $OpenBSD: s_server.c,v 1.59 2014/07/12 17:54:31 jsing Exp $ */ +/* $OpenBSD: s_server.c,v 1.60 2014/07/12 19:31:21 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -928,9 +928,6 @@ bad: goto end; } - SSL_load_error_strings(); - OpenSSL_add_ssl_algorithms(); - #ifndef OPENSSL_NO_ENGINE e = setup_engine(bio_err, engine_id, 1); #endif diff --git a/lib/libssl/src/apps/s_time.c b/lib/libssl/src/apps/s_time.c index 14d2e12dcd0..c5fd05b828d 100644 --- a/lib/libssl/src/apps/s_time.c +++ b/lib/libssl/src/apps/s_time.c @@ -1,4 +1,4 @@ -/* $OpenBSD: s_time.c,v 1.32 2014/06/28 04:39:41 deraadt Exp $ */ +/* $OpenBSD: s_time.c,v 1.33 2014/07/12 19:31:21 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -332,7 +332,6 @@ s_time_main(int argc, char **argv) if (parseArgs(argc, argv) < 0) goto end; - OpenSSL_add_ssl_algorithms(); if ((tm_ctx = SSL_CTX_new(s_time_meth)) == NULL) return (1); @@ -344,8 +343,6 @@ s_time_main(int argc, char **argv) if (!set_cert_stuff(tm_ctx, t_cert_file, t_key_file)) goto end; - SSL_load_error_strings(); - if ((!SSL_CTX_load_verify_locations(tm_ctx, CAfile, CApath)) || (!SSL_CTX_set_default_verify_paths(tm_ctx))) { /* -- 2.20.1