nettle: Update to version 4.0

Message ID 20260520201549.2964300-3-adolf.belka@ipfire.org
State New
Headers
Series nettle: Update to version 4.0 |

Commit Message

Adolf Belka 20 May 2026, 8:15 p.m. UTC
- Update from version 3.10.2 to 4.0
- Update of rootfile
- Changelog
4.0
	This is a new major release. It includes one new feature,
	 support for SLH-DSA. There are several changes to Nettle's
	 API, as well as deletion of obsolete features. There are also
	 several improvements to the ABI that leaves the API mostly
	 unchanged, in particular, smaller context structs for several
	 algorithms.
	The most disruptive API change is that the *_digest functions
	 no longer takes the desired digest size as argument. Truncated
	 hashes appeared to be an important use case decades ago when
	 the previous interface was designed, but that is now rather
	 obscure.
	Feedback on the new interfaces is appreciated, e.g., if the
	 variable tag length for OCB and CCM should be supported
	 differently, if additional types would benefit from larger
	 alignment, or if there are remaining interface bugs or
	 inconsistencies. Smaller additional API or ABI changes may be
	 considered for the next release, Nettle-4.1, but after that,
	 the intention is that both ABI and API should stay backwards
	 compatible for a longer time.
	The shared library names are libnettle.so.9.0 and
	 libhogweed.so.7.0, with new sonames libnettle.so.9 and
	 libhogweed.so.7.
    Interface changes:
	* The _digest functions for hash algorithms, MACs and AEADs no
	  longer take the desired digest size as argument, instead,
	  they always produce the full-size digest. The typedef
	  nettle_hash_digest_func has also been changed accordingly.
	  There are two exceptions: CCM and OCB. These AEAD algorithms
	  are specified with a variable tag length, which is not a
	  mere truncation of the output. Their _digest functions
	  (ccm_digest, ocb_digest, ccm_ae128_digest, ...) also have
	  their length argument deleted, but they still produce a
	  variable size digest. The number of octets to write (at most
	  16) is stored into the context struct by the corresponding
	  _set_nonce function.
	* The functions to process complete messages using CCM AES now
	  take a const cipher context as the first argument, e.g,
	  first argument to ccm_aes128_encrypt_message is now a const
	  struct aes128_ctx *. It used to be a struct ccm_aes128_ctx
	  *, where everything but the underlying cipher context was
	  ignored.
	* The SHA3 functions now use the same struct sha3_ctx for all
	  flavors, and the same function sha3_init. Old names, e.g.,
	  sha3_256_ctx and sha3_256_init, are defined as preprocessor
	  aliases, for backwards compatibility.
	* The dst_length argument to base16_decode_update and
	  base64_decode_update is now both an input and output
	  argument. On input it must now hold the size of the
	  destination buffer, and decoding fails if that is not
	  sufficient. Previously, dst_length was an output only, and
	  it was required that the destination buffer was large enough
	  for any input of the given src_length.
    Interface deletions:
	* Deleted the old struct aes_ctx, and all functions operating
	  on it. Use the fixed key size interfaces instead, e.g.,
	  struct aes256_ctx, introduced in Nettle-3.0.
	* Deleted dsa-compat.h, and everything declared therein. Use
	  the interface in dsa.h, introduced in Nettle-3.0.
	* Deleted old header sha.h. Use sha1.h or sha2.h instead, as
	  appropriate.
	* Deleted the general HMAC interface, with functions like
	  hmac_set_key that work with an arbitrary underlying hash
	  function. Use the specific hmac functions instead, e.g.,
	  hmac_sha256_set_key, or the mac abstraction defined in
	  nettle-meta.h, e.g, the nettle_hmac_sha256 instance.
	* Deleted the undocumented struct nettle_armor abstraction.
	* Deleted the undocumented function base64_encode_group.
	* Deleted md5-compat.h, and everything declared therein. Use
	  the interface in md5.h instead (or even better, stop using md5).
	* Deleted pgp.h, and everything declared therein. This attempt
	  to support openpgp formats was incomplete, undocumented, and
	  mostly obsolete.
	* Delete all the *_DATA_SIZE compatibility aliases. Use
	  corresponding *_BLOCK_SIZE constants instead, introduced in
	  Nettle-3.0.
	* Deleted the obsolete functions _rsa_blind and _rsa_unblind.
	  (Current RSA blinding in Nettle uses internal functions with
	  a different interface).
	* Delete compatibility aliases salsa20_set_iv,
	  SALSA20_IV_SIZE. These were renamed to salsa20_set_nonce and
	  SALSA20_NONCE_SIZE in Nettle-3.0.
	* Deleted compatibility aliases _nettle_md5_compress,
	  _nettle_sha1_compress. These internal functions were
	  promoted to documented and supported functions in
	  Nettle-3.9, with new names md5_compress and sha1_compress.
	* Deleted compatibility alias yarrow_force_reseed. Renamed to
	  yarrow_slow_reseed in Nettle-2.0.
    ABI changes and improvements.
	* Introduce 16-byte alignment on certain types. Applied to
	  union nettle_block16, and subkey arrays of AES and UMAC.
	  This is intended to improve performance for SIMD load and
	  store instructions, which on some platforms may be faster
	  with proper alignment. The larger alignment is enabled only
	  for platforms where the alignment of the uint64_t type is 8.
	* Size of struct gcm_key is reduced from 4096 bytes to 2048.
	* Size of the new sha3_ctx is considerable smaller, 216 bytes,
	  than the previous types that included a buffer for a
	  complete block. E.g., the largest one, for sha3_128_ctx
	  (shake128), used to be 376 bytes.
	* Size of HMAC contexts have been reduced, by not including
	  multiple block buffers. E.g, size of struct hmac_sha256_ctx
	  reduced from 336 bytes to 192. This change has been
	  discussed for a long time, with first attempt made by Dmitry
	  Baryshkov years ago, but delayed, since it implies an ABI
	  break.
	* For OCB block counters, use type uint32_t for blocks of
	  associated data, and uint64_t for message blocks, instead of
	  size_t. This makes the implementation limits the same for
	  32-bit and 64-bit platforms.
    Bug fixes:
	* Fix off-by-one bug in sexp parser, which could result in a
	  one byte overread on invalid input. Also fix excessive
	  recursion and stack usage for some inputs. Both problems
	  reported via oss-fuzz.
	* Fix ed448_shake256_verify to check that the final signature
	  octet is zero (previous versions completely ignored this
	  somewhat redundant octet). Reported by Oren Yomtov.
    New features:
	* Support for SLH-DSA signatures (stateless hash-based digital
	  signature algorithm). See the Nettle manual for details.
	* New public function drbg_ctr_aes256_update, to enable
	  FIPS-compliant reseeding. Contributed by Daiki Ueno.
    Configure and build changes:
	* Support for at least C99 is required when building Nettle.
	  In addition, support for alignof and alignas is required;
	  these are part of C11, but intention is that this is the
	  only required C11 feature.
	* The unusual configure options --with-lib-path and
	  --with-include-path has been deleted. Use CFLAGS and LDFLAGS
	  instead. This implies that Nettle's configure script no
	  longer attempts to add rpath-related linker flags
	  automagically; if any are needed, they must be passed in
	  LDFLAGS.
	* The logic to sometimes change the default libdir has been
	  deleted. Previously, configure tried to be helpful and
	  change the default, e.g., to ${exec_prefix}/lib32 when you
	  build 32-bit libraries on a system where ${exec_prefix}/lib
	  is for 64-bit libraries. If you relied on this behavior, you
	  now have to use the --libdir configure option.
	* Rearranged getopt files, now based on gnulib copies.

