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.

chelsio: 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-21-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@kernel.org>

+8 -8
+2 -2
drivers/net/ethernet/chelsio/inline_crypto/ch_ipsec/chcr_ipsec.c
··· 170 170 unsigned char *key = x->aead->alg_key; 171 171 int ck_size, key_ctx_size = 0; 172 172 unsigned char ghash_h[AEAD_H_SIZE]; 173 - struct crypto_aes_ctx aes; 173 + struct aes_enckey aes; 174 174 int ret = 0; 175 175 176 176 if (keylen > 3) { ··· 204 204 /* Calculate the H = CIPH(K, 0 repeated 16 times). 205 205 * It will go in key context 206 206 */ 207 - ret = aes_expandkey(&aes, key, keylen); 207 + ret = aes_prepareenckey(&aes, key, keylen); 208 208 if (ret) { 209 209 sa_entry->enckey_len = 0; 210 210 goto out;
+4 -4
drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c
··· 76 76 unsigned char ghash_h[TLS_CIPHER_AES_GCM_256_TAG_SIZE]; 77 77 struct tls12_crypto_info_aes_gcm_128 *info_128_gcm; 78 78 struct ktls_key_ctx *kctx = &tx_info->key_ctx; 79 - struct crypto_aes_ctx aes_ctx; 79 + struct aes_enckey aes; 80 80 unsigned char *key, *salt; 81 81 82 82 switch (crypto_info->cipher_type) { ··· 138 138 * It will go in key context 139 139 */ 140 140 141 - ret = aes_expandkey(&aes_ctx, key, keylen); 141 + ret = aes_prepareenckey(&aes, key, keylen); 142 142 if (ret) 143 143 goto out; 144 144 145 145 memset(ghash_h, 0, ghash_size); 146 - aes_encrypt(&aes_ctx, ghash_h, ghash_h); 147 - memzero_explicit(&aes_ctx, sizeof(aes_ctx)); 146 + aes_encrypt(&aes, ghash_h, ghash_h); 147 + memzero_explicit(&aes, sizeof(aes)); 148 148 149 149 /* fill the Key context */ 150 150 if (direction == TLS_OFFLOAD_CTX_DIR_TX) {
+2 -2
drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_hw.c
··· 247 247 unsigned char *key_p, *salt; 248 248 unsigned char ghash_h[AEAD_H_SIZE]; 249 249 int ck_size, key_ctx_size, kctx_mackey_size, salt_size; 250 - struct crypto_aes_ctx aes; 250 + struct aes_enckey aes; 251 251 int ret; 252 252 253 253 key_ctx_size = sizeof(struct _key_ctx) + ··· 291 291 /* Calculate the H = CIPH(K, 0 repeated 16 times). 292 292 * It will go in key context 293 293 */ 294 - ret = aes_expandkey(&aes, key, keylen); 294 + ret = aes_prepareenckey(&aes, key, keylen); 295 295 if (ret) 296 296 return ret; 297 297