Skip to content
This repository was archived by the owner on Apr 22, 2023. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,11 @@ parser.add_option('--shared-openssl-libpath',
dest='shared_openssl_libpath',
help='a directory to search for the shared OpenSSL DLLs')

parser.add_option('--shared-openssl-fips',
action='store_true',
dest='shared_openssl_fips',
help='enable FIPS mode for shared OpenSSL DLLs')

parser.add_option('--shared-v8',
action='store_true',
dest='shared_v8',
Expand Down Expand Up @@ -610,6 +615,9 @@ def configure_openssl(o):
else:
o['cflags'] += cflags.split()

if options.shared_openssl_fips:
o['defines'] += ['OPENSSL_FIPS']


def configure_winsdk(o):
if flavor != 'win':
Expand Down
11 changes: 11 additions & 0 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@

#if HAVE_OPENSSL
#include "node_crypto.h"
#ifdef OPENSSL_FIPS
#include "crypto.h"
#endif
#endif

#if defined HAVE_DTRACE || defined HAVE_ETW || defined HAVE_SYSTEMTAP
Expand Down Expand Up @@ -2420,6 +2423,14 @@ void SetupProcessObject(Environment* env,
versions,
"openssl",
OneByteString(node_isolate, &OPENSSL_VERSION_TEXT[i], j - i));

#ifdef OPENSSL_FIPS
if(!FIPS_mode_set(1)) {
fprintf(stderr,"OpenSSL shared library does not support FIPS mode");
exit(1);
}
#endif

#endif

// process.arch
Expand Down