Re: cryptsetup benchmark vs openssl speed, huge difference
Ondrej Kozina <[email protected]> Tue, 24 Oct 2023 09:51:19 +0200
| Newsgroups | dev.linux.lists.cryptsetup |
|---|---|
| Message-ID | <[email protected]> |
Hi John, On 24/10/2023 07:10, John Smith wrote: > Is there a reason why the AES-XTS speed is vastly inferior to openssl? cryptsetup benchmark does not measure performance of openssl (or other configured userspace crypto backend). For detailed answer see below. > > cryptsetup benchmark > aes-xts 512b 2503.5 MiB/s 2514.3 MiB/s > > openssl speed -evp aes-256-xts > type 16 bytes 64 bytes 256 bytes 1024 bytes > 8192 bytes 16384 bytes > AES-256-XTS 633950.11k 2343011.04k 4795982.60k 6688253.60k > 7698595.84k 7806526.67k > > This is also borne out by the NVMe performance, or lack thereof. > couple remarks to better establish cryptsetup benchmark baselines: 1) The benchmark does not perform any I/O on storage device. There's no correlation with block device installed in the system. 2) All block cipher results (aes, serpent, ...) are collected measuring kernel crypto layer performance (accessed via netlink API from). It depends what implementation of the cipher kernel crypto layer loads (based on system arch, CPU installed, kernel modules compiled-in etc.). There's ab overhead for using kernel crypto layer via netlink API. It does not reflect real performance of dm-crypt mapped over available block device in the system, by far. For example: dm-crypt encrypts data in 512B to 4KiB sized blocks based on dm-crypt table parameters (sector_size). The cryptsetup benchmark on the other hand measures performance by encrypting much larger data chunks (1MiB IIRC). O.