]> git.ipfire.org Git - thirdparty/gnutls.git/log
thirdparty/gnutls.git
2 years agonettle: plumb RSA-OAEP in the Nettle crypto backend
Daiki Ueno [Thu, 8 Feb 2024 09:38:44 +0000 (18:38 +0900)] 
nettle: plumb RSA-OAEP in the Nettle crypto backend

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agospki: support RSA-OAEP parameters
Daiki Ueno [Thu, 8 Feb 2024 06:32:37 +0000 (15:32 +0900)] 
spki: support RSA-OAEP parameters

This adds a new API gnutls_x509_spki_{get,set}_rsa_oaep_params to
retrieve and store RSA-OAEP parameters embedded in
SubjectPublicKeyInfo.

As RSA-OAEP labels are allocated, this also adds copy and clear method
on the gnutls_x509_spki_st struct and use them extensively instead of
memcpy and memset.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agoalgorithms: register RSA-OAEP
Daiki Ueno [Thu, 8 Feb 2024 08:07:39 +0000 (17:07 +0900)] 
algorithms: register RSA-OAEP

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agonettle: vendor-in RSA-OAEP implementation
Daiki Ueno [Thu, 8 Feb 2024 11:38:33 +0000 (20:38 +0900)] 
nettle: vendor-in RSA-OAEP implementation

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agoMerge branch 'wip/dueno/utsname-followup' into 'master'
Zoltán Fridrich [Tue, 23 Jan 2024 13:05:36 +0000 (13:05 +0000)] 
Merge branch 'wip/dueno/utsname-followup' into 'master'

ktls: fix kernel version checking using utsname

See merge request gnutls/gnutls!1801

2 years agoktls: fix kernel version checking using utsname
Daiki Ueno [Tue, 23 Jan 2024 02:54:32 +0000 (11:54 +0900)] 
ktls: fix kernel version checking using utsname

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agoMerge branch 'zfridric_devel' into 'master'
Zoltán Fridrich [Mon, 22 Jan 2024 12:12:06 +0000 (12:12 +0000)] 
Merge branch 'zfridric_devel' into 'master'

Make compression libraries dynamically loadable

Closes #1424

See merge request gnutls/gnutls!1800

2 years agoMake compression libraries dynamically loadable
Zoltan Fridrich [Fri, 19 Jan 2024 13:22:35 +0000 (14:22 +0100)] 
Make compression libraries dynamically loadable

Signed-off-by: Zoltan Fridrich <zfridric@redhat.com>
2 years agoMerge branch 'wip/dueno/release-3.8.3' into 'master' 3.8.3
Daiki Ueno [Tue, 16 Jan 2024 09:10:08 +0000 (09:10 +0000)] 
Merge branch 'wip/dueno/release-3.8.3' into 'master'

Release 3.8.3

See merge request gnutls/gnutls!1799

2 years agoRelease 3.8.3
Daiki Ueno [Tue, 16 Jan 2024 05:51:36 +0000 (14:51 +0900)] 
Release 3.8.3

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agorsa-psk: minimize branching after decryption
Daiki Ueno [Wed, 10 Jan 2024 10:13:17 +0000 (19:13 +0900)] 
rsa-psk: minimize branching after decryption

This moves any non-trivial code between gnutls_privkey_decrypt_data2
and the function return in _gnutls_proc_rsa_psk_client_kx up until the
decryption.  This also avoids an extra memcpy to session->key.key.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agox509: detect loop in certificate chain
Daiki Ueno [Thu, 11 Jan 2024 06:45:11 +0000 (15:45 +0900)] 
x509: detect loop in certificate chain

There can be a loop in a certificate chain, when multiple CA
certificates are cross-signed with each other, such as A → B, B → C,
and C → A.  Previously, the verification logic was not capable of
handling this scenario while sorting the certificates in the chain in
_gnutls_sort_clist, resulting in an assertion failure.  This patch
properly detects such loop and aborts further processing in a graceful
manner.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agoMerge branch 'cllang-fips-zeroization' into 'master'
Daiki Ueno [Mon, 15 Jan 2024 11:08:08 +0000 (11:08 +0000)] 
Merge branch 'cllang-fips-zeroization' into 'master'

