Engage POWER8 AES support.

This commit is contained in:
Andy Polyakov 2014-06-01 23:38:11 +02:00
parent a5510df337
commit de51e830a6
7 changed files with 41 additions and 14 deletions

View file

@ -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";

20
TABLE
View file

@ -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

View file

@ -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) $@

View file

@ -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";

View file

@ -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) && ( \

View file

@ -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);

View file

@ -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: