./security/nettle, Cryptographic library

[ Image CVSweb ] [ Image Homepage ] [ Image RSS ] [ Image Required by ] [ Image Add to tracker ]


Branch: CURRENT, Version: 3.10.2, Package name: nettle-3.10.2, Maintainer: pkgsrc-users

Nettle is a cryptographic library that is designed to fit easily in more
or less any context: In crypto toolkits for object-oriented languages
(C++, Python, Pike, ...), in applications like LSH or GNUPG, or even in
kernel space. In most contexts, you need more than the basic
cryptographic algorithms, you also need some way to keep track of available
algorithms, their properties and variants. You often have some algorithm
selection process, often dictated by a protocol you want to implement.

And as the requirements of applications differ in subtle and not so
subtle ways, an API that fits one application well can be a pain to use
in a different context. And that is why there are so many different
cryptographic libraries around.

Nettle tries to avoid this problem by doing one thing, the low-level
crypto stuff, and providing a simple but general interface to it.
In particular, Nettle doesn't do algorithm selection. It doesn't do
memory allocation. It doesn't do any I/O.

The idea is that one can build several application and context specific
interfaces on top of Nettle, and share the code, test cases, benchmarks,
documentation, etc. Examples are the Nettle module for the Pike
language, and LSH, which both use an object-oriented abstraction on top
of the library.


Required to run:
[devel/gmp]

Required to build:
[pkgtools/cwrappers]

Master sites:

Filesize: 2582.66 KB

Version history: (Expand)


CVS history: (Expand)


   2026-02-06 14:51:49 by Thomas Klausner | Files touched by this commit (5)
Log message:
nettle: downgrade, gnutls is not ready for nettle 4
   2026-02-06 11:06:21 by Thomas Klausner | Files touched by this commit (1305)
Log message:
*: recursive bump for nettle 4.0 shlib major bump
   2026-02-06 11:02:02 by Thomas Klausner | Files touched by this commit (4) | Package updated
Log message:
nettle: update to 4.0.

NEWS for the Nettle 4.0 release

	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.
   2025-06-30 21:15:21 by Adam Ciarcinski | Files touched by this commit (2) | Package updated
Log message:
nettle: updated to 3.10.2

3.10.2

This is a maintenance release, with only a few bugfixes and
portability improvements.

The new version is intended to be fully source and binary
compatible with Nettle-3.6. The shared library names are
libnettle.so.8.11 and libhogweed.so.6.11, with sonames
libnettle.so.8 and libhogweed.so.6.

Bug fixes:

* Fix missing prototypes in getopt.h and getopt.c, affecting
  non-glibc systems, and causing compile errors with C23
  compilers that require prototypes, e.g., gcc-15.

* For powerpc64, avoid using v9 (ISA v3.0) instructions
  lxvb16x, lxv and stxv in powerpc64/p8/ files.

* For powerpc64, add configure check for __VSX__, and disable
  use of assembly if not defined. Nettle's powerpc64 assembly
  requires at least v7 (ISA v2.06).
   2024-12-31 18:42:57 by Adam Ciarcinski | Files touched by this commit (3) | Package updated
Log message:
nettle: updated to 3.10.1

Nettle 3.10.1 release

This is a maintenance release, with only a few bugfixes and
portability improvements.

The new version is intended to be fully source and binary
compatible with Nettle-3.6. The shared library names are
libnettle.so.8.10 and libhogweed.so.6.10, with sonames
libnettle.so.8 and libhogweed.so.6.

Bug fixes:

* Fix buffer overread in the new sha256 assembly for
  powerpc64, as well as a stack alignment issue.

* Added missing nettle_mac structs for hmac-gosthash.

* Fix configure test for valgrind, to not attempt to run
  valgrind on executables built using memory sanitizers.

Optimizations:

* Improved runtime detection of cpu features for OpenBSD and
  FreeBSD, using elf_aux_info when available. This also adds
  runtime detection for FreeBSD on arm64. Contributed by Brad
  Smith.
   2024-06-18 12:45:53 by Adam Ciarcinski | Files touched by this commit (6) | Package updated
Log message:
nettle: updated to 3.10

Nettle 3.10 release

This is a maintenance release, including a few each of bug
fixes, new features and optimizations.

The new version is intended to be fully source and binary
compatible with Nettle-3.6. The shared library names are
libnettle.so.8.9 and libhogweed.so.6.9, with sonames
libnettle.so.8 and libhogweed.so.6.

Bug fixes:

* Add missing hash functions sha512_224 and sha512_256 to the
  nettle_get_hashes() list. The name values in the
  corresponding nettle_hash structs also changed to use
  underscore instead of dash, for consistency.

* Fix a few cases of formally undefined calls to memcpy(dst,
  NULL, 0), resulting from valid calls to, e.g.,
  sha256_update(ctx, 0, NULL).

New features:

* Support RSA-OAEP encryption. Contributed by Nicolas Mora and
  Daiki Ueno.

