]> git.ipfire.org Git - thirdparty/gnutls.git/log
thirdparty/gnutls.git
2 years agoMerge branch 'wip/dueno/sast' into 'master' ech
Daiki Ueno [Mon, 20 May 2024 01:14:03 +0000 (01:14 +0000)] 
Merge branch 'wip/dueno/sast' into 'master'

build: suppress static analyzer warnings

See merge request gnutls/gnutls!1837

2 years agoshuffle_exts: avoid theoretical wrap around of unsigned integer
Daiki Ueno [Fri, 17 May 2024 01:34:46 +0000 (10:34 +0900)] 
shuffle_exts: avoid theoretical wrap around of unsigned integer

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agoload_dir_certs: avoid memleak
Daiki Ueno [Tue, 30 Apr 2024 13:28:29 +0000 (22:28 +0900)] 
load_dir_certs: avoid memleak

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agoMerge branch 'wip/dueno/nettle-aes-cbc' into 'master'
Daiki Ueno [Wed, 15 May 2024 09:59:53 +0000 (09:59 +0000)] 
Merge branch 'wip/dueno/nettle-aes-cbc' into 'master'

nettle: utilize nettle_cbc_aes*_encrypt for performance

See merge request gnutls/gnutls!1836

2 years agonettle: utilize nettle_cbc_aes*_encrypt for performance
Daiki Ueno [Wed, 15 May 2024 01:17:41 +0000 (10:17 +0900)] 
nettle: utilize nettle_cbc_aes*_encrypt for performance

While CBC encryption is inherently slow for lack of parallelisim,
Nettle >= 3.8 provides specialized AES-CBC encryption functions to
improve performance by avoiding multiple calls to block cipher
initialization. This patch makes GnuTLS use those functions if
available.

Here are the results of benchmark:

* GNUTLS_CPUID_OVERRIDE=0x1, without nettle_cbc_aes*_encrypt:

  Checking cipher-MAC combinations, payload size: 16384
          AES-128-CBC-SHA1 0.90 GB/sec
          AES-128-CBC-SHA256 0.88 GB/sec

  Checking ciphers, payload size: 16384
               AES-128-CBC 1.56 GB/sec

* GNUTLS_CPUID_OVERRIDE=0x1, with nettle_cbc_aes*_encrypt:

  Checking cipher-MAC combinations, payload size: 16384
          AES-128-CBC-SHA1 1.08 GB/sec
          AES-128-CBC-SHA256 1.05 GB/sec

  Checking ciphers, payload size: 16384
               AES-128-CBC 2.16 GB/sec

* GNUTLS_CPUID_OVERRIDE unset:

  Checking cipher-MAC combinations, payload size: 16384
          AES-128-CBC-SHA1 1.13 GB/sec
          AES-128-CBC-SHA256 1.05 GB/sec

  Checking ciphers, payload size: 16384
               AES-128-CBC 2.24 GB/sec

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agoMerge branch 'wip/dueno/pkcs12-pbmac1' into 'master'
Daiki Ueno [Tue, 14 May 2024 15:01:27 +0000 (15:01 +0000)] 
Merge branch 'wip/dueno/pkcs12-pbmac1' into 'master'

Support PBMAC1 usage in PKCS#12

See merge request gnutls/gnutls!1833

2 years agoSupport PBMAC1 usage in PKCS#12
Daiki Ueno [Tue, 30 Apr 2024 01:17:37 +0000 (10:17 +0900)] 
Support PBMAC1 usage in PKCS#12

This allows usage of PBMAC1 as the MAC to verify a PKCS#12 structure,
following draft-ietf-lamps-pkcs12-pbmac1[1]. While the MAC
verification is transparent, the generation requires a new API
gnutls_pkcs12_generate_mac3 to be used with the
GNUTLS_PKCS12_USE_PBMAC1 flag.

certtool has also been extended with the --pbmac1 option, which can be
used in combination with --to-p12.

