Skip to content

Commit

Permalink
print OpenSSL error reason when certificate load fails (#596)
Browse files Browse the repository at this point in the history
  • Loading branch information
rajeshsingh381 authored Dec 1, 2022
1 parent 90bfdae commit 58d74ec
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/sslsocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,14 +336,18 @@ enum tls_init_status TLS_init_context(void)
if (SSL_CTX_use_certificate_file(sip_trp_ssl_ctx,
tls_cert_name,
SSL_FILETYPE_PEM) != 1) {
ERROR("TLS_init_context: SSL_CTX_use_certificate_file failed");
char errbuf[256] = {'\0'};
ERR_error_string_n(ERR_get_error(), errbuf, sizeof(errbuf));
ERROR("TLS_init_context: SSL_CTX_use_certificate_file failed: %s", errbuf);
return TLS_INIT_ERROR;
}

if (SSL_CTX_use_certificate_file(sip_trp_ssl_ctx_client,
tls_cert_name,
SSL_FILETYPE_PEM) != 1) {
ERROR("TLS_init_context: SSL_CTX_use_certificate_file (client) failed");
char errbuf[256] = {'\0'};
ERR_error_string_n(ERR_get_error(), errbuf, sizeof(errbuf));
ERROR("TLS_init_context: SSL_CTX_use_certificate_file (client) failed: %s", errbuf);
return TLS_INIT_ERROR;
}
if (SSL_CTX_use_PrivateKey_file(sip_trp_ssl_ctx,
Expand Down

0 comments on commit 58d74ec

Please sign in to comment.