Skip to content

Commit e16a04e

Browse files
richardlautargos
authored andcommitted
src: fix dynamically linked OpenSSL version
Report the version of OpenSSL that Node.js is running with instead of the version of OpenSSL that Node.js was compiled against. PR-URL: #53456 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
1 parent 1877f22 commit e16a04e

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/node_metadata.cc

+5-4
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#endif // NODE_BUNDLED_ZLIB
2323

2424
#if HAVE_OPENSSL
25-
#include <openssl/opensslv.h>
25+
#include <openssl/crypto.h>
2626
#if NODE_OPENSSL_HAS_QUIC
2727
#include <openssl/quic.h>
2828
#endif
@@ -54,9 +54,10 @@ static constexpr size_t search(const char* s, char c, size_t n = 0) {
5454
static inline std::string GetOpenSSLVersion() {
5555
// sample openssl version string format
5656
// for reference: "OpenSSL 1.1.0i 14 Aug 2018"
57-
constexpr size_t start = search(OPENSSL_VERSION_TEXT, ' ') + 1;
58-
constexpr size_t len = search(&OPENSSL_VERSION_TEXT[start], ' ');
59-
return std::string(OPENSSL_VERSION_TEXT, start, len);
57+
const char* version = OpenSSL_version(OPENSSL_VERSION);
58+
const size_t start = search(version, ' ') + 1;
59+
const size_t len = search(&version[start], ' ');
60+
return std::string(version, start, len);
6061
}
6162
#endif // HAVE_OPENSSL
6263

0 commit comments

Comments
 (0)