diff options
author | J Mohan Rao Arisankala <mohan@barracuda.com> | 2016-05-23 23:37:47 +0530 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2016-05-23 23:08:22 +0100 |
commit | a93e0e78db78e03bdcd29acf9bbc8a812ee50cb6 (patch) | |
tree | 41552644ef269676d910de3e605ddeb2b54f2b9e /crypto/evp | |
parent | 1c7bfec5982210b2666a91771777c56338cf4d8d (diff) |
#4342: few missing malloc return checks and free in error paths
ossl_hmac_cleanup, pkey_hmac_cleanup:
- allow to invoke with NULL data
- using EVP_PKEY_CTX_[get|set]_data
EVP_DigestInit_ex:
- remove additional check for ‘type’ and doing clear free instead of
free
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Diffstat (limited to 'crypto/evp')
-rw-r--r-- | crypto/evp/digest.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/crypto/evp/digest.c b/crypto/evp/digest.c index 051fc7b19d..c594a0a638 100644 --- a/crypto/evp/digest.c +++ b/crypto/evp/digest.c @@ -68,10 +68,8 @@ int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl) * previous handle, re-querying for an ENGINE, and having a * reinitialisation, when it may all be unnecessary. */ - if (ctx->engine && ctx->digest && (!type || - (type - && (type->type == - ctx->digest->type)))) + if (ctx->engine && ctx->digest && + (type == NULL || (type->type == ctx->digest->type))) goto skip_to_init; if (type) { /* @@ -117,7 +115,7 @@ int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl) #endif if (ctx->digest != type) { if (ctx->digest && ctx->digest->ctx_size) { - OPENSSL_free(ctx->md_data); + OPENSSL_clear_free(ctx->md_data, ctx->digest->ctx_size); ctx->md_data = NULL; } ctx->digest = type; |