From 2b561cb0e87f2ee535e8c64907883cd275ad3fec 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/evp/p_open.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/lib/libcrypto/evp/p_open.c') diff --git a/src/lib/libcrypto/evp/p_open.c b/src/lib/libcrypto/evp/p_open.c index 1eb238dfde..57a46706b9 100644 --- a/src/lib/libcrypto/evp/p_open.c +++ b/src/lib/libcrypto/evp/p_open.c @@ -1,4 +1,4 @@ -/* $OpenBSD: p_open.c,v 1.18 2017/01/29 17:49:23 beck Exp $ */ +/* $OpenBSD: p_open.c,v 1.19 2017/05/02 03:59:44 deraadt Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -109,9 +109,7 @@ EVP_OpenInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, ret = 1; err: - if (key != NULL) - explicit_bzero(key, size); - free(key); + freezero(key, size); return (ret); } -- cgit v1.2.3-55-g6feb