diff options
| author | schwarze <> | 2021-11-10 09:00:21 +0000 |
|---|---|---|
| committer | schwarze <> | 2021-11-10 09:00:21 +0000 |
| commit | 55467db80ad5175dbedeef72e2591c1bca714269 (patch) | |
| tree | 54c07f4deb379431d9c1053700dcdd6ce9d02dad /src | |
| parent | 4d7b2a303b0012f3d9ea474efcca97480a760a9e (diff) | |
| download | openbsd-55467db80ad5175dbedeef72e2591c1bca714269.tar.gz openbsd-55467db80ad5175dbedeef72e2591c1bca714269.tar.bz2 openbsd-55467db80ad5175dbedeef72e2591c1bca714269.zip | |
Merge two bug fixes from the OpenSSL 1.1.1 branch, which is still
under a free license:
1. If the three X509_load_*(3) functions are called with a NULL
file argument, do not return 1 to the caller because the return
value 1 means "i loaded one certificate or CRL into the store".
2. When calling PEM load functions, do not ask the user for a
password in an interactive manner.
This includes parts of the following commits:
commit c0452248ea1a59a41023a4765ef7d9825e80a62b
Author: Rich Salz <rsalz@openssl.org>
Date: Thu Apr 20 15:33:42 2017 -0400
Message: [...] Remove NULL checks and allow a segv to occur. [...]
commit db854bb14a7010712cfc02861731399b1b587474
Author: Bernd Edlinger <bernd.edlinger@hotmail.de>
Date: Mon Aug 7 18:02:53 2017 +0200
Message: Avoid surpising password dialog in X509 file lookup.
OK tb@
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libcrypto/x509/by_file.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/lib/libcrypto/x509/by_file.c b/src/lib/libcrypto/x509/by_file.c index f719636412..db66617d2b 100644 --- a/src/lib/libcrypto/x509/by_file.c +++ b/src/lib/libcrypto/x509/by_file.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: by_file.c,v 1.22 2021/11/01 20:53:08 tb Exp $ */ | 1 | /* $OpenBSD: by_file.c,v 1.23 2021/11/10 09:00:21 schwarze 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 | * |
| @@ -127,8 +127,6 @@ X509_load_cert_file(X509_LOOKUP *ctx, const char *file, int type) | |||
| 127 | int i, count = 0; | 127 | int i, count = 0; |
| 128 | X509 *x = NULL; | 128 | X509 *x = NULL; |
| 129 | 129 | ||
| 130 | if (file == NULL) | ||
| 131 | return (1); | ||
| 132 | in = BIO_new(BIO_s_file_internal()); | 130 | in = BIO_new(BIO_s_file_internal()); |
| 133 | 131 | ||
| 134 | if ((in == NULL) || (BIO_read_filename(in, file) <= 0)) { | 132 | if ((in == NULL) || (BIO_read_filename(in, file) <= 0)) { |
| @@ -138,7 +136,7 @@ X509_load_cert_file(X509_LOOKUP *ctx, const char *file, int type) | |||
| 138 | 136 | ||
| 139 | if (type == X509_FILETYPE_PEM) { | 137 | if (type == X509_FILETYPE_PEM) { |
| 140 | for (;;) { | 138 | for (;;) { |
| 141 | x = PEM_read_bio_X509_AUX(in, NULL, NULL, NULL); | 139 | x = PEM_read_bio_X509_AUX(in, NULL, NULL, ""); |
| 142 | if (x == NULL) { | 140 | if (x == NULL) { |
| 143 | if ((ERR_GET_REASON(ERR_peek_last_error()) == | 141 | if ((ERR_GET_REASON(ERR_peek_last_error()) == |
| 144 | PEM_R_NO_START_LINE) && (count > 0)) { | 142 | PEM_R_NO_START_LINE) && (count > 0)) { |
| @@ -185,8 +183,6 @@ X509_load_crl_file(X509_LOOKUP *ctx, const char *file, int type) | |||
| 185 | int i, count = 0; | 183 | int i, count = 0; |
| 186 | X509_CRL *x = NULL; | 184 | X509_CRL *x = NULL; |
| 187 | 185 | ||
| 188 | if (file == NULL) | ||
| 189 | return (1); | ||
| 190 | in = BIO_new(BIO_s_file_internal()); | 186 | in = BIO_new(BIO_s_file_internal()); |
| 191 | 187 | ||
| 192 | if ((in == NULL) || (BIO_read_filename(in, file) <= 0)) { | 188 | if ((in == NULL) || (BIO_read_filename(in, file) <= 0)) { |
| @@ -196,7 +192,7 @@ X509_load_crl_file(X509_LOOKUP *ctx, const char *file, int type) | |||
| 196 | 192 | ||
| 197 | if (type == X509_FILETYPE_PEM) { | 193 | if (type == X509_FILETYPE_PEM) { |
| 198 | for (;;) { | 194 | for (;;) { |
| 199 | x = PEM_read_bio_X509_CRL(in, NULL, NULL, NULL); | 195 | x = PEM_read_bio_X509_CRL(in, NULL, NULL, ""); |
| 200 | if (x == NULL) { | 196 | if (x == NULL) { |
| 201 | if ((ERR_GET_REASON(ERR_peek_last_error()) == | 197 | if ((ERR_GET_REASON(ERR_peek_last_error()) == |
| 202 | PEM_R_NO_START_LINE) && (count > 0)) { | 198 | PEM_R_NO_START_LINE) && (count > 0)) { |
| @@ -250,7 +246,7 @@ X509_load_cert_crl_file(X509_LOOKUP *ctx, const char *file, int type) | |||
| 250 | X509error(ERR_R_SYS_LIB); | 246 | X509error(ERR_R_SYS_LIB); |
| 251 | return 0; | 247 | return 0; |
| 252 | } | 248 | } |
| 253 | inf = PEM_X509_INFO_read_bio(in, NULL, NULL, NULL); | 249 | inf = PEM_X509_INFO_read_bio(in, NULL, NULL, ""); |
| 254 | BIO_free(in); | 250 | BIO_free(in); |
| 255 | if (!inf) { | 251 | if (!inf) { |
| 256 | X509error(ERR_R_PEM_LIB); | 252 | X509error(ERR_R_PEM_LIB); |
