diff options
Diffstat (limited to 'src/lib/libcrypto/rsa')
-rw-r--r-- | src/lib/libcrypto/rsa/rsa_eay.c | 26 | ||||
-rw-r--r-- | src/lib/libcrypto/rsa/rsa_saos.c | 12 | ||||
-rw-r--r-- | src/lib/libcrypto/rsa/rsa_sign.c | 16 |
3 files changed, 21 insertions, 33 deletions
diff --git a/src/lib/libcrypto/rsa/rsa_eay.c b/src/lib/libcrypto/rsa/rsa_eay.c index 90a3be8dd3..128269a81a 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.46 2017/01/29 17:49:23 beck Exp $ */ | 1 | /* $OpenBSD: rsa_eay.c,v 1.47 2017/04/28 22:38:51 beck 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,8 @@ 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); | 248 | |
249 | free(buf); | ||
250 | } | ||
251 | return r; | 249 | return r; |
252 | } | 250 | } |
253 | 251 | ||
@@ -468,10 +466,8 @@ err: | |||
468 | BN_CTX_end(ctx); | 466 | BN_CTX_end(ctx); |
469 | BN_CTX_free(ctx); | 467 | BN_CTX_free(ctx); |
470 | } | 468 | } |
471 | if (buf != NULL) { | 469 | freezero(buf, num); |
472 | explicit_bzero(buf, num); | 470 | |
473 | free(buf); | ||
474 | } | ||
475 | return r; | 471 | return r; |
476 | } | 472 | } |
477 | 473 | ||
@@ -597,10 +593,8 @@ err: | |||
597 | BN_CTX_end(ctx); | 593 | BN_CTX_end(ctx); |
598 | BN_CTX_free(ctx); | 594 | BN_CTX_free(ctx); |
599 | } | 595 | } |
600 | if (buf != NULL) { | 596 | freezero(buf, num); |
601 | explicit_bzero(buf, num); | 597 | |
602 | free(buf); | ||
603 | } | ||
604 | return r; | 598 | return r; |
605 | } | 599 | } |
606 | 600 | ||
@@ -700,10 +694,8 @@ err: | |||
700 | BN_CTX_end(ctx); | 694 | BN_CTX_end(ctx); |
701 | BN_CTX_free(ctx); | 695 | BN_CTX_free(ctx); |
702 | } | 696 | } |
703 | if (buf != NULL) { | 697 | freezero(buf, num); |
704 | explicit_bzero(buf, num); | 698 | |
705 | free(buf); | ||
706 | } | ||
707 | return r; | 699 | return r; |
708 | } | 700 | } |
709 | 701 | ||
diff --git a/src/lib/libcrypto/rsa/rsa_saos.c b/src/lib/libcrypto/rsa/rsa_saos.c index 179217c236..50522b972a 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.20 2017/01/29 17:49:23 beck Exp $ */ | 1 | /* $OpenBSD: rsa_saos.c,v 1.21 2017/04/28 22:38:51 beck 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,8 @@ 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); | 100 | |
101 | return ret; | 101 | return ret; |
102 | } | 102 | } |
103 | 103 | ||
@@ -137,9 +137,7 @@ RSA_verify_ASN1_OCTET_STRING(int dtype, const unsigned char *m, | |||
137 | ret = 1; | 137 | ret = 1; |
138 | err: | 138 | err: |
139 | ASN1_OCTET_STRING_free(sig); | 139 | ASN1_OCTET_STRING_free(sig); |
140 | if (s != NULL) { | 140 | freezero(s, siglen); |
141 | explicit_bzero(s, (unsigned int)siglen); | 141 | |
142 | free(s); | ||
143 | } | ||
144 | return ret; | 142 | return ret; |
145 | } | 143 | } |
diff --git a/src/lib/libcrypto/rsa/rsa_sign.c b/src/lib/libcrypto/rsa/rsa_sign.c index 52cbc3dfe3..618ec155cc 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.26 2017/01/29 17:49:23 beck Exp $ */ | 1 | /* $OpenBSD: rsa_sign.c,v 1.27 2017/04/28 22:38:51 beck 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,9 @@ 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); | 140 | |
141 | } | ||
142 | return (ret); | 141 | return (ret); |
143 | } | 142 | } |
144 | 143 | ||
@@ -234,10 +233,9 @@ int_rsa_verify(int dtype, const unsigned char *m, unsigned int m_len, | |||
234 | err: | 233 | err: |
235 | if (sig != NULL) | 234 | if (sig != NULL) |
236 | X509_SIG_free(sig); | 235 | X509_SIG_free(sig); |
237 | if (s != NULL) { | 236 | |
238 | explicit_bzero(s, (unsigned int)siglen); | 237 | freezero(s, (unsigned int)siglen); |
239 | free(s); | 238 | |
240 | } | ||
241 | return ret; | 239 | return ret; |
242 | } | 240 | } |
243 | 241 | ||