Signed-off-by: Adolf Belka <adolf.belka@ipfire.org>
---
 config/rootfiles/common/nettle | 13 +++++--------
 lfs/nettle                     |  6 +++---
 2 files changed, 8 insertions(+), 11 deletions(-)
  

Patch

diff --git a/config/rootfiles/common/nettle b/config/rootfiles/common/nettle
index 267d1eef3..cb23f710c 100644
--- a/config/rootfiles/common/nettle
+++ b/config/rootfiles/common/nettle
@@ -27,7 +27,6 @@ 
 #usr/include/nettle/curve448.h
 #usr/include/nettle/des.h
 #usr/include/nettle/drbg-ctr.h
-#usr/include/nettle/dsa-compat.h
 #usr/include/nettle/dsa.h
 #usr/include/nettle/eax.h
 #usr/include/nettle/ecc-curve.h
@@ -43,7 +42,6 @@ 
 #usr/include/nettle/macros.h
 #usr/include/nettle/md2.h
 #usr/include/nettle/md4.h
-#usr/include/nettle/md5-compat.h
 #usr/include/nettle/md5.h
 #usr/include/nettle/memops.h
 #usr/include/nettle/memxor.h
@@ -52,7 +50,6 @@ 
 #usr/include/nettle/nist-keywrap.h
 #usr/include/nettle/ocb.h
 #usr/include/nettle/pbkdf2.h
