]> git.ipfire.org Git - thirdparty/nettle.git/commitdiff
ppc: Update fat setup for new ghash organization.
authorNiels Möller <nisse@lysator.liu.se>
Tue, 22 Feb 2022 18:43:41 +0000 (19:43 +0100)
committerNiels Möller <nisse@lysator.liu.se>
Tue, 22 Feb 2022 18:43:41 +0000 (19:43 +0100)
fat-ppc.c
powerpc64/fat/ghash-set-key-2.asm [moved from powerpc64/fat/gcm-hash.asm with 88% similarity]
powerpc64/fat/ghash-update-2.asm [new file with mode: 0644]

index 3cf720bd969ec0368f07b0d51e0bfb5a552a495a..bf622cf50a44016e9029b6b64c26fe1303491edb 100644 (file)
--- a/fat-ppc.c
+++ b/fat-ppc.c
@@ -64,8 +64,7 @@
 
 #include "aes-internal.h"
 #include "chacha-internal.h"
-#include "gcm.h"
-#include "gcm-internal.h"
+#include "ghash-internal.h"
 #include "fat-setup.h"
 
 /* Defines from arch/powerpc/include/uapi/asm/cputable.h in Linux kernel */
@@ -153,13 +152,13 @@ DECLARE_FAT_FUNC(_nettle_aes_decrypt, aes_crypt_internal_func)
 DECLARE_FAT_FUNC_VAR(aes_decrypt, aes_crypt_internal_func, c)
 DECLARE_FAT_FUNC_VAR(aes_decrypt, aes_crypt_internal_func, ppc64)
 
-DECLARE_FAT_FUNC(_nettle_gcm_init_key, gcm_init_key_func)
-DECLARE_FAT_FUNC_VAR(gcm_init_key, gcm_init_key_func, c)
-DECLARE_FAT_FUNC_VAR(gcm_init_key, gcm_init_key_func, ppc64)
+DECLARE_FAT_FUNC(_nettle_ghash_set_key, ghash_set_key_func)
+DECLARE_FAT_FUNC_VAR(ghash_set_key, ghash_set_key_func, c)
+DECLARE_FAT_FUNC_VAR(ghash_set_key, ghash_set_key_func, ppc64)
 
-DECLARE_FAT_FUNC(_nettle_gcm_hash, gcm_hash_func)
-DECLARE_FAT_FUNC_VAR(gcm_hash, gcm_hash_func, c)
-DECLARE_FAT_FUNC_VAR(gcm_hash, gcm_hash_func, ppc64)
+DECLARE_FAT_FUNC(_nettle_ghash_update, ghash_update_func)
+DECLARE_FAT_FUNC_VAR(ghash_update, ghash_update_func, c)
+DECLARE_FAT_FUNC_VAR(ghash_update, ghash_update_func, ppc64)
 
 DECLARE_FAT_FUNC(_nettle_chacha_core, chacha_core_func)
 DECLARE_FAT_FUNC_VAR(chacha_core, chacha_core_func, c);
@@ -193,19 +192,19 @@ fat_init (void)
       _nettle_aes_encrypt_vec = _nettle_aes_encrypt_ppc64;
       _nettle_aes_decrypt_vec = _nettle_aes_decrypt_ppc64;
 
