提交 f98a893e 编写于 作者: B Bernd Edlinger

Fix error handling in RAND_DRBG_set

Reviewed-by: NMatthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Reviewed-by: NPaul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/7519)
上级 0f316a0c
...@@ -115,6 +115,9 @@ int RAND_DRBG_set(RAND_DRBG *drbg, int type, unsigned int flags) ...@@ -115,6 +115,9 @@ int RAND_DRBG_set(RAND_DRBG *drbg, int type, unsigned int flags)
switch (type) { switch (type) {
default: default:
drbg->type = 0;
drbg->flags = 0;
drbg->meth = NULL;
RANDerr(RAND_F_RAND_DRBG_SET, RAND_R_UNSUPPORTED_DRBG_TYPE); RANDerr(RAND_F_RAND_DRBG_SET, RAND_R_UNSUPPORTED_DRBG_TYPE);
return 0; return 0;
case 0: case 0:
...@@ -127,8 +130,10 @@ int RAND_DRBG_set(RAND_DRBG *drbg, int type, unsigned int flags) ...@@ -127,8 +130,10 @@ int RAND_DRBG_set(RAND_DRBG *drbg, int type, unsigned int flags)
break; break;
} }
if (ret == 0) if (ret == 0) {
drbg->state = DRBG_ERROR;
RANDerr(RAND_F_RAND_DRBG_SET, RAND_R_ERROR_INITIALISING_DRBG); RANDerr(RAND_F_RAND_DRBG_SET, RAND_R_ERROR_INITIALISING_DRBG);
}
return ret; return ret;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册