summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorBernd Edlinger <bernd.edlinger@hotmail.de>2018-10-29 13:48:53 +0100
committerBernd Edlinger <bernd.edlinger@hotmail.de>2018-11-05 22:35:09 +0100
commit17209be89b4d5aad94b91cfe0d9d24d5243a4a2f (patch)
tree4fcb92cea17ba1a46fbc3e1d19b77def9b86f36e /crypto
parentFix return formatting. (diff)
downloadopenssl-17209be89b4d5aad94b91cfe0d9d24d5243a4a2f.tar.xz
openssl-17209be89b4d5aad94b91cfe0d9d24d5243a4a2f.zip
Fix error handling in RAND_DRBG_set
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com> Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/7517)
Diffstat (limited to '')
-rw-r--r--crypto/rand/drbg_lib.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/crypto/rand/drbg_lib.c b/crypto/rand/drbg_lib.c
index 8e372e593e..f518ce5138 100644
--- a/crypto/rand/drbg_lib.c
+++ b/crypto/rand/drbg_lib.c
@@ -180,12 +180,17 @@ int RAND_DRBG_set(RAND_DRBG *drbg, int type, unsigned int flags)
else
ret = drbg_hash_init(drbg);
} else {
+ drbg->type = 0;
+ drbg->flags = 0;
+ drbg->meth = NULL;
RANDerr(RAND_F_RAND_DRBG_SET, RAND_R_UNSUPPORTED_DRBG_TYPE);
return 0;
}
- if (ret == 0)
+ if (ret == 0) {
+ drbg->state = DRBG_ERROR;
RANDerr(RAND_F_RAND_DRBG_SET, RAND_R_ERROR_INITIALISING_DRBG);
+ }
return ret;
}