]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
nettle: remove bundled code for *_shake_output
authorDaiki Ueno <ueno@gnu.org>
Tue, 3 Mar 2026 01:22:40 +0000 (10:22 +0900)
committerDaiki Ueno <ueno@gnu.org>
Wed, 4 Mar 2026 11:49:58 +0000 (20:49 +0900)
Now that Nettle 3.10 is required to build the library, the bundled
code is no longer used.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
configure.ac
devel/import-from-nettle.sh
lib/nettle/Makefile.am
lib/nettle/int/sha3-shake.h [deleted file]
lib/nettle/mac.c

index 10dd171e8f473bb68c20ff20fc9715413e6cc719..0339bcdcba6ee1ab213099b1130231417d818b32 100644 (file)
@@ -834,13 +834,6 @@ LIBS="$LIBS $NETTLE_LIBS"
 AC_CHECK_FUNCS(nettle_cbc_aes128_encrypt)
 LIBS=$save_LIBS
 
-# Check for incremental SHAKE
-save_LIBS=$LIBS
-LIBS="$LIBS $NETTLE_LIBS"
-AC_CHECK_FUNCS(nettle_sha3_128_shake_output)
-LIBS=$save_LIBS
-AM_CONDITIONAL([NEED_SHAKE_OUTPUT], [test "$ac_cv_func_nettle_sha3_128_shake_output" != yes])
-
 # Check sonames of the linked libraries needed for FIPS selftests.
 save_CFLAGS=$CFLAGS
 CFLAGS="$CFLAGS $GMP_CFLAGS"
index a7c44e3a29f4bfe4ac093e802d7c73b0e2bc7724..0a94c884d5dba2b08d17aa963ffef25db1b756ff 100755 (executable)
@@ -11,14 +11,6 @@ DST=$srcdir/lib/nettle/backport
 
 IMPORTS="
 block-internal.h
-md-internal.h
-nettle-write.h
-sha3.c
-sha3-internal.h
-sha3-shake.c
-shake128.c
-shake256.c
-write-le64.c
 "
 
 PUBLIC="
@@ -34,7 +26,6 @@ nettle-meta.h
 nettle-types.h
 sha1.h
 sha2.h
-sha3.h
 "
 
 test -d $DST || mkdir $DST
@@ -89,15 +80,6 @@ for f in $IMPORTS; do
        sed \
          -e '/^#include <nettle\/nettle-types\.h>/a\
 #include "block8.h"
-' \
-         $dst > $dst-t && mv $dst-t $dst
-       ;;
-    esac
-    case $dst in
-      */shake*.c)
-       sed \
-         -e '/^#include <nettle\/sha3\.h>/a\
-#include "int/sha3-shake.h"
 ' \
          $dst > $dst-t && mv $dst-t $dst
        ;;
index 86903dee33aceccf908336cda596d3bced0d3dbe..a24d45d5241515cd6c82aa812e69e2729e8dfa36 100644 (file)
@@ -51,7 +51,7 @@ libcrypto_la_SOURCES = pk.c mpi.c mac.c cipher.c init.c \
        int/ecdsa-compute-k.c int/ecdsa-compute-k.h \
        int/mpn-base256.c int/mpn-base256.h \
        int/block8.h backport/block-internal.h \
-       int/rsa-pad.c int/nettle-internal.h int/sha3-shake.h
+       int/rsa-pad.c int/nettle-internal.h
 
 if WINDOWS
 if HAVE_BCRYPT
@@ -99,16 +99,3 @@ libcrypto_la_SOURCES += \
        gost/acpkm.c gost/acpkm.h \
        gost/cmac.h gost/cmac-magma.c gost/cmac-kuznyechik.c
 endif
-
-if NEED_SHAKE_OUTPUT
-libcrypto_la_SOURCES += \
-       backport/md-internal.h \
-       backport/nettle-write.h \
-       backport/sha3.c \
-       backport/sha3-internal.h \
-       backport/sha3-shake.c \
-       backport/shake128.c \
-       backport/shake256.c \
-       backport/write-le64.c \
-       $(NULL)
-endif
diff --git a/lib/nettle/int/sha3-shake.h b/lib/nettle/int/sha3-shake.h
deleted file mode 100644 (file)
index 541d279..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-/* sha3.h
-
-   The sha3 hash function (aka Keccak).
-
-   Copyright (C) 2012 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/.
-*/
-
-#ifndef GNUTLS_LIB_NETTLE_INT_SHA3_SHAKE_H_INCLUDED
-#define GNUTLS_LIB_NETTLE_INT_SHA3_SHAKE_H_INCLUDED
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* This function has already been public in older Nettle releases */
-#undef sha3_256_shake
-
-/* Name mangling */
-#define sha3_128_init gnutls_nettle_backport_sha3_128_init
-#define sha3_128_update gnutls_nettle_backport_sha3_128_update
-#define sha3_128_shake gnutls_nettle_backport_sha3_128_shake
-#define sha3_128_shake_output gnutls_nettle_backport_sha3_128_shake_output
-#define sha3_256_shake gnutls_nettle_backport_sha3_256_shake
-#define sha3_256_shake_output gnutls_nettle_backport_sha3_256_shake_output
-#define sha3_128_ctx gnutls_nettle_backport_sha3_128_ctx
-
-#define SHA3_128_DIGEST_SIZE 16
-#define SHA3_128_BLOCK_SIZE 168
-
-struct sha3_128_ctx {
-       struct sha3_state state;
-       unsigned index;
-       uint8_t block[SHA3_128_BLOCK_SIZE];
-};
-
-void sha3_128_init(struct sha3_128_ctx *ctx);
-
-void sha3_128_update(struct sha3_128_ctx *ctx, size_t length,
-                    const uint8_t *data);
-
-void sha3_128_shake(struct sha3_128_ctx *ctx, size_t length, uint8_t *digest);
-
-void sha3_128_shake_output(struct sha3_128_ctx *ctx, size_t length,
-                          uint8_t *digest);
-
-/* Alternative digest function implementing shake256, with arbitrary
-   digest size */
-void sha3_256_shake(struct sha3_256_ctx *ctx, size_t length, uint8_t *digest);
-
-/* Unlike sha3_256_shake, this function can be called multiple times
-   to retrieve output from shake256 in an incremental manner */
-void sha3_256_shake_output(struct sha3_256_ctx *ctx, size_t length,
-                          uint8_t *digest);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* GNUTLS_LIB_NETTLE_INT_SHA3_SHAKE_H_INCLUDED */
index e29479bc2dcb5defe1b1441bc40920fe9eac95b4..da8a21e62bf88387552608f7a4be903730fd3708 100644 (file)
@@ -32,9 +32,6 @@
 #include <nettle/sha1.h>
 #include <nettle/sha2.h>
 #include <nettle/sha3.h>
-#ifndef HAVE_NETTLE_SHA3_128_SHAKE_OUTPUT
-#include "int/sha3-shake.h"
-#endif
 #include <nettle/hmac.h>
 #include <nettle/umac.h>
 #include <nettle/hkdf.h>