fips: Zeroize temporary values

See merge request gnutls/gnutls!1797

2 years agofips: Zeroize temporary values
Clemens Lang [Fri, 12 Jan 2024 10:12:14 +0000 (11:12 +0100)] 
fips: Zeroize temporary values

The standard says "temporary value(s) generated during the integrity
test of the module's software […] shall be zeroised from the module upon
completion of the integrity test".

That includes the computed HMAC value, which is currently not zeroized
after the test. Add explicit calls to gnutls_memset() to fix that.

Signed-off-by: Clemens Lang <cllang@redhat.com>
2 years agoMerge branch 'wip/dueno/ci-fixes3' into 'master'
Daiki Ueno [Mon, 15 Jan 2024 04:42:10 +0000 (04:42 +0000)] 
Merge branch 'wip/dueno/ci-fixes3' into 'master'

Assorted CI fixes

See merge request gnutls/gnutls!1798

2 years ago.gitlab-ci.yml: bump cache version
Daiki Ueno [Mon, 15 Jan 2024 01:42:26 +0000 (10:42 +0900)] 
.gitlab-ci.yml: bump cache version

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years ago.gitlab-ci.yml: Adjust to Alpine Linux' clang-format path change
Clemens Lang [Fri, 12 Jan 2024 10:32:22 +0000 (11:32 +0100)] 
.gitlab-ci.yml: Adjust to Alpine Linux' clang-format path change

According to Alpine Linux' package database search functionality, the
clang16-extra-tools package now installs clang-format in
/usr/lib/llvm16/bin/clang-format.

/usr/bin/clang-format is provided by clang17-extra-tools instead, but
requires changes in formatting. Add /usr/lib/llvm16/bin to PATH for the
formatting script to continue using the previous version.

Signed-off-by: Clemens Lang <cllang@redhat.com>
2 years agotests: suppress leaks in libsofthsm2
Daiki Ueno [Sun, 14 Jan 2024 07:53:15 +0000 (16:53 +0900)] 
tests: suppress leaks in libsofthsm2

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agotests/pkcs11-tool.sh: skip if neither p11tool nor certool is built
Daiki Ueno [Mon, 1 Jan 2024 05:26:08 +0000 (14:26 +0900)] 
tests/pkcs11-tool.sh: skip if neither p11tool nor certool is built

When compiled with --disable-tools, we can't assume p11tool and
certool are available.  This also switches to using create_testdir and
locate any intermediate files under a temporary directory which is
cleaned up at exit.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agoUpdate year of copyright notices in doc/gnutls.texi
Daiki Ueno [Mon, 1 Jan 2024 03:51:16 +0000 (12:51 +0900)] 
Update year of copyright notices in doc/gnutls.texi

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agoMerge branch 'wip/dueno/ktls-utsname' into 'master'
Daiki Ueno [Tue, 12 Dec 2023 15:33:16 +0000 (15:33 +0000)] 
Merge branch 'wip/dueno/ktls-utsname' into 'master'

ktls: check Linux kernel version at run time

See merge request gnutls/gnutls!1793

2 years agoMerge branch 'wip/dueno/cli-aia-fixes' into 'master'
Daiki Ueno [Tue, 12 Dec 2023 14:29:11 +0000 (14:29 +0000)] 
Merge branch 'wip/dueno/cli-aia-fixes' into 'master'

cli: fix --ca-auto-retrieve crash when no caIssuer is present in AIA

See merge request gnutls/gnutls!1792

2 years agoMerge branch 'eddsa-fix' into 'master'
Daiki Ueno [Fri, 1 Dec 2023 22:07:36 +0000 (22:07 +0000)] 
Merge branch 'eddsa-fix' into 'master'

pkcs11: Unbreak importing EdDSA keys with curve name in parameters

Closes #1515

See merge request gnutls/gnutls!1795

