mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-05 16:00:05 +01:00
For each 1 MiB of data en/decrypted, 'cryptsetup benchmark' is setting up a new AF_ALG socket, which involves 4 system calls and is included in the data en/decryption time. With high-speed ciphers (e.g. VAES optimized AES-XTS) this can measure well over 10000 AF_ALG socket setups per second. This is not representative of dm-crypt, which only allocates a cipher when the dm-crypt device is created. Therefore, allocate the AF_ALG socket once, before doing the benchmark. On AMD Ryzen 9 9950X this increases the 'cryptsetup benchmark' result of AES-256-XTS slightly, from 14000 MiB/s to 14600 MiB/s. Note that an in-kernel benchmark of the crypto API with the same block size (65536 bytes) gives 34100 MiB/s, so AF_ALG still takes more time than the en/decryption itself -- this cannot easily be addressed though. Signed-off-by: Eric Biggers <ebiggers@google.com>