1. https://datatracker.ietf.org/doc/draft-ietf-lamps-pkcs12-pbmac1/

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agognutls_pkcs12_generate_mac2: factor out mac generation logic
Daiki Ueno [Tue, 14 May 2024 03:40:38 +0000 (12:40 +0900)] 
gnutls_pkcs12_generate_mac2: factor out mac generation logic

This would allow us to easily implement PBMAC1 usage in PKCS#12.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agopkcs7-crypt: output keyLength in PBKDF2 only if it is greater than 0
Daiki Ueno [Tue, 14 May 2024 02:09:21 +0000 (11:09 +0900)] 
pkcs7-crypt: output keyLength in PBKDF2 only if it is greater than 0

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agopkcs7-crypt: use _gnutls_x509_write_uint32 as possible
Daiki Ueno [Tue, 14 May 2024 01:48:43 +0000 (10:48 +0900)] 
pkcs7-crypt: use _gnutls_x509_write_uint32 as possible

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years ago_gnutls_x509_read_uint: accept values greater than 0x7FFFFFFF
Daiki Ueno [Tue, 14 May 2024 01:24:03 +0000 (10:24 +0900)] 
_gnutls_x509_read_uint: accept values greater than 0x7FFFFFFF

_gnutls_x509_read_uint previously only accepted integer values encoded
in 4 bytes without checking if the first byte indicates a negative
integer in 2's complement format.  This adds the check and also avoid
unnecessary memory allocation.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agoMerge branch 'wip/dueno/ci-gitlab-tag-change' into 'master'
Daiki Ueno [Fri, 10 May 2024 10:19:02 +0000 (10:19 +0000)] 
Merge branch 'wip/dueno/ci-gitlab-tag-change' into 'master'

.gitlab-ci.yml: use correct tag for GitLab 1.70 deployment

See merge request gnutls/gnutls!1835

2 years ago.gitlab-ci.yml: run fedora-threadsan/build without ASLR
Daiki Ueno [Fri, 10 May 2024 05:57:32 +0000 (14:57 +0900)] 
.gitlab-ci.yml: run fedora-threadsan/build without ASLR

ThreadSanitizer doesn't cope well with newer kernel (>= 6.6.x) when
ASLR is enabled:
https://github.com/google/sanitizers/issues/1716

This disables ASLR locally around the fedora-threadsan tasks.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years ago.gitlab-ci.yml: Bump cache version
Daiki Ueno [Fri, 10 May 2024 00:05:01 +0000 (09:05 +0900)] 
.gitlab-ci.yml: Bump cache version

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years ago.gitlab-ci.yml: use correct tag for GitLab 1.70 deployment
Daiki Ueno [Thu, 9 May 2024 14:29:30 +0000 (23:29 +0900)] 
.gitlab-ci.yml: use correct tag for GitLab 1.70 deployment

The "shared", "linux", and "docker" tags we use to select shared CI
runners are consolidated into "saas-linux-small-amd64" in GitLab 1.70:
https://docs.gitlab.com/ee/update/deprecations.html#removal-of-tags-from-small-saas-runners-on-linux

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agoMerge branch 'wip/dueno/error-asn1' into 'master'
Daiki Ueno [Thu, 9 May 2024 13:53:34 +0000 (13:53 +0000)] 
Merge branch 'wip/dueno/error-asn1' into 'master'

build: fix confusions between libtasn1 and GnuTLS error codes

See merge request gnutls/gnutls!1834

2 years agobuild: fix confusions between libtasn1 and GnuTLS error codes
Daiki Ueno [Sun, 5 May 2024 22:46:29 +0000 (07:46 +0900)] 
build: fix confusions between libtasn1 and GnuTLS error codes

libtasn1 error codes returned from asn1_{read,write}_value are always
positive. Check against ASN1_SUCCESS instead.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agoMerge branch 'dg0yt-master-patch-98306' into 'master'
Daiki Ueno [Fri, 3 May 2024 10:28:06 +0000 (10:28 +0000)] 
Merge branch 'dg0yt-master-patch-98306' into 'master'

