diff options
author | atishkov <a.tishkov@aladdin.ru> | 2023-07-07 16:00:38 +0300 |
---|---|---|
committer | Pauli <pauli@openssl.org> | 2023-07-17 08:52:30 +1000 |
commit | 33ef5fc2c2bf0b0587bfcba28f61329abd83be70 (patch) | |
tree | 282367dc4422105213aa71085751058a285f0711 /ssl/ssl_rsa.c | |
parent | 01b048513153bdbee3efc82389d38d353352a7f1 (diff) |
Remove unreachable code from SSL_use_certificate_file() as in SSL_CTX_use_certificate_file()
CLA: trivial
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
(Merged from https://github.com/openssl/openssl/pull/21394)
Diffstat (limited to 'ssl/ssl_rsa.c')
-rw-r--r-- | ssl/ssl_rsa.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/ssl/ssl_rsa.c b/ssl/ssl_rsa.c index 3d4ad85a62..1df087abd1 100644 --- a/ssl/ssl_rsa.c +++ b/ssl/ssl_rsa.c @@ -68,10 +68,6 @@ int SSL_use_certificate_file(SSL *ssl, const char *file, int type) goto end; } - if (type != SSL_FILETYPE_ASN1 && type != SSL_FILETYPE_PEM) { - ERR_raise(ERR_LIB_SSL, SSL_R_BAD_SSL_FILETYPE); - goto end; - } x = X509_new_ex(ssl->ctx->libctx, ssl->ctx->propq); if (x == NULL) { ERR_raise(ERR_LIB_SSL, ERR_R_ASN1_LIB); @@ -314,10 +310,7 @@ int SSL_CTX_use_certificate_file(SSL_CTX *ctx, const char *file, int type) ERR_raise(ERR_LIB_SSL, ERR_R_SYS_LIB); goto end; } - if (type != SSL_FILETYPE_ASN1 && type != SSL_FILETYPE_PEM) { - ERR_raise(ERR_LIB_SSL, SSL_R_BAD_SSL_FILETYPE); - goto end; - } + x = X509_new_ex(ctx->libctx, ctx->propq); if (x == NULL) { ERR_raise(ERR_LIB_SSL, ERR_R_ASN1_LIB); @@ -330,6 +323,9 @@ int SSL_CTX_use_certificate_file(SSL_CTX *ctx, const char *file, int type) j = ERR_R_PEM_LIB; cert = PEM_read_bio_X509(in, &x, ctx->default_passwd_callback, ctx->default_passwd_callback_userdata); + } else { + ERR_raise(ERR_LIB_SSL, SSL_R_BAD_SSL_FILETYPE); + goto end; } if (cert == NULL) { ERR_raise(ERR_LIB_SSL, j); |