Skip to content

Commit ae23673

Browse files
committed
build: remove the bundled FIPS provider build
--openssl-is-fips with bundled OpenSSL never worked: the openssl-fipsmodule target had no dependency edge, so fipsinstall's input was produced by nothing. Repairing it would not help, since a FIPS provider built out of tree has no validation status. Remove the machinery and restrict --openssl-is-fips to --shared-openssl. Signed-off-by: Filip Skokan <panva.ip@gmail.com>
1 parent 5b9d28a commit ae23673

7 files changed

Lines changed: 33 additions & 166 deletions

File tree

β€ŽBUILDING.mdβ€Ž

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,14 +1042,20 @@ using the following configure option:
10421042

10431043
## Building Node.js with FIPS-compliant OpenSSL
10441044

1045-
Node.js supports FIPS when statically or dynamically linked with OpenSSL 3 via
1046-
[OpenSSL's provider model](https://docs.openssl.org/3.0/man7/crypto/#OPENSSL-PROVIDERS).
1047-
It is not necessary to rebuild Node.js to enable support for FIPS.
1045+
Node.js can use an OpenSSL FIPS provider via
1046+
[OpenSSL's provider model](https://docs.openssl.org/master/man7/crypto/#openssl-providers),
1047+
whether OpenSSL is linked statically or dynamically. It is not necessary to
1048+
rebuild Node.js to do so; the provider and the OpenSSL configuration that
1049+
activates it are supplied at runtime.
10481050

1049-
When using OpenSSL 1.1.1, Node.js must be built against a FIPS-capable OpenSSL.
1051+
Node.js does not build a FIPS provider. OpenSSL requires that a FIPS provider
1052+
be built from a release that carries a FIPS certificate, so a provider built
1053+
as part of the Node.js build would have no validation status.
10501054

1051-
See [FIPS mode](doc/api/crypto.md#fips-mode) for more information on how to
1052-
enable FIPS support in Node.js.
1055+
`./configure --openssl-is-fips` only records that the OpenSSL being linked is
1056+
FIPS capable, and requires `--shared-openssl`.
1057+
1058+
See [FIPS mode](doc/api/crypto.md#fips-mode) for how to configure it.
10531059

10541060
## Building Node.js with Temporal support
10551061

β€Žconfigure.pyβ€Ž

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,8 @@
268268
action='store_true',
269269
dest='openssl_is_fips',
270270
default=None,
271-
help='specifies that the OpenSSL library is FIPS compatible')
271+
help='specifies that the shared OpenSSL library is FIPS capable '
272+
'(requires --shared-openssl)')
272273

273274
parser.add_argument('--openssl-use-def-ca-store',
274275
action='store_true',
@@ -2275,7 +2276,6 @@ def configure_openssl(o):
22752276
variables['node_shared_ngtcp2'] = b(options.shared_ngtcp2)
22762277
variables['node_shared_nghttp3'] = b(options.shared_nghttp3)
22772278
variables['openssl_is_fips'] = b(options.openssl_is_fips)
2278-
variables['node_fipsinstall'] = b(False)
22792279

22802280
if options.openssl_no_asm:
22812281
variables['openssl_no_asm'] = 1
@@ -2330,12 +2330,12 @@ def without_ssl_error(option):
23302330
if options.openssl_no_asm and options.shared_openssl:
23312331
error('--openssl-no-asm is incompatible with --shared-openssl')
23322332

2333+
if options.openssl_is_fips and not options.shared_openssl:
2334+
error('--openssl-is-fips is only available with --shared-openssl')
2335+
23332336
if options.openssl_is_fips:
23342337
o['defines'] += ['OPENSSL_FIPS']
23352338

2336-
if options.openssl_is_fips and not options.shared_openssl:
2337-
variables['node_fipsinstall'] = b(True)
2338-
23392339
configure_library('openssl', o)
23402340

23412341
o['variables']['openssl_version'] = get_openssl_version(o)

β€Ždeps/openssl/openssl.gypβ€Ž

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -97,35 +97,6 @@
9797
},
9898
}],
9999
]
100-
}, {
101-
# openssl-fipsmodule target
102-
'target_name': 'openssl-fipsmodule',
103-
'type': 'shared_library',
104-
'dependencies': ['openssl-cli'],
105-
'includes': ['./openssl_common.gypi'],
106-
'include_dirs+': ['openssl/apps/include'],
107-
'cflags': [ '-fPIC' ],
108-
#'ldflags': [ '-o', 'fips.so' ],
109-
#'ldflags': [ '-Wl,--version-script=providers/fips.ld',],
110-
'conditions': [
111-
[ 'openssl_no_asm==1', {
112-
'includes': ['./openssl-fips_no_asm.gypi'],
113-
}, 'target_arch=="arm64" and OS=="win"', {
114-
# VC-WIN64-ARM inherits from VC-noCE-common that has no asms.
115-
'includes': ['./openssl-fips_no_asm.gypi'],
116-
}, 'gas_version and v(gas_version) >= v("2.26") or '
117-
'nasm_version and v(nasm_version) >= v("2.11.8")', {
118-
# Require AVX512IFMA supported. See
119-
# https://www.openssl.org/docs/man1.1.1/man3/OPENSSL_ia32cap.html
120-
# Currently crypto/poly1305/asm/poly1305-x86_64.pl requires AVX512IFMA.
121-
'includes': ['./openssl-fips_asm.gypi'],
122-
}, {
123-
'includes': ['./openssl-fips_asm_avx2.gypi'],
124-
}],
125-
],
126-
'direct_dependent_settings': {
127-
'include_dirs': [ 'openssl/include', 'openssl/crypto/include']
128-
}
129-
},
100+
},
130101
]
131102
}