Fix configuration with multi-word GMP_LIBS.

See merge request gnutls/gnutls!1832

2 years agoFix configuration with multi-word GMP_LIBS.
Kai Pastor [Wed, 24 Apr 2024 05:36:22 +0000 (07:36 +0200)] 
Fix configuration with multi-word GMP_LIBS.

Signed-off-by: Kai Pastor <dg0yt@darc.de>
2 years agoMerge branch 'zfridric_devel2' into 'master'
Zoltán Fridrich [Fri, 12 Apr 2024 07:23:44 +0000 (07:23 +0000)] 
Merge branch 'zfridric_devel2' into 'master'

Fix RSAES-PKCS1-v1_5 system-wide configuration

Closes #1540

See merge request gnutls/gnutls!1830

2 years agoPrevent GCOVR from returning NegativeHits exception
Zoltan Fridrich [Thu, 11 Apr 2024 15:53:06 +0000 (17:53 +0200)] 
Prevent GCOVR from returning NegativeHits exception

see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68080

Signed-off-by: Zoltan Fridrich <zfridric@redhat.com>
2 years agoFix RSAES-PKCS1-v1_5 system-wide configuration
Zoltan Fridrich [Wed, 10 Apr 2024 10:51:33 +0000 (12:51 +0200)] 
Fix RSAES-PKCS1-v1_5 system-wide configuration

Signed-off-by: Zoltan Fridrich <zfridric@redhat.com>
2 years agoMerge branch 'zfridric_devel2' into 'master' 3.8.5
Zoltán Fridrich [Thu, 4 Apr 2024 09:14:35 +0000 (09:14 +0000)] 
Merge branch 'zfridric_devel2' into 'master'

Release 3.8.5

See merge request gnutls/gnutls!1829

2 years agoRelease 3.8.5
Zoltan Fridrich [Wed, 3 Apr 2024 11:03:21 +0000 (13:03 +0200)] 
Release 3.8.5

Signed-off-by: Zoltan Fridrich <zfridric@redhat.com>
2 years agoMerge branch 'zfridric_devel2' into 'master'
Zoltán Fridrich [Tue, 2 Apr 2024 13:28:16 +0000 (13:28 +0000)] 
Merge branch 'zfridric_devel2' into 'master'

Disable RSAES-PKCS1-v1.5 by default

See merge request gnutls/gnutls!1828

2 years agoAdd option to disable RSAES-PKCS1-v1_5
Zoltan Fridrich [Tue, 26 Mar 2024 10:48:58 +0000 (11:48 +0100)] 
Add option to disable RSAES-PKCS1-v1_5

A new option `allow-rsa-pkcs1-encrypt` has been added into the
system-wide library configuration which allows to enable/disable
the RSAES-PKCS1-v1_5. Currently, the RSAES-PKCS1-v1_5 is enabled
by default.

Signed-off-by: Zoltan Fridrich <zfridric@redhat.com>
2 years agoMerge branch 'rsa_compute_root_tr' into 'master'
Daiki Ueno [Wed, 27 Mar 2024 16:13:57 +0000 (16:13 +0000)] 
Merge branch 'rsa_compute_root_tr' into 'master'

Mangle/hide GNUTLS-built nettle_rsa_compute_root_tr()

See merge request gnutls/gnutls!1826

2 years agoMangle/hide GNUTLS-built nettle_rsa_compute_root_tr()
Alyssa Ross [Mon, 25 Mar 2024 10:17:29 +0000 (10:17 +0000)] 
Mangle/hide GNUTLS-built nettle_rsa_compute_root_tr()

Since bfb326f6e ("nettle: plumb RSA-OAEP in the Nettle crypto backend"),
building gnutls statically fails due to a duplicate definition of
nettle_rsa_compute_root_tr (which comes from "rsa_compute_root_tr" being
replaced by a preprocessor macro).

