]> git.ipfire.org Git - thirdparty/gnutls.git/log
thirdparty/gnutls.git
2 years agoMerge branch 'wip/dueno/edwards-keygen' into 'master'
Daiki Ueno [Wed, 27 Sep 2023 08:22:21 +0000 (08:22 +0000)] 
Merge branch 'wip/dueno/edwards-keygen' into 'master'

pkcs11: fix key pair generation for EdDSA

Closes #1309

See merge request gnutls/gnutls!1778

2 years agopkcs11: fix key pair generation for EdDSA
Daiki Ueno [Sat, 23 Sep 2023 06:37:03 +0000 (15:37 +0900)] 
pkcs11: fix key pair generation for EdDSA

Previouly we used the CKM_EDDSA mechanism to generate key pair, though
the mechanism can only be used for signing and verification as
specified in PKCS#11 3.1 section 6.3.  For key generation, the
CKM_EC_EDWARDS_KEY_PAIR_GEN mechanism (or
CKM_EC_MONTGOMERY_KEY_PAIR_GEN, if the point is represented in the
Montgomery form) needs to be used.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agoMerge branch 'codespell' into 'master'
Daiki Ueno [Mon, 18 Sep 2023 09:32:08 +0000 (09:32 +0000)] 
Merge branch 'codespell' into 'master'

doc: fix typos found by codespell

See merge request gnutls/gnutls!1777

2 years agodoc: fix typos found by codespell
Dimitri Papadopoulos [Sun, 17 Sep 2023 14:29:38 +0000 (16:29 +0200)] 
doc: fix typos found by codespell

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
2 years agoMerge branch 'wip/dueno/ecdh-api2' into 'master'
Daiki Ueno [Tue, 12 Sep 2023 09:46:13 +0000 (09:46 +0000)] 
Merge branch 'wip/dueno/ecdh-api2' into 'master'

abstract: simplify DH key export and import API

See merge request gnutls/gnutls!1775

2 years agognutls_privkey_generate2: allow missing Q for DH
Daiki Ueno [Mon, 11 Sep 2023 04:59:45 +0000 (13:59 +0900)] 
gnutls_privkey_generate2: allow missing Q for DH

As the Q parameter is optional in the gnutls_dh_params_t, this allows
generating Diffie-Hellman private key without that parameter.

While it is mandatory in FIPS mode, it is ensured when generating the
DH parameters or importing through gnutls_dh_params_import_raw3.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agoabstract: add gnutls_pubkey_export_dh_raw
Daiki Ueno [Sun, 10 Sep 2023 11:19:13 +0000 (20:19 +0900)] 
abstract: add gnutls_pubkey_export_dh_raw

This adds gnutls_pubkey_export_dh_raw, a public key counterpart of
gnutls_privkey_export_dh_raw.  This also replaces the P, Q, G
parameters with gnutls_dh_params_t in the function signatures to avoid
unnecessary serialization of bignums.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agoMerge branch 'gcm-key-length' into 'master'
Daiki Ueno [Mon, 11 Sep 2023 12:29:14 +0000 (12:29 +0000)] 
Merge branch 'gcm-key-length' into 'master'

cipher: fix AES-SIV-GCM key lengths

See merge request gnutls/gnutls!1776

2 years agocipher: fix AES-SIV-GCM key lengths
Miroslav Lichvar [Mon, 11 Sep 2023 08:45:39 +0000 (10:45 +0200)] 
cipher: fix AES-SIV-GCM key lengths

Fix provided key lengths of AES-SIV-GCM ciphers, which have halved keys
when compared to AES-SIV-CMAC.

Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
2 years agognutls_pubkey_import_privkey: support GNUTLS_PK_DH
Daiki Ueno [Sun, 10 Sep 2023 22:23:51 +0000 (07:23 +0900)] 
gnutls_pubkey_import_privkey: support GNUTLS_PK_DH

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agoMerge branch 'wip/dueno/nettle-siv-gcm' into 'master'
Daiki Ueno [Thu, 7 Sep 2023 22:29:43 +0000 (22:29 +0000)] 
Merge branch 'wip/dueno/nettle-siv-gcm' into 'master'

nettle: expose SIV-GCM through the AEAD interface

Closes #1356

See merge request gnutls/gnutls!1774

2 years agoNEWS: mention AES-GCM-SIV support
Daiki Ueno [Wed, 6 Sep 2023 05:55:10 +0000 (14:55 +0900)] 
NEWS: mention AES-GCM-SIV support

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agonettle: expose SIV-GCM through the AEAD interface
Daiki Ueno [Wed, 6 Sep 2023 05:02:43 +0000 (14:02 +0900)] 
nettle: expose SIV-GCM through the AEAD interface

This adds a couple of new cipher algorithms GNUTLS_CIPHER_AES_128_SIV_GCM
and GNUTLS_CIPHER_AES_256_SIV_GCM, exposing nettle_siv_gcm_aes{128,256}*
functions.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agonettle: vendor-in SIV-GCM implementation
Daiki Ueno [Wed, 6 Sep 2023 04:34:27 +0000 (13:34 +0900)] 
nettle: vendor-in SIV-GCM implementation

This imports SIV-GCM implementation from Nettle 3.9.1, while still
assuming Nettle 3.6 as the baseline.  As such, only non-optimized
implementation is imported.  Performance critical applications are
advised to build GnuTLS with Nettle 3.9.1 or later.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agodevel: update nettle submodule
Daiki Ueno [Tue, 5 Sep 2023 00:39:28 +0000 (09:39 +0900)] 
devel: update nettle submodule

This updates nettle submodule to the 3.9.1 release.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agoMerge branch 'wip/dueno/ecdh-api' into 'master'
Daiki Ueno [Mon, 4 Sep 2023 19:25:23 +0000 (19:25 +0000)] 
Merge branch 'wip/dueno/ecdh-api' into 'master'

gnutls_privkey_derive_secret: new function

Closes #894

See merge request gnutls/gnutls!1773

2 years agognutls_privkey_derive_secret: new function
Daiki Ueno [Tue, 12 Apr 2022 06:17:44 +0000 (08:17 +0200)] 
gnutls_privkey_derive_secret: new function

This adds a new function gnutls_privkey_derive_secret, which can be
used in conjunction with the other key import or key generation API to
calculate shared secret.

Key import can be done with gnutls_{pubkey,privkey}_import_ecc_raw for
ECDH and gnutls_{pubkey,privkey}_import_dh_raw for FFDH, while key
generation could be done with gnutls_privkey_generate2 with respective
algorithms (e.g., GNUTLS_PK_ECDH_X25519) and key generation parameters
in gnutls_keygen_data_st format.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agoabstract, x509: add functions to import and export DH keys
Daiki Ueno [Thu, 31 Aug 2023 04:55:58 +0000 (13:55 +0900)] 
abstract, x509: add functions to import and export DH keys

This adds a couple of functions to import and export Diffie-Hellman
private keys.  While it shares the structure as DSA, it differs in q
parameter which is optional in Diffie-Hellman and the algorithm
ID: GNUTLS_PK_DH vs GNUTLS_PK_DSA.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agoabstract, x509: refactor raw DSA key import logic
Daiki Ueno [Sun, 3 Sep 2023 01:20:37 +0000 (10:20 +0900)] 
abstract, x509: refactor raw DSA key import logic

This switches to using DSA_{P,Q,G,X,Y} instead of magic number, and
adds check for required parameters.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agompi: remove unnecessary integer size conversion
Daiki Ueno [Sun, 3 Sep 2023 01:36:13 +0000 (10:36 +0900)] 
mpi: remove unnecessary integer size conversion

The following pattern:

```c
size_t siz = prime->size;
if (_gnutls_mpi_init_scan_nz(&tmp_prime, prime->data, siz)) {
  ...
}
```

was previously written as:

```c
size_t siz = prime->size;
if (_gnutls_mpi_scan_nz (&tmp_prime, prime->data, &siz))
  ...
}
```

Now that _gnutls_mpi_init_scan_nz takes an immediate integer instead
of a pointer, we don't need to account for the integere size and thus
no conversion should be necessary.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agognutls_privkey_generate2: accept DH parameters
Daiki Ueno [Thu, 31 Aug 2023 00:21:23 +0000 (09:21 +0900)] 
gnutls_privkey_generate2: accept DH parameters

This adds a new GNUTLS_KEYGEN_DH type for gnutls_keygen_data_st, so
gnutls_privkey_generate2 can use pre-generated DH parameters instead
of newly generated ones.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agognutls_privkey_import_ecc_raw: allow X25519/X448 curves
Daiki Ueno [Tue, 12 Apr 2022 06:28:22 +0000 (08:28 +0200)] 
gnutls_privkey_import_ecc_raw: allow X25519/X448 curves

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agognutls_pubkey_import_ecc_raw: allow X25519/X448 curves
Daiki Ueno [Tue, 12 Apr 2022 06:21:12 +0000 (08:21 +0200)] 
gnutls_pubkey_import_ecc_raw: allow X25519/X448 curves

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agoMerge branch 'wip/dueno/sigpipe' into 'master'
Daiki Ueno [Mon, 28 Aug 2023 12:18:56 +0000 (12:18 +0000)] 
Merge branch 'wip/dueno/sigpipe' into 'master'

tests: ignore SIGPIPE in forking tests if the parent is TLS client

See merge request gnutls/gnutls!1772

2 years agotests: ignore SIGPIPE in forking tests if the parent is TLS client
Daiki Ueno [Mon, 28 Aug 2023 06:47:04 +0000 (15:47 +0900)] 
tests: ignore SIGPIPE in forking tests if the parent is TLS client

If the tests are forking and the parent process is a client, care must
be taken to handle SIGPIPE reported by the child process (server) when
the client closes the connection.

This hadn't been exposed until commit
dd79ac9bcf90012e090726adf7c1940bcce8333f, thanks to the fact that the
parent process kept the other pipe end which effectively prevented a
"broken pipe".

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agoMerge branch 'wip/dueno/benchmark-gettime' into 'master'
Daiki Ueno [Fri, 25 Aug 2023 20:47:53 +0000 (20:47 +0000)] 
Merge branch 'wip/dueno/benchmark-gettime' into 'master'

benchmark: use fallback gettime provided by Gnulib's timespec module

Closes #1497

See merge request gnutls/gnutls!1770

2 years agobenchmark: use fallback gettime provided by Gnulib's timespec module
Daiki Ueno [Wed, 23 Aug 2023 01:43:54 +0000 (10:43 +0900)] 
benchmark: use fallback gettime provided by Gnulib's timespec module

If CLOCK_PROCESS_CPUTIME_ID is not defined, a fallback gettime
function was defined as an inline function.  Given that "timespec.h"
from Gnulib already defines such a fallback function with the same
name, it's not necessary to redefine it.  This should fix the build
issue with Clang:

  In file included from ../../gnutls-3.8.1/src/cli.c:65:
  ../../gnutls-3.8.1/src/benchmark.h:38:20: error: static declaration of 'gettime' follows non-static declaration
  inline static void gettime(struct timespec *ts)
                     ^
  ../../gnutls-3.8.1/src/gl/timespec.h:93:6: note: previous declaration is here
  void gettime (struct timespec *) _GL_ARG_NONNULL ((1));
       ^

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agoMerge branch 'wip/dueno/libssp-windows' into 'master'
Daiki Ueno [Wed, 23 Aug 2023 01:37:31 +0000 (01:37 +0000)] 
Merge branch 'wip/dueno/libssp-windows' into 'master'

.gitlab-ci.yml: bundle libssp-0.dll in the Windows archive

Closes #1498

See merge request gnutls/gnutls!1769

2 years ago.gitlab-ci.yml: bundle libssp-0.dll in the Windows archive
Daiki Ueno [Tue, 22 Aug 2023 01:43:38 +0000 (10:43 +0900)] 
.gitlab-ci.yml: bundle libssp-0.dll in the Windows archive

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agoMerge branch 'master' into 'master'
Daiki Ueno [Tue, 8 Aug 2023 01:27:30 +0000 (01:27 +0000)] 
Merge branch 'master' into 'master'

Move the GNUTLS_NO_EXTENSIONS compatibility #define to gnutls.h

See merge request gnutls/gnutls!1766

2 years agoMerge branch 'faketime-configure' into 'master'
Daiki Ueno [Mon, 7 Aug 2023 09:48:01 +0000 (09:48 +0000)] 
Merge branch 'faketime-configure' into 'master'

configure.ac: Avoid noise when faketime is not available

See merge request gnutls/gnutls!1767

2 years agoconfigure.ac: Avoid noise when faketime is not available
Sam James [Mon, 7 Aug 2023 07:23:50 +0000 (08:23 +0100)] 
configure.ac: Avoid noise when faketime is not available

We already checked for whether faketime is installed, so don't try to call it
if we couldn't find a path to it.

This avoids noise like:
```
checking for faketime... no
checking for datefudge... no
checking whether faketime program works... 1691391464
/var/tmp/portage/net-libs/gnutls-3.8.1/work/gnutls-3.8.1/configure: line 11540: 2006-09-23 00:00:00: command not found
/var/tmp/portage/net-libs/gnutls-3.8.1/work/gnutls-3.8.1/configure: line 11540: test: =: unary operator expected
no
```

Bug: https://bugs.gentoo.org/911833
Signed-off-by: Sam James <sam@gentoo.org>
2 years agoMerge branch 'master' into 'master'
Daiki Ueno [Mon, 7 Aug 2023 00:37:42 +0000 (00:37 +0000)] 
Merge branch 'master' into 'master'

Fix build on GNU/Hurd

See merge request gnutls/gnutls!1765

2 years agoMove the GNUTLS_NO_EXTENSIONS compatibility #define to gnutls.h
Adrian Bunk [Sun, 6 Aug 2023 19:46:22 +0000 (22:46 +0300)] 
Move the GNUTLS_NO_EXTENSIONS compatibility #define to gnutls.h

Signed-off-by: Adrian Bunk <bunk@debian.org>
2 years agoFix build on GNU/Hurd
Samuel Thibault [Sun, 6 Aug 2023 18:37:31 +0000 (20:37 +0200)] 
Fix build on GNU/Hurd

