Home GnuPG
Diffusion GnuPG 99e2c178c73c

g10/cipher-aead: add fast path for avoid memcpy when AEAD encrypting

Description

g10/cipher-aead: add fast path for avoid memcpy when AEAD encrypting

* g10/cipher-aead.c (do_hash): Add faster path for encrypting directly
from input buffer instead of memcpying then encrypting inplace.

When encrypting with AES256.OCB on AMD Ryzen 5800X, memcpy shows as
taking largest portion of computation time. Patch adds fast path for
AEAD encryption which largely eliminates need for memcpying when
doing AEAD encryption. AES256.OCB throughput increases from 2.2GB/s
to 4.2GB/s on said system (1.9x faster).

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