This patch fixes this by renaming the GNUTLS version by redefining the
value of the rsa_compute_root_tr macro.

Signed-off-by: Alyssa Ross <hi@alyssa.is>
2 years agoMerge branch 'wip/dueno/deterministic-ecdsa-followup' into 'master'
Daiki Ueno [Tue, 26 Mar 2024 15:30:20 +0000 (15:30 +0000)] 
Merge branch 'wip/dueno/deterministic-ecdsa-followup' into 'master'

nettle: avoid potential memleak with GMP older than 6.2.0

See merge request gnutls/gnutls!1827

2 years agoMerge branch 'wip/dueno/legacy-algorithms' into 'master'
Daiki Ueno [Tue, 26 Mar 2024 15:18:04 +0000 (15:18 +0000)] 
Merge branch 'wip/dueno/legacy-algorithms' into 'master'

Enable RIPEMD160 and PBES1-DES-SHA1 for compatibility

See merge request gnutls/gnutls!1824

2 years agox509: support PBES1-DES-SHA1
Daiki Ueno [Fri, 22 Mar 2024 03:47:00 +0000 (12:47 +0900)] 
x509: support PBES1-DES-SHA1

PBES1 with single DES backed by SHA-1 hash is used to parse legacy
PKCS#8 file in GCR.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agonettle: avoid potential memleak with GMP older than 6.2.0
Daiki Ueno [Tue, 26 Mar 2024 11:18:08 +0000 (20:18 +0900)] 
nettle: avoid potential memleak with GMP older than 6.2.0

As GMP 6.1.0 or ealier eagerly allocates memory at mpz_init_set_str,
if the operand is already initialized, it will cause a small leak.

See also: https://gmplib.org/repo/gmp/rev/f049e75390fc

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agoMerge branch 'wip/dueno/rsa-oaep-followup2' into 'master'
Daiki Ueno [Tue, 26 Mar 2024 11:10:15 +0000 (11:10 +0000)] 
Merge branch 'wip/dueno/rsa-oaep-followup2' into 'master'

gnutls_privkey_decrypt_data: don't free plaintext on failure

Closes #1535

See merge request gnutls/gnutls!1825

2 years agognutls_privkey_decrypt_data: don't free plaintext on failure
Daiki Ueno [Sun, 24 Mar 2024 21:45:39 +0000 (06:45 +0900)] 
gnutls_privkey_decrypt_data: don't free plaintext on failure

As _wrap_nettle_pk_decrypt uses a locally allocated buffer for the
plaintext, it doesn't need to free the plaintext given by the caller.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agonettle: plumb RIPEMD160
Daiki Ueno [Fri, 22 Mar 2024 01:48:02 +0000 (10:48 +0900)] 
nettle: plumb RIPEMD160

RIPEMD160 is still used by GnuTLS to calculate fingerprint for an
OpenPGP key when displaying it:

- https://git.gnupg.org/cgi-bin/gitweb.cgi?p=gnupg.git;a=blob;f=g10/keyid.c;h=7e4c50b59de8c25756c5ce890deecab233f19b53;hb=refs/heads/master#l800
- https://gitlab.gnome.org/GNOME/gcr/-/blob/f3c95db45099dff288986aa367007da1e855a3d0/gcr/gcr-openpgp.c#L268

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agoMerge branch 'zfridric_devel2' into 'master' 3.8.4
Zoltán Fridrich [Tue, 19 Mar 2024 12:20:02 +0000 (12:20 +0000)] 
Merge branch 'zfridric_devel2' into 'master'

Release 3.8.4

Closes #1516, #1525, and #1527

See merge request gnutls/gnutls!1823

2 years agoRelease 3.8.4
Zoltan Fridrich [Mon, 18 Mar 2024 11:48:32 +0000 (12:48 +0100)] 
Release 3.8.4

