Home GnuPG

Add s390x/zSeries acceleration for AES

Description

Add s390x/zSeries acceleration for AES

* configure.ac: Add 'rijndael-s390x.lo'.
* cipher/Makefile.am: Add 'rijndael-s390x.c'.
* cipher/rijndael-internal.c (USE_S390X_CRYPTO): New.
(RIJNDAEL_context_s) [USE_S390X_CRYPTO]: New 'km*_func' members.
* cipher/rijndael-s390x.c: New.
* cipher/rijndael.c (_gcry_aes_s390x_setup_acceleration)
(_gcry_aes_s390x_setup_setkey)
(_gcry_aes_s390x_setup_prepare_decryption, _gcry_aes_s390x_encrypt)
(_gcry_aes_s390x_decrypt): New.
(do_setkey) [USE_S390X_CRYPTO]: Add s390x acceleration setup.

Patchs adds acceleration for single-block AES and following modes:

  • CBC, CBC-MAC, CFB, OFB, CTR, XTS and OCB

Benchmarks (z15, 5.2Ghz):

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

 ECB enc |      3.81 ns/B     250.2 MiB/s     19.82 c/B
 ECB dec |      4.13 ns/B     231.1 MiB/s     21.46 c/B
 CBC enc |      3.69 ns/B     258.5 MiB/s     19.19 c/B
 CBC dec |      3.71 ns/B     257.1 MiB/s     19.29 c/B
 CFB enc |      3.69 ns/B     258.7 MiB/s     19.17 c/B
 CFB dec |      3.56 ns/B     267.8 MiB/s     18.52 c/B
 OFB enc |      3.85 ns/B     247.8 MiB/s     20.01 c/B
 OFB dec |      3.85 ns/B     247.9 MiB/s     20.01 c/B
 CTR enc |      3.65 ns/B     261.6 MiB/s     18.96 c/B
 CTR dec |      3.64 ns/B     261.6 MiB/s     18.95 c/B
 XTS enc |      3.66 ns/B     260.8 MiB/s     19.02 c/B
 XTS dec |      3.75 ns/B     254.2 MiB/s     19.51 c/B
 CCM enc |      7.34 ns/B     129.9 MiB/s     38.19 c/B
 CCM dec |      7.34 ns/B     129.9 MiB/s     38.19 c/B
CCM auth |      3.70 ns/B     257.6 MiB/s     19.25 c/B
 EAX enc |      7.34 ns/B     129.8 MiB/s     38.19 c/B
 EAX dec |      7.35 ns/B     129.8 MiB/s     38.20 c/B
EAX auth |      3.70 ns/B     257.8 MiB/s     19.24 c/B
 GCM enc |      6.22 ns/B     153.3 MiB/s     32.36 c/B
 GCM dec |      6.23 ns/B     153.0 MiB/s     32.42 c/B
GCM auth |      2.59 ns/B     368.9 MiB/s     13.44 c/B
 OCB enc |      3.82 ns/B     249.7 MiB/s     19.86 c/B
 OCB dec |      3.90 ns/B     244.2 MiB/s     20.31 c/B
OCB auth |      3.88 ns/B     245.5 MiB/s     20.20 c/B

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

 ECB enc |      2.10 ns/B     453.1 MiB/s     10.94 c/B
 ECB dec |      2.11 ns/B     453.0 MiB/s     10.95 c/B
 CBC enc |     0.182 ns/B      5240 MiB/s     0.946 c/B
 CBC dec |     0.044 ns/B     21581 MiB/s     0.230 c/B
 CFB enc |     0.206 ns/B      4623 MiB/s      1.07 c/B
 CFB dec |     0.140 ns/B      6826 MiB/s     0.727 c/B
 OFB enc |     0.183 ns/B      5222 MiB/s     0.950 c/B
 OFB dec |     0.182 ns/B      5252 MiB/s     0.944 c/B
 CTR enc |     0.059 ns/B     16095 MiB/s     0.308 c/B
 CTR dec |     0.059 ns/B     16045 MiB/s     0.309 c/B
 XTS enc |     0.043 ns/B     21998 MiB/s     0.225 c/B
 XTS dec |     0.043 ns/B     22012 MiB/s     0.225 c/B
 CCM enc |     0.239 ns/B      3989 MiB/s      1.24 c/B
 CCM dec |     0.239 ns/B      3987 MiB/s      1.24 c/B
CCM auth |     0.180 ns/B      5288 MiB/s     0.938 c/B
 EAX enc |     0.242 ns/B      3940 MiB/s      1.26 c/B
 EAX dec |     0.243 ns/B      3926 MiB/s      1.26 c/B
EAX auth |     0.183 ns/B      5218 MiB/s     0.950 c/B
 GCM enc |      2.64 ns/B     361.6 MiB/s     13.71 c/B
 GCM dec |      2.64 ns/B     361.3 MiB/s     13.72 c/B
GCM auth |      2.58 ns/B     370.1 MiB/s     13.40 c/B
 OCB enc |     0.186 ns/B      5132 MiB/s     0.966 c/B
 OCB dec |     0.176 ns/B      5414 MiB/s     0.916 c/B
OCB auth |     0.149 ns/B      6394 MiB/s     0.776 c/B
  • Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>

Details

Provenance
jukiviliAuthored on Nov 7 2020, 10:24 AM
Parents
rCf12b6788f229: Add bulk function interface for OFB mode
Branches
Unknown
Tags
Unknown