summaryrefslogtreecommitdiffstats
path: root/lib/libcrypto/buffer/buffer.c
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2017-05-02 03:59:44 +0000
committerderaadt <deraadt@openbsd.org>2017-05-02 03:59:44 +0000
commit7de8a6843ca16b4f1c9d2a7eab4c71e8af96a4e6 (patch)
tree3ea360fbba39840d58df496af1ccadf16612454f /lib/libcrypto/buffer/buffer.c
parentMatching vmd(8) part of previous diff (first part of vmctl send/receive). (diff)
downloadwireguard-openbsd-7de8a6843ca16b4f1c9d2a7eab4c71e8af96a4e6.tar.xz
wireguard-openbsd-7de8a6843ca16b4f1c9d2a7eab4c71e8af96a4e6.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 'lib/libcrypto/buffer/buffer.c')
-rw-r--r--lib/libcrypto/buffer/buffer.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/lib/libcrypto/buffer/buffer.c b/lib/libcrypto/buffer/buffer.c
index 5ed893f5f95..f4e84c44780 100644
--- a/lib/libcrypto/buffer/buffer.c
+++ b/lib/libcrypto/buffer/buffer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: buffer.c,v 1.26 2017/04/09 15:06:20 jsing Exp $ */
+/* $OpenBSD: buffer.c,v 1.27 2017/05/02 03:59:44 deraadt Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -89,10 +89,7 @@ BUF_MEM_free(BUF_MEM *a)
if (a == NULL)
return;
- if (a->data != NULL) {
- explicit_bzero(a->data, a->max);
- free(a->data);
- }
+ freezero(a->data, a->max);
free(a);
}