openssl: use optimized asm code on x86 and x64
authorBert Belder <bertbelder@gmail.com>
Wed, 12 Sep 2012 23:50:38 +0000 (01:50 +0200)
committerisaacs <i@izs.me>
Tue, 25 Sep 2012 15:51:05 +0000 (08:51 -0700)
deps/openssl/config/k8/openssl/opensslconf-posix.h
deps/openssl/config/piii/openssl/opensslconf-posix.h
deps/openssl/config/piii/openssl/opensslconf-win32.h
deps/openssl/openssl.gyp

index 0685220..1a6058f 100644 (file)
@@ -41,9 +41,6 @@
 #ifndef OPENSSL_NO_SEED
 # define OPENSSL_NO_SEED
 #endif
-#ifndef OPENSSL_NO_ASM
-# define OPENSSL_NO_ASM
-#endif
 
 #endif /* OPENSSL_DOING_MAKEDEPEND */
 
index d935d43..36e305a 100644 (file)
@@ -41,9 +41,6 @@
 #ifndef OPENSSL_NO_SEED
 # define OPENSSL_NO_SEED
 #endif
-#ifndef OPENSSL_NO_ASM
-# define OPENSSL_NO_ASM
-#endif
 
 #endif /* OPENSSL_DOING_MAKEDEPEND */
 
index b4cdf04..529aec6 100644 (file)
@@ -44,9 +44,6 @@
 #ifndef OPENSSL_NO_SEED
 # define OPENSSL_NO_SEED
 #endif
-#ifndef OPENSSL_NO_ASM
-# define OPENSSL_NO_ASM
-#endif
 
 #endif /* OPENSSL_DOING_MAKEDEPEND */
 
index cbc0007..6aa147f 100644 (file)
@@ -19,7 +19,7 @@
         # Work around brain dead SunOS linker.
         'OPENSSL_NO_GOST',
         'OPENSSL_NO_HW_PADLOCK',
