1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
commit b664f981aff4b3a0622d63c0f955effc909a0c8f
Author: Philip Prindeville <philipp@redfish-solutions.com>
Date: Thu Feb 5 14:47:50 2026 -0700
[#4338] Build with current Openssl API
--- a/meson.build
+++ b/meson.build
@@ -331,6 +331,12 @@ elif CRYPTO_DEP.name() == openssl.name()
required: true,
)
message('Using OpenSSL.')
+ if cpp.has_function('SSL_get1_peer_certificate', prefix: '#include <openssl/ssl.h>', dependencies: openssl)
+ conf_data.set('HAVE_NEW_SSL_API', 1)
+ endif
+ if cpp.has_function('OpenSSL_version', prefix: '#include <openssl/crypto.h>', dependencies: openssl)
+ conf_data.set('HAVE_OPENSSL_VERSION', 1)
+ endif
else
error('Dependency not found: neither Botan nor OpenSSL.')
endif
--- a/src/lib/asiolink/openssl_tls.h
+++ b/src/lib/asiolink/openssl_tls.h
@@ -171,7 +171,11 @@ public:
///
/// @return The commonName part of the subjectName or the empty string.
virtual std::string getSubject() {
+#ifdef HAVE_NEW_SSL_API
+ ::X509* cert = ::SSL_get1_peer_certificate(this->native_handle());
+#else
::X509* cert = ::SSL_get_peer_certificate(this->native_handle());
+#endif
if (!cert) {
return ("");
}
@@ -205,7 +209,11 @@ public:
///
/// @return The commonName part of the issuerName or the empty string.
virtual std::string getIssuer() {
+#ifdef HAVE_NEW_SSL_API
+ ::X509* cert = ::SSL_get1_peer_certificate(this->native_handle());
+#else
::X509* cert = ::SSL_get_peer_certificate(this->native_handle());
+#endif
if (!cert) {
return ("");
}
--- a/src/lib/cryptolink/openssl_link.cc
+++ b/src/lib/cryptolink/openssl_link.cc
@@ -77,7 +77,11 @@ CryptoLink::initialize(CryptoLink& c) {
std::string
CryptoLink::getVersion() {
+#ifdef HAVE_OPENSSL_VERSION
+ return (OpenSSL_version(OPENSSL_VERSION));
+#else
return (SSLeay_version(SSLEAY_VERSION));
+#endif
}
} // namespace cryptolink
|