Skip to content

Commit 5909cf3

Browse files
richardlaunodejs-github-bot
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: nodejs#53456 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
1 parent 26f2cbd commit 5909cf3

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/node_metadata.cc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#endif // NODE_BUNDLED_ZLIB
2424

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

0 commit comments

Comments
 (0)