summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/bn/bn_asm.c
diff options
context:
space:
mode:
authorderaadt <>2017-05-02 03:59:45 +0000
committerderaadt <>2017-05-02 03:59:45 +0000
commit2b561cb0e87f2ee535e8c64907883cd275ad3fec (patch)
treebb9d050c5c2984047e6475e087694d6764f24157 /src/lib/libcrypto/bn/bn_asm.c
parent024e2580a5280d4df3724dab76ce52e14fe2060c (diff)
downloadopenbsd-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/bn/bn_asm.c')
-rw-r--r--src/lib/libcrypto/bn/bn_asm.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/lib/libcrypto/bn/bn_asm.c b/src/lib/libcrypto/bn/bn_asm.c
index 49f0ba5d7b..993fbb3dc5 100644
--- a/src/lib/libcrypto/bn/bn_asm.c
+++ b/src/lib/libcrypto/bn/bn_asm.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bn_asm.c,v 1.14 2015/02/25 15:39:49 bcook Exp $ */ 1/* $OpenBSD: bn_asm.c,v 1.15 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 *
@@ -989,8 +989,7 @@ enter:
989 } 989 }
990 memcpy(rp, tp, num * sizeof(BN_ULONG)); 990 memcpy(rp, tp, num * sizeof(BN_ULONG));
991out: 991out:
992 explicit_bzero(tp, (num + 2) * sizeof(BN_ULONG)); 992 freezero(tp, (num + 2) * sizeof(BN_ULONG));
993 free(tp);
994 return 1; 993 return 1;
995} 994}
996#else 995#else
@@ -1081,8 +1080,7 @@ bn_mul_mont(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp,
1081 } 1080 }
1082 memcpy(rp, tp, num * sizeof(BN_ULONG)); 1081 memcpy(rp, tp, num * sizeof(BN_ULONG));
1083out: 1082out:
1084 explicit_bzero(tp, (num + 2) * sizeof(BN_ULONG)); 1083 freezero(tp, (num + 2) * sizeof(BN_ULONG));
1085 free(tp);
1086 return 1; 1084 return 1;
1087} 1085}
1088#else 1086#else