Skip to content

Commit 6615fe5

Browse files
committedSep 27, 2024
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 627d399 commit 6615fe5

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
@@ -17,7 +17,7 @@
1717
#include "zlib.h"
1818

1919
#if HAVE_OPENSSL
20-
#include <openssl/opensslv.h>
20+
#include <openssl/crypto.h>
2121
#if NODE_OPENSSL_HAS_QUIC
2222
#include <openssl/quic.h>
2323
#endif
@@ -49,9 +49,10 @@ static constexpr size_t search(const char* s, char c, size_t n = 0) {
4949
static inline std::string GetOpenSSLVersion() {
5050
// sample openssl version string format
5151
// for reference: "OpenSSL 1.1.0i 14 Aug 2018"
52-
constexpr size_t start = search(OPENSSL_VERSION_TEXT, ' ') + 1;
53-
constexpr size_t len = search(&OPENSSL_VERSION_TEXT[start], ' ');
54-
return std::string(OPENSSL_VERSION_TEXT, start, len);
52+
const char* version = OpenSSL_version(OPENSSL_VERSION);
53+
const size_t start = search(version, ' ') + 1;
54+
const size_t len = search(&version[start], ' ');
55+
return std::string(version, start, len);
5556
}
5657
#endif // HAVE_OPENSSL
5758

0 commit comments

Comments
 (0)
Please sign in to comment.