Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: phy: mscc: macsec: Use new AES library API

Switch from the old AES library functions (which use struct
crypto_aes_ctx) to the new ones (which use struct aes_enckey). This
eliminates the unnecessary computation and caching of the decryption
round keys. The new AES en/decryption functions are also much faster
and use AES instructions when supported by the CPU.

Note that in addition to the change in the key preparation function and
the key struct type itself, the change in the type of the key struct
results in aes_encrypt() (which is temporarily a type-generic macro)
calling the new encryption function rather than the old one.

Acked-by: Ard Biesheuvel <ardb@kernel.org>
Link: https://lore.kernel.org/r/20260112192035.10427-22-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@kernel.org>

+4 -4
+4 -4
drivers/net/phy/mscc/mscc_macsec.c
··· 504 504 static int vsc8584_macsec_derive_key(const u8 *key, u16 key_len, u8 hkey[16]) 505 505 { 506 506 const u8 input[AES_BLOCK_SIZE] = {0}; 507 - struct crypto_aes_ctx ctx; 507 + struct aes_enckey aes; 508 508 int ret; 509 509 510 - ret = aes_expandkey(&ctx, key, key_len); 510 + ret = aes_prepareenckey(&aes, key, key_len); 511 511 if (ret) 512 512 return ret; 513 513 514 - aes_encrypt(&ctx, hkey, input); 515 - memzero_explicit(&ctx, sizeof(ctx)); 514 + aes_encrypt(&aes, hkey, input); 515 + memzero_explicit(&aes, sizeof(aes)); 516 516 return 0; 517 517 } 518 518