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/asn1/asn1_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/asn1/asn1_lib.c')
-rw-r--r-- | src/lib/libcrypto/asn1/asn1_lib.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/lib/libcrypto/asn1/asn1_lib.c b/src/lib/libcrypto/asn1/asn1_lib.c index a90873d54a..852644a781 100644 --- a/src/lib/libcrypto/asn1/asn1_lib.c +++ b/src/lib/libcrypto/asn1/asn1_lib.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: asn1_lib.c,v 1.38 2017/01/29 17:49:22 beck Exp $ */ | 1 | /* $OpenBSD: asn1_lib.c,v 1.39 2017/05/02 03:59:44 deraadt Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -401,9 +401,7 @@ ASN1_STRING_set(ASN1_STRING *str, const void *_data, int len) | |||
401 | void | 401 | void |
402 | ASN1_STRING_set0(ASN1_STRING *str, void *data, int len) | 402 | ASN1_STRING_set0(ASN1_STRING *str, void *data, int len) |
403 | { | 403 | { |
404 | if (str->data != NULL) | 404 | freezero(str->data, str->length); |
405 | explicit_bzero(str->data, str->length); | ||
406 | free(str->data); | ||
407 | str->data = data; | 405 | str->data = data; |
408 | str->length = len; | 406 | str->length = len; |
409 | } | 407 | } |
@@ -436,10 +434,8 @@ ASN1_STRING_free(ASN1_STRING *a) | |||
436 | { | 434 | { |
437 | if (a == NULL) | 435 | if (a == NULL) |
438 | return; | 436 | return; |
439 | if (a->data != NULL && !(a->flags & ASN1_STRING_FLAG_NDEF)) { | 437 | if (a->data != NULL && !(a->flags & ASN1_STRING_FLAG_NDEF)) |
440 | explicit_bzero(a->data, a->length); | 438 | freezero(a->data, a->length); |
441 | free(a->data); | ||
442 | } | ||
443 | free(a); | 439 | free(a); |
444 | } | 440 | } |
445 | 441 | ||