-      /* Make sure _nettle_gcm_init_key_vec function is compatible
-         with _nettle_gcm_hash_vec function e.g. _nettle_gcm_init_key_c()
+      /* Make sure _nettle_ghash_set_key_vec function is compatible
+         with _nettle_ghash_update_vec function e.g. _nettle_ghash_key_c()
          fills gcm_key table with values that are incompatible with
-         _nettle_gcm_hash_ppc64() */
-      _nettle_gcm_init_key_vec = _nettle_gcm_init_key_ppc64;
-      _nettle_gcm_hash_vec = _nettle_gcm_hash_ppc64;
+         _nettle_ghash_update_arm64() */
+      _nettle_ghash_set_key_vec = _nettle_ghash_set_key_ppc64;
+      _nettle_ghash_update_vec = _nettle_ghash_update_ppc64;
     }
   else
     {
       _nettle_aes_encrypt_vec = _nettle_aes_encrypt_c;
       _nettle_aes_decrypt_vec = _nettle_aes_decrypt_c;
-      _nettle_gcm_init_key_vec = _nettle_gcm_init_key_c;
-      _nettle_gcm_hash_vec = _nettle_gcm_hash_c;
+      _nettle_ghash_set_key_vec = _nettle_ghash_set_key_c;
+      _nettle_ghash_update_vec = _nettle_ghash_update_c;
     }
   if (features.have_altivec)
     {
@@ -237,14 +236,13 @@ DEFINE_FAT_FUNC(_nettle_aes_decrypt, void,
  const uint8_t *src),
  (rounds, keys, T, length, dst, src))
 
-DEFINE_FAT_FUNC(_nettle_gcm_init_key, void,
-               (union nettle_block16 *table),
-               (table))
-
-DEFINE_FAT_FUNC(_nettle_gcm_hash, void,
-               (const struct gcm_key *key, union nettle_block16 *x,
-                size_t length, const uint8_t *data),
-               (key, x, length, data))
+DEFINE_FAT_FUNC(_nettle_ghash_set_key, void,
+               (struct gcm_key *ctx, const union nettle_block16 *key),
+               (ctx, key))
+DEFINE_FAT_FUNC(_nettle_ghash_update, const uint8_t *,
+               (const struct gcm_key *ctx, union nettle_block16 *state,
+                size_t blocks, const uint8_t *data),
+               (ctx, state, blocks, data))
 
 DEFINE_FAT_FUNC(_nettle_chacha_core, void,
                (uint32_t *dst, const uint32_t *src, unsigned rounds),
similarity index 88%
rename from powerpc64/fat/gcm-hash.asm
rename to powerpc64/fat/ghash-set-key-2.asm
index 57c343d783e3f01359ea1a04fe4509802fee2ed3..6c6535c1cf08dabeade929b9a9f0c5f6105fa1a2 100644 (file)
@@ -1,5 +1,4 @@
-C powerpc64/fat/gcm-hash.asm
-
+C powerpc64/fat/ghash-set-key-2.asm
 
 ifelse(`
    Copyright (C) 2020 Mamone Tarsha
@@ -32,8 +31,7 @@ ifelse(`
 ')
 
 dnl picked up by configure
-dnl PROLOGUE(_nettle_fat_gcm_init_key)
-dnl PROLOGUE(_nettle_fat_gcm_hash)
+dnl PROLOGUE(_nettle_ghash_set_key)
 
 define(`fat_transform', `$1_ppc64')
-include_src(`powerpc64/p8/gcm-hash.asm')
+include_src(`powerpc64/p8/ghash-set-key.asm')
diff --git a/powerpc64/fat/ghash-update-2.asm b/powerpc64/fat/ghash-update-2.asm
new file mode 100644 (file)
index 0000000..d600a3c
--- /dev/null
@@ -0,0 +1,37 @@
+C powerpc64/fat/ghash-update.asm
+
+ifelse(`
+   Copyright (C) 2020 Mamone Tarsha
+
+   This file is part of GNU Nettle.
+
+   GNU Nettle is free software: you can redistribute it and/or
+   modify it under the terms of either:
+
+     * the GNU Lesser General Public License as published by the Free
+       Software Foundation; either version 3 of the License, or (at your
+       option) any later version.
+
+   or
+
+     * the GNU General Public License as published by the Free
+       Software Foundation; either version 2 of the License, or (at your
+       option) any later version.
+
+   or both in parallel, as here.
+
+   GNU Nettle is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received copies of the GNU General Public License and
+   the GNU Lesser General Public License along with this program.  If
+   not, see http://www.gnu.org/licenses/.
+')
+
+dnl picked up by configure
+dnl PROLOGUE(_nettle_ghash_update)
+
+define(`fat_transform', `$1_ppc64')
+include_src(`powerpc64/p8/ghash-update.asm')