summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/asn1/a_sign.c
diff options
context:
space:
mode:
authorderaadt <>2017-05-02 03:59:45 +0000
committerderaadt <>2017-05-02 03:59:45 +0000
commit5904cc0e04409fde39a97e6580535da34eeb4291 (patch)
treebb9d050c5c2984047e6475e087694d6764f24157 /src/lib/libcrypto/asn1/a_sign.c
parentb3449a25972849293bca9a6fc6581f37f6e0faf6 (diff)
downloadopenbsd-5904cc0e04409fde39a97e6580535da34eeb4291.tar.gz
openbsd-5904cc0e04409fde39a97e6580535da34eeb4291.tar.bz2
openbsd-5904cc0e04409fde39a97e6580535da34eeb4291.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/a_sign.c')
-rw-r--r--src/lib/libcrypto/asn1/a_sign.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/lib/libcrypto/asn1/a_sign.c b/src/lib/libcrypto/asn1/a_sign.c
index 4e545eb719..df955be745 100644
--- a/src/lib/libcrypto/asn1/a_sign.c
+++ b/src/lib/libcrypto/asn1/a_sign.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: a_sign.c,v 1.22 2017/01/29 17:49:22 beck Exp $ */ 1/* $OpenBSD: a_sign.c,v 1.23 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 *
@@ -227,13 +227,7 @@ ASN1_item_sign_ctx(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2,
227 227
228err: 228err:
229 EVP_MD_CTX_cleanup(ctx); 229 EVP_MD_CTX_cleanup(ctx);
230 if (buf_in != NULL) { 230 freezero((char *)buf_in, inl);
231 explicit_bzero((char *)buf_in, inl); 231 freezero((char *)buf_out, outll);
232 free(buf_in);
233 }
234 if (buf_out != NULL) {
235 explicit_bzero((char *)buf_out, outll);
236 free(buf_out);
237 }
238 return (outl); 232 return (outl);
239} 233}