Skip to content

Commit

Permalink
src: warn about FIPS options used with shared OpenSSL
Browse files Browse the repository at this point in the history
Related: #48950
  • Loading branch information
khardix committed Aug 15, 2023
1 parent 75efb42 commit 137735c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
7 changes: 6 additions & 1 deletion node.gypi
Expand Up @@ -350,7 +350,10 @@
'defines': [ 'HAVE_OPENSSL=1' ],
'conditions': [
[ 'node_shared_openssl=="false"', {
'defines': [ 'OPENSSL_API_COMPAT=0x10100000L', ],
'defines': [
'OPENSSL_API_COMPAT=0x10100000L',
'NODE_OPENSSL_IS_SHARED=0',
],
'dependencies': [
'./deps/openssl/openssl.gyp:openssl',

Expand Down Expand Up @@ -392,6 +395,8 @@
],
}],
]
}, {
'defines': [ 'NODE_OPENSSL_IS_SHARED=1', ]
}],
[ 'openssl_quic=="true" and node_shared_ngtcp2=="false"', {
'dependencies': [ './deps/ngtcp2/ngtcp2.gyp:ngtcp2' ]
Expand Down
8 changes: 8 additions & 0 deletions src/node.cc
Expand Up @@ -1054,6 +1054,14 @@ InitializeOncePerProcessInternal(const std::vector<std::string>& args,
OPENSSL_init();
}
#endif
#if NODE_OPENSSL_IS_SHARED
if (per_process::cli_options->enable_fips_crypto ||
per_process::cli_options->force_fips_crypto) {
result->errors_.emplace_back(
"Warning: FIPS options are not supported with shared OpenSSL library!"
);
}
#endif // NODE_OPENSSL_IS_SHARED
if (!crypto::ProcessFipsOptions()) {
// XXX: ERR_GET_REASON does not return something that is
// useful as an exit code at all.
Expand Down

0 comments on commit 137735c

Please sign in to comment.