Home GnuPG

rijndael-ppc: add bulk modes for CBC, CFB, CTR and XTS

Description

rijndael-ppc: add bulk modes for CBC, CFB, CTR and XTS

* cipher/rijndael-ppc.c (vec_add_uint128, _gcry_aes_ppc8_cfb_enc)
(_gcry_aes_ppc8_cfb_dec, _gcry_aes_ppc8_cbc_enc)
(_gcry_aes_ppc8_cbc_dec, _gcry_aes_ppc8_ctr_enc)
(_gcry_aes_ppc8_xts_crypt): New.
* cipher/rijndael.c [USE_PPC_CRYPTO] (_gcry_aes_ppc8_cfb_enc)
(_gcry_aes_ppc8_cfb_dec, _gcry_aes_ppc8_cbc_enc)
(_gcry_aes_ppc8_cbc_dec, _gcry_aes_ppc8_ctr_enc)
(_gcry_aes_ppc8_xts_crypt): New.
(do_setkey, _gcry_aes_cfb_enc, _gcry_aes_cfb_dec, _gcry_aes_cbc_enc)
(_gcry_aes_cbc_dec, _gcry_aes_ctr_enc)
(_gcry_aes_xts_crypto) [USE_PPC_CRYPTO]: Enable PowerPC AES
CFB/CBC/CTR/XTS bulk implementations.
* configure.ac (gcry_cv_gcc_inline_asm_ppc_altivec): Add 'vadduwm'
instruction.

Benchmark on POWER8 ~3.8Ghz:

Before:
AES | nanosecs/byte mebibytes/sec cycles/byte

 CBC enc |      2.13 ns/B     447.2 MiB/s      8.10 c/B
 CBC dec |      1.13 ns/B     843.4 MiB/s      4.30 c/B
 CFB enc |      2.20 ns/B     433.9 MiB/s      8.35 c/B
 CFB dec |      2.22 ns/B     429.7 MiB/s      8.43 c/B
 CTR enc |      2.18 ns/B     438.2 MiB/s      8.27 c/B
 CTR dec |      2.18 ns/B     437.4 MiB/s      8.28 c/B
 XTS enc |      2.31 ns/B     412.8 MiB/s      8.78 c/B
 XTS dec |      2.30 ns/B     414.3 MiB/s      8.75 c/B
 CCM enc |      4.33 ns/B     220.1 MiB/s     16.47 c/B
 CCM dec |      4.34 ns/B     219.9 MiB/s     16.48 c/B
CCM auth |      2.16 ns/B     440.6 MiB/s      8.22 c/B
 EAX enc |      4.34 ns/B     219.8 MiB/s     16.49 c/B
 EAX dec |      4.34 ns/B     219.8 MiB/s     16.49 c/B
EAX auth |      2.16 ns/B     440.5 MiB/s      8.23 c/B

After:
AES | nanosecs/byte mebibytes/sec cycles/byte

 CBC enc |      1.06 ns/B     903.1 MiB/s      4.01 c/B
 CBC dec |     0.211 ns/B      4511 MiB/s     0.803 c/B
 CFB enc |      1.06 ns/B     896.7 MiB/s      4.04 c/B
 CFB dec |     0.209 ns/B      4563 MiB/s     0.794 c/B
 CTR enc |     0.237 ns/B      4026 MiB/s     0.900 c/B
 CTR dec |     0.237 ns/B      4029 MiB/s     0.900 c/B
 XTS enc |     0.496 ns/B      1922 MiB/s      1.89 c/B
 XTS dec |     0.496 ns/B      1924 MiB/s      1.88 c/B
 CCM enc |      1.29 ns/B     737.7 MiB/s      4.91 c/B
 CCM dec |      1.29 ns/B     737.8 MiB/s      4.91 c/B
CCM auth |      1.06 ns/B     903.3 MiB/s      4.01 c/B
 EAX enc |      1.29 ns/B     737.7 MiB/s      4.91 c/B
 EAX dec |      1.29 ns/B     737.2 MiB/s      4.92 c/B
  • GnuPG-bug-id: T4529
  • Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>

Details

Provenance
jukiviliAuthored on Aug 21 2019, 7:53 PM
Parents
rCbd1367bb6078: rijndael-ppc: add bulk mode for ocb_auth
Branches
Unknown
Tags
Unknown
Tasks
T4529: libgcrypt: POWER AES Vector Acceleration