-#usr/include/nettle/pgp.h
 #usr/include/nettle/pkcs1.h
 #usr/include/nettle/poly1305.h
 #usr/include/nettle/pss-mgf1.h
@@ -63,12 +60,12 @@ 
 #usr/include/nettle/salsa20.h
 #usr/include/nettle/serpent.h
 #usr/include/nettle/sexp.h
-#usr/include/nettle/sha.h
 #usr/include/nettle/sha1.h
 #usr/include/nettle/sha2.h
 #usr/include/nettle/sha3.h
 #usr/include/nettle/siv-cmac.h
 #usr/include/nettle/siv-gcm.h
+#usr/include/nettle/slh-dsa.h
 #usr/include/nettle/sm3.h
 #usr/include/nettle/sm4.h
 #usr/include/nettle/streebog.h
@@ -78,10 +75,10 @@ 
 #usr/include/nettle/xts.h
 #usr/include/nettle/yarrow.h
 usr/lib/libhogweed.so
-usr/lib/libhogweed.so.6
-usr/lib/libhogweed.so.6.11
+usr/lib/libhogweed.so.7
+usr/lib/libhogweed.so.7.0
 #usr/lib/libnettle.so
-usr/lib/libnettle.so.8
-usr/lib/libnettle.so.8.11
+usr/lib/libnettle.so.9
+usr/lib/libnettle.so.9.0
 #usr/lib/pkgconfig/hogweed.pc
 #usr/lib/pkgconfig/nettle.pc
diff --git a/lfs/nettle b/lfs/nettle
index 193bcb178..eedffae9b 100644
--- a/lfs/nettle
+++ b/lfs/nettle
@@ -1,7 +1,7 @@ 
 ###############################################################################
 #                                                                             #
 # IPFire.org - A linux based firewall                                         #
-# Copyright (C) 2007-2025  IPFire Team  <info@ipfire.org>                     #
+# Copyright (C) 2007-2026  IPFire Team  <info@ipfire.org>                     #
 #                                                                             #
 # This program is free software: you can redistribute it and/or modify        #
 # it under the terms of the GNU General Public License as published by        #
@@ -24,7 +24,7 @@ 
 
 include Config
 
-VER        = 3.10.2
+VER        = 4.0
 
 THISAPP    = nettle-$(VER)
 DL_FILE    = $(THISAPP).tar.gz
@@ -40,7 +40,7 @@  objects = $(DL_FILE)
 
 $(DL_FILE) = $(DL_FROM)/$(DL_FILE)
 
-$(DL_FILE)_BLAKE2 = 2bcd54c97d793238a9c6527f0ba4851dd9e5b53c80abc1ed012ef53e9dbed1fc47c474ca7c29a2c0a989830e45f85eb61db4752dd8b8487cffc8559f43788c89
+$(DL_FILE)_BLAKE2 = 7391fe45917ad394973a9069305c415779182ca9c7640105c47bbf23ef74301099ca8ab1bc18cc331297ec43c848b34b1c1549ae1111dadea17c35032a5ffcdc
 
 install : $(TARGET)