2 years agotests: Reproducer for regression in parent (requires opensc installed)
Jakub Jelen [Fri, 1 Dec 2023 17:16:05 +0000 (18:16 +0100)] 
tests: Reproducer for regression in parent (requires opensc installed)

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
2 years agopkcs11: Unbreak importing EdDSA keys with curve name in parameters
Jakub Jelen [Thu, 30 Nov 2023 10:30:30 +0000 (11:30 +0100)] 
pkcs11: Unbreak importing EdDSA keys with curve name in parameters

Fixes: #1515
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
2 years agoMerge branch 'markharfouche-master-patch-88279' into 'master'
Daiki Ueno [Tue, 28 Nov 2023 13:37:59 +0000 (13:37 +0000)] 
Merge branch 'markharfouche-master-patch-88279' into 'master'

specify osstatus_error takes in an OSStatus as its first argument

See merge request gnutls/gnutls!1794

2 years agospecify osstatus_error takes in an OSStatus as its first argument
Mark Harfouche [Mon, 27 Nov 2023 12:20:23 +0000 (12:20 +0000)] 
specify osstatus_error takes in an OSStatus as its first argument

Signed-off-by: Mark Harfouche <mark.harfouche@gmail.com>
2 years agoMerge branch 'zfridric_devel' into 'master' 3.8.2
Zoltán Fridrich [Wed, 15 Nov 2023 08:24:45 +0000 (08:24 +0000)] 
Merge branch 'zfridric_devel' into 'master'

Release 3.8.2

Closes #1511

See merge request gnutls/gnutls!1787

2 years agoRelease 3.8.2
Zoltan Fridrich [Fri, 20 Oct 2023 11:43:46 +0000 (13:43 +0200)] 
Release 3.8.2

Signed-off-by: Zoltan Fridrich <zfridric@redhat.com>
2 years agoauth/rsa_psk: side-step potential side-channel
Daiki Ueno [Mon, 23 Oct 2023 00:26:57 +0000 (09:26 +0900)] 
auth/rsa_psk: side-step potential side-channel

This removes branching that depends on secret data, porting changes
for regular RSA key exchange from
4804febddc2ed958e5ae774de2a8f85edeeff538 and
80a6ce8ddb02477cd724cd5b2944791aaddb702a.  This also removes the
allow_wrong_pms as it was used sorely to control debug output
depending on the branching.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agotests: ktls.sh: skip if kernel version is older than 5.11
Daiki Ueno [Fri, 10 Nov 2023 06:54:01 +0000 (15:54 +0900)] 
tests: ktls.sh: skip if kernel version is older than 5.11

The test assumes that CHACHA20-POLY1305 ciphersuites are available,
though they were added in 5.11.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agoktls: check Linux kernel version at run time
Daiki Ueno [Fri, 10 Nov 2023 06:49:53 +0000 (15:49 +0900)] 
ktls: check Linux kernel version at run time

When a GnuTLS application runs in a container guest and the host
kernel is older than expected, it fails at initializing KTLS.  This
adds a check at run time, using uname.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agox509: clarify the calling convention of AIA callbacks
Daiki Ueno [Thu, 9 Nov 2023 08:17:36 +0000 (17:17 +0900)] 
x509: clarify the calling convention of AIA callbacks

This updates the documentation of
gnutls_x509_trust_list_set_getissuer_function to explicitly mention
that the callback shall initialize the output arguments upon
successful call, even if the result is empty.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agocli: fix --ca-auto-retrieve crash when no caIssuer is present in AIA
Daiki Ueno [Thu, 9 Nov 2023 04:33:13 +0000 (13:33 +0900)] 
cli: fix --ca-auto-retrieve crash when no caIssuer is present in AIA

Previously, when caIssuer URI is not present in the certificate's AIA
extension, the callback successfully returned 0, but didn't initialize
the output arguments, resulting in a segmentation fault in the caller.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agoMerge branch 'fix123' into 'master'
Daiki Ueno [Mon, 6 Nov 2023 13:49:35 +0000 (13:49 +0000)] 
Merge branch 'fix123' into 'master'

handshake.c: Fixed a missing goto statement

See merge request gnutls/gnutls!1791

2 years agoMerge branch 'fix_errno' into 'master'
Daiki Ueno [Mon, 6 Nov 2023 13:49:21 +0000 (13:49 +0000)] 
Merge branch 'fix_errno' into 'master'

