diff --git a/src/node_metadata.cc b/src/node_metadata.cc index 844c5ac2c2b948..985d44b3cd1f1a 100644 --- a/src/node_metadata.cc +++ b/src/node_metadata.cc @@ -22,7 +22,7 @@ #endif // NODE_BUNDLED_ZLIB #if HAVE_OPENSSL -#include +#include #if NODE_OPENSSL_HAS_QUIC #include #endif @@ -54,9 +54,10 @@ static constexpr size_t search(const char* s, char c, size_t n = 0) { static inline std::string GetOpenSSLVersion() { // sample openssl version string format // for reference: "OpenSSL 1.1.0i 14 Aug 2018" - constexpr size_t start = search(OPENSSL_VERSION_TEXT, ' ') + 1; - constexpr size_t len = search(&OPENSSL_VERSION_TEXT[start], ' '); - return std::string(OPENSSL_VERSION_TEXT, start, len); + const char* version = OpenSSL_version(OPENSSL_VERSION); + const size_t start = search(version, ' ') + 1; + const size_t len = search(&version[start], ' '); + return std::string(version, start, len); } #endif // HAVE_OPENSSL