Skip to content

Commit e520e59

Browse files
committed
Add support for OpenSSL3 to OpenSSLConnection
1 parent c40585b commit e520e59

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/generic/OpenSSLConnection.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,15 @@ OpenSSLConnection::SSLFuncs::SSLFuncs()
1313

1414
valid = false;
1515

16+
// Try OpenSSL 3
17+
handle *sslhandle = OpenLibrary("libssl.so.3");
18+
handle *cryptohandle = OpenLibrary("libcrypto.so.3");
1619
// Try OpenSSL 1.1
17-
handle *sslhandle = OpenLibrary("libssl.so.1.1");
18-
handle *cryptohandle = OpenLibrary("libcrypto.so.1.1");
20+
if (!sslhandle || !cryptohandle)
21+
{
22+
sslhandle = OpenLibrary("libssl.so.1.1");
23+
cryptohandle = OpenLibrary("libcrypto.so.1.1");
24+
}
1925
// Try OpenSSL 1.0
2026
if (!sslhandle || !cryptohandle)
2127
{
@@ -50,7 +56,8 @@ OpenSSLConnection::SSLFuncs::SSLFuncs()
5056
valid = valid && LoadSymbol(write, sslhandle, "SSL_write");
5157
valid = valid && LoadSymbol(shutdown, sslhandle, "SSL_shutdown");
5258
valid = valid && LoadSymbol(get_verify_result, sslhandle, "SSL_get_verify_result");
53-
valid = valid && LoadSymbol(get_peer_certificate, sslhandle, "SSL_get_peer_certificate");
59+
valid = valid && (LoadSymbol(get_peer_certificate, sslhandle, "SSL_get1_peer_certificate") ||
60+
LoadSymbol(get_peer_certificate, sslhandle, "SSL_get_peer_certificate"));
5461

5562
valid = valid && (LoadSymbol(SSLv23_method, sslhandle, "SSLv23_method") ||
5663
LoadSymbol(SSLv23_method, sslhandle, "TLS_method"));

0 commit comments

Comments
 (0)