diff options
Diffstat (limited to 'src/lib/libcrypto/evp/digest.c')
-rw-r--r-- | src/lib/libcrypto/evp/digest.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/lib/libcrypto/evp/digest.c b/src/lib/libcrypto/evp/digest.c index ee1f955959..7471c1e822 100644 --- a/src/lib/libcrypto/evp/digest.c +++ b/src/lib/libcrypto/evp/digest.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: digest.c,v 1.27 2017/01/29 17:49:23 beck Exp $ */ | 1 | /* $OpenBSD: digest.c,v 1.28 2017/05/02 03:59:44 deraadt Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -193,8 +193,7 @@ EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl) | |||
193 | if (ctx->digest != type) { | 193 | if (ctx->digest != type) { |
194 | if (ctx->digest && ctx->digest->ctx_size && ctx->md_data && | 194 | if (ctx->digest && ctx->digest->ctx_size && ctx->md_data && |
195 | !EVP_MD_CTX_test_flags(ctx, EVP_MD_CTX_FLAG_REUSE)) { | 195 | !EVP_MD_CTX_test_flags(ctx, EVP_MD_CTX_FLAG_REUSE)) { |
196 | explicit_bzero(ctx->md_data, ctx->digest->ctx_size); | 196 | freezero(ctx->md_data, ctx->digest->ctx_size); |
197 | free(ctx->md_data); | ||
198 | ctx->md_data = NULL; | 197 | ctx->md_data = NULL; |
199 | } | 198 | } |
200 | ctx->digest = type; | 199 | ctx->digest = type; |
@@ -360,10 +359,8 @@ EVP_MD_CTX_cleanup(EVP_MD_CTX *ctx) | |||
360 | !EVP_MD_CTX_test_flags(ctx, EVP_MD_CTX_FLAG_CLEANED)) | 359 | !EVP_MD_CTX_test_flags(ctx, EVP_MD_CTX_FLAG_CLEANED)) |
361 | ctx->digest->cleanup(ctx); | 360 | ctx->digest->cleanup(ctx); |
362 | if (ctx->digest && ctx->digest->ctx_size && ctx->md_data && | 361 | if (ctx->digest && ctx->digest->ctx_size && ctx->md_data && |
363 | !EVP_MD_CTX_test_flags(ctx, EVP_MD_CTX_FLAG_REUSE)) { | 362 | !EVP_MD_CTX_test_flags(ctx, EVP_MD_CTX_FLAG_REUSE)) |
364 | explicit_bzero(ctx->md_data, ctx->digest->ctx_size); | 363 | freezero(ctx->md_data, ctx->digest->ctx_size); |
365 | free(ctx->md_data); | ||
366 | } | ||
367 | EVP_PKEY_CTX_free(ctx->pctx); | 364 | EVP_PKEY_CTX_free(ctx->pctx); |
368 | #ifndef OPENSSL_NO_ENGINE | 365 | #ifndef OPENSSL_NO_ENGINE |
369 | if (ctx->engine) | 366 | if (ctx->engine) |