- Philip Prindeville
2024-09: Brought down the number of utilities keactrl depends on.
+ 2026-03: Support compiling without deprecated OpenSSL API.
- q66
2025-01: Added support for building with Boost 1.87.
/* Compile with OpenSSL crypto */
#mesondefine WITH_OPENSSL
+
+/* OpenSSL has the new X.509 certificate API */
+#mesondefine HAVE_NEW_SSL_API
+
+/* Use OpenSSL_version() instead of SSLeay_version() */
+#mesondefine HAVE_OPENSSL_VERSION
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', true)
+ endif
+ if cpp.has_function(
+ 'OpenSSL_version',
+ prefix: '#include <openssl/crypto.h>',
+ dependencies: openssl,
+ )
+ conf_data.set('HAVE_OPENSSL_VERSION', true)
+ endif
else
error('Dependency not found: neither Botan nor OpenSSL.')
endif
///
/// @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 ("");
}
///
/// @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 ("");
}
std::string
CryptoLink::getVersion() {
+#ifdef HAVE_OPENSSL_VERSION
+ return (OpenSSL_version(OPENSSL_VERSION));
+#else
return (SSLeay_version(SSLEAY_VERSION));
+#endif
}
} // namespace cryptolink