linux/arch
Stian Halseth 290fa0470d lib/crypto: sparc/aes-xts: Add optimization using the AES opcodes
Implement aes_xts_encrypt_arch() and aes_xts_decrypt_arch() with the AES
opcodes, for AES-128 and AES-256, two blocks per iteration. AES-192,
which IEEE 1619 does not specify, and data that is not 8-byte aligned
are left to the generic code.

The tweak is kept as little-endian words, so that multiplying it by x is
a 128-bit shift done with addcc and the VIS3 addxc. A little-endian
store and an ordinary load through a stack slot give it in the byte
order of the data, and the slot is cleared on return. The routines open
a register window, as %g4-%g6 belong to the kernel.

With that, xts-aes-lib no longer has to be kept off SPARC. Register it
there again, with the priority x86 and RISC-V use, so that it also
outranks an xts(ecb-aes-sparc64) instance (priority 300).

On a T7-1 (M7), MiB/s unless noted:

                               xts(ecb-aes-sparc64)  xts-aes-lib
  AF_ALG, 64 KiB, AES-128                     415         1092
  AF_ALG, 64 KiB, AES-256                     390          936
  dm-crypt on brd, AES-256:
    sequential read                          1399         2559
    sequential write                         1472         3480
    4 KiB write latency, QD1 (us)            40.6         32.7

dm-crypt now matches aes-cbc-essiv on the same ramdisk.

On a T4-1, AF_ALG AES-256 goes from 238 to 544 MiB/s, and AES-128
from 252 to 616.

Tested with CONFIG_CRYPTO_SELFTESTS_FULL, and against OpenSSL over
random keys, tweaks and lengths, on both machines.

Link: https://github.com/sparclinux/issues/issues/106
Signed-off-by: Stian Halseth <stian@itx.no>
Link: https://patch.msgid.link/20261004192812.4145406-1-stian@itx.no
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
2026-10-04 21:40:47 +02:00
..
alpha pci-v7.3-changes 2026-08-23 12:44:10 -07:00
arc Treewide timer related cleanups: 2026-08-18 15:58:29 -07:00
arm ARM: socfpga: select the PL310 erratum 753970 workaround 2026-08-31 10:44:39 -05:00
arm64 soc: fixes for 7.3 2026-09-18 09:34:57 -07:00
csky mm.git review status for mm-hotfixes-stable..mm-stable 2026-08-20 18:17:08 -07:00
hexagon Treewide timer related cleanups: 2026-08-18 15:58:29 -07:00
loongarch kmalloc_obj conversions for v7.3-rc2 2026-09-05 20:45:18 -07:00
m68k m68knommu: updates and fixes for v7.3 2026-08-28 08:44:36 -07:00
microblaze Treewide timer related cleanups: 2026-08-18 15:58:29 -07:00
mips - Fix kconfig dependencies for ECONET 2026-09-18 09:25:07 -07:00
nios2 mm.git review status for mm-hotfixes-stable..mm-stable 2026-08-20 18:17:08 -07:00
openrisc OpenRISC 7.3 updates 2026-08-30 09:26:54 -07:00
parisc parisc architecture fixes and updates for kernel v7.3-rc1: 2026-08-23 10:30:02 -07:00
powerpc powerpc/iommu: Fix the overflow validation in iommu_tce_check_ioba 2026-09-16 13:43:58 +05:30
riscv lib/crypto: riscv/aes-xts: Migrate optimized code into library 2026-09-30 09:42:10 -07:00
s390 s390/crypto: Enable CONTEXT_ANALYSIS 2026-09-08 15:53:41 +02:00
sh gpio updates for v7.3-rc1 2026-08-19 09:10:07 -07:00
sparc lib/crypto: sparc/aes-xts: Add optimization using the AES opcodes 2026-10-04 21:40:47 +02:00
um um: Use asm-generic/timex.h over the host architecture one 2026-08-24 17:10:35 -07:00
x86 crypto: x86/aesni-intel - Add transitional selections 2026-09-30 10:07:48 -07:00
xtensa Xtensa updates for v7.3 2026-08-28 08:55:47 -07:00
.gitignore
Kconfig VDSO updates: 2026-08-18 16:56:25 -07:00