@@ -639,6 +639,25 @@ def get_version_helper(cc, regexp):
639
639
else:
640
640
return 0
641
641
642
+ def get_nasm_version(asm):
643
+ try:
644
+ proc = subprocess.Popen(shlex.split(asm) + [' -v' ],
645
+ stdin=subprocess.PIPE, stderr=subprocess.PIPE,
646
+ stdout=subprocess.PIPE)
647
+ except OSError:
648
+ warn(' ' ' No acceptable ASM compiler found!
649
+ Please make sure you have installed nasm from http://www.nasm.us
650
+ and refer BUILDING.md.' ' ' )
651
+ return 0
652
+
653
+ match = re.match(r" NASM version ([2-9]\.[0-9][0-9]+)" ,
654
+ proc.communicate ()[0])
655
+
656
+ if match:
657
+ return match.group(1)
658
+ else:
659
+ return 0
660
+
642
661
def get_llvm_version(cc):
643
662
return get_version_helper(
644
663
cc, r" (^(?:FreeBSD )?clang version|based on LLVM) ([3-9]\.[0-9]+)" )
@@ -677,6 +696,11 @@ def get_gas_version(cc):
677
696
# quite prepared to go that far yet.
678
697
def check_compiler(o):
679
698
if sys.platform == ' win32' :
699
+ if not options.openssl_no_asm:
700
+ nasm_version = get_nasm_version(' nasm' )
701
+ o[' variables' ][' nasm_version' ] = nasm_version
702
+ if nasm_version == 0:
703
+ o[' variables' ][' openssl_no_asm' ] = 1
680
704
return
681
705
682
706
ok, is_clang, clang_version, gcc_version = try_check_compiler(CXX, ' c++' )
@@ -1039,32 +1063,35 @@ def configure_v8(o):
1039
1063
1040
1064
1041
1065
def configure_openssl(o):
1042
- o[' variables' ][' node_use_openssl' ] = b(not options.without_ssl)
1043
- o[' variables' ][' node_shared_openssl' ] = b(options.shared_openssl)
1044
- o[' variables' ][' openssl_no_asm' ] = 1 if options.openssl_no_asm else 0
1066
+ variables = o[' variables' ]
1067
+ variables[' node_use_openssl' ] = b(not options.without_ssl)
1068
+ variables[' node_shared_openssl' ] = b(options.shared_openssl)
1069
+ variables[' openssl_no_asm' ] = 1 if options.openssl_no_asm else 0
1045
1070
if options.use_openssl_ca_store:
1046
1071
o[' defines' ] += [' NODE_OPENSSL_CERT_STORE' ]
1047
1072
if options.openssl_system_ca_path:
1048
- o[ ' variables' ] [' openssl_system_ca_path' ] = options.openssl_system_ca_path
1049
- o[ ' variables' ] [' node_without_node_options' ] = b(options.without_node_options)
1073
+ variables[' openssl_system_ca_path' ] = options.openssl_system_ca_path
1074
+ variables[' node_without_node_options' ] = b(options.without_node_options)
1050
1075
if options.without_node_options:
1051
1076
o[' defines' ] += [' NODE_WITHOUT_NODE_OPTIONS' ]
1077
+
1078
+ # supported asm compiler for AVX2. See https://github.com/openssl/openssl/
1079
+ # blob/OpenSSL_1_1_0-stable/crypto/modes/asm/aesni-gcm-x86_64.pl#L52-L69
1080
+ openssl110_asm_supported = \
1081
+ (' gas_version' in variables and variables[' gas_version' ] > = ' 2.23' ) or \
1082
+ (' xcode_version' in variables and variables[' xcode_version' ] > = ' 5.0' ) or \
1083
+ (' llvm_version' in variables and variables[' llvm_version' ] > = ' 3.3' ) or \
1084
+ (' nasm_version' in variables and variables[' nasm_version' ] > = ' 2.10' )
1085
+
1086
+ if not openssl110_asm_supported and variables[' openssl_no_asm' ] == 0:
1087
+ warn(' ' ' openssl_no_asm is enabled due to missed or old assembler.
1088
+ Please refer BUILDING.md' ' ' )
1089
+ variables[' openssl_no_asm' ] = 1
1090
+
1052
1091
if options.openssl_fips:
1053
- o[' variables' ][' openssl_fips' ] = options.openssl_fips
1054
- fips_dir = os.path.join(' deps' , ' openssl' , ' fips' )
1055
- fips_ld = os.path.abspath(os.path.join(fips_dir, ' fipsld' ))
1056
- # LINK is for Makefiles, LD/LDXX is for ninja
1057
- o[' make_fips_settings' ] = [
1058
- [' LINK' , fips_ld + ' <(openssl_fips)/bin/fipsld' ],
1059
- [' LD' , fips_ld + ' <(openssl_fips)/bin/fipsld' ],
1060
- [' LDXX' , fips_ld + ' <(openssl_fips)/bin/fipsld' ],
1061
- ]
1062
- else:
1063
- o[' variables' ][' openssl_fips' ] = ' '
1064
- try:
1065
- os.remove(' config_fips.gypi' )
1066
- except OSError:
1067
- pass
1092
+ print(' Error: FIPS is not supported yet in this version' )
1093
+ exit(1)
1094
+ variables[' openssl_fips' ] = ' '
1068
1095
1069
1096
if options.without_ssl:
1070
1097
def without_ssl_error(option):
0 commit comments