GNU/Hurd does not define an arbitrary PATH_MAX limitation, so pathbuf
can define its own abitrary limitation.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2 years agoMerge branch 'zfridric_devel' into 'master' 3.8.1
Zoltán Fridrich [Fri, 4 Aug 2023 07:41:42 +0000 (07:41 +0000)] 
Merge branch 'zfridric_devel' into 'master'

Release 3.8.1

See merge request gnutls/gnutls!1762

2 years agoRelease 3.8.1
Zoltan Fridrich [Thu, 3 Aug 2023 09:52:04 +0000 (11:52 +0200)] 
Release 3.8.1

Signed-off-by: Zoltan Fridrich <zfridric@redhat.com>
2 years agoMerge branch 'zfridric_devel3' into 'master'
Zoltán Fridrich [Thu, 3 Aug 2023 13:34:28 +0000 (13:34 +0000)] 
Merge branch 'zfridric_devel3' into 'master'

Safeguard against overflow inside pkcs11_find_objects

See merge request gnutls/gnutls!1764

2 years agoSafeguard against overflow inside pkcs11_find_objects
Zoltan Fridrich [Thu, 3 Aug 2023 12:09:33 +0000 (14:09 +0200)] 
Safeguard against overflow inside pkcs11_find_objects

Signed-off-by: Zoltan Fridrich <zfridric@redhat.com>
2 years agoMerge branch 'zfridric_devel' into 'master'
Zoltán Fridrich [Thu, 3 Aug 2023 08:01:51 +0000 (08:01 +0000)] 
Merge branch 'zfridric_devel' into 'master'

Refactor pkcs11_find_objects to use p11-kit iterator

Closes #1491

See merge request gnutls/gnutls!1758

2 years agoRefactor pkcs11_find_objects to use p11-kit iterator
Zoltan Fridrich [Tue, 25 Jul 2023 14:23:49 +0000 (16:23 +0200)] 
Refactor pkcs11_find_objects to use p11-kit iterator

Signed-off-by: Zoltan Fridrich <zfridric@redhat.com>
2 years agoMerge branch 'wip/dueno/ci-cross-fedora38' into 'master'
Daiki Ueno [Mon, 31 Jul 2023 23:17:27 +0000 (23:17 +0000)] 
Merge branch 'wip/dueno/ci-cross-fedora38' into 'master'

.gitlab-ci.yml: enable use of Fedora based CI image for cross compilation

See merge request gnutls/gnutls!1757

2 years agoMerge branch 'wip/dueno/ex-cxx' into 'master'
Daiki Ueno [Mon, 31 Jul 2023 15:03:48 +0000 (15:03 +0000)] 
Merge branch 'wip/dueno/ex-cxx' into 'master'

doc: fix C++ example compilation on MinGW

Closes #1480

See merge request gnutls/gnutls!1761

2 years agotests: propagate $CFLAGS in pkgconfig.sh
Daiki Ueno [Mon, 31 Jul 2023 14:46:19 +0000 (23:46 +0900)] 
tests: propagate $CFLAGS in pkgconfig.sh

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years ago.gitlab-ci.yml: re-enable i686 cross build
Daiki Ueno [Mon, 31 Jul 2023 02:54:27 +0000 (11:54 +0900)] 
.gitlab-ci.yml: re-enable i686 cross build

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agodoc: fix C++ example compilation on MinGW
Daiki Ueno [Mon, 31 Jul 2023 08:38:02 +0000 (17:38 +0900)] 
doc: fix C++ example compilation on MinGW

The examples under doc/examples/ are compiled with Gnulib, which
overrides write if it's not available, as a macro.  This conflicts
with the usage of std::iostream::write in ex-cxx.cpp.  To avoid the
build issue, use a custom namespace to hide it, as suggested in:
https://www.gnu.org/software/gnulib/manual/html_node/A-C_002b_002b-namespace-for-gnulib.html

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agoMerge branch 'wip/dueno/aead-nonce-length' into 'master'
Daiki Ueno [Mon, 31 Jul 2023 06:51:16 +0000 (06:51 +0000)] 
Merge branch 'wip/dueno/aead-nonce-length' into 'master'

Check nonce length more strictly in aead_{encrypt,decrypt}

Closes #1494

See merge request gnutls/gnutls!1756

2 years agoMerge branch 'zfridric_devel2' into 'master'
Zoltán Fridrich [Thu, 27 Jul 2023 11:59:33 +0000 (11:59 +0000)] 
Merge branch 'zfridric_devel2' into 'master'

Reduce the number of objects received per iteration in pkcs11_find_objects

Closes #1491

See merge request gnutls/gnutls!1759

2 years agoReduce the number of objects received per iteration in pkcs11_find_objects
Zoltan Fridrich [Thu, 27 Jul 2023 08:36:48 +0000 (10:36 +0200)] 
Reduce the number of objects received per iteration in pkcs11_find_objects

