From 728b53058ee6f89fa95c0ed3feaa410a85db7323 Mon Sep 17 00:00:00 2001 From: Andy Polyakov Date: Mon, 11 May 2015 11:36:48 +0200 Subject: [PATCH] Configure: engage ARMv8 assembly pack in ios64-cross target. Reviewed-by: Dr. Stephen Henson (cherry picked from commit c6d109051d1c2b9a453427a2a53ad3d40acc9276) Resolved Conflicts: Configure --- Configure | 7 ++++--- fips/fipssyms.h | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/Configure b/Configure index 34856e2d9c..2785677a62 100755 --- a/Configure +++ b/Configure @@ -136,6 +136,7 @@ my $mips32_asm=":bn-mips.o::aes_cbc.o aes-mips.o:::sha1-mips.o sha256-mips.o:::: my $mips64_asm=":bn-mips.o mips-mont.o::aes_cbc.o aes-mips.o:::sha1-mips.o sha256-mips.o sha512-mips.o::::::::"; my $s390x_asm="s390xcap.o s390xcpuid.o:bn-s390x.o s390x-mont.o s390x-gf2m.o::aes_ctr.o aes-s390x.o:::sha1-s390x.o sha256-s390x.o sha512-s390x.o::rc4-s390x.o:::::ghash-s390x.o:"; my $armv4_asm="armcap.o armv4cpuid.o:bn_asm.o armv4-mont.o armv4-gf2m.o::aes_cbc.o aes-armv4.o:::sha1-armv4-large.o sha256-armv4.o sha512-armv4.o:::::::ghash-armv4.o::void"; +my $aarch64_asm="armcap.o arm64cpuid.o mem_clr.o:::aes_core.o aes_cbc.o aesv8-armx.o:::sha1-armv8.o sha256-armv8.o sha512-armv8.o:::::::ghashv8-armx.o:"; my $parisc11_asm="pariscid.o:bn_asm.o parisc-mont.o::aes_core.o aes_cbc.o aes-parisc.o:::sha1-parisc.o sha256-parisc.o sha512-parisc.o::rc4-parisc.o:::::ghash-parisc.o::32"; my $parisc20_asm="pariscid.o:pa-risc2W.o parisc-mont.o::aes_core.o aes_cbc.o aes-parisc.o:::sha1-parisc.o sha256-parisc.o sha512-parisc.o::rc4-parisc.o:::::ghash-parisc.o::64"; my $ppc32_asm="ppccpuid.o ppccap.o:bn-ppc.o ppc-mont.o ppc64-mont.o::aes_core.o aes_cbc.o aes-ppc.o:::sha1-ppc.o sha256-ppc.o::::::::"; @@ -596,7 +597,7 @@ my %table=( # CROSS_SDK=iPhoneOS7.0.sdk # "iphoneos-cross","cc:-O3 -isysroot \$(CROSS_TOP)/SDKs/\$(CROSS_SDK) -fomit-frame-pointer -fno-common::-D_REENTRANT:iOS:-Wl,-search_paths_first%:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${no_asm}:dlfcn:darwin-shared:-fPIC -fno-common:-dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", -"ios64-cross","cc:-O3 -arch arm64 -mios-version-min=7.0.0 -isysroot \$(CROSS_TOP)/SDKs/\$(CROSS_SDK) -fno-common::-D_REENTRANT:iOS:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHAR -RC4_CHUNK DES_INT DES_UNROLL -BF_PTR:${no_asm}:dlfcn:darwin-shared:-fPIC -fno-common:-dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", +"ios64-cross","cc:-O3 -arch arm64 -mios-version-min=7.0.0 -isysroot \$(CROSS_TOP)/SDKs/\$(CROSS_SDK) -fno-common::-D_REENTRANT:iOS:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHAR -RC4_CHUNK DES_INT DES_UNROLL -BF_PTR:${aarch64_asm}:ios64:dlfcn:darwin-shared:-fPIC -fno-common:-dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", ##### A/UX "aux3-gcc","gcc:-O2 -DTERMIO::(unknown):AUX:-lbsd:RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:::", @@ -1575,7 +1576,7 @@ if ($rmd160_obj =~ /\.o$/) } if ($aes_obj =~ /\.o$/) { - $cflags.=" -DAES_ASM"; + $cflags.=" -DAES_ASM" if ($aes_obj =~ m/\baes\-/); # aes_ctr.o is not a real file, only indication that assembler # module implements AES_ctr32_encrypt... $cflags.=" -DAES_CTR_ASM" if ($aes_obj =~ s/\s*aes_ctr\.o//); @@ -1596,7 +1597,7 @@ else { $wp_obj="wp_block.o"; } $cmll_obj=$cmll_enc unless ($cmll_obj =~ /.o$/); -if ($modes_obj =~ /ghash/) +if ($modes_obj =~ /ghash\-/) { $cflags.=" -DGHASH_ASM"; } diff --git a/fips/fipssyms.h b/fips/fipssyms.h index 5719aeac2a..f5d04d073c 100644 --- a/fips/fipssyms.h +++ b/fips/fipssyms.h @@ -668,6 +668,40 @@ #define bn_mul_mont_gather5 fips_bn_mul_mont_gather5 #define bn_scatter5 fips_bn_scatter5 #define bn_gather5 fips_bn_gather5 +#define _armv8_aes_probe _fips_armv8_aes_probe +#define _armv8_pmull_probe _fips_armv8_pmull_probe +#define _armv8_sha1_probe _fips_armv8_sha1_probe +#define _armv8_sha256_probe _fips_armv8_sha256_probe +#define aes_v8_encrypt fips_aes_v8_encrypt +#define aes_v8_decrypt fips_aes_v8_decrypt +#define aes_v8_set_encrypt_key fips_aes_v8_set_encrypt_key +#define aes_v8_set_decrypt_key fips_aes_v8_set_decrypt_key +#define aes_v8_cbc_encrypt fips_aes_v8_cbc_encrypt +#define aes_v8_ctr32_encrypt_blocks fips_aes_v8_ctr32_encrypt_blocks +#define gcm_init_v8 fips_gcm_init_v8 +#define gcm_gmult_v8 fips_gcm_gmult_v8 +#define gcm_ghash_v8 fips_gcm_ghash_v8 +#if defined(__APPLE__) && __ASSEMBLER__ +#define _OPENSSL_armcap_P _fips_openssl_armcap_P +#define __armv7_neon_probe __fips_armv7_neon_probe +#define __armv7_tick __fips_armv7_tick +#define __armv8_aes_probe __fips_armv8_aes_probe +#define __armv8_pmull_probe __fips_armv8_pmull_probe +#define __armv8_sha1_probe __fips_armv8_sha1_probe +#define __armv8_sha256_probe __fips_armv8_sha256_probe +#define _aes_v8_encrypt _fips_aes_v8_encrypt +#define _aes_v8_decrypt _fips_aes_v8_decrypt +#define _aes_v8_set_encrypt_key _fips_aes_v8_set_encrypt_key +#define _aes_v8_set_decrypt_key _fips_aes_v8_set_decrypt_key +#define _aes_v8_cbc_encrypt _fips_aes_v8_cbc_encrypt +#define _aes_v8_ctr32_encrypt_blocks _fips_aes_v8_ctr32_encrypt_blocks +#define _gcm_init_v8 _fips_gcm_init_v8 +#define _gcm_gmult_v8 _fips_gcm_gmult_v8 +#define _gcm_ghash_v8 _fips_gcm_ghash_v8 +#define _sha1_block_data_order _fips_sha1_block_data_order +#define _sha256_block_data_order _fips_sha256_block_data_order +#define _sha512_block_data_order _fips_sha512_block_data_order +#endif #if defined(_MSC_VER) # pragma const_seg("fipsro$b")