summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@kernel.org>2026-01-12 22:20:20 +0300
committerEric Biggers <ebiggers@kernel.org>2026-01-16 01:09:07 +0300
commit60fb28ca028634210e12a4e674d3563f741e617c (patch)
tree65849894301c8862ce1083e8b921247e319720d4
parent12b03936a02fd17fd7c7a9711c225f34332c6c57 (diff)
downloadlinux-60fb28ca028634210e12a4e674d3563f741e617c.tar.xz
staging: rtl8723bs: core: 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-23-ebiggers@kernel.org Signed-off-by: Eric Biggers <ebiggers@kernel.org>
-rw-r--r--drivers/staging/rtl8723bs/core/rtw_security.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/staging/rtl8723bs/core/rtw_security.c b/drivers/staging/rtl8723bs/core/rtw_security.c
index 2f941ffbd465..8ee5bed252bf 100644
--- a/drivers/staging/rtl8723bs/core/rtw_security.c
+++ b/drivers/staging/rtl8723bs/core/rtw_security.c
@@ -637,11 +637,11 @@ exit:
/****************************************/
static void aes128k128d(u8 *key, u8 *data, u8 *ciphertext)
{
- struct crypto_aes_ctx ctx;
+ struct aes_enckey aes;
- aes_expandkey(&ctx, key, 16);
- aes_encrypt(&ctx, ciphertext, data);
- memzero_explicit(&ctx, sizeof(ctx));
+ aes_prepareenckey(&aes, key, 16);
+ aes_encrypt(&aes, ciphertext, data);
+ memzero_explicit(&aes, sizeof(aes));
}
/************************************************/
@@ -1406,13 +1406,13 @@ static void gf_mulx(u8 *pad)
static int omac1_aes_128_vector(u8 *key, size_t num_elem,
u8 *addr[], size_t *len, u8 *mac)
{
- struct crypto_aes_ctx ctx;
+ struct aes_enckey aes;
u8 cbc[AES_BLOCK_SIZE], pad[AES_BLOCK_SIZE];
u8 *pos, *end;
size_t i, e, left, total_len;
int ret;
- ret = aes_expandkey(&ctx, key, 16);
+ ret = aes_prepareenckey(&aes, key, 16);
if (ret)
return -1;
memset(cbc, 0, AES_BLOCK_SIZE);
@@ -1436,12 +1436,12 @@ static int omac1_aes_128_vector(u8 *key, size_t num_elem,
}
}
if (left > AES_BLOCK_SIZE)
- aes_encrypt(&ctx, cbc, cbc);
+ aes_encrypt(&aes, cbc, cbc);
left -= AES_BLOCK_SIZE;
}
memset(pad, 0, AES_BLOCK_SIZE);
- aes_encrypt(&ctx, pad, pad);
+ aes_encrypt(&aes, pad, pad);
gf_mulx(pad);
if (left || total_len == 0) {
@@ -1459,8 +1459,8 @@ static int omac1_aes_128_vector(u8 *key, size_t num_elem,
for (i = 0; i < AES_BLOCK_SIZE; i++)
pad[i] ^= cbc[i];
- aes_encrypt(&ctx, pad, mac);
- memzero_explicit(&ctx, sizeof(ctx));
+ aes_encrypt(&aes, pad, mac);
+ memzero_explicit(&aes, sizeof(aes));
return 0;
}