Signed-off-by: Zoltan Fridrich <zfridric@redhat.com>
2 years ago.gitlab-ci.yml: drop use of Debian cross images
Daiki Ueno [Mon, 24 Jul 2023 07:14:20 +0000 (09:14 +0200)] 
.gitlab-ci.yml: drop use of Debian cross images

Due to licensing concern, we had to remove the Debian-based CI images
for cross compilation.  Some of them are already covered by the
Fedora-based CI images, though it would be nice if the following are
added back:

- x86 (32-bit): maybe we could just use -m32 on Fedora image,
  similarly to mingw targets
- Arm (32-bit)

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years ago.gitlab-ci.yml: enable use of Fedora cross toolchain
Daiki Ueno [Sun, 23 Jul 2023 06:17:32 +0000 (08:17 +0200)] 
.gitlab-ci.yml: enable use of Fedora cross toolchain

This adds new tests for cross-compiling to AArch64, PowerPC 64 (LE),
and s390x through the CI image based on Fedora 38.  The main advantage
of doing this is that the toolchain version is in sync with the
current Fedora native builds.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agoaccelerated: check nonce length in aead_{encrypt,decrypt}
Daiki Ueno [Thu, 20 Jul 2023 06:54:36 +0000 (08:54 +0200)] 
accelerated: check nonce length in aead_{encrypt,decrypt}

This propagates any IV length mismatch detected as an error, in the
accelerated code for x86.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agonettle: check nonce length in aead_{encrypt,decrypt}
Daiki Ueno [Thu, 20 Jul 2023 06:49:30 +0000 (08:49 +0200)] 
nettle: check nonce length in aead_{encrypt,decrypt}

This adds a missing check on the maximum IV length in aead_encrypt and
aead_decrypt, to the Nettle crypto backend.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agoMerge branch 'wip/dueno/certtool-negative-serial' into 'master'
Daiki Ueno [Thu, 13 Jul 2023 08:57:16 +0000 (08:57 +0000)] 
Merge branch 'wip/dueno/certtool-negative-serial' into 'master'

certtool: reject negative serial numbers

See merge request gnutls/gnutls!1755

2 years agotests: add negative serial number test
Elias Gustafsson [Tue, 4 Apr 2023 00:16:04 +0000 (02:16 +0200)] 
tests: add negative serial number test

Signed-off-by: Elias Gustafsson <elias.skondal@gmail.com>
2 years agocerttool: reject negative serial numbers
Elias Gustafsson [Tue, 4 Apr 2023 00:07:21 +0000 (02:07 +0200)] 
certtool: reject negative serial numbers

Signed-off-by: Elias Gustafsson <elias.skondal@gmail.com>
2 years agoMerge branch 'wip/dueno/faketime' into 'master'
Daiki Ueno [Wed, 12 Jul 2023 18:14:24 +0000 (18:14 +0000)] 
Merge branch 'wip/dueno/faketime' into 'master'

Improve time adjustment logic in tests

See merge request gnutls/gnutls!1754

2 years agotests: use template file for generating long DNS certificate request
Daiki Ueno [Mon, 10 Jul 2023 12:53:35 +0000 (14:53 +0200)] 
tests: use template file for generating long DNS certificate request

Instead of an interaction file, which causes problems on Windows when
reading a password from tty.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agotests: fix error code in ocsp-tests/ocsp-must-staple-connection.sh
Daiki Ueno [Sat, 8 Jul 2023 12:47:19 +0000 (14:47 +0200)] 
tests: fix error code in ocsp-tests/ocsp-must-staple-connection.sh

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agotests: print diff when cert-tests/crq.sh produces unexpected output
Daiki Ueno [Sat, 8 Jul 2023 12:42:33 +0000 (14:42 +0200)] 
tests: print diff when cert-tests/crq.sh produces unexpected output

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agobuild: remove unused backward compatibility macro
Daiki Ueno [Sat, 8 Jul 2023 04:36:39 +0000 (06:36 +0200)] 
build: remove unused backward compatibility macro

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agotests: remove unnecessary calls to skip_if_no_datefudge
Daiki Ueno [Fri, 7 Jul 2023 13:48:19 +0000 (15:48 +0200)] 
tests: remove unnecessary calls to skip_if_no_datefudge

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agoNEWS: mention --attime option
Daiki Ueno [Wed, 5 Jul 2023 15:00:40 +0000 (17:00 +0200)] 
NEWS: mention --attime option

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agotests: use SH_LOG_COMPILER in cert-tests
Daiki Ueno [Wed, 5 Jul 2023 15:45:54 +0000 (17:45 +0200)] 
tests: use SH_LOG_COMPILER in cert-tests

