]> git.ipfire.org Git - thirdparty/nettle.git/commitdiff
arm64: Update fat setup for new ghash organization.
authorNiels Möller <nisse@lysator.liu.se>
Mon, 21 Feb 2022 17:58:40 +0000 (18:58 +0100)
committerNiels Möller <nisse@lysator.liu.se>
Mon, 21 Feb 2022 17:58:40 +0000 (18:58 +0100)
ChangeLog
arm64/fat/ghash-set-key-2.asm [moved from arm64/fat/gcm-hash.asm with 88% similarity]
arm64/fat/ghash-update-2.asm [new file with mode: 0644]
configure.ac
fat-arm64.c
ghash-update.c

index 4d6efb226096f7194d0bedfa4f7f602bab2741eb..2fbf6d9dae8b9569b3779c689ebc90e201b18ca0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2022-02-21  Niels Möller  <nisse@lysator.liu.se>
 
+       * fat-arm64.c (fat_init): Update fat init for new _ghash_set_key
+       and _ghash_update functions, delete setup for old gcm functions.
+
+       * arm64/fat/ghash-update-2.asm: New file.
+       * arm64/fat/ghash-set-key-2.asm: New file.
+       * arm64/fat/gcm-hash.asm: Deleted.
+
+       * ghash-update.c (_nettle_ghash_update_c): New name, for fat builds.
+
        * arm64/crypto/gcm-hash.asm: Deleted, split into two new files...
        * arm64/crypto/ghash-set-key.asm: New file.
        * arm64/crypto/ghash-update.asm: New file.
similarity index 88%
rename from arm64/fat/gcm-hash.asm
rename to arm64/fat/ghash-set-key-2.asm
index 5ef171b534ff71fcd2bbe43ee6e0f1117b7dc2b0..530035f2a73cb87ec25b515f4b4c9a54a4ad8dbd 100644 (file)
@@ -1,4 +1,4 @@
-C arm64/fat/gcm-hash.asm
+C arm64/fat/ghash-set-key.asm
 
 ifelse(`
    Copyright (C) 2021 Mamone Tarsha
@@ -31,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_arm64')
-include_src(`arm64/crypto/gcm-hash.asm')
+include_src(`arm64/crypto/ghash-set-key.asm')
diff --git a/arm64/fat/ghash-update-2.asm b/arm64/fat/ghash-update-2.asm
new file mode 100644 (file)
index 0000000..d865652
--- /dev/null
@@ -0,0 +1,37 @@
+C arm64/fat/ghash-update.asm
+
+ifelse(`
+   Copyright (C) 2021 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_arm64')
+include_src(`arm64/crypto/ghash-update.asm')
index dfd8f4fa1dc26ec4a072e74f4f18b16aca232878..17ba3fe1afdeb366564601c6aa3e5e12ffe5115b 100644 (file)
@@ -752,6 +752,7 @@ AH_VERBATIM([HAVE_NATIVE],
 #undef HAVE_NATIVE_ecc_secp521r1_modp
 #undef HAVE_NATIVE_ecc_secp521r1_redc
 #undef HAVE_NATIVE_ghash_set_key
+#undef HAVE_NATIVE_ghash_update
 #undef HAVE_NATIVE_salsa20_core
 #undef HAVE_NATIVE_salsa20_2core
 #undef HAVE_NATIVE_fat_salsa20_2core
index f6aef25ed479367263c7bc5d774afb61293b4dec..ef3c33f44942c4e2fa2ebe95e005d3bea382fad3 100644 (file)
@@ -51,8 +51,7 @@
 #include "nettle-types.h"
 
 #include "aes.h"
-#include "gcm.h"
-#include "gcm-internal.h"
+#include "ghash-internal.h"
 #include "fat-setup.h"
 
 /* Defines from arch/arm64/include/uapi/asm/hwcap.h in Linux kernel */
@@ -148,13 +147,13 @@ DECLARE_FAT_FUNC(nettle_aes256_decrypt, aes256_crypt_func)
 DECLARE_FAT_FUNC_VAR(aes256_decrypt, aes256_crypt_func, c)
 DECLARE_FAT_FUNC_VAR(aes256_decrypt, aes256_crypt_func, arm64)
 
-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, arm64)
+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, arm64)
 
-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, arm64)
+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, arm64)
 
 DECLARE_FAT_FUNC(nettle_sha1_compress, sha1_compress_func)
 DECLARE_FAT_FUNC_VAR(sha1_compress, sha1_compress_func, c)
@@ -206,17 +205,17 @@ fat_init (void)
       if (verbose)
        fprintf (stderr, "libnettle: enabling hardware-accelerated polynomial multiply code.\n");
 
-      /* 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_arm64() */
-      _nettle_gcm_init_key_vec = _nettle_gcm_init_key_arm64;
-      _nettle_gcm_hash_vec = _nettle_gcm_hash_arm64;
+         _nettle_ghash_update_arm64() */
+      _nettle_ghash_set_key_vec = _nettle_ghash_set_key_arm64;
+      _nettle_ghash_update_vec = _nettle_ghash_update_arm64;
     }
   else
     {
-      _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_sha1)
     {
@@ -267,14 +266,13 @@ DEFINE_FAT_FUNC(nettle_aes256_decrypt, void,
   uint8_t *dst,const uint8_t *src),
  (ctx, 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_sha1_compress, void,
                (uint32_t *state, const uint8_t *input),
index b960bcda06f88fec7418f11790e3ef1f21c5df60..6eb19d807cc5f451ac825dce95d55002c095a2e1 100644 (file)
 # error Unsupported table size.
 #endif
 
+/* For fat builds */
+#if HAVE_NATIVE_ghash_update
+const uint8_t *
+_nettle_ghash_update_c (const struct gcm_key *ctx, union nettle_block16 *state,
+                       size_t blocks, const uint8_t *data);
+#define _nettle_ghash_update _nettle_ghash_update_c
+
+#endif
 #if WORDS_BIGENDIAN
 # define W(left,right) (0x##left##right)
 #else