lib: Use correct transport getting error number

See merge request gnutls/gnutls!1790

2 years agohandshake.c: Fixed a missing goto statement
Ajit Singh [Mon, 6 Nov 2023 10:15:10 +0000 (15:45 +0530)] 
handshake.c: Fixed a missing goto statement

Signed-off-by: Ajit Singh <ajeetsinghchahar2@gmail.com>
2 years agolib: Use correct transport getting error number
Frediano Ziglio [Sun, 5 Nov 2023 17:47:44 +0000 (17:47 +0000)] 
lib: Use correct transport getting error number

For write we need to use transport_send_ptr, not transport_recv_ptr.

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
2 years agoMerge branch 'lgtm' into 'master'
Daiki Ueno [Thu, 26 Oct 2023 00:05:19 +0000 (00:05 +0000)] 
Merge branch 'lgtm' into 'master'

.lgtm.yml: remove LGTM.com configuration file

See merge request gnutls/gnutls!1788

2 years ago.lgtm.yml: remove LGTM.com configuration file
Dimitri Papadopoulos [Wed, 25 Oct 2023 22:17:33 +0000 (00:17 +0200)] 
.lgtm.yml: remove LGTM.com configuration file

LGTM.com has been deprecated and replaced by GitHub code analysis:
https://github.blog/2022-08-15-the-next-step-for-lgtm-com-github-code-scanning/

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
2 years agoMerge branch 'wip/dueno/srptool-fixes' into 'master'
Daiki Ueno [Thu, 19 Oct 2023 11:57:10 +0000 (11:57 +0000)] 
Merge branch 'wip/dueno/srptool-fixes' into 'master'

srptool: rework entry parsing without indexing

See merge request gnutls/gnutls!1782

2 years agoMerge branch 'wip/dueno/release-3.8.2' into 'master'
Zoltán Fridrich [Thu, 19 Oct 2023 11:12:34 +0000 (11:12 +0000)] 
Merge branch 'wip/dueno/release-3.8.2' into 'master'

NEWS: mention KTLS support in FreeBSD [ci skip]

See merge request gnutls/gnutls!1785

2 years agoNEWS: mention KTLS support in FreeBSD [ci skip]
Daiki Ueno [Tue, 17 Oct 2023 23:21:05 +0000 (08:21 +0900)] 
NEWS: mention KTLS support in FreeBSD [ci skip]

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agoMerge branch 'cal-doc-typo' into 'master'
Daiki Ueno [Wed, 18 Oct 2023 20:51:14 +0000 (20:51 +0000)] 
Merge branch 'cal-doc-typo' into 'master'

CONTRIBUTING.md: Fix file name in reviewer checklist

See merge request gnutls/gnutls!1784

2 years agoCONTRIBUTING.md: Fix file name in reviewer checklist
Clemens Lang [Wed, 18 Oct 2023 08:50:08 +0000 (10:50 +0200)] 
CONTRIBUTING.md: Fix file name in reviewer checklist

The coding guidelines are in CONTRIBUTING.md, not CONTRIBUTION.md (which
does not exist).

Signed-off-by: Clemens Lang <cllang@redhat.com>
2 years agosrptool: rework entry parsing without indexing
xuraoqing [Wed, 23 Aug 2023 03:56:03 +0000 (11:56 +0800)] 
srptool: rework entry parsing without indexing

This simplifies the loop matching and parsing an SRP entry,
considering the buffer read with fgets is always NUL-terminated.

Signed-off-by: xuraoqing <xuraoqing@huawei.com>
Modified-by: Daiki Ueno <ueno@gnu.org>
2 years agoMerge branch 'wip/dueno/starttls-name' into 'master'
Daiki Ueno [Wed, 18 Oct 2023 09:35:08 +0000 (09:35 +0000)] 
Merge branch 'wip/dueno/starttls-name' into 'master'

cli: add --starttls-name option

Closes #1507

See merge request gnutls/gnutls!1781

