summaryrefslogtreecommitdiffstats
path: root/crypto/dh
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2001-06-23 23:07:34 +0000
committerDr. Stephen Henson <steve@openssl.org>2001-06-23 23:07:34 +0000
commit0c9de428ae03a3dd9272aba90c595f6c25a4525d (patch)
tree0432aee5cab40ad7e686f1b44dd58affbd0840c8 /crypto/dh
parentf13def508cdec14c02817d5e52946758fd0289b7 (diff)
In {RSA,DSA,DH}_new_method(x) need to increase the reference
count of the ENGINE is x is not NULL since it will be freed in {RSA,DSA,DH}_free().
Diffstat (limited to 'crypto/dh')
-rw-r--r--crypto/dh/dh_lib.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/crypto/dh/dh_lib.c b/crypto/dh/dh_lib.c
index b3c609e8be..2d778ef300 100644
--- a/crypto/dh/dh_lib.c
+++ b/crypto/dh/dh_lib.c
@@ -142,16 +142,21 @@ DH *DH_new_method(ENGINE *engine)
DHerr(DH_F_DH_NEW,ERR_R_MALLOC_FAILURE);
return(NULL);
}
- if(engine)
- ret->engine = engine;
+
+ if (engine)
+ {
+ if(ENGINE_init(engine))
+ ret->engine = engine;
+ else
+ ret->engine = NULL;
+ }
else
+ ret->engine=ENGINE_get_default_DH();
+ if(ret->engine == NULL)
{
- if((ret->engine=ENGINE_get_default_DH()) == NULL)
- {
- DHerr(DH_F_DH_NEW,ERR_LIB_ENGINE);
- OPENSSL_free(ret);
- return NULL;
- }
+ DHerr(DH_F_DH_NEW,ERR_LIB_ENGINE);
+ OPENSSL_free(ret);
+ return NULL;
}
meth = ENGINE_get_DH(ret->engine);
ret->pad=0;