Skip to content

Commit 7475982

Browse files
committed
openssl: enable optimized asm code on x86 and x64
1 parent 5edbb53 commit 7475982

File tree

1 file changed

+222
-27
lines changed

1 file changed

+222
-27
lines changed

deps/openssl/openssl.gyp

+222-27
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,7 @@
1616
# No clue what these are for.
1717
'L_ENDIAN',
1818
'PURIFY',
19-
'_REENTRANT',
20-
# Disable TTY output. This is not a standard openssl configuration,
21-
# option, but a patch that we're floating.
22-
# We don't use any asm files at the moment.
23-
'OPENSSL_NO_ASM'
19+
'_REENTRANT'
2420
],
2521
'sources': [
2622
'openssl/ssl/bio_ssl.c',
@@ -69,9 +65,7 @@
6965
'openssl/ssl/t1_reneg.c',
7066
'openssl/ssl/t1_srvr.c',
7167
'openssl/ssl/tls_srp.c',
72-
'openssl/crypto/aes/aes_cbc.c',
7368
'openssl/crypto/aes/aes_cfb.c',
74-
'openssl/crypto/aes/aes_core.c',
7569
'openssl/crypto/aes/aes_ctr.c',
7670
'openssl/crypto/aes/aes_ecb.c',
7771
'openssl/crypto/aes/aes_ige.c',
@@ -157,8 +151,6 @@
157151
'openssl/crypto/asn1/x_x509a.c',
158152
'openssl/crypto/bf/bf_cfb64.c',
159153
'openssl/crypto/bf/bf_ecb.c',
160-
'openssl/crypto/bf/bf_enc.c',
161-
'openssl/crypto/bf/bf_enc.c',
162154
'openssl/crypto/bf/bf_ofb64.c',
163155
'openssl/crypto/bf/bf_skey.c',
164156
'openssl/crypto/bio/b_dump.c',
@@ -210,17 +202,13 @@
210202
'openssl/crypto/buffer/buf_err.c',
211203
'openssl/crypto/buffer/buf_str.c',
212204
'openssl/crypto/buffer/buffer.c',
213-
'openssl/crypto/camellia/camellia.c',
214-
'openssl/crypto/camellia/cmll_cbc.c',
215205
'openssl/crypto/camellia/cmll_cfb.c',
216206
'openssl/crypto/camellia/cmll_ctr.c',
217207
'openssl/crypto/camellia/cmll_ecb.c',
218-
'openssl/crypto/camellia/cmll_misc.c',
219208
'openssl/crypto/camellia/cmll_ofb.c',
220209
'openssl/crypto/camellia/cmll_utl.c',
221210
'openssl/crypto/cast/c_cfb64.c',
222211
'openssl/crypto/cast/c_ecb.c',
223-
'openssl/crypto/cast/c_enc.c',
224212
'openssl/crypto/cast/c_ofb64.c',
225213
'openssl/crypto/cast/c_skey.c',
226214
'openssl/crypto/cmac/cm_ameth.c',
@@ -258,7 +246,6 @@
258246
'openssl/crypto/des/cfb64ede.c',
259247
'openssl/crypto/des/cfb64enc.c',
260248
'openssl/crypto/des/cfb_enc.c',
261-
'openssl/crypto/des/des_enc.c',
262249
'openssl/crypto/des/des_old.c',
263250
'openssl/crypto/des/des_old2.c',
264251
'openssl/crypto/des/ecb3_enc.c',
@@ -267,7 +254,6 @@
267254
'openssl/crypto/des/enc_read.c',
268255
'openssl/crypto/des/enc_writ.c',
269256
'openssl/crypto/des/fcrypt.c',
270-
'openssl/crypto/des/fcrypt_b.c',
271257
'openssl/crypto/des/ofb64ede.c',
272258
'openssl/crypto/des/ofb64enc.c',
273259
'openssl/crypto/des/ofb_enc.c',
@@ -455,7 +441,6 @@
455441
'openssl/crypto/mdc2/mdc2_one.c',
456442
'openssl/crypto/mdc2/mdc2dgst.c',
457443
'openssl/crypto/mem.c',
458-
'openssl/crypto/mem_clr.c',
459444
'openssl/crypto/mem_dbg.c',
460445
'openssl/crypto/modes/cbc128.c',
461446
'openssl/crypto/modes/ccm128.c',
@@ -534,8 +519,6 @@
534519
'openssl/crypto/rc2/rc2_skey.c',
535520
'openssl/crypto/rc2/rc2cfb64.c',
536521
'openssl/crypto/rc2/rc2ofb64.c',
537-
'openssl/crypto/rc4/rc4_enc.c',
538-
'openssl/crypto/rc4/rc4_skey.c',
539522
'openssl/crypto/rc4/rc4_utl.c',
540523
'openssl/crypto/ripemd/rmd_dgst.c',
541524
'openssl/crypto/ripemd/rmd_one.c',
@@ -595,7 +578,6 @@
595578
'openssl/crypto/ui/ui_openssl.c',
596579
'openssl/crypto/ui/ui_util.c',
597580
'openssl/crypto/uid.c',
598-
'openssl/crypto/whrlpool/wp_block.c',
599581
'openssl/crypto/whrlpool/wp_dgst.c',
600582
'openssl/crypto/x509/by_dir.c',
601583
'openssl/crypto/x509/by_file.c',
@@ -666,13 +648,233 @@
666648
'openssl/engines/e_gmp.c',
667649
'openssl/engines/e_nuron.c',
668650
'openssl/engines/e_sureware.c',
669-
'openssl/engines/e_ubsec.c',
651+
'openssl/engines/e_ubsec.c'
670652
],
671653
'sources/': [
672654
['exclude', 'md2/.*$'],
673655
['exclude', 'store/.*$']
674656
],
675657
'conditions': [
658+
['target_arch!="ia32" and target_arch!="x64"', {
659+
# Disable asm
660+
'defines': [
661+
'OPENSSL_NO_ASM'
662+
],
663+
'sources': [
664+
'openssl/crypto/aes/aes_cbc.c',
665+
'openssl/crypto/aes/aes_core.c',
666+
'openssl/crypto/bf/bf_enc.c',
667+
'openssl/crypto/bn/bn_asm.c',
668+
'openssl/crypto/cast/c_enc.c',
669+
'openssl/crypto/camellia/camellia.c',
670+
'openssl/crypto/camellia/cmll_cbc.c',
671+
'openssl/crypto/camellia/cmll_misc.c',
672+
'openssl/crypto/des/des_enc.c',
673+
'openssl/crypto/des/fcrypt_b.c',
674+
'openssl/crypto/mem_clr.c',
675+
'openssl/crypto/rc4/rc4_enc.c',
676+
'openssl/crypto/rc4/rc4_skey.c',
677+
'openssl/crypto/whrlpool/wp_block.c'
678+
]
679+
}, {
680+
# Enable asm
681+
'defines': [
682+
'AES_ASM',
683+
'BF_ASM',
684+
'BNCO_ASM',
685+
'BN_ASM',
686+
'CPUID_ASM',
687+
'DES_ASM',
688+
'LIB_BN_ASM',
689+
'OPENSSL_BN_ASM',
690+
'OPENSSL_CPUID_OBJ',
691+
'RIP_ASM',
692+
'WHIRLPOOL_ASM',
693+
'WP_ASM'
694+
],
695+
'conditions': [
696+
['OS!="win" and OS!="mac" and target_arch=="ia32"', {
697+
'sources': [
698+
'asm/x86-elf-gas/aes/aes-586.s',
699+
'asm/x86-elf-gas/aes/aesni-x86.s',
700+
'asm/x86-elf-gas/bf/bf-686.s',
701+
'asm/x86-elf-gas/bn/x86-mont.s',
702+
'asm/x86-elf-gas/bn/x86.s',
703+
'asm/x86-elf-gas/camellia/cmll-x86.s',
704+
'asm/x86-elf-gas/cast/cast-586.s',
705+
'asm/x86-elf-gas/des/crypt586.s',
706+
'asm/x86-elf-gas/des/des-586.s',
707+
'asm/x86-elf-gas/md5/md5-586.s',
708+
'asm/x86-elf-gas/rc4/rc4-586.s',
709+
'asm/x86-elf-gas/rc5/rc5-586.s',
710+
'asm/x86-elf-gas/ripemd/rmd-586.s',
711+
'asm/x86-elf-gas/sha/sha1-586.s',
712+
'asm/x86-elf-gas/sha/sha256-586.s',
713+
'asm/x86-elf-gas/sha/sha512-586.s',
714+
'asm/x86-elf-gas/whrlpool/wp-mmx.s',
715+
'asm/x86-elf-gas/x86cpuid.s',
716+
'openssl/crypto/whrlpool/wp_block.c'
717+
]
718+
}],
719+
['OS!="win" and OS!="mac" and target_arch=="x64"', {
720+
'sources': [
721+
'asm/x64-elf-gas/aes/aes-x86_64.s',
722+
'asm/x64-elf-gas/aes/aesni-x86_64.s',
723+
'asm/x64-elf-gas/aes/aesni-sha1-x86_64.s',
724+
'asm/x64-elf-gas/bn/modexp512-x86_64.s',
725+
'asm/x64-elf-gas/bn/x86_64-mont.s',
726+
'asm/x64-elf-gas/camellia/cmll-x86_64.s',
727+
'asm/x64-elf-gas/md5/md5-x86_64.s',
728+
'asm/x64-elf-gas/rc4/rc4-x86_64.s',
729+
'asm/x64-elf-gas/rc4/rc4-md5-x86_64.s',
730+
'asm/x64-elf-gas/sha/sha1-x86_64.s',
731+
'asm/x64-elf-gas/sha/sha512-x86_64.s',
732+
'asm/x64-elf-gas/whrlpool/wp-x86_64.s',
733+
'asm/x64-elf-gas/x86_64cpuid.s',
734+
# Non-generated asm
735+
'openssl/crypto/bn/asm/x86_64-gcc.c',
736+
# No asm available
737+
'openssl/crypto/bf/bf_enc.c',
738+
'openssl/crypto/cast/c_enc.c',
739+
'openssl/crypto/camellia/cmll_misc.c',
740+
'openssl/crypto/des/des_enc.c',
741+
'openssl/crypto/des/fcrypt_b.c'
742+
]
743+
}],
744+
['OS=="mac" and target_arch=="ia32"', {
745+
'sources': [
746+
'asm/x86-macosx-gas/aes/aes-586.s',
747+
'asm/x86-macosx-gas/aes/aesni-x86.s',
748+
'asm/x86-macosx-gas/bf/bf-686.s',
749+
'asm/x86-macosx-gas/bn/x86-mont.s',
750+
'asm/x86-macosx-gas/bn/x86.s',
751+
'asm/x86-macosx-gas/camellia/cmll-x86.s',
752+
'asm/x86-macosx-gas/cast/cast-586.s',
753+
'asm/x86-macosx-gas/des/crypt586.s',
754+
'asm/x86-macosx-gas/des/des-586.s',
755+
'asm/x86-macosx-gas/md5/md5-586.s',
756+
'asm/x86-macosx-gas/rc4/rc4-586.s',
757+
'asm/x86-macosx-gas/rc5/rc5-586.s',
758+
'asm/x86-macosx-gas/ripemd/rmd-586.s',
759+
'asm/x86-macosx-gas/sha/sha1-586.s',
760+
'asm/x86-macosx-gas/sha/sha256-586.s',
761+
'asm/x86-macosx-gas/sha/sha512-586.s',
762+
'asm/x86-macosx-gas/whrlpool/wp-mmx.s',
763+
'asm/x86-macosx-gas/x86cpuid.s',
764+
'openssl/crypto/whrlpool/wp_block.c'
765+
]
766+
}],
767+
['OS=="mac" and target_arch=="x64"', {
768+
'sources': [
769+
'asm/x64-macosx-gas/aes/aes-x86_64.s',
770+
'asm/x64-macosx-gas/aes/aesni-x86_64.s',
771+
'asm/x64-macosx-gas/aes/aesni-sha1-x86_64.s',
772+
'asm/x64-macosx-gas/bn/modexp512-x86_64.s',
773+
'asm/x64-macosx-gas/bn/x86_64-mont.s',
774+
'asm/x64-macosx-gas/camellia/cmll-x86_64.s',
775+
'asm/x64-macosx-gas/md5/md5-x86_64.s',
776+
'asm/x64-macosx-gas/rc4/rc4-x86_64.s',
777+
'asm/x64-macosx-gas/rc4/rc4-md5-x86_64.s',
778+
'asm/x64-macosx-gas/sha/sha1-x86_64.s',
779+
'asm/x64-macosx-gas/sha/sha512-x86_64.s',
780+
'asm/x64-macosx-gas/whrlpool/wp-x86_64.s',
781+
'asm/x64-macosx-gas/x86_64cpuid.s',
782+
# Non-generated asm
783+
'openssl/crypto/bn/asm/x86_64-gcc.c',
784+
# No asm available
785+
'openssl/crypto/bf/bf_enc.c',
786+
'openssl/crypto/cast/c_enc.c',
787+
'openssl/crypto/camellia/cmll_misc.c',
788+
'openssl/crypto/des/des_enc.c',
789+
'openssl/crypto/des/fcrypt_b.c'
790+
]
791+
}],
792+
['OS=="win" and target_arch=="ia32"', {
793+
'sources': [
794+
'asm/x86-win32-masm/aes/aes-586.asm',
795+
'asm/x86-win32-masm/aes/aesni-x86.asm',
796+
'asm/x86-win32-masm/bf/bf-686.asm',
797+
'asm/x86-win32-masm/bn/x86-mont.asm',
798+
'asm/x86-win32-masm/bn/x86.asm',
799+
'asm/x86-win32-masm/camellia/cmll-x86.asm',
800+
'asm/x86-win32-masm/cast/cast-586.asm',
801+
'asm/x86-win32-masm/des/crypt586.asm',
802+
'asm/x86-win32-masm/des/des-586.asm',
803+
'asm/x86-win32-masm/md5/md5-586.asm',
804+
'asm/x86-win32-masm/rc4/rc4-586.asm',
805+
'asm/x86-win32-masm/rc5/rc5-586.asm',
806+
'asm/x86-win32-masm/ripemd/rmd-586.asm',
807+
'asm/x86-win32-masm/sha/sha1-586.asm',
808+
'asm/x86-win32-masm/sha/sha256-586.asm',
809+
'asm/x86-win32-masm/sha/sha512-586.asm',
810+
'asm/x86-win32-masm/whrlpool/wp-mmx.asm',
811+
'asm/x86-win32-masm/x86cpuid.asm',
812+
'openssl/crypto/whrlpool/wp_block.c'
813+
],
814+
'rules': [
815+
{
816+
'rule_name': 'Assemble',
817+
'extension': 'asm',
818+
'inputs': [],
819+
'outputs': [
820+
'<(INTERMEDIATE_DIR)/<(RULE_INPUT_ROOT).obj',
821+
],
822+
'action': [
823+
'ml.exe',
824+
'/Zi',
825+
'/Fo', '<(INTERMEDIATE_DIR)/<(RULE_INPUT_ROOT).obj',
826+
'/c', '<(RULE_INPUT_PATH)',
827+
],
828+
'process_outputs_as_sources': 0,
829+
'message': 'Assembling <(RULE_INPUT_PATH) to <(INTERMEDIATE_DIR)/<(RULE_INPUT_ROOT).obj.',
830+
}
831+
]
832+
}],
833+
['OS=="win" and target_arch=="x64"', {
834+
'sources': [
835+
'asm/x64-win32-masm/aes/aes-x86_64.asm',
836+
'asm/x64-win32-masm/aes/aesni-x86_64.asm',
837+
'asm/x64-win32-masm/aes/aesni-sha1-x86_64.asm',
838+
'asm/x64-win32-masm/bn/modexp512-x86_64.asm',
839+
'asm/x64-win32-masm/bn/x86_64-mont.asm',
840+
'asm/x64-win32-masm/camellia/cmll-x86_64.asm',
841+
'asm/x64-win32-masm/md5/md5-x86_64.asm',
842+
'asm/x64-win32-masm/rc4/rc4-x86_64.asm',
843+
'asm/x64-win32-masm/rc4/rc4-md5-x86_64.asm',
844+
'asm/x64-win32-masm/sha/sha1-x86_64.asm',
845+
'asm/x64-win32-masm/sha/sha512-x86_64.asm',
846+
'asm/x64-win32-masm/whrlpool/wp-x86_64.asm',
847+
'asm/x64-win32-masm/x86_64cpuid.asm',
848+
# Non-generated asm
849+
'openssl/crypto/bn/asm/x86_64-win32-masm.asm',
850+
# No asm available
851+
'openssl/crypto/bf/bf_enc.c',
852+
'openssl/crypto/cast/c_enc.c',
853+
'openssl/crypto/camellia/cmll_misc.c',
854+
'openssl/crypto/des/des_enc.c',
855+
'openssl/crypto/des/fcrypt_b.c'
856+
],
857+
'rules': [
858+
{
859+
'rule_name': 'Assemble',
860+
'extension': 'asm',
861+
'inputs': [],
862+
'outputs': [
863+
'<(INTERMEDIATE_DIR)/<(RULE_INPUT_ROOT).obj',
864+
],
865+
'action': [
866+
'ml64.exe',
867+
'/Zi',
868+
'/Fo', '<(INTERMEDIATE_DIR)/<(RULE_INPUT_ROOT).obj',
869+
'/c', '<(RULE_INPUT_PATH)',
870+
],
871+
'process_outputs_as_sources': 0,
872+
'message': 'Assembling <(RULE_INPUT_PATH) to <(INTERMEDIATE_DIR)/<(RULE_INPUT_ROOT).obj.',
873+
}
874+
]
875+
}]
876+
]
877+
}],
676878
['OS=="win"', {
677879
'defines': [
678880
'MK1MF_BUILD',
@@ -697,21 +899,14 @@
697899
}],
698900
['target_arch=="ia32"', {
699901
'variables': {'openssl_config_path': 'config/piii'},
700-
'sources': [
701-
'openssl/crypto/bn/bn_asm.c',
702-
]
703902
}],
704903
['target_arch=="x64"', {
705904
'variables': {'openssl_config_path': 'config/k8'},
706-
'sources': [
707-
'openssl/crypto/bn/asm/x86_64-gcc.c',
708-
]
709905
}],
710906
['target_arch=="arm"', {
711907
'variables': {'openssl_config_path': 'config/android'},
712908
'sources': [
713909
'openssl/crypto/armcap.c',
714-
'openssl/crypto/bn/bn_asm.c',
715910
]
716911
}]
717912
],

0 commit comments

Comments
 (0)