Signed-off-by: Zoltan Fridrich <zfridric@redhat.com>
2 years agoMerge branch 'interop-version' into 'master'
Stanislav Židek [Tue, 19 Mar 2024 09:00:54 +0000 (09:00 +0000)] 
Merge branch 'interop-version' into 'master'

TLS interoperability: test actual compiled master

See merge request gnutls/gnutls!1802

2 years agonettle: avoid normalization of mpz_t in deterministic ECDSA
Daiki Ueno [Fri, 12 Jan 2024 08:56:58 +0000 (17:56 +0900)] 
nettle: avoid normalization of mpz_t in deterministic ECDSA

This removes function calls that potentially leak bit-length of a
private key used to calculate a nonce in deterministic ECDSA.  Namely:

- _gnutls_dsa_compute_k has been rewritten to work on always
  zero-padded mp_limb_t arrays instead of mpz_t
- rnd_mpz_func has been replaced with rnd_datum_func, which is backed
  by a byte array instead of an mpz_t value

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agognutls_x509_trust_list_verify_crt2: remove length limit of input
Daiki Ueno [Mon, 29 Jan 2024 04:52:46 +0000 (13:52 +0900)] 
gnutls_x509_trust_list_verify_crt2: remove length limit of input

Previously, if cert_list_size exceeded DEFAULT_MAX_VERIFY_DEPTH, the
chain verification logic crashed with assertion failure.  This patch
removes the restriction while keeping the maximum number of
retrieved certificates being DEFAULT_MAX_VERIFY_DEPTH.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agoMerge branch 'codespell' into 'master'
Daiki Ueno [Sat, 16 Mar 2024 22:53:19 +0000 (22:53 +0000)] 
Merge branch 'codespell' into 'master'

Fix a few typos found by codespell

See merge request gnutls/gnutls!1821

2 years agoFix a few typos found by codespell
Dimitri Papadopoulos [Sat, 16 Mar 2024 12:48:01 +0000 (13:48 +0100)] 
Fix a few typos found by codespell

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
2 years agoTLS interoperability: updated tests
Stanislav Zidek [Thu, 14 Mar 2024 11:57:25 +0000 (12:57 +0100)] 
TLS interoperability: updated tests

Signed-off-by: Stanislav Zidek <szidek@redhat.com>
2 years agoTLS interoperability: test actual compiled master
Stanislav Zidek [Wed, 6 Mar 2024 13:06:05 +0000 (14:06 +0100)] 
TLS interoperability: test actual compiled master

Previously, system (fedora) version of GnuTLS was used in TLS
interoperability tests.

fedora-ktls/build was repurposed for native (as similar as possible)
fedora build and both unit- and interop- tests are running with
this build.

Signed-off-by: Stanislav Zidek <szidek@redhat.com>
2 years agoMerge branch 'wip/dueno/news-update' into 'master'
Daiki Ueno [Thu, 14 Mar 2024 05:15:45 +0000 (05:15 +0000)] 
Merge branch 'wip/dueno/news-update' into 'master'

NEWS: Mention RSA-OAEP support [ci skip]

See merge request gnutls/gnutls!1820

2 years agoNEWS: Mention RSA-OAEP support [ci skip]
Daiki Ueno [Thu, 14 Mar 2024 00:01:52 +0000 (09:01 +0900)] 
NEWS: Mention RSA-OAEP support [ci skip]

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agoMerge branch 'wip/dueno/rsa-oaep-followup' into 'master'
Daiki Ueno [Mon, 11 Mar 2024 10:58:51 +0000 (10:58 +0000)] 
Merge branch 'wip/dueno/rsa-oaep-followup' into 'master'

x509: fix reading of MGF-1 OID

See merge request gnutls/gnutls!1819

2 years agox509: fix reading of MGF-1 OID
Daiki Ueno [Sat, 9 Mar 2024 21:58:46 +0000 (06:58 +0900)] 
x509: fix reading of MGF-1 OID