2 years agoMerge branch 'fix-dtls-handshake-1-byte-first-fragment' into 'master'
Daiki Ueno [Wed, 18 Oct 2023 01:56:03 +0000 (01:56 +0000)] 
Merge branch 'fix-dtls-handshake-1-byte-first-fragment' into 'master'

Fix DTLS handshake when first fragment is 1 byte

See merge request gnutls/gnutls!1753

2 years ago.gitlab-ci.yml: disable p11-kit for MinGW builds
Daiki Ueno [Tue, 17 Oct 2023 20:24:33 +0000 (05:24 +0900)] 
.gitlab-ci.yml: disable p11-kit for MinGW builds

Currently, tests are failing with page fault in MinGW64 builds if
p11-kit is enabled.  This temporarily disables it.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agocli: add --starttls-name option
Daiki Ueno [Fri, 13 Oct 2023 08:36:57 +0000 (17:36 +0900)] 
cli: add --starttls-name option

Some deployment of application protocols, such as XMPP, require a
different hostname than the host being connected.  This adds a new
option, --starttls-name, to gnutls-cli to specify it separately.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agoMerge branch 'wip/dueno/check-headers' into 'master'
Daiki Ueno [Tue, 10 Oct 2023 22:35:00 +0000 (22:35 +0000)] 
Merge branch 'wip/dueno/check-headers' into 'master'

devel: add script to fix header inclusion

Closes #459

See merge request gnutls/gnutls!1780

2 years ago.gitlab-ci.yml: hook devel/check-headers.sh in .pre target
Daiki Ueno [Sat, 7 Oct 2023 08:25:45 +0000 (17:25 +0900)] 
.gitlab-ci.yml: hook devel/check-headers.sh in .pre target

This adds devel/check-headers.sh in the .pre target phase so any
inconsistent header inclusion would be detected early in the CI.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agodevel: make local header inclusion consistent
Daiki Ueno [Sat, 7 Oct 2023 08:24:02 +0000 (17:24 +0900)] 
devel: make local header inclusion consistent

This is the result of running devel/check-headers.sh --format on all
.c and .h files under lib.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agodevel: add script to fix header inclusion
Daiki Ueno [Sat, 7 Oct 2023 08:17:39 +0000 (17:17 +0900)] 
devel: add script to fix header inclusion

This adds check-headers.sh script which scans .c files and checks that
local header files under lib/ are consistently included with #include
"foo.h" instead of #include <foo.h>.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agoMerge branch 'wip/dueno/pkcs11-ed448' into 'master'
Daiki Ueno [Thu, 5 Oct 2023 22:13:36 +0000 (22:13 +0000)] 
Merge branch 'wip/dueno/pkcs11-ed448' into 'master'

pkcs11: support Ed448 keys

Closes #1502

See merge request gnutls/gnutls!1779

2 years agoMerge branch 'ktls-freebsd'
Daiki Ueno [Wed, 4 Oct 2023 09:26:14 +0000 (09:26 +0000)] 
Merge branch 'ktls-freebsd'

See merge request gnutls/gnutls!1768

2 years agoktls: add support for FreeBSD
Yongye Zhu [Wed, 4 Oct 2023 09:26:14 +0000 (09:26 +0000)] 
ktls: add support for FreeBSD

This extend the KTLS support to FreeBSD, with the AES-GCM-128, AES-GCM-256, and ChaCha20-Poly1305 ciphersuites.

Signed-off-by: Yongye Zhu <zyy1102000@gmail.com>
Reviewed-by: Frantisek Krenzelok <krenzelok.frantisek@gmail.com>
2 years agopkcs11: support Ed448 keys
Daiki Ueno [Thu, 28 Sep 2023 02:38:36 +0000 (11:38 +0900)] 
pkcs11: support Ed448 keys

This adds support for Ed448 keys backed by PKCS#11.  To differentiate
Ed448 keys from Ed25519 keys, this requires an extra logic to check
CKA_EC_PARAMS when reading public keys.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agotests: refactor pkcs11-privkey-generate
Daiki Ueno [Thu, 28 Sep 2023 02:37:15 +0000 (11:37 +0900)] 
tests: refactor pkcs11-privkey-generate

This factors out key generation logic into a separate function so we
can easily extend the test to cover more key types.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
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>