From 5904cc0e04409fde39a97e6580535da34eeb4291 Mon Sep 17 00:00:00 2001 From: deraadt <> Date: Tue, 2 May 2017 03:59:45 +0000 Subject: use freezero() instead of memset/explicit_bzero + free. Substantially reduces conditional logic (-218, +82). MOD_EXP_CTIME_MIN_CACHE_LINE_WIDTH cache alignment calculation bn/bn_exp.c wasn'tt quite right. Two other tricky bits with ASN1_STRING_FLAG_NDEF and BN_FLG_STATIC_DATA where the condition cannot be collapsed completely. Passes regress. ok beck --- src/lib/libcrypto/hmac/hm_pmeth.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'src/lib/libcrypto/hmac') diff --git a/src/lib/libcrypto/hmac/hm_pmeth.c b/src/lib/libcrypto/hmac/hm_pmeth.c index c5ac6c00c0..390725fa25 100644 --- a/src/lib/libcrypto/hmac/hm_pmeth.c +++ b/src/lib/libcrypto/hmac/hm_pmeth.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hm_pmeth.c,v 1.9 2015/09/10 15:56:25 jsing Exp $ */ +/* $OpenBSD: hm_pmeth.c,v 1.10 2017/05/02 03:59:44 deraadt Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2007. */ @@ -122,12 +122,7 @@ pkey_hmac_cleanup(EVP_PKEY_CTX *ctx) HMAC_PKEY_CTX *hctx = ctx->data; HMAC_CTX_cleanup(&hctx->ctx); - if (hctx->ktmp.data) { - if (hctx->ktmp.length) - explicit_bzero(hctx->ktmp.data, hctx->ktmp.length); - free(hctx->ktmp.data); - hctx->ktmp.data = NULL; - } + freezero(hctx->ktmp.data, hctx->ktmp.length); free(hctx); } -- cgit v1.2.3-55-g6feb