Skip to content

Commit 8f4ba12

Browse files
pjgeorgfsaporito
authored andcommitted
Replace deprecated function for OpenSSL >= 3.0 (datastax#518)
ERR_get_error_line_data is deprecated in OpenSSL >= 3.0. It can be replaced by the newer function ERR_get_error_all added in OpenSSL 3.0.
1 parent 96dbee4 commit 8f4ba12

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/ssl/ssl_openssl_impl.cpp

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,13 @@ static void ssl_log_errors(const char* context) {
9191
const char* data;
9292
int flags;
9393
int err;
94-
while ((err = ERR_get_error_line_data(NULL, NULL, &data, &flags)) != 0) {
94+
while ((err =
95+
#if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
96+
ERR_get_error_all(NULL, NULL, NULL, &data, &flags)
97+
#else
98+
ERR_get_error_line_data(NULL, NULL, &data, &flags)
99+
#endif
100+
) != 0) {
95101
char buf[256];
96102
ERR_error_string_n(err, buf, sizeof(buf));
97103
LOG_ERROR("%s: %s:%s", context, buf, (flags & ERR_TXT_STRING) ? data : "");
@@ -104,7 +110,13 @@ static String ssl_error_string() {
104110
int flags;
105111
int err;
106112
String error;
107-
while ((err = ERR_get_error_line_data(NULL, NULL, &data, &flags)) != 0) {
113+
while ((err =
114+
#if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
115+
ERR_get_error_all(NULL, NULL, NULL, &data, &flags)
116+
#else
117+
ERR_get_error_line_data(NULL, NULL, &data, &flags)
118+
#endif
119+
) != 0) {
108120
char buf[256];
109121
ERR_error_string_n(err, buf, sizeof(buf));
110122
if (!error.empty()) error.push_back(',');

0 commit comments

Comments
 (0)