Skip to content

Commit

Permalink
tools: partially detect quic support in shared_openssl
Browse files Browse the repository at this point in the history
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 <jasnell@gmail.com>

PR-URL: #37682
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
  • Loading branch information
jasnell authored and ruyadorno committed Mar 24, 2021
1 parent 6e2b609 commit 2227aa6
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
5 changes: 5 additions & 0 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
sys.path.insert(0, 'tools')
import getmoduleversion
import getnapibuildversion
import getsharedopensslhasquic
from gyp_node import run_gyp

# parse our options
Expand Down Expand Up @@ -1348,6 +1349,7 @@ def configure_openssl(o):
variables['node_shared_openssl'] = b(options.shared_openssl)
variables['openssl_is_fips'] = b(options.openssl_is_fips)
variables['openssl_fips'] = ''
variables['openssl_quic'] = b(True)

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

if options.shared_openssl:
variables['openssl_quic'] = b(getsharedopensslhasquic.get_has_quic(options.__dict__['shared_openssl_includes']))

configure_library('openssl', o)


Expand Down
19 changes: 19 additions & 0 deletions tools/getsharedopensslhasquic.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from __future__ import print_function
import os
import re

def get_has_quic(include_path):
openssl_crypto_h = os.path.join(
include_path,
'openssl',
'crypto.h')

f = open(openssl_crypto_h)

regex = '^#\s*define OPENSSL_INFO_QUIC'

for line in f:
if (re.match(regex, line)):
return True

return False

0 comments on commit 2227aa6

Please sign in to comment.