This omits the need of setting executable bits on shell script tests,
as well as makes the log file naming consistent.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agognutls-serv, gnutls-cli, gnutls-cli-debug: add --attime option
Daiki Ueno [Sat, 8 Jul 2023 04:29:17 +0000 (06:29 +0200)] 
gnutls-serv, gnutls-cli, gnutls-cli-debug: add --attime option

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agocerttool: add --attime option
Wilbur Wetterquarz [Wed, 22 Mar 2023 00:00:09 +0000 (01:00 +0100)] 
certtool: add --attime option

This adds a --attime option to certtool, so the tests don't need
faketime or datefudge to adjust system time.

Signed-off-by: Wilbur Wetterquarz <freaxmate@protonmail.com>
Modified-by: Daiki Ueno <ueno@gnu.org>
2 years agoocsptool: fix memleak spotted by ASan
Daiki Ueno [Thu, 6 Jul 2023 12:30:52 +0000 (14:30 +0200)] 
ocsptool: fix memleak spotted by ASan

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agoocsptool: add --attime option
Pravek Sharma [Mon, 13 Mar 2023 02:31:33 +0000 (22:31 -0400)] 
ocsptool: add --attime option

This adds a --attime option to ocsptool, so the tests don't need
faketime or datefudge to adjust system time.

Signed-off-by: Pravek Sharma <sharmapravek@gmail.com>
Modified-by: Daiki Ueno <ueno@gnu.org>
2 years agosystem: override gettime if time is overridden
Daiki Ueno [Wed, 5 Jul 2023 15:28:47 +0000 (17:28 +0200)] 
system: override gettime if time is overridden

If the gnutls_time is manually set by user, it would be more intuitive
to also update gnutls_gettime to use it internally.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agotests: detect faketime at configure time
Daiki Ueno [Wed, 5 Jul 2023 13:55:16 +0000 (15:55 +0200)] 
tests: detect faketime at configure time

Previously, the test suite checked the existence of faketime or
datefudge at "make check", multiple times when it is needed.  This
moves the check to configure and check it only once.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
Co-authored-by: Andreas Metzler <ametzler@bebt.de>
2 years agoMerge branch 'wip/dueno/ems-followup' into 'master'
Daiki Ueno [Mon, 10 Jul 2023 14:26:57 +0000 (14:26 +0000)] 
Merge branch 'wip/dueno/ems-followup' into 'master'

Follow-up changes to extended master secret enforcement

See merge request gnutls/gnutls!1752

2 years agopriority: add config keyword "tls-session-hash"
Daiki Ueno [Tue, 4 Jul 2023 07:47:52 +0000 (09:47 +0200)] 
priority: add config keyword "tls-session-hash"

This adds a new keyword in the configuration file, "tls-session-hash",
which shall appear in the [overrides] section and takes either
"request" or "require" as the argument.  This is particularly useful
when reverting the EMS requirement in FIPS mode for interoperability
reasons.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agotls1-prf: mark use of non-EMS PRF non-approved in FIPS
Daiki Ueno [Thu, 29 Jun 2023 08:04:51 +0000 (10:04 +0200)] 
tls1-prf: mark use of non-EMS PRF non-approved in FIPS

This adds service indicator transitions around the use of TLS 1.2 PRF.
As of May 16, 2023, the use of extended master secret is mandatory
according to FIPS 140-3 IG.  This patch detects the usage of non-EMS
KDF by checking the label: if it is "master secret", the service
indicator transitions to a non-approved state.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agoMerge branch 'tmp-ametzler-2023-manpage-copyright-year' into 'master'
Daiki Ueno [Sat, 8 Jul 2023 11:44:05 +0000 (11:44 +0000)] 
Merge branch 'tmp-ametzler-2023-manpage-copyright-year' into 'master'

Bump manpage copyright year

See merge request gnutls/gnutls!1746

2 years agoFix update-copyright-year target for switch from GNU autogen
Andreas Metzler [Sun, 4 Jun 2023 12:15:45 +0000 (14:15 +0200)] 
Fix update-copyright-year target for switch from GNU autogen

Signed-off-by: Andreas Metzler <ametzler@bebt.de>
2 years agoAutomate and fix manpage copyright year update
Andreas Metzler [Sun, 4 Jun 2023 11:53:43 +0000 (13:53 +0200)] 
Automate and fix manpage copyright year update

Handle manpage copyright year update in update-copyright-year
target, and fix the library manpage copyright year statement, $(YEAR)
expanded to an empty string

Broken by: 5a58370864e04f5dbb05b0ae453e6fa592a93175
Signed-off-by: Andreas Metzler <ametzler@bebt.de>
2 years agoBump manpage copyright year
Andreas Metzler [Sat, 3 Jun 2023 11:27:53 +0000 (13:27 +0200)] 
Bump manpage copyright year

Signed-off-by: Andreas Metzler <ametzler@bebt.de>
2 years agoMerge branch 'wip/dueno/test-ciphersuites' into 'master'
Daiki Ueno [Fri, 7 Jul 2023 18:26:17 +0000 (18:26 +0000)] 
Merge branch 'wip/dueno/test-ciphersuites' into 'master'

