Skip to content

Commit 33f5555

Browse files
committed
SSL: simplified ssl_password_file error handling.
Instead of collecting a number of the possible SSL_CTX_use_PrivateKey_file() error codes that becomes more and more difficult with the rising variety of OpenSSL versions and its derivatives, just continue with the next password. Multiple passwords in a single ssl_password_file feature was broken after recent OpenSSL changes (commit 4aac102f75b517bdb56b1bcfd0a856052d559f6e). Affected OpenSSL releases: 0.9.8zc, 1.0.0o, 1.0.1j and 1.0.2-beta3. Reported by Piotr Sikora.
1 parent 54606d4 commit 33f5555

File tree

1 file changed

+3
-14
lines changed

1 file changed

+3
-14
lines changed

src/event/ngx_event_openssl.c

+3-14
Original file line numberDiff line numberDiff line change
@@ -404,20 +404,9 @@ ngx_ssl_certificate(ngx_conf_t *cf, ngx_ssl_t *ssl, ngx_str_t *cert,
404404
}
405405

406406
if (--tries) {
407-
n = ERR_peek_error();
408-
409-
#ifdef OPENSSL_IS_BORINGSSL
410-
if (ERR_GET_LIB(n) == ERR_LIB_CIPHER
411-
&& ERR_GET_REASON(n) == CIPHER_R_BAD_DECRYPT)
412-
#else
413-
if (ERR_GET_LIB(n) == ERR_LIB_EVP
414-
&& ERR_GET_REASON(n) == EVP_R_BAD_DECRYPT)
415-
#endif
416-
{
417-
ERR_clear_error();
418-
SSL_CTX_set_default_passwd_cb_userdata(ssl->ctx, ++pwd);
419-
continue;
420-
}
407+
ERR_clear_error();
408+
SSL_CTX_set_default_passwd_cb_userdata(ssl->ctx, ++pwd);
409+
continue;
421410
}
422411

423412
ngx_ssl_error(NGX_LOG_EMERG, ssl->log, 0,

0 commit comments

Comments
 (0)