From d18ae25f28e72831dc3c51f78e0735342540098b Mon Sep 17 00:00:00 2001 From: beck <> Date: Sat, 17 Mar 2018 16:20:01 +0000 Subject: Bring in compatibility for OpenSSL 1.1 style init functions. This adds OPENSSL_init_crypto and OPENSSL_init_ssl, as well thread safety modifications for the existing LibreSSL init functions. The initialization routines are called automatically by the normal entry points into the library, as in newer OpenSSL ok jsing@, nits by tb@ and deraadt@ --- src/lib/libcrypto/err/err_all.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'src/lib/libcrypto/err/err_all.c') diff --git a/src/lib/libcrypto/err/err_all.c b/src/lib/libcrypto/err/err_all.c index 40009cbe88..24de3c9c15 100644 --- a/src/lib/libcrypto/err/err_all.c +++ b/src/lib/libcrypto/err/err_all.c @@ -1,4 +1,4 @@ -/* $OpenBSD: err_all.c,v 1.23 2016/10/19 16:49:11 jsing Exp $ */ +/* $OpenBSD: err_all.c,v 1.24 2018/03/17 16:20:01 beck Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -56,6 +56,7 @@ * [including the GNU Public Licence.] */ +#include #include #include @@ -103,11 +104,13 @@ #include #endif -void -ERR_load_crypto_strings(void) +void ERR_load_ERR_strings_internal(void); + +static void +ERR_load_crypto_strings_internal(void) { #ifndef OPENSSL_NO_ERR - ERR_load_ERR_strings(); /* include error strings for SYSerr */ + ERR_load_ERR_strings_internal(); /* include error strings for SYSerr */ ERR_load_BN_strings(); #ifndef OPENSSL_NO_RSA ERR_load_RSA_strings(); @@ -153,3 +156,10 @@ ERR_load_crypto_strings(void) #endif #endif } + +void +ERR_load_crypto_strings(void) +{ + static pthread_once_t loaded = PTHREAD_ONCE_INIT; + (void) pthread_once(&loaded, ERR_load_crypto_strings_internal); +} -- cgit v1.2.3-55-g6feb