]> git.ipfire.org Git - thirdparty/nettle.git/commitdiff
Add nettle_mac structs for gosthash94 and gosthash94cp.
authorNiels Möller <nisse@lysator.liu.se>
Sun, 16 Jun 2024 19:00:51 +0000 (21:00 +0200)
committerNiels Möller <nisse@lysator.liu.se>
Sun, 16 Jun 2024 19:08:49 +0000 (21:08 +0200)
ChangeLog
Makefile.in
hmac-gosthash94-meta.c [new file with mode: 0644]
nettle-meta-macs.c
nettle-meta.h
testsuite/meta-mac-test.c

index ca7a424cb4c7e27beea60dbee0fc4d5cc48fb8a9..0259bc3bc98e00bdc8e75c034f63762b28d15aba 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2024-06-16  Niels Möller  <nisse@lysator.liu.se>
 
+       * hmac-gosthash94-meta.c: New file.
+       * nettle-meta.h (nettle_hmac_gosthash94)
+       (nettle_hmac_gosthash94cp): Declare.
+       * nettle-meta-macs.c (_nettle_macs): Add nettle_hmac_gosthash94
+       and nettle_hmac_gosthash94cp.
+       * Makefile.in (nettle_SOURCES): Add hmac-gosthash94-meta.c.
+       * testsuite/meta-mac-test.c: Update test.
+
        * Released Nettle-3.10.
 
        * examples/rsa-encrypt-test: Consistently add $EXEEXT to
index 2bf7f1e814a62f0e953234daac022323048d0c10..71ad761ec5c50b2dc2b3118a5db8aec03528efde 100644 (file)
@@ -126,7 +126,8 @@ nettle_SOURCES = aes-decrypt-internal.c aes-decrypt.c aes-decrypt-table.c \
                 hmac-sha512.c hmac-streebog.c hmac-sm3.c \
                 hmac-md5-meta.c hmac-ripemd160-meta.c hmac-sha1-meta.c \
                 hmac-sha224-meta.c hmac-sha256-meta.c hmac-sha384-meta.c \
-                hmac-sha512-meta.c hmac-streebog-meta.c hmac-sm3-meta.c \
+                hmac-sha512-meta.c hmac-gosthash94-meta.c \
+                hmac-streebog-meta.c hmac-sm3-meta.c \
                 knuth-lfib.c hkdf.c \
                 md2.c md2-meta.c md4.c md4-meta.c \
                 md5.c md5-compat.c md5-meta.c \
diff --git a/hmac-gosthash94-meta.c b/hmac-gosthash94-meta.c
new file mode 100644 (file)
index 0000000..6078807
--- /dev/null
@@ -0,0 +1,56 @@
+/* hmac-gosthash94-meta.c
+
+   Copyright (C) 2024 Niels Möller
+
+   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/.
+*/
+
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "nettle-meta.h"
+
+#include "hmac.h"
+
+static void
+hmac_gosthash94_set_key_wrapper (void *ctx, const uint8_t *key)
+{
+  hmac_gosthash94_set_key (ctx, GOSTHASH94_DIGEST_SIZE, key);
+}
+
+const struct nettle_mac nettle_hmac_gosthash94
+= _NETTLE_HMAC(hmac_gosthash94, GOSTHASH94);
+
+static void
+hmac_gosthash94cp_set_key_wrapper (void *ctx, const uint8_t *key)
+{
+  hmac_gosthash94cp_set_key (ctx, GOSTHASH94CP_DIGEST_SIZE, key);
+}
+
+const struct nettle_mac nettle_hmac_gosthash94cp
+= _NETTLE_HMAC(hmac_gosthash94cp, GOSTHASH94CP);
index 40aa6dcd544c498d4fcf1c87784afea046a0633c..48b2176ea3d6dd1bcc7dfbf9f270fa376b51893f 100644 (file)
@@ -41,6 +41,8 @@ const struct nettle_mac * const _nettle_macs[] = {
   &nettle_cmac_aes128,
   &nettle_cmac_aes256,
   &nettle_cmac_des3,
+  &nettle_hmac_gosthash94,
+  &nettle_hmac_gosthash94cp,
   &nettle_hmac_md5,
   &nettle_hmac_ripemd160,
   &nettle_hmac_sha1,
index 19dc96c5b3a93f7fe1ac4f6e32e2151e35435017..f0d4b1e29abc44d810765c42d11805e7f527c964 100644 (file)
@@ -285,6 +285,8 @@ extern const struct nettle_mac nettle_cmac_aes256;
 extern const struct nettle_mac nettle_cmac_des3;
 
 /* HMAC variants with key size = digest size */
+extern const struct nettle_mac nettle_hmac_gosthash94;
+extern const struct nettle_mac nettle_hmac_gosthash94cp;
 extern const struct nettle_mac nettle_hmac_md5;
 extern const struct nettle_mac nettle_hmac_ripemd160;
 extern const struct nettle_mac nettle_hmac_sha1;
index 0ff82810de7035a7f1fa256ea7cb2fa14c430bea..6c848a88798fc3d6fb9a9355c2012d1b02641a4d 100644 (file)
@@ -5,6 +5,8 @@ const char* macs[] = {
   "cmac_aes128",
   "cmac_aes256",
   "cmac_des3",
+  "hmac_gosthash94",
+  "hmac_gosthash94cp",
   "hmac_md5",
   "hmac_ripemd160",
   "hmac_sha1",