tests: update tests/suite/ciphersuite after a96b04ff

See merge request gnutls/gnutls!1745

2 years agotests: re-add test-ciphersuite-names.sh to TESTS
Daiki Ueno [Mon, 5 Jun 2023 14:47:36 +0000 (16:47 +0200)] 
tests: re-add test-ciphersuite-names.sh to TESTS

The test was removed from TESTS in commit
5e52b0d0fec0d9eaac30ca8f35fd7b8368064222.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agotests: update tests/suite/ciphersuite after a96b04ff
Daiki Ueno [Thu, 1 Jun 2023 14:08:24 +0000 (16:08 +0200)] 
tests: update tests/suite/ciphersuite after a96b04ff

The commit a96b04ffcf8fd7375dc3c0f90602bf679f5a9791 introduced a new
field in gnutls_cipher_suite_entry_st for gnutls_ciphersuite_get. The
scan-gnutls.sh script needs to be updated to correctly parse the
ciphersuites list.  This also fixes the include path so the test
doesn't require gnutls to be installed on the system.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agoMerge branch 'wip/dueno/ci-fedora38' into 'master'
Daiki Ueno [Fri, 7 Jul 2023 12:38:13 +0000 (12:38 +0000)] 
Merge branch 'wip/dueno/ci-fedora38' into 'master'

.gitlab-ci.yml: switch to Fedora 38 images

See merge request gnutls/gnutls!1747

2 years agotests: make testcompat-openssl-tls13-serv.sh less flaky
Daiki Ueno [Fri, 7 Jul 2023 11:18:20 +0000 (13:18 +0200)] 
tests: make testcompat-openssl-tls13-serv.sh less flaky

Bash has a special variable GROUPS[1] which clashes with our use in
testcompat-openssl-tls13-serv.sh as a list of key exchange groups.
This avoids using it as well as expands the logging message to
indicate what is tested.

1. https://www.gnu.org/software/bash/manual/html_node/Bash-Variables.html#index-GROUPS

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agolib: suppress -Wmaybe-uninitialized warning
Daiki Ueno [Fri, 7 Jul 2023 08:07:26 +0000 (10:07 +0200)] 
lib: suppress -Wmaybe-uninitialized warning

Spotted by GCC 13:

  pkcs11.c: In function 'gnutls_pkcs11_token_get_info':
  pkcs11.c:2535:25: error: 'str' may be used uninitialized [-Werror=maybe-uninitialized]
   2535 |                         memcpy(output, str, len);
        |                         ^~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agolib: suppress false-positive -Wanalyzer-out-of-bounds
Daiki Ueno [Wed, 7 Jun 2023 14:44:00 +0000 (16:44 +0200)] 
lib: suppress false-positive -Wanalyzer-out-of-bounds

