Skip to content

Commit

Permalink
src: gate all quic behind disabled-by-default compile flag
Browse files Browse the repository at this point in the history
Due to quictls/openssl@93ae85b
it is clear that we will need to revert back to using
OpenSSL's official releases. This means we will be forced
to re-implement at least part of the underlying QUIC
implementation to use different crypto APIs. For that
reason, this PR disables building any of the QUIC support
by default and introduces a new compile time flag.

PR-URL: nodejs#57142
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: Jordan Harband <[email protected]>
Reviewed-By: Marco Ippolito <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: Chengzhong Wu <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: Stephen Belanger <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
  • Loading branch information
jasnell committed Feb 20, 2025
1 parent 06d5701 commit 3b0fce1
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 34 deletions.
17 changes: 9 additions & 8 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
sys.path.insert(0, 'tools')
import getmoduleversion
import getnapibuildversion
import getsharedopensslhasquic
from gyp_node import run_gyp
from utils import SearchFiles

Expand Down Expand Up @@ -847,6 +846,12 @@

# End dummy list.

parser.add_argument('--with-quic',
action='store_true',
dest='quic',
default=None,
help='build with QUIC support')

parser.add_argument('--without-ssl',
action='store_true',
dest='without_ssl',
Expand Down Expand Up @@ -1743,6 +1748,7 @@ def configure_openssl(o):
variables['node_shared_ngtcp2'] = b(options.shared_ngtcp2)
variables['node_shared_nghttp3'] = b(options.shared_nghttp3)
variables['openssl_is_fips'] = b(options.openssl_is_fips)
variables['node_quic'] = b(options.quic)
variables['node_fipsinstall'] = b(False)

if options.openssl_no_asm:
Expand Down Expand Up @@ -1804,13 +1810,8 @@ def without_ssl_error(option):
if options.openssl_is_fips and not options.shared_openssl:
variables['node_fipsinstall'] = b(True)

if options.shared_openssl:
has_quic = getsharedopensslhasquic.get_has_quic(options.__dict__['shared_openssl_includes'])
else:
has_quic = getsharedopensslhasquic.get_has_quic('deps/openssl/openssl/include')

variables['openssl_quic'] = b(has_quic)
if has_quic:
variables['openssl_quic'] = b(options.quic)
if options.quic:
o['defines'] += ['NODE_OPENSSL_HAS_QUIC']

configure_library('openssl', o)
Expand Down
6 changes: 5 additions & 1 deletion node.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -927,12 +927,16 @@
[ 'node_use_openssl=="true"', {
'sources': [
'<@(node_crypto_sources)',
'<@(node_quic_sources)',
],
'dependencies': [
'deps/ncrypto/ncrypto.gyp:ncrypto',
],
}],
[ 'node_quic=="true"', {
'sources': [
'<@(node_quic_sources)',
],
}],
[ 'OS in "linux freebsd mac solaris" and '
'target_arch=="x64" and '
'node_target_type=="executable"', {
Expand Down
6 changes: 6 additions & 0 deletions src/node_options.cc
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,13 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() {
true);
AddOption("--experimental-quic",
"" /* undocumented until its development */,
#ifdef NODE_OPENSSL_HAS_QUIC
&EnvironmentOptions::experimental_quic,
#else
// Option is a no-op if the NODE_OPENSSL_HAS_QUIC
// compile flag is not enabled
NoOp{},
#endif
kAllowedInEnvvar);
AddOption("--experimental-webstorage",
"experimental Web Storage API",
Expand Down
2 changes: 2 additions & 0 deletions src/node_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,9 @@ class EnvironmentOptions : public Options {
bool experimental_websocket = true;
bool experimental_sqlite = true;
bool experimental_webstorage = false;
#ifdef NODE_OPENSSL_HAS_QUIC
bool experimental_quic = false;
#endif
std::string localstorage_file;
bool experimental_global_navigator = true;
bool experimental_global_web_crypto = true;
Expand Down
2 changes: 1 addition & 1 deletion test/common/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const noop = () => {};
const hasCrypto = Boolean(process.versions.openssl) &&
!process.env.NODE_SKIP_CRYPTO;

const hasQuic = hasCrypto && !!process.config.variables.openssl_quic;
const hasQuic = hasCrypto && !!process.config.variables.node_quic;

function parseTestFlags(filename = process.argv[1]) {
// The copyright notice is relatively big and the flags could come afterwards.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,9 @@ assert(undocumented.delete('--no-verify-base-objects'));
assert(undocumented.delete('--trace-promises'));
assert(undocumented.delete('--no-trace-promises'));
assert(undocumented.delete('--experimental-quic'));
assert(undocumented.delete('--no-experimental-quic'));
if (common.hasQuic) {
assert(undocumented.delete('--no-experimental-quic'));
}

// Remove negated versions of the flags.
for (const flag of undocumented) {
Expand Down
23 changes: 0 additions & 23 deletions tools/getsharedopensslhasquic.py

This file was deleted.

0 comments on commit 3b0fce1

Please sign in to comment.