From: Bernd Edlinger Date: Mon, 29 Oct 2018 12:48:53 +0000 (+0100) Subject: Fix error handling in RAND_DRBG_set X-Git-Tag: OpenSSL_1_1_1a~45 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=f98a893ed454faf97d77a53833da95646478c14c;p=oweals%2Fopenssl.git Fix error handling in RAND_DRBG_set Reviewed-by: Matthias St. Pierre Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/7519) --- diff --git a/crypto/rand/drbg_lib.c b/crypto/rand/drbg_lib.c index 43e7509e6a..b9c1cca0e0 100644 --- a/crypto/rand/drbg_lib.c +++ b/crypto/rand/drbg_lib.c @@ -115,6 +115,9 @@ int RAND_DRBG_set(RAND_DRBG *drbg, int type, unsigned int flags) switch (type) { default: + drbg->type = 0; + drbg->flags = 0; + drbg->meth = NULL; RANDerr(RAND_F_RAND_DRBG_SET, RAND_R_UNSUPPORTED_DRBG_TYPE); return 0; case 0: @@ -127,8 +130,10 @@ int RAND_DRBG_set(RAND_DRBG *drbg, int type, unsigned int flags) break; } - if (ret == 0) + if (ret == 0) { + drbg->state = DRBG_ERROR; RANDerr(RAND_F_RAND_DRBG_SET, RAND_R_ERROR_INITIALISING_DRBG); + } return ret; }