summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/rsa/rsa_eay.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_eay.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_eay.c')
-rw-r--r--src/lib/libcrypto/rsa/rsa_eay.c22
1 files changed, 5 insertions, 17 deletions
diff --git a/src/lib/libcrypto/rsa/rsa_eay.c b/src/lib/libcrypto/rsa/rsa_eay.c
index f9f620ae23..6c3da0d656 100644
--- a/src/lib/libcrypto/rsa/rsa_eay.c
+++ b/src/lib/libcrypto/rsa/rsa_eay.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: rsa_eay.c,v 1.48 2017/04/28 22:46:40 beck Exp $ */ 1/* $OpenBSD: rsa_eay.c,v 1.49 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 *
@@ -244,10 +244,7 @@ err:
244 BN_CTX_end(ctx); 244 BN_CTX_end(ctx);
245 BN_CTX_free(ctx); 245 BN_CTX_free(ctx);
246 } 246 }
247 if (buf != NULL) { 247 freezero(buf, num);
248 explicit_bzero(buf, num);
249 free(buf);
250 }
251 return r; 248 return r;
252} 249}
253 250
@@ -468,10 +465,7 @@ err:
468 BN_CTX_end(ctx); 465 BN_CTX_end(ctx);
469 BN_CTX_free(ctx); 466 BN_CTX_free(ctx);
470 } 467 }
471 if (buf != NULL) { 468 freezero(buf, num);
472 explicit_bzero(buf, num);
473 free(buf);
474 }
475 return r; 469 return r;
476} 470}
477 471
@@ -597,10 +591,7 @@ err:
597 BN_CTX_end(ctx); 591 BN_CTX_end(ctx);
598 BN_CTX_free(ctx); 592 BN_CTX_free(ctx);
599 } 593 }
600 if (buf != NULL) { 594 freezero(buf, num);
601 explicit_bzero(buf, num);
602 free(buf);
603 }
604 return r; 595 return r;
605} 596}
606 597
@@ -700,10 +691,7 @@ err:
700 BN_CTX_end(ctx); 691 BN_CTX_end(ctx);
701 BN_CTX_free(ctx); 692 BN_CTX_free(ctx);
702 } 693 }
703 if (buf != NULL) { 694 freezero(buf, num);
704 explicit_bzero(buf, num);
705 free(buf);
706 }
707 return r; 695 return r;
708} 696}
709 697