Home GnuPG

Add s390x/zSeries implementation of ChaCha20

Description

Add s390x/zSeries implementation of ChaCha20

* cipher/Makefile.am: Add 'asm-common-s390x.h' and 'chacha20-s390x.S'.
* cipher/asm-common-s390x.h: New.
* cipher/chacha20-s390x.S: New.
* cipher/chacha20.c (USE_S390X_VX): New.
(CHACHA20_context_t): Change 'use_*' bit-field to unsigned type; Add
'use_s390x'.
(_gcry_chacha20_s390x_vx_blocks8)
(_gcry_chacha20_s390x_vx_blocks4_2_1): New.
(chacha20_do_setkey): Add HW feature detect for s390x/VX.
(chacha20_blocks, do_chacha20_encrypt_stream_tail): Add s390x/VX
code-path.
* configure.ac: Add 'chacha20-s390x.lo'.

Patch adds VX vector instruction set accelerated ChaCha20
implementation for zSeries.

Benchmark on z15 (4504 Mhz):

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

STREAM enc |      2.62 ns/B     364.0 MiB/s     11.80 c/B
STREAM dec |      2.62 ns/B     363.8 MiB/s     11.81 c/B

After (~5x faster):
CHACHA20 | nanosecs/byte mebibytes/sec cycles/byte

STREAM enc |     0.505 ns/B      1888 MiB/s      2.28 c/B
STREAM dec |     0.506 ns/B      1887 MiB/s      2.28 c/B
  • GnuPG-bug-id: T5201
  • Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>