asn1_read_value may return error code in a positive integer thus the
previous code could lead to an access to uninitialized value.  This is
a regression in the RSA-OAEP support.  Spotted by oss-fuzz:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=67300

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agoMerge branch 'wip/dueno/rsa-oaep' into 'master'
Daiki Ueno [Sat, 9 Mar 2024 01:14:45 +0000 (01:14 +0000)] 
Merge branch 'wip/dueno/rsa-oaep' into 'master'

Support RSA-OAEP

See merge request gnutls/gnutls!1805

2 years agotests: add test for RSA-OAEP cert generation with certtool
Daiki Ueno [Fri, 8 Mar 2024 03:48:09 +0000 (12:48 +0900)] 
tests: add test for RSA-OAEP cert generation with certtool

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agoMerge branch 'zfridric_devel2' into 'master'
Zoltán Fridrich [Tue, 5 Mar 2024 08:30:36 +0000 (08:30 +0000)] 
Merge branch 'zfridric_devel2' into 'master'

Fix mingw build on fedora

See merge request gnutls/gnutls!1818

2 years agoFix mingw build on fedora
Zoltan Fridrich [Mon, 4 Mar 2024 12:41:22 +0000 (13:41 +0100)] 
Fix mingw build on fedora

Signed-off-by: Zoltan Fridrich <zfridric@redhat.com>
2 years agoMerge branch 'macro-fix' into 'master'
Daiki Ueno [Mon, 4 Mar 2024 01:48:06 +0000 (01:48 +0000)] 
Merge branch 'macro-fix' into 'master'

#1530 Fix macro naming in errors.h Signed-off-by: Ramesh <adhikari.resume@gmail.com>

See merge request gnutls/gnutls!1815

2 years agoFix typo in fallback _gnutls_no_log macro alias in errors.h
Ramesh Adhikari [Mon, 4 Mar 2024 01:48:06 +0000 (01:48 +0000)] 
Fix typo in fallback _gnutls_no_log macro alias in errors.h

Previously, when C99_MACROS is not defined, _gnutls_no_log was
expanded to _gnutle_null_log and thus caused a compilation error.

Reported by Andrew Lilley Brinker in:
https://gitlab.com/gnutls/gnutls/-/issues/1530

Signed-off-by: Ramesh <adhikari.resume@gmail.com>
2 years agoMerge branch 'test_single_process' into 'master'
Daiki Ueno [Mon, 4 Mar 2024 00:02:27 +0000 (00:02 +0000)] 
Merge branch 'test_single_process' into 'master'

tests: rewrite 'hello_retry_request' as single process

See merge request gnutls/gnutls!1817

2 years agoRemove duplicate line in eagain-common.h
Sahil Siddiq [Sun, 3 Mar 2024 20:33:09 +0000 (02:03 +0530)] 
Remove duplicate line in eagain-common.h

HANDSHAKE(c, s) has already been defined on line
64. Hence, the macro on line 96 can be removed.

Signed-off-by: Sahil Siddiq <icegambit91@gmail.com>
2 years agotests: rewrite 'hello_retry_request' as single process
Sahil Siddiq [Sun, 3 Mar 2024 20:16:37 +0000 (01:46 +0530)] 
tests: rewrite 'hello_retry_request' as single process

Part of issue #1472.
https://gitlab.com/gnutls/gnutls/-/issues/1472

