diff options
author | deraadt <> | 2017-05-02 03:59:45 +0000 |
---|---|---|
committer | deraadt <> | 2017-05-02 03:59:45 +0000 |
commit | 2b561cb0e87f2ee535e8c64907883cd275ad3fec (patch) | |
tree | bb9d050c5c2984047e6475e087694d6764f24157 /src/lib/libcrypto/ec/ec_lib.c | |
parent | 024e2580a5280d4df3724dab76ce52e14fe2060c (diff) | |
download | openbsd-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/ec/ec_lib.c')
-rw-r--r-- | src/lib/libcrypto/ec/ec_lib.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/lib/libcrypto/ec/ec_lib.c b/src/lib/libcrypto/ec/ec_lib.c index baddbf6dc8..0d062111b5 100644 --- a/src/lib/libcrypto/ec/ec_lib.c +++ b/src/lib/libcrypto/ec/ec_lib.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ec_lib.c,v 1.23 2017/01/29 17:49:23 beck Exp $ */ | 1 | /* $OpenBSD: ec_lib.c,v 1.24 2017/05/02 03:59:44 deraadt Exp $ */ |
2 | /* | 2 | /* |
3 | * Originally written by Bodo Moeller for the OpenSSL project. | 3 | * Originally written by Bodo Moeller for the OpenSSL project. |
4 | */ | 4 | */ |
@@ -151,12 +151,8 @@ EC_GROUP_clear_free(EC_GROUP * group) | |||
151 | BN_clear_free(&group->order); | 151 | BN_clear_free(&group->order); |
152 | BN_clear_free(&group->cofactor); | 152 | BN_clear_free(&group->cofactor); |
153 | 153 | ||
154 | if (group->seed) { | 154 | freezero(group->seed, group->seed_len); |
155 | explicit_bzero(group->seed, group->seed_len); | 155 | freezero(group, sizeof *group); |
156 | free(group->seed); | ||
157 | } | ||
158 | explicit_bzero(group, sizeof *group); | ||
159 | free(group); | ||
160 | } | 156 | } |
161 | 157 | ||
162 | 158 | ||
@@ -743,8 +739,7 @@ EC_POINT_clear_free(EC_POINT * point) | |||
743 | point->meth->point_clear_finish(point); | 739 | point->meth->point_clear_finish(point); |
744 | else if (point->meth->point_finish != 0) | 740 | else if (point->meth->point_finish != 0) |
745 | point->meth->point_finish(point); | 741 | point->meth->point_finish(point); |
746 | explicit_bzero(point, sizeof *point); | 742 | freezero(point, sizeof *point); |
747 | free(point); | ||
748 | } | 743 | } |
749 | 744 | ||
750 | 745 | ||