]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
crypto: arm64/aes-gcm - Rename struct ghash_key and make fixed-sized
authorEric Biggers <ebiggers@kernel.org>
Thu, 19 Mar 2026 06:17:11 +0000 (23:17 -0700)
committerEric Biggers <ebiggers@kernel.org>
Mon, 23 Mar 2026 23:44:29 +0000 (16:44 -0700)
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>
arch/arm64/crypto/ghash-ce-core.S
arch/arm64/crypto/ghash-ce-glue.c

index a01f136f4fb240084067c3ebca73375f4995ed7e..33772d8fe6b5e0ef3454124b10f8b6fde28976a7 100644 (file)
@@ -64,7 +64,7 @@
 
        /*
         * void pmull_ghash_update_p64(int blocks, u64 dg[], const char *src,
-        *                             u64 const h[][2], const char *head)
+        *                             u64 const h[4][2], const char *head)
         */
 SYM_FUNC_START(pmull_ghash_update_p64)
        ld1             {SHASH.2d}, [x3]
@@ -413,18 +413,19 @@ CPU_LE(   rev             w8, w8          )
        .endm
 
        /*
-        * void pmull_gcm_encrypt(int blocks, u8 dst[], const u8 src[],
-        *                        struct ghash_key const *k, u64 dg[], u8 ctr[],
-        *                        int rounds, u8 tag)
+        * void pmull_gcm_encrypt(int bytes, u8 dst[], const u8 src[],
+        *                        u64 const h[4][2], u64 dg[], u8 ctr[],
+        *                        u32 const rk[], int rounds, u8 tag[])
         */
 SYM_FUNC_START(pmull_gcm_encrypt)
        pmull_gcm_do_crypt      1
 SYM_FUNC_END(pmull_gcm_encrypt)
 
        /*
-        * void pmull_gcm_decrypt(int blocks, u8 dst[], const u8 src[],
-        *                        struct ghash_key const *k, u64 dg[], u8 ctr[],
-        *                        int rounds, u8 tag)
+        * int pmull_gcm_decrypt(int bytes, u8 dst[], const u8 src[],
+        *                       u64 const h[4][2], u64 dg[], u8 ctr[],
+        *                       u32 const rk[], int rounds, const u8 l[],
+        *                       const u8 tag[], u64 authsize)
         */
 SYM_FUNC_START(pmull_gcm_decrypt)
        pmull_gcm_do_crypt      0
index 590054c3260d9ff14b1c3cc3ab4cb84ec4f34d59..eaf2932ceaf57e94a6966a577eef43a1b4238184 100644 (file)
@@ -30,30 +30,30 @@ MODULE_ALIAS_CRYPTO("rfc4106(gcm(aes))");
 
 #define RFC4106_NONCE_SIZE     4
 
-struct ghash_key {
+struct arm_ghash_key {
        be128                   k;
-       u64                     h[][2];
+       u64                     h[4][2];
 };
 
 struct gcm_aes_ctx {
        struct aes_enckey       aes_key;
        u8                      nonce[RFC4106_NONCE_SIZE];
-       struct ghash_key        ghash_key;
+       struct arm_ghash_key    ghash_key;
 };
 
 asmlinkage void pmull_ghash_update_p64(int blocks, u64 dg[], const char *src,
-                                      u64 const h[][2], const char *head);
+                                      u64 const h[4][2], const char *head);
 
 asmlinkage void pmull_gcm_encrypt(int bytes, u8 dst[], const u8 src[],
-                                 u64 const h[][2], u64 dg[], u8 ctr[],
+                                 u64 const h[4][2], u64 dg[], u8 ctr[],
                                  u32 const rk[], int rounds, u8 tag[]);
 asmlinkage int pmull_gcm_decrypt(int bytes, u8 dst[], const u8 src[],
-                                u64 const h[][2], u64 dg[], u8 ctr[],
+                                u64 const h[4][2], u64 dg[], u8 ctr[],
                                 u32 const rk[], int rounds, const u8 l[],
                                 const u8 tag[], u64 authsize);
 
 static void ghash_do_simd_update(int blocks, u64 dg[], const char *src,
-                                struct ghash_key *key, const char *head)
+                                struct arm_ghash_key *key, const char *head)
 {
        scoped_ksimd()
                pmull_ghash_update_p64(blocks, dg, src, key->h, head);
@@ -363,8 +363,7 @@ static struct aead_alg gcm_aes_algs[] = {{
        .base.cra_driver_name   = "gcm-aes-ce",
        .base.cra_priority      = 300,
        .base.cra_blocksize     = 1,
-       .base.cra_ctxsize       = sizeof(struct gcm_aes_ctx) +
-                                 4 * sizeof(u64[2]),
+       .base.cra_ctxsize       = sizeof(struct gcm_aes_ctx),
        .base.cra_module        = THIS_MODULE,
 }, {
        .ivsize                 = GCM_RFC4106_IV_SIZE,
@@ -379,8 +378,7 @@ static struct aead_alg gcm_aes_algs[] = {{
        .base.cra_driver_name   = "rfc4106-gcm-aes-ce",
        .base.cra_priority      = 300,
        .base.cra_blocksize     = 1,
-       .base.cra_ctxsize       = sizeof(struct gcm_aes_ctx) +
-                                 4 * sizeof(u64[2]),
+       .base.cra_ctxsize       = sizeof(struct gcm_aes_ctx),
        .base.cra_module        = THIS_MODULE,
 }};