Skip to content

Commit

Permalink
[SBI] Guard OpenSSL keylog callback with version check
Browse files Browse the repository at this point in the history
Wrap SSL_CTX_set_keylog_callback calls with an OpenSSL version check
to ensure compatibility with versions older than 1.1.1.

This prevents compilation issues on earlier OpenSSL releases,
such as those found on Ubuntu 18.04(bionic).
  • Loading branch information
acetcom committed Jan 19, 2025
1 parent 9c370ff commit aaa950e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/sbi/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -386,8 +386,10 @@ static CURLcode sslctx_callback(CURL *curl, void *sslctx, void *userdata)
/* Ensure app data is set for SSL objects */
SSL_CTX_set_app_data(ctx, client->sslkeylog);

#if OPENSSL_VERSION_NUMBER >= 0x10101000L
/* Set the SSL Key Log callback */
SSL_CTX_set_keylog_callback(ctx, ogs_sbi_keylog_callback);
#endif

return CURLE_OK;
}
Expand Down
2 changes: 2 additions & 0 deletions lib/sbi/nghttp2-server.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,10 @@ static SSL_CTX *create_ssl_ctx(
if (sslkeylog_file) {
/* Ensure app data is set for SSL objects */
SSL_CTX_set_app_data(ssl_ctx, sslkeylog_file);
#if OPENSSL_VERSION_NUMBER >= 0x10101000L
/* Set the SSL Key Log callback */
SSL_CTX_set_keylog_callback(ssl_ctx, ogs_sbi_keylog_callback);
#endif
}

ssl_opts = (SSL_OP_ALL & ~SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS) |
Expand Down

0 comments on commit aaa950e

Please sign in to comment.