Home GnuPG

sm4 & camellia: add generic bulk acceleration for CTR32LE mode (GCM-SIV)

Description

sm4 & camellia: add generic bulk acceleration for CTR32LE mode (GCM-SIV)

* cipher/bulkhelp.h (bulk_ctr32le_enc_128): New.
* cipher/camellia-glue.c (_gcry_camellia_ctr32le_enc): New.
(camellia_setkey): Setup `bulk_ops->ctr32le_enc` if any AVX2
implementation is available.
* cipher/sm4.c (_gcry_sm4_ctr32le_enc): New.
(sm4_setkey): Setup `bulk_ops->ctr32le_enc`.
* tests/basic.c (check_gcm_siv_cipher): Add large bulk encryption
test vectors for SM4 and CAMELLIA128.

On Intel tigerlake, SM4-GCM-SIV encryption performance is now
1.69 cycles/byte (was 32.9 c/B). CAMELLIA128-GCM-SIV encryption
is now 1.38 cycles/byte (was 21.2 c/B).

  • Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>

Details

Provenance
jukiviliAuthored on Jul 21 2022, 10:05 AM
Parents
rCeaed633c1662: sm4: add amd64 GFNI/AVX512 implementation
Branches
Unknown
Tags
Unknown