* New function sha3_256_shake_output, new functions
  sha3_128_init, sha3_128_update, sha3_128_shake,
  sha3_128_shake_output. Contributed by Daiki Ueno.

* Added DRBG-CTR with AES256, contributed by Simon Josefsson.

Optimizations:

* New combined gcm-aes assembly for powerpc64, contributed by
  Danny Tsen.

* New sha256 assembly for powerpc64, contributed by Eric
  Richter.

* Improved performance for powerpc64 AES decrypt, by skipping
  subkey transformations that don't suit the vncipher
  instructions.

* Add arm64 CPU feature detection for Android and for Apple systems,
  contributed by Foolbar and Tim Kosse, prespectively.

Miscellaneous:

* New tests for side-channel silence, based on valgrind.

* Delete all md5 assembly code. Delete all sparc32 assembly code.
   2023-06-06 07:12:06 by Adam Ciarcinski | Files touched by this commit (2) | Package updated
Log message:
nettle: updated to 3.9.1

Nettle 3.9.1 release

This is a bugfix release, fixing a few bugs reported for
Nettle-3.9. The bug in the new OCB code may be exploitable for
denial of service or worse, since triggering it leads to
memory corruption. Upgrading from Nettle-3.9 to the new
version is strongly recommended.

The new version is intended to be fully source and binary
compatible with Nettle-3.6. The shared library names are
libnettle.so.8.8 and libhogweed.so.6.8, with sonames
libnettle.so.8 and libhogweed.so.6.

Bug fixes:

* Fix OCB loop for processing messages of size 272 bytes or
  larger. Reported and fixed by Jussi Kivilinna.

* Fix alignment bug in the new x86_64 non-pclmul assembly
  implementation of ghash. Reported by Henrik Grubbström.

* Fix build-time memory leak in eccdata. Reported by Noah
  Watkins.
   2023-05-23 15:25:32 by Thomas Klausner | Files touched by this commit (4) | Package updated
Log message:
nettle: update to 3.9.

NEWS for the Nettle 3.9 release

	This release includes bug fixes, several new features, a few
	performance improvements, and one performance regression
	affecting GCM on certain platforms.

	The new version is intended to be fully source and binary
	compatible with Nettle-3.6. The shared library names are
	libnettle.so.8.7 and libhogweed.so.6.7, with sonames
	libnettle.so.8 and libhogweed.so.6.

	This release includes a rewrite of the C implementation of
	GHASH (dating from 2011), as well as the plain x86_64 assembly
	version, to use precomputed tables in a different way, with
	tables always accessed in the same sequential manner.

	This should make Nettle's GHASH implementation side-channel
	silent on all platforms, but considerably slower on platforms
	without carry-less mul instructions. E.g., benchmarks of the C
	implementation on x86_64 showed a slowdown of 3 times.

	Bug fixes:

	* Fix bug in ecdsa and gostdsa signature verify operation, for
	  the unlikely corner case that point addition really is point
	  duplication.

	* Fix for chacha on Power7, nettle's assembly used an
	  instruction only available on later processors. Fixed by
	  Mamone Tarsha.

	* GHASH implementation should now be side-channel silent on
	  all architectures.

	* A few portability fixes for *BSD.

	New features:

	* Support for the SM4 block cipher, contributed by Tianjia
          Zhang.

	* Support for the Balloon password hash, contributed by Zoltan
          Fridrich.

	* Support for SIV-GCM authenticated encryption mode,
          contributed by Daiki Ueno.

	* Support for OCB authenticated encryption mode.

	* New exported functions md5_compress, sha1_compress,
	  sha256_compress, sha512_compress, based on patches from
	  Corentin Labbe.

	Optimizations:

	* Improved sha256 performance, in particular for x86_64 and
	  s390x.

	* Use GMP's mpn_sec_tabselect, which is implemented in
	  assembly on many platforms, and delete the similar nettle
	  function. Gives a modest speedup to all ecc operations.

	* Faster poly1305 for x86_64 and ppc64. New ppc code
	  contributed by Mamone Tarsha.

	Miscellaneous:

	* New ASM_FLAGS variable recognized by configure.

	* Delete all arcfour assembly code. Affects 32-bit x86, 32-bit
	  and 64-bit sparc.

	Known issues:

	* Version 6.2.1 of GNU GMP (the most recent GMP release as of
	  this writing) has a known issue for MacOS on 64-bit ARM: GMP
	  assembly files use the reserved x18 register. On this
	  platform it is recommended to use a GMP snapshot where this
	  bug is fixed, and upgrade to a later GMP release when one
	  becomes available.

	* Also on MacOS, Nettle's testsuite may still break due to
	  DYLD_LIBRARY_PATH being discarded under some circumstances.
	  As a workaround, use

	  make check EMULATOR='env DYLD_LIBRARY_PATH=$(TEST_SHLIB_DIR)'