-        'OPENSSL_NO_TTY',
+        'OPENSSL_NO_TTY'
       ],
       'sources': [
         'openssl/ssl/bio_ssl.c',
@@ -67,9 +67,7 @@
         'openssl/ssl/t1_reneg.c',
         'openssl/ssl/t1_srvr.c',
 
-        'openssl/crypto/aes/aes_cbc.c',
         'openssl/crypto/aes/aes_cfb.c',
-        'openssl/crypto/aes/aes_core.c',
         'openssl/crypto/aes/aes_ctr.c',
         'openssl/crypto/aes/aes_ecb.c',
         'openssl/crypto/aes/aes_ige.c',
         'openssl/crypto/asn1/x_x509a.c',
         'openssl/crypto/bf/bf_cfb64.c',
         'openssl/crypto/bf/bf_ecb.c',
-        'openssl/crypto/bf/bf_enc.c',
-        'openssl/crypto/bf/bf_enc.c',
         'openssl/crypto/bf/bf_ofb64.c',
         'openssl/crypto/bf/bf_skey.c',
         'openssl/crypto/bio/b_dump.c',
         'openssl/crypto/bio/bss_null.c',
         'openssl/crypto/bio/bss_sock.c',
         'openssl/crypto/bn/bn_add.c',
-        'openssl/crypto/bn/bn_asm.c',
         'openssl/crypto/bn/bn_blind.c',
         'openssl/crypto/bn/bn_const.c',
         'openssl/crypto/bn/bn_ctx.c',
         'openssl/crypto/camellia/cmll_ofb.c',
         'openssl/crypto/cast/c_cfb64.c',
         'openssl/crypto/cast/c_ecb.c',
-        'openssl/crypto/cast/c_enc.c',
         'openssl/crypto/cast/c_ofb64.c',
         'openssl/crypto/cast/c_skey.c',
         'openssl/crypto/cms/cms_asn1.c',
         'openssl/crypto/des/cfb64ede.c',
         'openssl/crypto/des/cfb64enc.c',
         'openssl/crypto/des/cfb_enc.c',
-        'openssl/crypto/des/des_enc.c',
         'openssl/crypto/des/des_old.c',
         'openssl/crypto/des/des_old2.c',
         'openssl/crypto/des/ecb3_enc.c',
         'openssl/crypto/des/enc_read.c',
         'openssl/crypto/des/enc_writ.c',
         'openssl/crypto/des/fcrypt.c',
-        'openssl/crypto/des/fcrypt_b.c',
         'openssl/crypto/des/ofb64ede.c',
         'openssl/crypto/des/ofb64enc.c',
         'openssl/crypto/des/ofb_enc.c',
         'openssl/crypto/mdc2/mdc2dgst.c',
         'openssl/crypto/mdc2/mdc2_one.c',
         'openssl/crypto/mem.c',
-        'openssl/crypto/mem_clr.c',
         'openssl/crypto/mem_dbg.c',
         'openssl/crypto/modes/cbc128.c',
         'openssl/crypto/modes/cfb128.c',
         'openssl/crypto/rc2/rc2_skey.c',
         'openssl/crypto/rc2/rc2cfb64.c',
         'openssl/crypto/rc2/rc2ofb64.c',
-        'openssl/crypto/rc4/rc4_enc.c',
-        'openssl/crypto/rc4/rc4_skey.c',
         'openssl/crypto/ripemd/rmd_dgst.c',
         'openssl/crypto/ripemd/rmd_one.c',
         'openssl/crypto/rsa/rsa_ameth.c',
         'openssl/engines/e_gmp.c',
         'openssl/engines/e_nuron.c',
         'openssl/engines/e_sureware.c',
-        'openssl/engines/e_ubsec.c',
-      ],
-      'sources/': [
-        ['exclude', 'camellia/.*$'],
-        ['exclude', 'cms/.*$'],
-        ['exclude', 'mdc2/.*$'],
+        'openssl/engines/e_ubsec.c'
       ],
       'conditions': [
+        ['target_arch!="ia32" and target_arch!="x64"', {
+          # Disable asm
+          'defines': [
+            'OPENSSL_NO_ASM'
+          ],
+          'sources': [
+            'openssl/crypto/aes/aes_cbc.c',
+            'openssl/crypto/aes/aes_core.c',
+            'openssl/crypto/bf/bf_enc.c',
+            'openssl/crypto/bn/bn_asm.c',
+            'openssl/crypto/cast/c_enc.c',
+            'openssl/crypto/des/des_enc.c',
+            'openssl/crypto/des/fcrypt_b.c',
+            'openssl/crypto/mem_clr.c',
+            'openssl/crypto/rc4/rc4_enc.c',
+            'openssl/crypto/rc4/rc4_skey.c'
+          ]
+        }, {
+          # Enable asm
+          'defines': [
+            'AES_ASM',
+            'BF_ASM',
+            'BNCO_ASM',
+            'BN_ASM',
+            'CPUID_ASM',
+            'DES_ASM',
+            'LIB_BN_ASM',
+            'OPENSSL_BN_ASM',
+            'OPENSSL_CPUID_OBJ',
+            'RIP_ASM',
+            'WHIRLPOOL_ASM',
+            'WP_ASM'
+          ],
+          'conditions': [
+            ['OS!="win" and OS!="mac" and target_arch=="ia32"', {
+              'sources': [
+                'asm/x86-elf-gas/aes/aes-586.s',
+                'asm/x86-elf-gas/bf/bf-686.s',
+                'asm/x86-elf-gas/bn/x86-mont.s',
+                'asm/x86-elf-gas/bn/x86.s',
+                'asm/x86-elf-gas/camellia/cmll-x86.s',
+                'asm/x86-elf-gas/cast/cast-586.s',
+                'asm/x86-elf-gas/des/crypt586.s',
+                'asm/x86-elf-gas/des/des-586.s',
+                'asm/x86-elf-gas/md5/md5-586.s',
+                'asm/x86-elf-gas/rc4/rc4-586.s',
+                'asm/x86-elf-gas/rc5/rc5-586.s',
+                'asm/x86-elf-gas/ripemd/rmd-586.s',
+                'asm/x86-elf-gas/sha/sha1-586.s',
+                'asm/x86-elf-gas/sha/sha256-586.s',
+                'asm/x86-elf-gas/sha/sha512-586.s',
+                'asm/x86-elf-gas/whrlpool/wp-mmx.s',
+                'asm/x86-elf-gas/x86cpuid.s'
+              ]
+            }],
+            ['OS!="win" and OS!="mac" and target_arch=="x64"', {
+              'sources': [
+                'asm/x64-elf-gas/aes/aes-x86_64.s',
+                'asm/x64-elf-gas/bn/x86_64-mont.s',
+                'asm/x64-elf-gas/camellia/cmll-x86_64.s',
+                'asm/x64-elf-gas/md5/md5-x86_64.s',
+                'asm/x64-elf-gas/rc4/rc4-x86_64.s',
+                'asm/x64-elf-gas/sha/sha1-x86_64.s',
+                'asm/x64-elf-gas/sha/sha512-x86_64.s',
+                'asm/x64-elf-gas/whrlpool/wp-x86_64.s',
+                'asm/x64-elf-gas/x86_64cpuid.s',
+                # Non-generated asm
+                'openssl/crypto/bn/asm/x86_64-gcc.c',
+                # No asm available
+                'openssl/crypto/cast/c_enc.c',
+                'openssl/crypto/des/des_enc.c',
+                'openssl/crypto/bf/bf_enc.c'
+              ]
+            }],
+            ['OS=="mac" and target_arch=="ia32"', {
+              'sources': [
+                'asm/x86-macosx-gas/aes/aes-586.s',
+                'asm/x86-macosx-gas/bf/bf-686.s',
+                'asm/x86-macosx-gas/bn/x86-mont.s',
+                'asm/x86-macosx-gas/bn/x86.s',
+                'asm/x86-macosx-gas/camellia/cmll-x86.s',
+                'asm/x86-macosx-gas/cast/cast-586.s',
+                'asm/x86-macosx-gas/des/crypt586.s',
+                'asm/x86-macosx-gas/des/des-586.s',
+                'asm/x86-macosx-gas/md5/md5-586.s',
+                'asm/x86-macosx-gas/rc4/rc4-586.s',
+                'asm/x86-macosx-gas/rc5/rc5-586.s',
+                'asm/x86-macosx-gas/ripemd/rmd-586.s',
+                'asm/x86-macosx-gas/sha/sha1-586.s',
+                'asm/x86-macosx-gas/sha/sha256-586.s',
+                'asm/x86-macosx-gas/sha/sha512-586.s',
+                'asm/x86-macosx-gas/whrlpool/wp-mmx.s',
+                'asm/x86-macosx-gas/x86cpuid.s'
+              ]
+            }],
+            ['OS=="mac" and target_arch=="x64"', {
+              'sources': [
+                'asm/x64-macosx-gas/aes/aes-x86_64.s',
+                'asm/x64-macosx-gas/bn/x86_64-mont.s',
+                'asm/x64-macosx-gas/camellia/cmll-x86_64.s',
+                'asm/x64-macosx-gas/md5/md5-x86_64.s',
+                'asm/x64-macosx-gas/rc4/rc4-x86_64.s',
+                'asm/x64-macosx-gas/sha/sha1-x86_64.s',
+                'asm/x64-macosx-gas/sha/sha512-x86_64.s',
+                'asm/x64-macosx-gas/whrlpool/wp-x86_64.s',
+                'asm/x64-macosx-gas/x86_64cpuid.s',
+                # Non-generated asm
+                'openssl/crypto/bn/asm/x86_64-gcc.c',
+                # No asm available
+                'openssl/crypto/cast/c_enc.c',
+                'openssl/crypto/des/des_enc.c',
+                'openssl/crypto/bf/bf_enc.c'
+              ]
+            }],
+            ['OS=="win" and target_arch=="ia32"', {
+              'sources': [
+                'asm/x86-win32-masm/aes/aes-586.asm',
+                'asm/x86-win32-masm/bf/bf-686.asm',
+                'asm/x86-win32-masm/bn/x86-mont.asm',
+                'asm/x86-win32-masm/bn/x86.asm',
+                'asm/x86-win32-masm/camellia/cmll-x86.asm',
+                'asm/x86-win32-masm/cast/cast-586.asm',
+                'asm/x86-win32-masm/des/crypt586.asm',
+                'asm/x86-win32-masm/des/des-586.asm',
+                'asm/x86-win32-masm/md5/md5-586.asm',
+                'asm/x86-win32-masm/rc4/rc4-586.asm',
+                'asm/x86-win32-masm/rc5/rc5-586.asm',
+                'asm/x86-win32-masm/ripemd/rmd-586.asm',
+                'asm/x86-win32-masm/sha/sha1-586.asm',
+                'asm/x86-win32-masm/sha/sha256-586.asm',
+                'asm/x86-win32-masm/sha/sha512-586.asm',
+                'asm/x86-win32-masm/whrlpool/wp-mmx.asm',
+                'asm/x86-win32-masm/x86cpuid.asm'
+              ],
+              'rules': [
+                {
+                  'rule_name': 'Assemble',
+                  'extension': 'asm',
+                  'inputs': [],
+                  'outputs': [
+                    '<(INTERMEDIATE_DIR)/<(RULE_INPUT_ROOT).obj',
+                  ],
+                  'action': [
+                    'ml.exe',
+                    '/Zi',
+                    '/Fo', '<(INTERMEDIATE_DIR)/<(RULE_INPUT_ROOT).obj',
+                    '/c', '<(RULE_INPUT_PATH)',
+                  ],
+                  'process_outputs_as_sources': 0,
+                  'message': 'Assembling <(RULE_INPUT_PATH) to <(INTERMEDIATE_DIR)/<(RULE_INPUT_ROOT).obj.',
+                }
+              ]
+            }],
+            ['OS=="win" and target_arch=="x64"', {
+              'sources': [
+                'asm/x64-win32-masm/aes/aes-x86_64.asm',
+                'asm/x64-win32-masm/bn/x86_64-mont.asm',
+                'asm/x64-win32-masm/camellia/cmll-x86_64.asm',
+                'asm/x64-win32-masm/md5/md5-x86_64.asm',
+                'asm/x64-win32-masm/rc4/rc4-x86_64.asm',
+                'asm/x64-win32-masm/sha/sha1-x86_64.asm',
+                'asm/x64-win32-masm/sha/sha512-x86_64.asm',
+                'asm/x64-win32-masm/whrlpool/wp-x86_64.asm',
+                'asm/x64-win32-masm/x86_64cpuid.asm',
+                # Non-generated asm
+                'openssl/crypto/bn/asm/x86_64-win32-masm.asm',
+                # No asm available
+                'openssl/crypto/cast/c_enc.c',
+                'openssl/crypto/des/des_enc.c',
+                'openssl/crypto/bf/bf_enc.c'
+              ],
+              'rules': [
+                {
+                  'rule_name': 'Assemble',
+                  'extension': 'asm',
+                  'inputs': [],
+                  'outputs': [
+                    '<(INTERMEDIATE_DIR)/<(RULE_INPUT_ROOT).obj',
+                  ],
+                  'action': [
+                    'ml64.exe',
+                    '/Zi',
+                    '/Fo', '<(INTERMEDIATE_DIR)/<(RULE_INPUT_ROOT).obj',
+                    '/c', '<(RULE_INPUT_PATH)',
+                  ],
+                  'process_outputs_as_sources': 0,
+                  'message': 'Assembling <(RULE_INPUT_PATH) to <(INTERMEDIATE_DIR)/<(RULE_INPUT_ROOT).obj.',
+                }
+              ]
+            }]
+          ]
+        }],
         ['OS=="win"', {
           'defines': [
             'MK1MF_BUILD',
           'variables': {'openssl_config_path': 'config/android'},
         }],
       ],
+      'sources/': [
+        ['exclude', 'camellia/.*$'],
+        ['exclude', 'cms/.*$'],
+        ['exclude', 'mdc2/.*$'],
+      ],
       'include_dirs': [
         '.',
         'openssl',