β€Žnode.gypβ€Ž

Lines changed: 15 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -788,87 +788,22 @@
788788
]
789789
}],
790790

791-
['node_fipsinstall=="true"', {
792-
'variables': {
793-
'openssl-cli': '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)openssl-cli<(EXECUTABLE_SUFFIX)',
794-
'provider_name': 'libopenssl-fipsmodule',
795-
'opensslconfig': './deps/openssl/nodejs-openssl.cnf',
796-
'conditions': [
797-
['GENERATOR == "ninja"', {
798-
'fipsmodule_internal': '<(PRODUCT_DIR)/lib/<(provider_name).so',
799-
'fipsmodule': '<(PRODUCT_DIR)/obj/lib/openssl-modules/fips.so',
800-
'fipsconfig': '<(PRODUCT_DIR)/obj/lib/fipsmodule.cnf',
801-
'opensslconfig_internal': '<(PRODUCT_DIR)/obj/lib/openssl.cnf',
802-
}, {
803-
'fipsmodule_internal': '<(PRODUCT_DIR)/obj.target/deps/openssl/<(provider_name).so',
804-
'fipsmodule': '<(PRODUCT_DIR)/obj.target/deps/openssl/lib/openssl-modules/fips.so',
805-
'fipsconfig': '<(PRODUCT_DIR)/obj.target/deps/openssl/fipsmodule.cnf',
806-
'opensslconfig_internal': '<(PRODUCT_DIR)/obj.target/deps/openssl/openssl.cnf',
807-
}],
808-
],
809-
},
810-
'actions': [
811-
{
812-
'action_name': 'fipsinstall',
813-
'process_outputs_as_sources': 1,
814-
'inputs': [
815-
'<(fipsmodule_internal)',
816-
],
817-
'outputs': [
818-
'<(fipsconfig)',
819-
],
820-
'action': [
821-
'<(openssl-cli)', 'fipsinstall',
822-
'-provider_name', '<(provider_name)',
823-
'-module', '<(fipsmodule_internal)',
824-
'-out', '<(fipsconfig)',
825-
#'-quiet',
826-
],
827-
},
828-
{
829-
'action_name': 'copy_fips_module',
830-
'inputs': [
831-
'<(fipsmodule_internal)',
832-
],
833-
'outputs': [
834-
'<(fipsmodule)',
835-
],
836-
'action': [
837-
'<(python)', 'tools/copyfile.py',
838-
'<(fipsmodule_internal)',
839-
'<(fipsmodule)',
840-
],
841-
},
842-
{
843-
'action_name': 'copy_openssl_cnf_and_include_fips_cnf',
844-
'inputs': [ '<(opensslconfig)', ],
845-
'outputs': [ '<(opensslconfig_internal)', ],
846-
'action': [
847-
'<(python)', 'tools/enable_fips_include.py',
848-
'<(opensslconfig)',
849-
'<(opensslconfig_internal)',
850-
'<(fipsconfig)',
851-
],
852-
},
791+
],
792+
'variables': {
793+
'opensslconfig_internal': '<(obj_dir)/deps/openssl/openssl.cnf',
794+
'opensslconfig': './deps/openssl/nodejs-openssl.cnf',
795+
},
796+
'actions': [
797+
{
798+
'action_name': 'reset_openssl_cnf',
799+
'inputs': [ '<(opensslconfig)', ],
800+
'outputs': [ '<(opensslconfig_internal)', ],
801+
'action': [
802+
'<(python)', 'tools/copyfile.py',
803+
'<(opensslconfig)',
804+
'<(opensslconfig_internal)',
853805
],
854-
}, {
855-
'variables': {
856-
'opensslconfig_internal': '<(obj_dir)/deps/openssl/openssl.cnf',
857-
'opensslconfig': './deps/openssl/nodejs-openssl.cnf',
858-
},
859-
'actions': [
860-
{
861-
'action_name': 'reset_openssl_cnf',
862-
'inputs': [ '<(opensslconfig)', ],
863-
'outputs': [ '<(opensslconfig_internal)', ],
864-
'action': [
865-
'<(python)', 'tools/copyfile.py',
866-
'<(opensslconfig)',
867-
'<(opensslconfig_internal)',
868-
],
869-
},
870-
],
871-
}],
806+
},
872807
],
873808
}, # node_core_target_name
874809
{

β€Žsrc/node_config.ccβ€Ž

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,6 @@ static void InitConfig(Local<Object> target,
6464
READONLY_FALSE_PROPERTY(target, "hasOpenSSL");
6565
#endif // HAVE_OPENSSL
6666

67-
READONLY_TRUE_PROPERTY(target, "fipsMode");
68-
6967
#ifdef NODE_HAVE_I18N_SUPPORT
7068

7169
READONLY_TRUE_PROPERTY(target, "hasIntl");

β€Žtools/enable_fips_include.pyβ€Ž

Lines changed: 0 additions & 42 deletions
This file was deleted.

β€Žtypings/internalBinding/config.d.tsβ€Ž

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ export interface ConfigBinding {
22
isDebugBuild: boolean;
33
openSSLIsBoringSSL: boolean;
44
hasOpenSSL: boolean;
5-
fipsMode: boolean;
65
hasIntl: boolean;
76
hasSmallICU: boolean;
87
hasTracing: boolean;

0 commit comments

Comments
Β (0)