提交 beb89508 编写于 作者: D Dr. Stephen Henson

Free DRBG context in self tests.

上级 2d1122b8
...@@ -112,6 +112,7 @@ DRBG_CTX *FIPS_drbg_new(int type, unsigned int flags) ...@@ -112,6 +112,7 @@ DRBG_CTX *FIPS_drbg_new(int type, unsigned int flags)
void FIPS_drbg_free(DRBG_CTX *dctx) void FIPS_drbg_free(DRBG_CTX *dctx)
{ {
if (dctx->uninstantiate)
dctx->uninstantiate(dctx); dctx->uninstantiate(dctx);
OPENSSL_cleanse(dctx, sizeof(DRBG_CTX)); OPENSSL_cleanse(dctx, sizeof(DRBG_CTX));
OPENSSL_free(dctx); OPENSSL_free(dctx);
...@@ -388,7 +389,8 @@ int FIPS_drbg_uninstantiate(DRBG_CTX *dctx) ...@@ -388,7 +389,8 @@ int FIPS_drbg_uninstantiate(DRBG_CTX *dctx)
{ {
int rv; int rv;
if (!dctx->uninstantiate) if (!dctx->uninstantiate)
return 1; rv = 1;
else
rv = dctx->uninstantiate(dctx); rv = dctx->uninstantiate(dctx);
/* Although we'd like to cleanse here we can't because we have to /* Although we'd like to cleanse here we can't because we have to
* test the uninstantiate really zeroes the data. * test the uninstantiate really zeroes the data.
......
...@@ -1011,6 +1011,7 @@ int FIPS_selftest_drbg(void) ...@@ -1011,6 +1011,7 @@ int FIPS_selftest_drbg(void)
if (!fips_drbg_health_check(dctx, td)) if (!fips_drbg_health_check(dctx, td))
break; break;
} }
FIPS_drbg_free(dctx);
if (td->nid == 0) if (td->nid == 0)
return 1; return 1;
return 0; return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册