GCC analyzer from GCC 13 reports this:

  verify-high.c:1471:21: error: stack-based buffer over-read [CWE-126] [-Werror=analyzer-out-of-bounds]
   1471 |                 if (gnutls_x509_trust_list_get_issuer(
        |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   1472 |                             list, cert_list[i - 1], &issuer,

This is false-positive, as i is always in a range 0 < i < cert_list_size.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agolib: suppress false-positive -Wanalyzer-deref-before-check
Daiki Ueno [Wed, 7 Jun 2023 09:54:54 +0000 (11:54 +0200)] 
lib: suppress false-positive -Wanalyzer-deref-before-check

GCC analyzer from GCC 13 reports an error when a pointer dereference
followed by a memcpy:

  x509_dn.c:54:17: error: check of '*name.data' for NULL after already dereferencing it [-Werror=analyzer-deref-before-check]
     54 |                 memcpy(_oid, name->data, name->size);
        |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This is a false-positive, because we check name->size is > 0 on a
previous line.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agosrc: suppress clang-analyzer warning
Daiki Ueno [Wed, 7 Jun 2023 09:43:32 +0000 (11:43 +0200)] 
src: suppress clang-analyzer warning

clang-analyzer from Clang 16 reports the following:

  serv.c:2069:2: warning: Null pointer passed to 1st parameter expecting 'nonnull' [core.NonNullParamChecker]
          memcpy(cache_db[i].session_data.data, data.data, data.size);
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years ago.gitlab-ci.yml: switch to Fedora 38 images
Daiki Ueno [Tue, 6 Jun 2023 07:30:50 +0000 (09:30 +0200)] 
.gitlab-ci.yml: switch to Fedora 38 images

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agoFix DTLS handshake when first fragment is 1 byte
Stephen Paul Weber [Wed, 5 Jul 2023 03:28:48 +0000 (22:28 -0500)] 
Fix DTLS handshake when first fragment is 1 byte

Asterisk sometimes generates this, and it seems like a valid case.  If
the first fragment is 1 byte then subsequent fragments will still try to
merge into it so it needs to have a big enough buffer for this to happen.

Signed-off-by: Stephen Paul Weber <singpolyma@singpolyma.net>
2 years agoMerge branch 'dev-fix' into 'master'
Daiki Ueno [Mon, 19 Jun 2023 08:42:10 +0000 (08:42 +0000)] 
Merge branch 'dev-fix' into 'master'

m4/hooks.m4: Fixed typo

See merge request gnutls/gnutls!1751

2 years agom4/hooks.m4: Fixed typo
Ajit Singh [Wed, 7 Jun 2023 16:36:57 +0000 (22:06 +0530)] 
m4/hooks.m4: Fixed typo

Signed-off-by: Ajit Singh <ajeetsinghchahar2@gmail.com>
3 years agoMerge branch 'wip/dueno/nettle-backport-cleanup' into 'master'
Daiki Ueno [Mon, 29 May 2023 07:10:49 +0000 (07:10 +0000)] 
Merge branch 'wip/dueno/nettle-backport-cleanup' into 'master'

nettle: remove files no longer used

See merge request gnutls/gnutls!1744

3 years agoMerge branch 'wip/dueno/cfb8-post' into 'master'
Daiki Ueno [Mon, 29 May 2023 06:58:49 +0000 (06:58 +0000)] 
Merge branch 'wip/dueno/cfb8-post' into 'master'

crypto-selftests: mark CFB8 block sizes tests optional

See merge request gnutls/gnutls!1743

3 years ago.gitlab-ci.yml: pull in clang16-extra-tools instead of clang15-*
Daiki Ueno [Wed, 24 May 2023 07:02:26 +0000 (09:02 +0200)] 
.gitlab-ci.yml: pull in clang16-extra-tools instead of clang15-*

Also re-indent the existing code with the newer version of clang.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
3 years agotests: use GNUTLS_SELF_TEST_FLAG_ALL macro instead of magic number
Daiki Ueno [Thu, 11 May 2023 00:57:09 +0000 (09:57 +0900)] 
tests: use GNUTLS_SELF_TEST_FLAG_ALL macro instead of magic number

Signed-off-by: Daiki Ueno <ueno@gnu.org>
3 years agocrypto-selftests: mark CFB8 block sizes tests optional
Daiki Ueno [Thu, 11 May 2023 00:52:20 +0000 (09:52 +0900)] 
crypto-selftests: mark CFB8 block sizes tests optional

It was not obvious that the second function supplied to CASE2 macro
was only called when GNUTLS_SELF_TEST_FLAG_ALL is set.  This splits
the macro into two: the one to be required and the other to be
optional.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
3 years agonettle: remove files no longer used
Daiki Ueno [Thu, 11 May 2023 13:13:25 +0000 (22:13 +0900)] 
nettle: remove files no longer used

Signed-off-by: Daiki Ueno <ueno@gnu.org>
3 years agoMerge branch 'wip/dueno/external-psk-importer' into 'master'
Daiki Ueno [Fri, 5 May 2023 21:00:12 +0000 (21:00 +0000)] 
Merge branch 'wip/dueno/external-psk-importer' into 'master'

psk: Add basic support for RFC 9258 external PSK importer interface

Closes #1355

See merge request gnutls/gnutls!1741

3 years agopsk: Add basic support for RFC 9258 external PSK importer interface
Daiki Ueno [Mon, 1 May 2023 23:41:08 +0000 (08:41 +0900)] 
psk: Add basic support for RFC 9258 external PSK importer interface

This adds a minimal, callback-based API to import external PSK,
following RFC 9258.  The client and the server importing external PSK
are supposed to set a callback to retrieve PSK, which returns flags
that may indicate the PSK is imported, along with the key:

  typedef int gnutls_psk_client_credentials_function3(
          gnutls_session_t session,
          gnutls_datum_t *username, gnutls_datum_t *key,
          gnutls_psk_key_flags *flags);

  typedef int gnutls_psk_server_credentials_function3(
          gnutls_session_t session,
          const gnutls_datum_t *username, gnutls_datum_t *key,
          gnutls_psk_key_flags *flags);

Those callbacks are responsible to call
gnutls_psk_format_imported_identity() for external PSKs to build a
serialized PSK identity, and set GNUTLS_PSK_KEY_EXT in flags if the
identity is an imported one.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
3 years agoMerge branch 'wip/dueno/clang-format' into 'master'
Daiki Ueno [Mon, 24 Apr 2023 15:14:29 +0000 (15:14 +0000)] 
Merge branch 'wip/dueno/clang-format' into 'master'

build: switch to using clang-format instead of GNU indent

See merge request gnutls/gnutls!1727

3 years agobuild: re-indent code
Daiki Ueno [Mon, 24 Apr 2023 03:39:42 +0000 (12:39 +0900)] 
build: re-indent code

Signed-off-by: Daiki Ueno <ueno@gnu.org>