Skip to content

Commit 2227aa6

Browse files
jasnellruyadorno
authored andcommitted
tools: partially detect quic support in shared_openssl
If the shared openssl does not have the `OPENSSL_INFO_QUIC` define, then it definitely does not have the QUIC apis. This is only a partially accurate check because it does not detect if the shared openssl was actually *built* without the OPENSSL_NO_QUIC define set. Signed-off-by: James M Snell <[email protected]> PR-URL: #37682 Reviewed-By: Daniel Bevenius <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
1 parent 6e2b609 commit 2227aa6

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

configure.py

+5
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
sys.path.insert(0, 'tools')
3939
import getmoduleversion
4040
import getnapibuildversion
41+
import getsharedopensslhasquic
4142
from gyp_node import run_gyp
4243

4344
# parse our options
@@ -1348,6 +1349,7 @@ def configure_openssl(o):
13481349
variables['node_shared_openssl'] = b(options.shared_openssl)
13491350
variables['openssl_is_fips'] = b(options.openssl_is_fips)
13501351
variables['openssl_fips'] = ''
1352+
variables['openssl_quic'] = b(True)
13511353

13521354
if options.openssl_no_asm:
13531355
variables['openssl_no_asm'] = 1
@@ -1403,6 +1405,9 @@ def without_ssl_error(option):
14031405
if options.openssl_fips or options.openssl_fips == '':
14041406
error('FIPS is not supported in this version of Node.js')
14051407

1408+
if options.shared_openssl:
1409+
variables['openssl_quic'] = b(getsharedopensslhasquic.get_has_quic(options.__dict__['shared_openssl_includes']))
1410+
14061411
configure_library('openssl', o)
14071412

14081413

tools/getsharedopensslhasquic.py

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from __future__ import print_function
2+
import os
3+
import re
4+
5+
def get_has_quic(include_path):
6+
openssl_crypto_h = os.path.join(
7+
include_path,
8+
'openssl',
9+
'crypto.h')
10+
11+
f = open(openssl_crypto_h)
12+
13+
regex = '^#\s*define OPENSSL_INFO_QUIC'
14+
15+
for line in f:
16+
if (re.match(regex, line)):
17+
return True
18+
19+
return False

0 commit comments

Comments
 (0)