From 076fc55527a1499391fa6de109c8387895199ee9 Mon Sep 17 00:00:00 2001 From: Rich Salz Date: Fri, 7 Apr 2017 12:07:42 -0400 Subject: Make default_method mostly compile-time Document thread-safety issues Have RSA_null return NULL (always fails) Reviewed-by: Matt Caswell (Merged from https://github.com/openssl/openssl/pull/2244) --- crypto/dh/dh_key.c | 12 ++++++++++++ crypto/dh/dh_lib.c | 14 -------------- 2 files changed, 12 insertions(+), 14 deletions(-) (limited to 'crypto/dh') diff --git a/crypto/dh/dh_key.c b/crypto/dh/dh_key.c index 204e5a7a42..fce9ff47f3 100644 --- a/crypto/dh/dh_key.c +++ b/crypto/dh/dh_key.c @@ -56,11 +56,23 @@ static DH_METHOD dh_ossl = { NULL }; +static const DH_METHOD *default_DH_method = &dh_ossl; + const DH_METHOD *DH_OpenSSL(void) { return &dh_ossl; } +void DH_set_default_method(const DH_METHOD *meth) +{ + default_DH_method = meth; +} + +const DH_METHOD *DH_get_default_method(void) +{ + return default_DH_method; +} + static int generate_key(DH *dh) { int ok = 0; diff --git a/crypto/dh/dh_lib.c b/crypto/dh/dh_lib.c index 3dfe7c4e58..f22bcf0706 100644 --- a/crypto/dh/dh_lib.c +++ b/crypto/dh/dh_lib.c @@ -13,20 +13,6 @@ #include "dh_locl.h" #include -static const DH_METHOD *default_DH_method = NULL; - -void DH_set_default_method(const DH_METHOD *meth) -{ - default_DH_method = meth; -} - -const DH_METHOD *DH_get_default_method(void) -{ - if (!default_DH_method) - default_DH_method = DH_OpenSSL(); - return default_DH_method; -} - int DH_set_method(DH *dh, const DH_METHOD *meth) { /* -- cgit v1.2.3