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.

crypto: arm64/aes-gcm - Rename struct ghash_key and make fixed-sized

Rename the 'struct ghash_key' in arch/arm64/crypto/ghash-ce-glue.c to
prevent a naming conflict with the library 'struct ghash_key'. In
addition, declare the 'h' field with an explicit size, now that there's
no longer any reason for it to be a flexible array.

Update the comments in the assembly file to match the C code. Note that
some of these were out-of-date.

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

+17 -18
+8 -7
arch/arm64/crypto/ghash-ce-core.S
··· 64 64 65 65 /* 66 66 * void pmull_ghash_update_p64(int blocks, u64 dg[], const char *src, 67 - * u64 const h[][2], const char *head) 67 + * u64 const h[4][2], const char *head) 68 68 */ 69 69 SYM_FUNC_START(pmull_ghash_update_p64) 70 70 ld1 {SHASH.2d}, [x3] ··· 413 413 .endm 414 414 415 415 /* 416 - * void pmull_gcm_encrypt(int blocks, u8 dst[], const u8 src[], 417 - * struct ghash_key const *k, u64 dg[], u8 ctr[], 418 - * int rounds, u8 tag) 416 + * void pmull_gcm_encrypt(int bytes, u8 dst[], const u8 src[], 417 + * u64 const h[4][2], u64 dg[], u8 ctr[], 418 + * u32 const rk[], int rounds, u8 tag[]) 419 419 */ 420 420 SYM_FUNC_START(pmull_gcm_encrypt) 421 421 pmull_gcm_do_crypt 1 422 422 SYM_FUNC_END(pmull_gcm_encrypt) 423 423 424 424 /* 425 - * void pmull_gcm_decrypt(int blocks, u8 dst[], const u8 src[], 426 - * struct ghash_key const *k, u64 dg[], u8 ctr[], 427 - * int rounds, u8 tag) 425 + * int pmull_gcm_decrypt(int bytes, u8 dst[], const u8 src[], 426 + * u64 const h[4][2], u64 dg[], u8 ctr[], 427 + * u32 const rk[], int rounds, const u8 l[], 428 + * const u8 tag[], u64 authsize) 428 429 */ 429 430 SYM_FUNC_START(pmull_gcm_decrypt) 430 431 pmull_gcm_do_crypt 0
+9 -11
arch/arm64/crypto/ghash-ce-glue.c
··· 30 30 31 31 #define RFC4106_NONCE_SIZE 4 32 32 33 - struct ghash_key { 33 + struct arm_ghash_key { 34 34 be128 k; 35 - u64 h[][2]; 35 + u64 h[4][2]; 36 36 }; 37 37 38 38 struct gcm_aes_ctx { 39 39 struct aes_enckey aes_key; 40 40 u8 nonce[RFC4106_NONCE_SIZE]; 41 - struct ghash_key ghash_key; 41 + struct arm_ghash_key ghash_key; 42 42 }; 43 43 44 44 asmlinkage void pmull_ghash_update_p64(int blocks, u64 dg[], const char *src, 45 - u64 const h[][2], const char *head); 45 + u64 const h[4][2], const char *head); 46 46 47 47 asmlinkage void pmull_gcm_encrypt(int bytes, u8 dst[], const u8 src[], 48 - u64 const h[][2], u64 dg[], u8 ctr[], 48 + u64 const h[4][2], u64 dg[], u8 ctr[], 49 49 u32 const rk[], int rounds, u8 tag[]); 50 50 asmlinkage int pmull_gcm_decrypt(int bytes, u8 dst[], const u8 src[], 51 - u64 const h[][2], u64 dg[], u8 ctr[], 51 + u64 const h[4][2], u64 dg[], u8 ctr[], 52 52 u32 const rk[], int rounds, const u8 l[], 53 53 const u8 tag[], u64 authsize); 54 54 55 55 static void ghash_do_simd_update(int blocks, u64 dg[], const char *src, 56 - struct ghash_key *key, const char *head) 56 + struct arm_ghash_key *key, const char *head) 57 57 { 58 58 scoped_ksimd() 59 59 pmull_ghash_update_p64(blocks, dg, src, key->h, head); ··· 363 363 .base.cra_driver_name = "gcm-aes-ce", 364 364 .base.cra_priority = 300, 365 365 .base.cra_blocksize = 1, 366 - .base.cra_ctxsize = sizeof(struct gcm_aes_ctx) + 367 - 4 * sizeof(u64[2]), 366 + .base.cra_ctxsize = sizeof(struct gcm_aes_ctx), 368 367 .base.cra_module = THIS_MODULE, 369 368 }, { 370 369 .ivsize = GCM_RFC4106_IV_SIZE, ··· 378 379 .base.cra_driver_name = "rfc4106-gcm-aes-ce", 379 380 .base.cra_priority = 300, 380 381 .base.cra_blocksize = 1, 381 - .base.cra_ctxsize = sizeof(struct gcm_aes_ctx) + 382 - 4 * sizeof(u64[2]), 382 + .base.cra_ctxsize = sizeof(struct gcm_aes_ctx), 383 383 .base.cra_module = THIS_MODULE, 384 384 }}; 385 385