Signed-off-by: Sahil Siddiq <icegambit91@gmail.com>
2 years agocrypto-selftests-pk: add test case for RSA-OAEP
Daiki Ueno [Sat, 17 Feb 2024 22:10:53 +0000 (07:10 +0900)] 
crypto-selftests-pk: add test case for RSA-OAEP

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agotests: add basic test for RSA-OAEP encryption
Daiki Ueno [Thu, 8 Feb 2024 11:32:53 +0000 (20:32 +0900)] 
tests: add basic test for RSA-OAEP encryption

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agocerttool: support generating RSA-OAEP private key
Daiki Ueno [Thu, 8 Feb 2024 09:40:00 +0000 (18:40 +0900)] 
certtool: support generating RSA-OAEP private key

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agoabstract: plumb RSA-OAEP in the abstract key types API
Daiki Ueno [Thu, 8 Feb 2024 09:39:41 +0000 (18:39 +0900)] 
abstract: plumb RSA-OAEP in the abstract key types API

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agox509: plumb RSA-OAEP in X.509 interface
Daiki Ueno [Thu, 8 Feb 2024 09:39:23 +0000 (18:39 +0900)] 
x509: plumb RSA-OAEP in X.509 interface

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years ago_gnutls_x509_decode_string: tolerate empty strings
Daiki Ueno [Fri, 16 Feb 2024 08:03:33 +0000 (17:03 +0900)] 
_gnutls_x509_decode_string: tolerate empty strings

Signed-off-by: Daiki Ueno <ueno@gnu.org>
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 agoMerge branch 'wip/dueno/ecdh-compute-tests' into 'master'
Daiki Ueno [Tue, 27 Feb 2024 11:28:11 +0000 (11:28 +0000)] 
Merge branch 'wip/dueno/ecdh-compute-tests' into 'master'

tests: support KAT in (EC)DH tests

See merge request gnutls/gnutls!1813

2 years agotests: support KAT in (EC)DH tests
Daiki Ueno [Fri, 23 Feb 2024 00:03:46 +0000 (09:03 +0900)] 
tests: support KAT in (EC)DH tests

While the logic existed, known answer tests were omitted in
tests/dh-compute, tests/dh-compute2, tests/ecdh-compute, and
tests/ecdh-compute2.  This enables the support for it as well as fixes
a couple of issues in the logic: avoid using `success` variable as it
shadows the helper function with the same name defined in
tests/utils.h, invert the memcmp condition, and properly use peer_x
and peer_y in place of x and y in ecdh-compute2.

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 'fips-skip-pkcs11-tool' into 'master'
Daiki Ueno [Thu, 15 Feb 2024 15:01:16 +0000 (15:01 +0000)] 
Merge branch 'fips-skip-pkcs11-tool' into 'master'

tests: skip pkcs11-tool.sh in FIPS mode

See merge request gnutls/gnutls!1811

2 years agoMerge branch 'wip/dueno/gmp-static' into 'master'
Daiki Ueno [Thu, 15 Feb 2024 13:55:40 +0000 (13:55 +0000)] 
Merge branch 'wip/dueno/gmp-static' into 'master'

build: allow GMP to be statically linked

See merge request gnutls/gnutls!1635

2 years agobuild: allow GMP to be statically linked
Daiki Ueno [Fri, 19 Aug 2022 03:32:27 +0000 (12:32 +0900)] 
build: allow GMP to be statically linked

Even though we set the custom allocator[1] to zeroize sensitive data,
it can be easily invalidated if the application sets its own custom
allocator.  An approach to prevent that is to link against a static
library of GMP, so the use of GMP is privatized and the custom
allocator configuration is not shared with other applications.

This patch allows libgnutls to be linked with the static library of
GMP.  Note that, to this work libgmp.a needs to be compiled with -fPIC
and libhogweed in Nettle is also linked to the static library of GMP.

1. https://gitlab.com/gnutls/gnutls/-/merge_requests/1554

Signed-off-by: Daiki Ueno <ueno@gnu.org>
2 years agotests: rename testdir of pkcs11-tool.sh
Alexander Sosedkin [Thu, 15 Feb 2024 12:29:46 +0000 (13:29 +0100)] 
tests: rename testdir of pkcs11-tool.sh

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
2 years agoMerge branch 'flags' into 'master'
Daiki Ueno [Thu, 15 Feb 2024 09:27:58 +0000 (09:27 +0000)] 
Merge branch 'flags' into 'master'

