summaryrefslogtreecommitdiffstats
path: root/crypto/rand
diff options
context:
space:
mode:
authorRich Salz <rsalz@akamai.com>2016-02-25 12:09:06 -0500
committerRich Salz <rsalz@openssl.org>2016-02-25 15:19:42 -0500
commit7c96dbcdab959fef74c4caae63cdebaa354ab252 (patch)
treeaf59789bb5bc85efd7e700d657db004910f8ba64 /crypto/rand
parent07b3ce8f8029f647c1babf0d8a03599885e7e284 (diff)
GH715: ENGINE_finish can take NULL
Simplifies calling code. Also fixed up any !ptr tests that were nearby, turning them into NULL tests. Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'crypto/rand')
-rw-r--r--crypto/rand/rand_lib.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/crypto/rand/rand_lib.c b/crypto/rand/rand_lib.c
index b43660b1fe..63fd231775 100644
--- a/crypto/rand/rand_lib.c
+++ b/crypto/rand/rand_lib.c
@@ -79,10 +79,8 @@ static const RAND_METHOD *default_RAND_meth = NULL;
int RAND_set_rand_method(const RAND_METHOD *meth)
{
#ifndef OPENSSL_NO_ENGINE
- if (funct_ref) {
- ENGINE_finish(funct_ref);
- funct_ref = NULL;
- }
+ ENGINE_finish(funct_ref);
+ funct_ref = NULL;
#endif
default_RAND_meth = meth;
return 1;
@@ -95,7 +93,7 @@ const RAND_METHOD *RAND_get_rand_method(void)
ENGINE *e = ENGINE_get_default_RAND();
if (e) {
default_RAND_meth = ENGINE_get_RAND(e);
- if (!default_RAND_meth) {
+ if (default_RAND_meth == NULL) {
ENGINE_finish(e);
e = NULL;
}
@@ -117,7 +115,7 @@ int RAND_set_rand_engine(ENGINE *engine)
if (!ENGINE_init(engine))
return 0;
tmp_meth = ENGINE_get_RAND(engine);
- if (!tmp_meth) {
+ if (tmp_meth == NULL) {
ENGINE_finish(engine);
return 0;
}