summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/rsa
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/rsa')
-rw-r--r--src/lib/libcrypto/rsa/rsa_eay.c22
-rw-r--r--src/lib/libcrypto/rsa/rsa_saos.c10
-rw-r--r--src/lib/libcrypto/rsa/rsa_sign.c16
3 files changed, 13 insertions, 35 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
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}
diff --git a/src/lib/libcrypto/rsa/rsa_sign.c b/src/lib/libcrypto/rsa/rsa_sign.c
index 818b88c604..6e9e869f0a 100644
--- a/src/lib/libcrypto/rsa/rsa_sign.c
+++ b/src/lib/libcrypto/rsa/rsa_sign.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: rsa_sign.c,v 1.28 2017/04/28 22:46:40 beck Exp $ */ 1/* $OpenBSD: rsa_sign.c,v 1.29 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 *
@@ -135,10 +135,8 @@ RSA_sign(int type, const unsigned char *m, unsigned int m_len,
135 else 135 else
136 *siglen = i; 136 *siglen = i;
137 137
138 if (type != NID_md5_sha1) { 138 if (type != NID_md5_sha1)
139 explicit_bzero(tmps, (unsigned int)j + 1); 139 freezero(tmps, (unsigned int)j + 1);
140 free(tmps);
141 }
142 return (ret); 140 return (ret);
143} 141}
144 142
@@ -232,12 +230,8 @@ int_rsa_verify(int dtype, const unsigned char *m, unsigned int m_len,
232 ret = 1; 230 ret = 1;
233 } 231 }
234err: 232err:
235 if (sig != NULL) 233 X509_SIG_free(sig);
236 X509_SIG_free(sig); 234 freezero(s, (unsigned int)siglen);
237 if (s != NULL) {
238 explicit_bzero(s, (unsigned int)siglen);
239 free(s);
240 }
241 return ret; 235 return ret;
242} 236}
243 237