Skip to content

Commit 24762a1

Browse files
committed
deps: fix OpenSSL security level at 1
Node.js 22 was released with OpenSSL 3.0 which had a default security level of 1. OpenSSL 3.2 bumped this to 2, but we need to fix this at 1 to minimize disruption to users of Node.js 22.x. PR-URL: #59859 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Filip Skokan <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Marco Ippolito <[email protected]>
1 parent b8870c4 commit 24762a1

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

deps/openssl/openssl.gyp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
# is able to create a malicious DLL in one of the default search paths.
2727
'OPENSSL_NO_HW',
2828
'OPENSSL_API_COMPAT=0x10100001L',
29+
'OPENSSL_TLS_SECURITY_LEVEL=1',
2930
'STATIC_LEGACY',
3031
#'OPENSSL_NO_DEPRECATED',
3132
],
@@ -62,6 +63,7 @@
6263
'include_dirs+': ['openssl/apps/include'],
6364
'defines': [
6465
'OPENSSL_API_COMPAT=0x10100001L',
66+
'OPENSSL_TLS_SECURITY_LEVEL=1',
6567
#'OPENSSL_NO_DEPRECATED',
6668
],
6769
'conditions': [

node.gypi

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,10 @@
380380
'defines': [ 'HAVE_OPENSSL=1' ],
381381
'conditions': [
382382
[ 'node_shared_openssl=="false"', {
383-
'defines': [ 'OPENSSL_API_COMPAT=0x10100000L', ],
383+
'defines': [
384+
'OPENSSL_API_COMPAT=0x10100000L',
385+
'OPENSSL_TLS_SECURITY_LEVEL=1',
386+
],
384387
'dependencies': [
385388
'./deps/openssl/openssl.gyp:openssl',
386389

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Flags: --expose-internals
2+
'use strict';
3+
const common = require('../common');
4+
if (!common.hasCrypto)
5+
common.skip('missing crypto');
6+
7+
if (process.config.variables.node_shared_openssl)
8+
common.skip('not applicable when dynamically linked to OpenSSL');
9+
10+
const secLevel = require('internal/crypto/util').getOpenSSLSecLevel();
11+
const assert = require('assert');
12+
13+
// Node.js 22 was released with OpenSSL 3.0 which had a default security
14+
// level of 1. OpenSSL 3.2 bumped this to 2, but we need to fix this at
15+
// 1 to minimize disruption to users of Node.js 22.x.
16+
assert.strictEqual(secLevel, 1);

0 commit comments

Comments
 (0)