lib/mpi.c: extract flag correctly

See merge request gnutls/gnutls!1809

2 years agoMerge branch 'parm' into 'master'
Daiki Ueno [Thu, 15 Feb 2024 08:28:08 +0000 (08:28 +0000)] 
Merge branch 'parm' into 'master'

lib/x509/x509.c: add missing argument to macro invokation

See merge request gnutls/gnutls!1810

2 years agotests: skip pkcs11-tool.sh in FIPS mode
Alexander Sosedkin [Wed, 14 Feb 2024 11:25:25 +0000 (12:25 +0100)] 
tests: skip pkcs11-tool.sh in FIPS mode

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
2 years agoMerge branch 'master' into 'master'
Daiki Ueno [Wed, 14 Feb 2024 09:48:51 +0000 (09:48 +0000)] 
Merge branch 'master' into 'master'

lib: fix two segfault issues caused by freeing uninitialized buf

See merge request gnutls/gnutls!1807

2 years agolib: fix a potential segfault in _gnutls13_recv_finished
Xin Long [Thu, 1 Feb 2024 22:21:05 +0000 (17:21 -0500)] 
lib: fix a potential segfault in _gnutls13_recv_finished

In _gnutls13_recv_finished(), 'buf' is not initialized or set when
_gnutls13_compute_finished() returns an err, and goto cleanup may
cause a segfault crash as it frees the uninitialized buf.allocd in
_gnutls_buffer_clear().

So fix it by return if _gnutls13_compute_finished() returns an err
in _gnutls13_recv_finished().

Signed-off-by: Xin Long <lucien.xin@gmail.com>
2 years agolib: fix a segfault in _gnutls13_recv_end_of_early_data
Xin Long [Thu, 1 Feb 2024 21:50:22 +0000 (16:50 -0500)] 
lib: fix a segfault in _gnutls13_recv_end_of_early_data

A crash occur in my app that uses gnutls13 early data, stack trace:

  #0  free (libc.so.6 + 0x97bf0)
  #1  _gnutls_buffer_clear (libgnutls.so.30 + 0x77c8c)
  #2  _gnutls13_recv_end_of_early_data (libgnutls.so.30 + 0xaf308)
  #3  _gnutls13_handshake_server (libgnutls.so.30 + 0x42d6c)
  #4  handshake_server (libgnutls.so.30 + 0x4ff6c)

The root cause is that _gnutls_buffer_clear() was trying to free
'buf' that is not initialized or set if GNUTLS_NO_END_OF_EARLY_DATA
flag is set on server side.

This patch fixes it by simply initializing buf at the begginning of
_gnutls13_recv_end_of_early_data().

Signed-off-by: Xin Long <lucien.xin@gmail.com>
2 years agolib/x509/x509.c: add missing argument to macro invokation
Avinash Sonawane [Tue, 13 Feb 2024 17:09:49 +0000 (22:39 +0530)] 
lib/x509/x509.c: add missing argument to macro invokation

Signed-off-by: Avinash Sonawane <rootkea@gmail.com>
2 years agolib/mpi.c: extract flag correctly
Avinash Sonawane [Tue, 13 Feb 2024 09:37:32 +0000 (15:07 +0530)] 
lib/mpi.c: extract flag correctly

Signed-off-by: Avinash Sonawane <rootkea@gmail.com>
2 years agoMerge branch 'wip/dueno/serv-memleak' into 'master'
Daiki Ueno [Mon, 29 Jan 2024 22:30:22 +0000 (22:30 +0000)] 
Merge branch 'wip/dueno/serv-memleak' into 'master'

serv: fix memleak when a connected client disappears

See merge request gnutls/gnutls!1803

2 years agoserv: fix memleak when a connected client disappears
Daiki Ueno [Sat, 27 Jan 2024 02:09:18 +0000 (11:09 +0900)] 
serv: fix memleak when a connected client disappears

Reported by Hubert Kario.

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