Skip to content

Commit c747471

Browse files
authored
fix retrieving openssl 3 versions (#17)
OpenSSL 3 now generates `include/openssl/opensslv.h` and that file in Node.js now includes the C++ preprocessor macros that are parsed to determine the OpenSSL version via two levels of indirection. Add a fallback (we need to check the original file location first for older release lines using pre-OpenSSL 3) to one of the generated files in the `config` dir.
1 parent c8baabb commit c747471

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

dist-indexer.js

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ const uvVersionUrl = [
3232
]
3333
const sslVersionUrl = [
3434
`${githubContentUrl}/deps/openssl/openssl/include/openssl/opensslv.h`,
35+
`${githubContentUrl}/deps/openssl/config/archs/linux-x86_64/asm/include/openssl/opensslv.h`,
3536
`${githubContentUrl}/deps/openssl/openssl/Makefile`
3637
]
3738
const zlibVersionUrl = `${githubContentUrl}/deps/zlib/zlib.h`
@@ -269,11 +270,27 @@ function fetchSslVersion (gitref, callback) {
269270
return callback(err)
270271
}
271272

272-
const m = rawData.match(/^VERSION=(.+)$/m)
273+
const m = rawData.match(/^#\s*define OPENSSL_VERSION_TEXT\s+"OpenSSL ([^\s]+)/m)
273274
version = m && m[1]
274-
cachePut(gitref, 'ssl', version)
275275

276-
callback(null, version)
276+
if (version) {
277+
version = version.replace(/-fips$/, '')
278+
cachePut(gitref, 'ssl', version)
279+
280+
return callback(null, version)
281+
}
282+
283+
fetch(sslVersionUrl[2], gitref, (err, rawData) => {
284+
if (err) {
285+
return callback(err)
286+
}
287+
288+
const m = rawData.match(/^VERSION=(.+)$/m)
289+
version = m && m[1]
290+
cachePut(gitref, 'ssl', version)
291+
292+
callback(null, version)
293+
})
277294
})
278295
})
279296
}

0 commit comments

Comments
 (0)