summaryrefslogtreecommitdiffstats
path: root/crypto/dh
diff options
context:
space:
mode:
authorRich Salz <rsalz@openssl.org>2017-04-07 12:39:02 -0400
committerRich Salz <rsalz@openssl.org>2017-05-27 13:07:07 -0400
commitb4d6f713d6c5b55a2887d79435490a503da39ae5 (patch)
tree1f7933ed63dec011d5728e369f34b5bc1c317347 /crypto/dh
parentab6abae63c701d6d3a5760d881b9bee235620e4b (diff)
Make default_method mostly compile-time
Document thread-safety issues Cherry-pick from 076fc55527a1499391fa6de109c8387895199ee9 but keeps the RSA_null method. Reviewed-by: Geoff Thorpe <geoff@openssl.org> (Merged from https://github.com/openssl/openssl/pull/3146)
Diffstat (limited to 'crypto/dh')
-rw-r--r--crypto/dh/dh_key.c12
-rw-r--r--crypto/dh/dh_lib.c14
2 files changed, 12 insertions, 14 deletions
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 adf1771514..344eab275d 100644
--- a/crypto/dh/dh_lib.c
+++ b/crypto/dh/dh_lib.c
@@ -13,20 +13,6 @@
#include "dh_locl.h"
#include <openssl/engine.h>
-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)
{
/*