summaryrefslogtreecommitdiff
path: root/lib/libcrypto/ec/ec_lib.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2017-05-02 03:59:46 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2017-05-02 03:59:46 +0000
commitcc4b23eafa00f2d02bd6a5aeb37a603e5616a1b5 (patch)
tree0c263850a80e2d5ef373e8dffa7717aaaa1e4a4a /lib/libcrypto/ec/ec_lib.c
parentcc386e2f2850053dd843b8a7630c3162a953abc8 (diff)
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/ec/ec_lib.c')
-rw-r--r--lib/libcrypto/ec/ec_lib.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/lib/libcrypto/ec/ec_lib.c b/lib/libcrypto/ec/ec_lib.c
index baddbf6dc85..0d062111b59 100644
--- a/lib/libcrypto/ec/ec_lib.c
+++ b/lib/libcrypto/ec/ec_lib.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ec_lib.c,v 1.23 2017/01/29 17:49:23 beck Exp $ */
+/* $OpenBSD: ec_lib.c,v 1.24 2017/05/02 03:59:44 deraadt Exp $ */
/*
* Originally written by Bodo Moeller for the OpenSSL project.
*/
@@ -151,12 +151,8 @@ EC_GROUP_clear_free(EC_GROUP * group)
BN_clear_free(&group->order);
BN_clear_free(&group->cofactor);
- if (group->seed) {
- explicit_bzero(group->seed, group->seed_len);
- free(group->seed);
- }
- explicit_bzero(group, sizeof *group);
- free(group);
+ freezero(group->seed, group->seed_len);
+ freezero(group, sizeof *group);
}
@@ -743,8 +739,7 @@ EC_POINT_clear_free(EC_POINT * point)
point->meth->point_clear_finish(point);
else if (point->meth->point_finish != 0)
point->meth->point_finish(point);
- explicit_bzero(point, sizeof *point);
- free(point);
+ freezero(point, sizeof *point);
}