Skip to content

Replace deprecated function for OpenSSL >= 3.0 #518

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 10, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions src/ssl/ssl_openssl_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,13 @@ static void ssl_log_errors(const char* context) {
const char* data;
int flags;
int err;
while ((err = ERR_get_error_line_data(NULL, NULL, &data, &flags)) != 0) {
while ((err =
#if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
ERR_get_error_all(NULL, NULL, NULL, &data, &flags)
#else
ERR_get_error_line_data(NULL, NULL, &data, &flags)
#endif
) != 0) {
char buf[256];
ERR_error_string_n(err, buf, sizeof(buf));
LOG_ERROR("%s: %s:%s", context, buf, (flags & ERR_TXT_STRING) ? data : "");
Expand All @@ -104,7 +110,13 @@ static String ssl_error_string() {
int flags;
int err;
String error;
while ((err = ERR_get_error_line_data(NULL, NULL, &data, &flags)) != 0) {
while ((err =
#if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
ERR_get_error_all(NULL, NULL, NULL, &data, &flags)
#else
ERR_get_error_line_data(NULL, NULL, &data, &flags)
#endif
) != 0) {
char buf[256];
ERR_error_string_n(err, buf, sizeof(buf));
if (!error.empty()) error.push_back(',');
Expand Down