summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/hmac/hm_pmeth.c
diff options
context:
space:
mode:
authorderaadt <>2017-05-02 03:59:45 +0000
committerderaadt <>2017-05-02 03:59:45 +0000
commit2b561cb0e87f2ee535e8c64907883cd275ad3fec (patch)
treebb9d050c5c2984047e6475e087694d6764f24157 /src/lib/libcrypto/hmac/hm_pmeth.c
parent024e2580a5280d4df3724dab76ce52e14fe2060c (diff)
downloadopenbsd-2b561cb0e87f2ee535e8c64907883cd275ad3fec.tar.gz
openbsd-2b561cb0e87f2ee535e8c64907883cd275ad3fec.tar.bz2
openbsd-2b561cb0e87f2ee535e8c64907883cd275ad3fec.zip
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
Diffstat (limited to 'src/lib/libcrypto/hmac/hm_pmeth.c')
-rw-r--r--src/lib/libcrypto/hmac/hm_pmeth.c9
1 files changed, 2 insertions, 7 deletions
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 @@
1/* $OpenBSD: hm_pmeth.c,v 1.9 2015/09/10 15:56:25 jsing Exp $ */ 1/* $OpenBSD: hm_pmeth.c,v 1.10 2017/05/02 03:59:44 deraadt Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2007. 3 * project 2007.
4 */ 4 */
@@ -122,12 +122,7 @@ pkey_hmac_cleanup(EVP_PKEY_CTX *ctx)
122 HMAC_PKEY_CTX *hctx = ctx->data; 122 HMAC_PKEY_CTX *hctx = ctx->data;
123 123
124 HMAC_CTX_cleanup(&hctx->ctx); 124 HMAC_CTX_cleanup(&hctx->ctx);
125 if (hctx->ktmp.data) { 125 freezero(hctx->ktmp.data, hctx->ktmp.length);
126 if (hctx->ktmp.length)
127 explicit_bzero(hctx->ktmp.data, hctx->ktmp.length);
128 free(hctx->ktmp.data);
129 hctx->ktmp.data = NULL;
130 }
131 free(hctx); 126 free(hctx);
132} 127}
133 128