summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/rsa/rsa_saos.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/rsa/rsa_saos.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/rsa/rsa_saos.c')
-rw-r--r--src/lib/libcrypto/rsa/rsa_saos.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/lib/libcrypto/rsa/rsa_saos.c b/src/lib/libcrypto/rsa/rsa_saos.c
index 10184b6c18..e1fbdcb5df 100644
--- a/src/lib/libcrypto/rsa/rsa_saos.c
+++ b/src/lib/libcrypto/rsa/rsa_saos.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: rsa_saos.c,v 1.22 2017/04/28 22:46:40 beck Exp $ */ 1/* $OpenBSD: rsa_saos.c,v 1.23 2017/05/02 03:59:45 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 *
@@ -96,8 +96,7 @@ RSA_sign_ASN1_OCTET_STRING(int type, const unsigned char *m, unsigned int m_len,
96 else 96 else
97 *siglen = i; 97 *siglen = i;
98 98
99 explicit_bzero(s, (unsigned int)j + 1); 99 freezero(s, (unsigned int)j + 1);
100 free(s);
101 return ret; 100 return ret;
102} 101}
103 102
@@ -137,9 +136,6 @@ RSA_verify_ASN1_OCTET_STRING(int dtype, const unsigned char *m,
137 ret = 1; 136 ret = 1;
138err: 137err:
139 ASN1_OCTET_STRING_free(sig); 138 ASN1_OCTET_STRING_free(sig);
140 if (s != NULL) { 139 freezero(s, (unsigned int)siglen);
141 explicit_bzero(s, (unsigned int)siglen);
142 free(s);
143 }
144 return ret; 140 return ret;
145} 141}