Home GnuPG

serpent: accelerate XTS and ECB modes

Description

serpent: accelerate XTS and ECB modes

* cipher/serpent-armv7-neon.S (_gcry_serpent_neon_blk8): New.
* cipher/serpent-avx2-amd64.S (_gcry_serpent_avx2_blk16): New.
* cipher/serpent-sse2-amd64.S (_gcry_serpent_sse2_blk8): New.
* cipher/serpent.c (_gcry_serpent_sse2_blk8)
(_gcry_serpent_avx2_blk16, _gcry_serpent_neon_blk8)
(_gcry_serpent_xts_crypt, _gcry_serpent_ecb_crypt)
(serpent_crypt_blk1_16, serpent_encrypt_blk1_16)
(serpent_decrypt_blk1_16): New.
(serpent_setkey): Setup XTS and ECB bulk functions.

Benchmark on AMD Ryzen 9 7900X:

Before:
SERPENT128 | nanosecs/byte mebibytes/sec cycles/byte auto Mhz

ECB enc |      5.42 ns/B     176.0 MiB/s     30.47 c/B      5625
ECB dec |      4.82 ns/B     197.9 MiB/s     27.11 c/B      5625
XTS enc |      5.57 ns/B     171.3 MiB/s     31.31 c/B      5625
XTS dec |      4.99 ns/B     191.1 MiB/s     28.07 c/B      5625

After:
SERPENT128 | nanosecs/byte mebibytes/sec cycles/byte auto Mhz

ECB enc |     0.708 ns/B      1347 MiB/s      3.98 c/B      5625
ECB dec |     0.694 ns/B      1373 MiB/s      3.91 c/B      5625
XTS enc |     0.766 ns/B      1246 MiB/s      4.31 c/B      5625
XTS dec |     0.754 ns/B      1264 MiB/s      4.24 c/B      5625
  • GnuPG-bug-id: T6242
  • Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>