aboutsummaryrefslogtreecommitdiff
path: root/crypto/dsa/dsa_lib.c
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/dsa/dsa_lib.c
parentf13def508cdec14c02817d5e52946758fd0289b7 (diff)
downloadopenssl-0c9de428ae03a3dd9272aba90c595f6c25a4525d.zip
openssl-0c9de428ae03a3dd9272aba90c595f6c25a4525d.tar.gz
openssl-0c9de428ae03a3dd9272aba90c595f6c25a4525d.tar.bz2
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/dsa/dsa_lib.c')
-rw-r--r--crypto/dsa/dsa_lib.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/crypto/dsa/dsa_lib.c b/crypto/dsa/dsa_lib.c
index 1b33705..48b228f 100644
--- a/crypto/dsa/dsa_lib.c
+++ b/crypto/dsa/dsa_lib.c
@@ -146,17 +146,24 @@ DSA *DSA_new_method(ENGINE *engine)
DSAerr(DSA_F_DSA_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_DSA();
+
+ if(ret->engine == NULL)
{
- if((ret->engine=ENGINE_get_default_DSA()) == NULL)
- {
- DSAerr(DSA_F_DSA_NEW,ERR_LIB_ENGINE);
- OPENSSL_free(ret);
- return NULL;
- }
+ DSAerr(DSA_F_DSA_NEW,ERR_LIB_ENGINE);
+ OPENSSL_free(ret);
+ return NULL;
}
+
meth = ENGINE_get_DSA(ret->engine);
ret->pad=0;
ret->version=0;