diff options
author | beck <> | 2017-04-28 22:38:51 +0000 |
---|---|---|
committer | beck <> | 2017-04-28 22:38:51 +0000 |
commit | 56efd82fd673bfdc68211c3fedb80c9ce8fdf05b (patch) | |
tree | cbc1f0f81b292f59a4de3cce8e808ae7e8f1ac30 | |
parent | fe7bbe3c3bf529f35488281aa8cb0ed03a308a6d (diff) | |
download | openbsd-56efd82fd673bfdc68211c3fedb80c9ce8fdf05b.tar.gz openbsd-56efd82fd673bfdc68211c3fedb80c9ce8fdf05b.tar.bz2 openbsd-56efd82fd673bfdc68211c3fedb80c9ce8fdf05b.zip |
*** empty log message ***
-rw-r--r-- | src/lib/libcrypto/malloc-wrapper.c | 5 | ||||
-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 | ||||
-rw-r--r-- | src/lib/libcrypto/x509/x509_vfy.c | 12 |
5 files changed, 25 insertions, 46 deletions
diff --git a/src/lib/libcrypto/malloc-wrapper.c b/src/lib/libcrypto/malloc-wrapper.c index 68af818230..d69b025173 100644 --- a/src/lib/libcrypto/malloc-wrapper.c +++ b/src/lib/libcrypto/malloc-wrapper.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: malloc-wrapper.c,v 1.3 2014/04/20 14:32:19 jsing Exp $ */ | 1 | /* $OpenBSD: malloc-wrapper.c,v 1.4 2017/04/28 22:38:51 beck Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2014 Bob Beck | 3 | * Copyright (c) 2014 Bob Beck |
4 | * | 4 | * |
@@ -165,8 +165,7 @@ CRYPTO_realloc_clean(void *ptr, int old_len, int num, const char *file, | |||
165 | ret = malloc(num); | 165 | ret = malloc(num); |
166 | if (ret && ptr && old_len > 0) { | 166 | if (ret && ptr && old_len > 0) { |
167 | memcpy(ret, ptr, old_len); | 167 | memcpy(ret, ptr, old_len); |
168 | explicit_bzero(ptr, old_len); | 168 | freezero(ptr, old_len); |
169 | free(ptr); | ||
170 | } | 169 | } |
171 | return ret; | 170 | return ret; |
172 | } | 171 | } |
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 | ||
diff --git a/src/lib/libcrypto/x509/x509_vfy.c b/src/lib/libcrypto/x509/x509_vfy.c index fbed5ec800..09d33d4cf1 100644 --- a/src/lib/libcrypto/x509/x509_vfy.c +++ b/src/lib/libcrypto/x509/x509_vfy.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: x509_vfy.c,v 1.61 2017/02/05 02:33:21 beck Exp $ */ | 1 | /* $OpenBSD: x509_vfy.c,v 1.62 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 | * |
@@ -541,15 +541,7 @@ X509_verify_cert(X509_STORE_CTX *ctx) | |||
541 | /* Safety net, error returns must set ctx->error */ | 541 | /* Safety net, error returns must set ctx->error */ |
542 | if (ok <= 0 && ctx->error == X509_V_OK) | 542 | if (ok <= 0 && ctx->error == X509_V_OK) |
543 | ctx->error = X509_V_ERR_UNSPECIFIED; | 543 | ctx->error = X509_V_ERR_UNSPECIFIED; |
544 | 544 | return ok; | |
545 | /* | ||
546 | * Safety net, if user provided verify callback indicates sucess | ||
547 | * make sure they have set error to X509_V_OK | ||
548 | */ | ||
549 | if (ctx->verify_cb != null_callback && ok == 1) | ||
550 | ctx->error = X509_V_OK; | ||
551 | |||
552 | return(ctx->error == X509_V_OK); | ||
553 | } | 545 | } |
554 | 546 | ||
555 | /* Given a STACK_OF(X509) find the issuer of cert (if any) | 547 | /* Given a STACK_OF(X509) find the issuer of cert (if any) |