diff options
author | Andy Polyakov <appro@openssl.org> | 2014-06-01 23:38:11 +0200 |
---|---|---|
committer | Andy Polyakov <appro@openssl.org> | 2014-06-01 23:38:11 +0200 |
commit | de51e830a637862ecd86b1feb848312366072dd1 (patch) | |
tree | 909835b193e87e7d39daf8c06c24e6ef49ad783f | |
parent | a5510df3374a5bd21fa843d9d2b85924c2568756 (diff) |
Engage POWER8 AES support.
-rwxr-xr-x | Configure | 2 | ||||
-rw-r--r-- | TABLE | 20 | ||||
-rw-r--r-- | crypto/aes/Makefile | 2 | ||||
-rwxr-xr-x | crypto/aes/asm/aesp8-ppc.pl | 2 | ||||
-rw-r--r-- | crypto/evp/e_aes.c | 12 | ||||
-rw-r--r-- | crypto/ppccap.c | 7 | ||||
-rwxr-xr-x | crypto/ppccpuid.pl | 10 |
7 files changed, 41 insertions, 14 deletions
@@ -140,7 +140,7 @@ my $armv4_asm="armcap.o armv4cpuid.o:bn_asm.o armv4-mont.o armv4-gf2m.o::aes_cbc 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::::::::"; 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 $ppc64_asm="ppccpuid.o ppccap.o:bn-ppc.o ppc-mont.o ppc64-mont.o::aes_core.o aes_cbc.o aes-ppc.o vpaes-ppc.o:::sha1-ppc.o sha256-ppc.o sha512-ppc.o::::::::"; +my $ppc64_asm="ppccpuid.o ppccap.o:bn-ppc.o ppc-mont.o ppc64-mont.o::aes_core.o aes_cbc.o aes-ppc.o vpaes-ppc.o aesp8-ppc.o:::sha1-ppc.o sha256-ppc.o sha512-ppc.o::::::::"; my $ppc32_asm=$ppc64_asm; my $no_asm=":::::::::::::::void"; @@ -902,7 +902,7 @@ $bn_ops = BN_LLONG RC4_CHAR $cpuid_obj = ppccpuid.o ppccap.o $bn_obj = bn-ppc.o ppc-mont.o ppc64-mont.o $des_obj = -$aes_obj = aes_core.o aes_cbc.o aes-ppc.o vpaes-ppc.o +$aes_obj = aes_core.o aes_cbc.o aes-ppc.o vpaes-ppc.o aesp8-ppc.o $bf_obj = $md5_obj = $sha1_obj = sha1-ppc.o sha256-ppc.o sha512-ppc.o @@ -935,7 +935,7 @@ $bn_ops = BN_LLONG RC4_CHAR $cpuid_obj = ppccpuid.o ppccap.o $bn_obj = bn-ppc.o ppc-mont.o ppc64-mont.o $des_obj = -$aes_obj = aes_core.o aes_cbc.o aes-ppc.o vpaes-ppc.o +$aes_obj = aes_core.o aes_cbc.o aes-ppc.o vpaes-ppc.o aesp8-ppc.o $bf_obj = $md5_obj = $sha1_obj = sha1-ppc.o sha256-ppc.o sha512-ppc.o @@ -1001,7 +1001,7 @@ $bn_ops = SIXTY_FOUR_BIT_LONG RC4_CHAR $cpuid_obj = ppccpuid.o ppccap.o $bn_obj = bn-ppc.o ppc-mont.o ppc64-mont.o $des_obj = -$aes_obj = aes_core.o aes_cbc.o aes-ppc.o vpaes-ppc.o +$aes_obj = aes_core.o aes_cbc.o aes-ppc.o vpaes-ppc.o aesp8-ppc.o $bf_obj = $md5_obj = $sha1_obj = sha1-ppc.o sha256-ppc.o sha512-ppc.o @@ -1034,7 +1034,7 @@ $bn_ops = SIXTY_FOUR_BIT_LONG RC4_CHAR $cpuid_obj = ppccpuid.o ppccap.o $bn_obj = bn-ppc.o ppc-mont.o ppc64-mont.o $des_obj = -$aes_obj = aes_core.o aes_cbc.o aes-ppc.o vpaes-ppc.o +$aes_obj = aes_core.o aes_cbc.o aes-ppc.o vpaes-ppc.o aesp8-ppc.o $bf_obj = $md5_obj = $sha1_obj = sha1-ppc.o sha256-ppc.o sha512-ppc.o @@ -1463,7 +1463,7 @@ $bn_ops = BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR $cpuid_obj = ppccpuid.o ppccap.o $bn_obj = bn-ppc.o ppc-mont.o ppc64-mont.o $des_obj = -$aes_obj = aes_core.o aes_cbc.o aes-ppc.o vpaes-ppc.o +$aes_obj = aes_core.o aes_cbc.o aes-ppc.o vpaes-ppc.o aesp8-ppc.o $bf_obj = $md5_obj = $sha1_obj = sha1-ppc.o sha256-ppc.o sha512-ppc.o @@ -1496,7 +1496,7 @@ $bn_ops = SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR $cpuid_obj = ppccpuid.o ppccap.o $bn_obj = bn-ppc.o ppc-mont.o ppc64-mont.o $des_obj = -$aes_obj = aes_core.o aes_cbc.o aes-ppc.o vpaes-ppc.o +$aes_obj = aes_core.o aes_cbc.o aes-ppc.o vpaes-ppc.o aesp8-ppc.o $bf_obj = $md5_obj = $sha1_obj = sha1-ppc.o sha256-ppc.o sha512-ppc.o @@ -2189,7 +2189,7 @@ $bn_ops = BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR $cpuid_obj = ppccpuid.o ppccap.o $bn_obj = bn-ppc.o ppc-mont.o ppc64-mont.o $des_obj = -$aes_obj = aes_core.o aes_cbc.o aes-ppc.o vpaes-ppc.o +$aes_obj = aes_core.o aes_cbc.o aes-ppc.o vpaes-ppc.o aesp8-ppc.o $bf_obj = $md5_obj = $sha1_obj = sha1-ppc.o sha256-ppc.o sha512-ppc.o @@ -4532,7 +4532,7 @@ $bn_ops = BN_LLONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL $cpuid_obj = ppccpuid.o ppccap.o $bn_obj = bn-ppc.o ppc-mont.o ppc64-mont.o $des_obj = -$aes_obj = aes_core.o aes_cbc.o aes-ppc.o vpaes-ppc.o +$aes_obj = aes_core.o aes_cbc.o aes-ppc.o vpaes-ppc.o aesp8-ppc.o $bf_obj = $md5_obj = $sha1_obj = sha1-ppc.o sha256-ppc.o sha512-ppc.o @@ -4565,7 +4565,7 @@ $bn_ops = SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL $cpuid_obj = ppccpuid.o ppccap.o $bn_obj = bn-ppc.o ppc-mont.o ppc64-mont.o $des_obj = -$aes_obj = aes_core.o aes_cbc.o aes-ppc.o vpaes-ppc.o +$aes_obj = aes_core.o aes_cbc.o aes-ppc.o vpaes-ppc.o aesp8-ppc.o $bf_obj = $md5_obj = $sha1_obj = sha1-ppc.o sha256-ppc.o sha512-ppc.o @@ -4598,7 +4598,7 @@ $bn_ops = SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL $cpuid_obj = ppccpuid.o ppccap.o $bn_obj = bn-ppc.o ppc-mont.o ppc64-mont.o $des_obj = -$aes_obj = aes_core.o aes_cbc.o aes-ppc.o vpaes-ppc.o +$aes_obj = aes_core.o aes_cbc.o aes-ppc.o vpaes-ppc.o aesp8-ppc.o $bf_obj = $md5_obj = $sha1_obj = sha1-ppc.o sha256-ppc.o sha512-ppc.o diff --git a/crypto/aes/Makefile b/crypto/aes/Makefile index 192464c9db..cd218c9d98 100644 --- a/crypto/aes/Makefile +++ b/crypto/aes/Makefile @@ -79,6 +79,8 @@ aes-ppc.s: asm/aes-ppc.pl $(PERL) asm/aes-ppc.pl $(PERLASM_SCHEME) $@ vpaes-ppc.s: asm/vpaes-ppc.pl $(PERL) asm/vpaes-ppc.pl $(PERLASM_SCHEME) $@ +aesp8-ppc.s: asm/aesp8-ppc.pl + $(PERL) asm/aesp8-ppc.pl $(PERLASM_SCHEME) $@ aes-parisc.s: asm/aes-parisc.pl $(PERL) asm/aes-parisc.pl $(PERLASM_SCHEME) $@ diff --git a/crypto/aes/asm/aesp8-ppc.pl b/crypto/aes/asm/aesp8-ppc.pl index b1da5965fb..31a260fc3c 100755 --- a/crypto/aes/asm/aesp8-ppc.pl +++ b/crypto/aes/asm/aesp8-ppc.pl @@ -49,7 +49,7 @@ die "can't locate ppc-xlate.pl"; open STDOUT,"| $^X $xlate $flavour ".shift || die "can't call $xlate: $!"; $FRAME=8*$SIZE_T; -$prefix="AES"; +$prefix="aes_p8"; $sp="r1"; $vrsave="r12"; diff --git a/crypto/evp/e_aes.c b/crypto/evp/e_aes.c index 6ba452593b..51714a4a4f 100644 --- a/crypto/evp/e_aes.c +++ b/crypto/evp/e_aes.c @@ -154,9 +154,17 @@ void AES_xts_decrypt(const char *inp,char *out,size_t len, const unsigned char iv[16]); #endif -#if defined(VPAES_ASM) && (defined(__powerpc__) || defined(__ppc__) || defined(_ARCH_PPC)) +#if defined(OPENSSL_CPUID_OBJ) && (defined(__powerpc__) || defined(__ppc__) || defined(_ARCH_PPC)) extern unsigned int OPENSSL_ppccap_P; -#define VPAES_CAPABLE (OPENSSL_ppccap_P&(1<<1)) +# ifdef VPAES_ASM +# define VPAES_CAPABLE (OPENSSL_ppccap_P&(1<<1)) +# endif +# define HWAES_CAPABLE (OPENSSL_ppccap_P&(1<<2)) +# define HWAES_set_encrypt_key aes_p8_set_encrypt_key +# define HWAES_set_decrypt_key aes_p8_set_decrypt_key +# define HWAES_encrypt aes_p8_encrypt +# define HWAES_decrypt aes_p8_decrypt +# define HWAES_cbc_encrypt aes_p8_cbc_encrypt #endif #if defined(AES_ASM) && !defined(I386_ONLY) && ( \ diff --git a/crypto/ppccap.c b/crypto/ppccap.c index d78bfbcdbb..4c5e88d3a0 100644 --- a/crypto/ppccap.c +++ b/crypto/ppccap.c @@ -12,6 +12,7 @@ #define PPC_FPU64 (1<<0) #define PPC_ALTIVEC (1<<1) +#define PPC_CRYPTO207 (1<<2) unsigned int OPENSSL_ppccap_P = 0; @@ -58,6 +59,7 @@ static void ill_handler (int sig) { siglongjmp(ill_jmp,sig); } void OPENSSL_ppc64_probe(void); void OPENSSL_altivec_probe(void); +void OPENSSL_crypto207_probe(void); void OPENSSL_cpuid_setup(void) { @@ -128,6 +130,11 @@ void OPENSSL_cpuid_setup(void) { OPENSSL_altivec_probe(); OPENSSL_ppccap_P |= PPC_ALTIVEC; + if (sigsetjmp(ill_jmp,1) == 0) + { + OPENSSL_crypto207_probe(); + OPENSSL_ppccap_P |= PPC_CRYPTO207; + } } sigaction (SIGILL,&ill_oact,NULL); diff --git a/crypto/ppccpuid.pl b/crypto/ppccpuid.pl index b4990ded85..aeafb6c7b5 100755 --- a/crypto/ppccpuid.pl +++ b/crypto/ppccpuid.pl @@ -42,6 +42,16 @@ $code=<<___; .byte 0,12,0x14,0,0,0,0,0 .size .OPENSSL_altivec_probe,.-..OPENSSL_altivec_probe +.globl .OPENSSL_crypto207_probe +.align 4 +.OPENSSL_crypto207_probe + lvx_u v0,0,r1 + vcipher v0,v0,v0 + blr + .long 0 + .byte 0,12,0x14,0,0,0,0,0 +.size .OPENSSL_crypto207_probe,.-.OPENSSL_crypto207_probe + .globl .OPENSSL_wipe_cpu .align 4 .OPENSSL_wipe_cpu: |