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>
This commit is contained in:
Rich Salz
2016-02-25 12:09:06 -05:00
committed by Rich Salz
parent 07b3ce8f80
commit 7c96dbcdab
18 changed files with 48 additions and 91 deletions

View File

@@ -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;
}