]> git.ipfire.org Git - thirdparty/gnutls.git/log
thirdparty/gnutls.git
4 years agoMerge branch 'master' into 'master'
Daiki Ueno [Mon, 16 Aug 2021 05:35:23 +0000 (05:35 +0000)] 
Merge branch 'master' into 'master'

x509: pin/password callback support for openssl encrypted private keys

See merge request gnutls/gnutls!1459

4 years agox509: pin/password callback support for openssl encrypted private keys
Craig Gallek [Wed, 11 Aug 2021 16:54:37 +0000 (12:54 -0400)] 
x509: pin/password callback support for openssl encrypted private keys

This attempts to use the registered pin callback when the password for
an encrypted openssl private key is not supplied.  This matches the
functionality for PKCS8 sealed keys above and is similar to what openssl
does in this situation.

Signed-off-by: Craig Gallek <cgallek@gmail.com>
4 years agoMerge branch 'wip/dueno/asan-poisoning' into 'master'
Daiki Ueno [Tue, 10 Aug 2021 12:26:04 +0000 (12:26 +0000)] 
Merge branch 'wip/dueno/asan-poisoning' into 'master'

mem: instrument with ASan memory poisoning as well as valgrind

Closes #1260

See merge request gnutls/gnutls!1458

4 years agomem: instrument with ASan memory poisoning as well as valgrind
Daiki Ueno [Sat, 7 Aug 2021 07:16:50 +0000 (09:16 +0200)] 
mem: instrument with ASan memory poisoning as well as valgrind

This makes it possible to catch undefined memory access in the more
lightweight CI runs.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
4 years agoMerge branch 'wip/dueno/tls13-rsa-pss-salt' into 'master'
Daiki Ueno [Sat, 7 Aug 2021 09:14:59 +0000 (09:14 +0000)] 
Merge branch 'wip/dueno/tls13-rsa-pss-salt' into 'master'

pk: add flags to force RSA-PSS salt length to match digest length

Closes #1258

See merge request gnutls/gnutls!1455

4 years agopk: add flags to force RSA-PSS salt length to match digest length
Daiki Ueno [Mon, 2 Aug 2021 16:32:28 +0000 (18:32 +0200)] 
pk: add flags to force RSA-PSS salt length to match digest length

This adds a couple of flags to RSA-PSS signing and verification, to
enforce that the salt length matches the digest length.  That is not
only recommended in RFC 4055, but also mandated in RFC 8446 in the TLS
1.3 context.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
4 years agoMerge branch 'wip/dueno/fips-rsa-key-size' into 'master'
Daiki Ueno [Thu, 5 Aug 2021 11:39:36 +0000 (11:39 +0000)] 
Merge branch 'wip/dueno/fips-rsa-key-size' into 'master'

fips: allow more RSA modulus sizes

See merge request gnutls/gnutls!1453

4 years agofips: allow more RSA modulus sizes
Daiki Ueno [Wed, 21 Jul 2021 08:34:23 +0000 (10:34 +0200)] 
fips: allow more RSA modulus sizes

Previously, we restricted RSA modulus size to be either 2048 or 3072
bits in FIPS mode, following FIPS 186-4.  On the other hand, FIPS
140-2 IG A.14 and FIPS 140-3 IG C.F updates it to allow arbitrary
modulus sizes equal to or larger than 2048 bits under certain
conditions.

This change reflects the guidance, though it only allows known sizes
due to the complexity of calculating the approximate security strength
using the formula in FIPS 140-2 IG 7.5.

Suggested-by: Stephan Mueller
Reviewed-by: Stephan Mueller
Signed-off-by: Daiki Ueno <ueno@gnu.org>
4 years agoMerge branch 'wip/dueno/test-key-share-single' into 'master'
Daiki Ueno [Wed, 4 Aug 2021 12:21:48 +0000 (12:21 +0000)] 
Merge branch 'wip/dueno/test-key-share-single' into 'master'

tests: tls13/key_share: rewrite as single process

See merge request gnutls/gnutls!1457

4 years agotests: tls13/key_share: rewrite as single process
Daiki Ueno [Tue, 3 Aug 2021 12:17:41 +0000 (14:17 +0200)] 
tests: tls13/key_share: rewrite as single process

Signed-off-by: Daiki Ueno <ueno@gnu.org>
4 years agoMerge branch 'wip/dueno/cppcheck' into 'master'
Daiki Ueno [Wed, 4 Aug 2021 07:52:00 +0000 (07:52 +0000)] 
Merge branch 'wip/dueno/cppcheck' into 'master'

devel: suppress cppcheck 2.5 false-positives

See merge request gnutls/gnutls!1456

4 years ago.gitlab-ci.yml: cppcheck: disable style checks
Daiki Ueno [Wed, 4 Aug 2021 04:45:30 +0000 (06:45 +0200)] 
.gitlab-ci.yml: cppcheck: disable style checks

Signed-off-by: Daiki Ueno <ueno@gnu.org>
4 years agodevel: suppress cppcheck 2.5 false-positives
Daiki Ueno [Tue, 3 Aug 2021 09:44:52 +0000 (11:44 +0200)] 
devel: suppress cppcheck 2.5 false-positives

This fixes errors and warnings as well as some style issues spotted by
cppcheck 2.5.  Others are recorded in the suppressions file.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
4 years agoMerge branch 'fix-ocsp-signer-check' into 'master'
Daiki Ueno [Wed, 14 Jul 2021 14:16:53 +0000 (14:16 +0000)] 
Merge branch 'fix-ocsp-signer-check' into 'master'

gnutls_ocsp_resp_verify: Check key purpose if signer not on trust list

Closes #1254

See merge request gnutls/gnutls!1452

4 years agognutls_ocsp_resp_verify: Check key purpose if signer not on trust list
Fiona Klute [Tue, 13 Jul 2021 21:53:12 +0000 (23:53 +0200)] 
gnutls_ocsp_resp_verify: Check key purpose if signer not on trust list

According to [1] the id-kp-OCSPSigning key purpose is only needed for
delegated signers, not signers explicitly set as trusted. The previous
code would reject a signature directly from a CA on the trust list
(without delegation) because the CA certificate didn't contain the
id-kp-OCSPSigning key purpose.

The tests included in this commit check:

1. Is a signature directly from a CA on the trust list accepted?

2. Is a signature from a delegated signer issued by a CA on the trust
   list accepted?

3. Is a signature from a certificate without id-kp-OCSPSigning issued
   by a CA on the trust list rejected?

Note that the CA in these tests is also the one that issued the
certificate the OCSP response is for, but the code (current and
previous) doesn't enforce this.

[1] https://datatracker.ietf.org/doc/html/rfc6960#section-4.2.2.2

Signed-off-by: Fiona Klute <fiona.klute@gmx.de>
4 years agoMerge branch 'wip/dueno/sh-tests' into 'master'
Daiki Ueno [Mon, 28 Jun 2021 07:07:31 +0000 (07:07 +0000)] 
Merge branch 'wip/dueno/sh-tests' into 'master'

tests: set SH_LOG_COMPILER so sh tests run under $(SHELL)

See merge request gnutls/gnutls!1450

4 years agotests: set SH_LOG_COMPILER so sh tests run under $(SHELL)
Daiki Ueno [Mon, 28 Jun 2021 05:04:55 +0000 (07:04 +0200)] 
tests: set SH_LOG_COMPILER so sh tests run under $(SHELL)

This omits the need of setting executable bits on shell script tests.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
4 years agoMerge branch 'wip/dueno/kshare-x25519-x448' into 'master'
Daiki Ueno [Fri, 25 Jun 2021 12:04:43 +0000 (12:04 +0000)] 
Merge branch 'wip/dueno/kshare-x25519-x448' into 'master'

key_share: treat X25519 and X448 as same PK type when advertising

Closes #1249

See merge request gnutls/gnutls!1449

4 years agokey_share: treat X25519 and X448 as same PK type when advertising
Daiki Ueno [Fri, 25 Jun 2021 06:39:12 +0000 (08:39 +0200)] 
key_share: treat X25519 and X448 as same PK type when advertising

Previously, if both X25519 and X448 groups were enabled in the
priority string, the client sent both algorithms in a key_share
extension, while it was only capable of handling one algorithm from
the same (Edwards curve) category.  This adds an extra check so the
client should send either X25519 or X448.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
4 years agoMerge branch 'mcatanzaro/set-trust-list-return' into 'master'
Daiki Ueno [Thu, 24 Jun 2021 13:20:05 +0000 (13:20 +0000)] 
Merge branch 'mcatanzaro/set-trust-list-return' into 'master'

Fix gnutls_certificate_set_trust_list() return value documentation

See merge request gnutls/gnutls!1448

4 years agoFix gnutls_certificate_set_trust_list() return value documentation
Michael Catanzaro [Tue, 22 Jun 2021 19:12:09 +0000 (14:12 -0500)] 
Fix gnutls_certificate_set_trust_list() return value documentation

This function is documented to return an error code, but in fact it has
no return value and never fails. Fix this.

Signed-off-by: Michael Catanzaro <mcatanzaro@redhat.com>
4 years agoMerge branch 'guile-egain-eintr' into 'master'
Daiki Ueno [Sat, 19 Jun 2021 17:43:53 +0000 (17:43 +0000)] 
Merge branch 'guile-egain-eintr' into 'master'

guile: Writes to record ports handle EAGAIN/EINTR transparently.

See merge request gnutls/gnutls!1417

4 years agoguile: Writes to record ports handle EAGAIN/EINTR transparently.
Ludovic Courtès [Sat, 24 Apr 2021 20:02:14 +0000 (22:02 +0200)] 
guile: Writes to record ports handle EAGAIN/EINTR transparently.

Reported at <https://issues.guix.gnu.org/47867>
by Florian Pelz <pelzflorian@pelzflorian.de>.

This is a followup to a229bb36c9592b151f6feb277238c41ab39f40a9.

* guile/src/core.c (write_to_session_record_port) [USING_GUILE_BEFORE_2_2]:
Keep looping upon GNUTLS_E_AGAIN and GNUTLS_E_INTERRUPTED.
(write_to_session_record_port) [!USING_GUILE_BEFORE_2_2]: Loop on
GNUTLS_E_INTERRUPTED and return -1 on GNUTLS_E_AGAIN if C_SESSION is
backed by a file descriptor.
* NEWS: Update.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
4 years agoMerge branch 'wip/dueno/pkcs11-reuse-key-id' into 'master'
Daiki Ueno [Fri, 11 Jun 2021 15:51:44 +0000 (15:51 +0000)] 
Merge branch 'wip/dueno/pkcs11-reuse-key-id' into 'master'

doc: p11tool: mention how CKA_IDs of certs are calculated upon --write

See merge request gnutls/gnutls!1446

4 years agoMerge branch 'wip/dueno/config-sigalgs' into 'master'
Daiki Ueno [Fri, 11 Jun 2021 15:32:21 +0000 (15:32 +0000)] 
Merge branch 'wip/dueno/config-sigalgs' into 'master'

priority: reflect system wide config when constructing sigalgs

See merge request gnutls/gnutls!1447

4 years agopriority: reflect system wide config when constructing sigalgs
Daiki Ueno [Fri, 11 Jun 2021 04:58:43 +0000 (06:58 +0200)] 
priority: reflect system wide config when constructing sigalgs

Otherwise the client would advertise signature algorithms which it
cannot use and cause handshake to fail.

Reported by Philip Schaten in:
https://lists.gnupg.org/pipermail/gnutls-help/2021-June/004711.html

Signed-off-by: Daiki Ueno <ueno@gnu.org>
4 years agop11tool: mention how CKA_IDs of certs are calculated upon --write
Daiki Ueno [Wed, 9 Jun 2021 12:29:11 +0000 (14:29 +0200)] 
p11tool: mention how CKA_IDs of certs are calculated upon --write

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agoMerge branch 'wip/dueno/release-3.7.2' into 'master' 3.7.2
Daiki Ueno [Sat, 29 May 2021 07:41:46 +0000 (07:41 +0000)] 
Merge branch 'wip/dueno/release-3.7.2' into 'master'

Release 3.7.2

See merge request gnutls/gnutls!1445

5 years agoRelease 3.7.2
Daiki Ueno [Sat, 29 May 2021 05:18:17 +0000 (07:18 +0200)] 
Release 3.7.2

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agorelease-steps: remove unnecessary steps
Daiki Ueno [Sat, 29 May 2021 05:09:07 +0000 (07:09 +0200)] 
release-steps: remove unnecessary steps

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agoAUTHORS: take into account of Co-authored-by:
Daiki Ueno [Sat, 29 May 2021 04:56:57 +0000 (06:56 +0200)] 
AUTHORS: take into account of Co-authored-by:

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years ago.mailmap: update
Daiki Ueno [Sat, 29 May 2021 04:52:42 +0000 (06:52 +0200)] 
.mailmap: update

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agoMerge branch 'wip/dueno/version-deps' into 'master'
Daiki Ueno [Sat, 29 May 2021 04:53:01 +0000 (04:53 +0000)] 
Merge branch 'wip/dueno/version-deps' into 'master'

build: fix interface version dependencies in libgnutls.map

See merge request gnutls/gnutls!1444

5 years agoMerge branch 'order-dn' into 'master'
Daiki Ueno [Sat, 29 May 2021 04:40:16 +0000 (04:40 +0000)] 
Merge branch 'order-dn' into 'master'

certtool: order DN components by scale.

Closes #1243

See merge request gnutls/gnutls!1438

5 years agoMerge branch 'wip/dueno/libkcapi-1.3.0' into 'master'
Daiki Ueno [Fri, 28 May 2021 19:03:30 +0000 (19:03 +0000)] 
Merge branch 'wip/dueno/libkcapi-1.3.0' into 'master'

build: require libkcapi 1.3.0 or later if --enable-afalg

See merge request gnutls/gnutls!1443

5 years agocerttool: order DN components by scale.
Daniel Kahn Gillmor [Tue, 18 May 2021 20:32:55 +0000 (16:32 -0400)] 
certtool: order DN components by scale.

DN components are expected to be ordered by scale, with the wire format
representing larger-scale components (like country or organization) before
smaller-scale components (like state or organizationalUnit).

The bulk of the changes here of course are changes to the target
certificates in the test suite.

Note that a change was necessary in tests/cert-tests/crq.sh because it
tests the "interactive" mode of certtool.  If any user is scripting
certtool in this way, this change will cause a backwards-incompatible
break.  However, I think this is OK -- the supported scripted/batch
mode for certtool should use a template file, and I don't think it's
important to maintain a strict api on the interactive mode.

The main change here is to order the DN from least-specific-to-most,
in particular:

    country, state, locality, org, orgunit, cn, uid

But I've also made an additional arbitrary choice, which is that DC
(domain component) comes *after* uid.  This was already the case in
certificate generation, but in *request* generation, it was the other
way around.  I've changed request generation to match this ordering
from certificate generation.

Closes: #1243
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
5 years agobuild: fix interface version dependencies in libgnutls.map
Daiki Ueno [Thu, 27 May 2021 08:00:22 +0000 (10:00 +0200)] 
build: fix interface version dependencies in libgnutls.map

Previously, the predecessor of GNUTLS_3_7_0 was mistakenly set to
GNUTLS_3_4 instead of GNUTLS_3_6_14.  This fix shouldn't have any
impact on ABI, given the dynamic loader doesn't take into account of
ordering of versions.  See also the first paragraph on:
https://www.akkadia.org/drepper/dsohowto.pdf#page=38

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agobuild: require libkcapi 1.3.0 or later if --enable-afalg
Daiki Ueno [Thu, 27 May 2021 07:34:50 +0000 (09:34 +0200)] 
build: require libkcapi 1.3.0 or later if --enable-afalg

The libkcapi 1.3.0 brings a couple of changes needed for GnuTLS:

 * fix: remove prctl PR_SET_DUMPABLE to allow library to be debugged
 * fix: ensure that sendmsg is always used as fallback when vmsplice cannot be used

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agoMerge branch 'wip/dueno/update-gnulib' into 'master'
Daiki Ueno [Fri, 28 May 2021 16:26:32 +0000 (16:26 +0000)] 
Merge branch 'wip/dueno/update-gnulib' into 'master'

Update git submodules for gnulib, nettle, and tlsfuzzer

See merge request gnutls/gnutls!1442

5 years agotlsfuzzer: update git submodules
Daiki Ueno [Fri, 28 May 2021 15:05:56 +0000 (17:05 +0200)] 
tlsfuzzer: update git submodules

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agonettle: update git submodule to 3.7.2 release
Daiki Ueno [Fri, 28 May 2021 06:51:27 +0000 (08:51 +0200)] 
nettle: update git submodule to 3.7.2 release

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agognulib: update git submodule
Daiki Ueno [Fri, 28 May 2021 06:50:19 +0000 (08:50 +0200)] 
gnulib: update git submodule

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agoMerge branch 'wip/dueno/update-libtasn1' into 'master'
Daiki Ueno [Thu, 27 May 2021 10:57:08 +0000 (10:57 +0000)] 
Merge branch 'wip/dueno/update-libtasn1' into 'master'

devel: update libtasn1 submodule

Closes #1078 and #1144

See merge request gnutls/gnutls!1441

5 years agodevel: update libtasn1 submodule
Daiki Ueno [Thu, 27 May 2021 06:10:30 +0000 (08:10 +0200)] 
devel: update libtasn1 submodule

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agoMerge branch 'wip/dueno/earlydata-server' into 'master'
Daiki Ueno [Wed, 26 May 2021 17:55:56 +0000 (17:55 +0000)] 
Merge branch 'wip/dueno/earlydata-server' into 'master'

pre_shared_key: limit 0-RTT to resumption connections

Closes #1239

See merge request gnutls/gnutls!1436

5 years agoMerge branch 'warn_fixes' into 'master'
Daiki Ueno [Fri, 21 May 2021 14:52:38 +0000 (14:52 +0000)] 
Merge branch 'warn_fixes' into 'master'

Fix some warnings

See merge request gnutls/gnutls!1439

5 years agoguile: Fix implicit conversion warning
Leonardo Bras [Fri, 21 May 2021 06:40:03 +0000 (03:40 -0300)] 
guile: Fix implicit conversion warning

When building, the following warning may be printing:

  CC       guile_gnutls_v_2_la-utils.lo
core.c: In function 'scm_gnutls_set_server_session_certificate_request_x':
core.c:545:13: warning: implicit conversion from 'gnutls_certificate_request_t' to 'gnutls_certificate_status_t' [-Wenum-conversion]
  545 |   c_request = scm_to_gnutls_certificate_request (request, 2, FUNC_NAME);
      |             ^
core.c:547:53: warning: implicit conversion from 'gnutls_certificate_status_t' to 'gnutls_certificate_request_t' [-Wenum-conversion]
  547 |   gnutls_certificate_server_set_request (c_session, c_request);
      |

Fix this warning by changing c_request type to gnutls_certificate_request_t.

Signed-off-by: Leonardo Bras <leobras.c@gmail.com>
5 years agoASN1 : Remove warnings related to old libtasn1 namings
Leonardo Bras [Fri, 21 May 2021 06:11:29 +0000 (03:11 -0300)] 
ASN1 : Remove warnings related to old libtasn1 namings

While compiling gnutls, some warnings related to deprecated names can be
printed, such as:

./../x509/x509_int.h:392:13: warning: 'ASN1_TYPE' macro is deprecated, use 'asn1_node' instead.
  392 | int _gnutls_x509_write_key_int_le(ASN1_TYPE node, const char *value,
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

To avoid that, rename types as show in devel/libtasn1/NEWS (release 3.1):

ASN1_DATA_NODE -> asn1_data_node_st
ASN1_ARRAY_TYPE -> asn1_static_node (was asn1_static_node_t)
ASN1_TYPE -> asn1_node
ASN1_TYPE_EMPTY -> NULL
static_struct_asn -> asn1_static_node_st
node_asn_struct -> asn1_node_st
node_asn -> asn1_node_st

Signed-off-by: Leonardo Bras <leobras.c@gmail.com>
5 years agoMerge branch 'omit-empty-policy-qualifiers' into 'master'
Daiki Ueno [Tue, 18 May 2021 06:39:44 +0000 (06:39 +0000)] 
Merge branch 'omit-empty-policy-qualifiers' into 'master'

x509: Omit empty sequences of policyQualifiers.

Closes #1238

See merge request gnutls/gnutls!1435

5 years agoMerge branch 'avoid-matching-templates' into 'master'
Daiki Ueno [Tue, 18 May 2021 05:51:31 +0000 (05:51 +0000)] 
Merge branch 'avoid-matching-templates' into 'master'

git: Do not ignore certtool templates.

Closes #1242

See merge request gnutls/gnutls!1437

5 years agogit: Do not ignore certtool templates.
Daniel Kahn Gillmor [Mon, 17 May 2021 17:33:28 +0000 (13:33 -0400)] 
git: Do not ignore certtool templates.

This effectively reverts part of
dc85966364994006f9337e4749d1487e4b8e16a1 in order to ensure that
tests/cert-tests/templates/*.tmpl are not ignored by git.

Closes: #1242
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
5 years agotests/cert-tests: test a policy without any policyQualifiers.
Daniel Kahn Gillmor [Mon, 17 May 2021 17:20:26 +0000 (13:20 -0400)] 
tests/cert-tests: test a policy without any policyQualifiers.

Ensure that a policy without policyQualifiers gets created with an
omitted sequence of qualifiers, rather than an empty sequence of
qualifiers.

We use NIST's test policy OID for this test.

This tests the fix for #1238.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
5 years agoMerge branch 'wip/dueno/tls12-cert-type' into 'master'
Daiki Ueno [Mon, 17 May 2021 16:53:14 +0000 (16:53 +0000)] 
Merge branch 'wip/dueno/tls12-cert-type' into 'master'

cert auth: filter out unsupported cert types from TLS 1.2 CR

See merge request gnutls/gnutls!1434

5 years agox509: Omit empty sequences of policyQualifiers.
Daniel Kahn Gillmor [Fri, 14 May 2021 21:57:54 +0000 (17:57 -0400)] 
x509: Omit empty sequences of policyQualifiers.

When a certificate has a policy attached but no policyQualifiers,
`certtool` should omit the policyQualifiers sequence entirely, rather
than emitting an empty sequence.

Closes: #1238
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
5 years agocert auth: filter out unsupported cert types from TLS 1.2 CR
Daiki Ueno [Fri, 14 May 2021 13:59:37 +0000 (15:59 +0200)] 
cert auth: filter out unsupported cert types from TLS 1.2 CR

When the server is advertising signature algorithms in TLS 1.2
CertificateRequest, it shouldn't send certificate_types not backed by
any of those algorithms.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agopre_shared_key: limit 0-RTT to resumption connections
Daiki Ueno [Mon, 17 May 2021 05:58:43 +0000 (07:58 +0200)] 
pre_shared_key: limit 0-RTT to resumption connections

While RFC 8446 allows 0-RTT data in a non-resumption connection
established with external PSK, it requires a mechanism to associate
encryption parameters with PSK.  Until we provide a new API for that,
let's limit the 0-RTT use to resumption connections only.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agoMerge branch 'minimal-key-usage' into 'master'
Daiki Ueno [Sat, 15 May 2021 14:34:51 +0000 (14:34 +0000)] 
Merge branch 'minimal-key-usage' into 'master'

x509: Write keyUsage extension with minimal BIT STRING

Closes #1236

See merge request gnutls/gnutls!1431

5 years agox509: Write keyUsage extension with minimal BIT STRING
Daniel Kahn Gillmor [Thu, 13 May 2021 00:49:20 +0000 (20:49 -0400)] 
x509: Write keyUsage extension with minimal BIT STRING

Avoid embedding trailing cleared bits in the BIT STRING for the
keyUsage extension.

The overwhelming majority of this changeset is correcting the
artifacts in the test suite, most of which had keyUsage with a
non-minimal encoding.  The only functional code change is in
lib/x509/x509_ext.c.

Closes: #1236
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
5 years agoMerge branch 'wip/dueno/addrconfig' into 'master'
Daiki Ueno [Fri, 14 May 2021 12:21:36 +0000 (12:21 +0000)] 
Merge branch 'wip/dueno/addrconfig' into 'master'

serv: stop setting AI_ADDRCONFIG on getaddrinfo

Closes #1007

See merge request gnutls/gnutls!1433

5 years agoMerge branch 'wip/dueno/ci-bootstrap' into 'master'
Daiki Ueno [Fri, 14 May 2021 11:14:29 +0000 (11:14 +0000)] 
Merge branch 'wip/dueno/ci-bootstrap' into 'master'

.gitlab-ci.yml: add bootstrap stage

Closes #891

See merge request gnutls/gnutls!1432

5 years ago.gitlab-ci.yml: add bootstrap stage
Daiki Ueno [Fri, 14 May 2021 06:48:24 +0000 (08:48 +0200)] 
.gitlab-ci.yml: add bootstrap stage

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agoserv: stop setting AI_ADDRCONFIG on getaddrinfo
Daiki Ueno [Fri, 14 May 2021 06:26:37 +0000 (08:26 +0200)] 
serv: stop setting AI_ADDRCONFIG on getaddrinfo

AI_ADDRCONFIG is only useful when the NODE argument is given in the
getaddrinfo call, as described in RFC 3493 6.1.  Suggested by Andreas
Metzler in:
https://gitlab.com/gnutls/gnutls/-/issues/1007#note_356637206

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agoMerge branch 'wip/dueno/windows-tests' into 'master'
Daiki Ueno [Thu, 13 May 2021 14:57:38 +0000 (14:57 +0000)] 
Merge branch 'wip/dueno/windows-tests' into 'master'

tests: don't install crypt32.dll and ncrypt.dll replacement

Closes #1232

See merge request gnutls/gnutls!1429

5 years agoconfigure.ac: specify -ladvapi32 in mingw builds
Daiki Ueno [Thu, 13 May 2021 13:03:10 +0000 (15:03 +0200)] 
configure.ac: specify -ladvapi32 in mingw builds

This library needs to be linked for CryptAcquireContextW, used in
lib/system/keys-win.c.  Suggested by Tim Kosse in:
https://gitlab.com/gnutls/gnutls/-/issues/1232

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agotests: don't install crypt32.dll and ncrypt.dll replacement
Daiki Ueno [Tue, 11 May 2021 07:50:22 +0000 (09:50 +0200)] 
tests: don't install crypt32.dll and ncrypt.dll replacement

Reported by Tim Kosse in:
https://gitlab.com/gnutls/gnutls/-/issues/1232

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agoMerge branch 'wip/dueno/earlydata' into 'master'
Daiki Ueno [Thu, 13 May 2021 10:31:25 +0000 (10:31 +0000)] 
Merge branch 'wip/dueno/earlydata' into 'master'

Improve 0-RTT support for QUIC

Closes #1216

See merge request gnutls/gnutls!1421

5 years agognutls_early_{cipher,prf_hash}_get: new functions
Daiki Ueno [Thu, 29 Apr 2021 16:44:28 +0000 (18:44 +0200)] 
gnutls_early_{cipher,prf_hash}_get: new functions

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agotests: rework tls13-early-data to check key scheduling
Daiki Ueno [Thu, 29 Apr 2021 09:50:00 +0000 (11:50 +0200)] 
tests: rework tls13-early-data to check key scheduling

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agotests: tls13-early-data: use TLS_CHACHA20_POLY1305_SHA256
Daiki Ueno [Thu, 29 Apr 2021 16:25:55 +0000 (18:25 +0200)] 
tests: tls13-early-data: use TLS_CHACHA20_POLY1305_SHA256

When resuming in TLS 1.3, the negotiated PRF hash must match the one
used in the initial handshake.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agotests: remove shell-script wrapper for tls13/prf-early
Daiki Ueno [Thu, 29 Apr 2021 16:09:01 +0000 (18:09 +0200)] 
tests: remove shell-script wrapper for tls13/prf-early

The wrapper (tls13/prf-early.sh) was merely for running
tls13/prf-early under datefudge.  The same thing can now be done with
virt_time_init_at.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agotests: virt-time: add virt_time_init_at
Daiki Ueno [Thu, 29 Apr 2021 15:56:37 +0000 (17:56 +0200)] 
tests: virt-time: add virt_time_init_at

This allows the tests to set the current time to arbitrary point,
instead of the current time; useful for the tests checking the traces
such as tls13/prf-early.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agognutls_init: add flag to omit EndOfEarlyData messages
Daiki Ueno [Thu, 29 Apr 2021 06:35:02 +0000 (08:35 +0200)] 
gnutls_init: add flag to omit EndOfEarlyData messages

The message is prohibited in QUIC:
https://tools.ietf.org/html/draft-ietf-quic-tls-34#section-8.3

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agognutls_init: redefine GNUTLS_ENABLE_EARLY_DATA flag for client
Daiki Ueno [Thu, 29 Apr 2021 06:26:46 +0000 (08:26 +0200)] 
gnutls_init: redefine GNUTLS_ENABLE_EARLY_DATA flag for client

The flag was only for the server, but it turned out to be useful for
client to explicitly indicate early data, when 0-RTT is handled
out-of-band as in QUIC.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agostate: call secret_func on early write key change as well
Daiki Ueno [Thu, 29 Apr 2021 06:23:15 +0000 (08:23 +0200)] 
state: call secret_func on early write key change as well

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agoMerge branch 'wip/dueno/build-fixes' into 'master'
Daiki Ueno [Thu, 13 May 2021 09:12:18 +0000 (09:12 +0000)] 
Merge branch 'wip/dueno/build-fixes' into 'master'

CI updates and build fixes spotted by GCC 11

See merge request gnutls/gnutls!1430

5 years ago.gitlab-ci.yml: doc-dist.Fedora: invoke "texconfig rehash"
Daiki Ueno [Thu, 13 May 2021 06:38:20 +0000 (08:38 +0200)] 
.gitlab-ci.yml: doc-dist.Fedora: invoke "texconfig rehash"

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agosystemkey: remove unused --inder and --infile options
Daiki Ueno [Thu, 13 May 2021 06:01:27 +0000 (08:01 +0200)] 
systemkey: remove unused --inder and --infile options

While those options have no effect, the command previously tried to
open a file for reading and leaked file descriptor.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agokeylog: suppress -Wanalyzer-file-leak warnings
Daiki Ueno [Wed, 12 May 2021 14:55:37 +0000 (16:55 +0200)] 
keylog: suppress -Wanalyzer-file-leak warnings

This workarounds the following warnings with gcc analyzer:

  kx.c:156:69: error: leak of FILE '<unknown>' [CWE-775] [-Werror=analyzer-file-leak]
    156 |                         _gnutls_bin2hex(session->security_parameters.
        |                                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
    157 |                                         client_random, GNUTLS_RANDOM_SIZE,
        |                                         ~~~~~~~~~~~~~

This should be harmless because the keylog file pointer is closed in
the ELF destructor.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years ago.gitlab-ci.yml: update build images to Fedora 34 and Alpine 3.13
Daiki Ueno [Wed, 12 May 2021 12:46:56 +0000 (14:46 +0200)] 
.gitlab-ci.yml: update build images to Fedora 34 and Alpine 3.13

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agodevel: regenerate abidw dump files
Daiki Ueno [Wed, 12 May 2021 12:44:37 +0000 (14:44 +0200)] 
devel: regenerate abidw dump files

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years ago.gitlab-ci.yml: bump cache version
Daiki Ueno [Tue, 11 May 2021 13:29:03 +0000 (15:29 +0200)] 
.gitlab-ci.yml: bump cache version

This should fix the nettle_streebog512_update detection.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agosrptool: add missing fclose on error path
Daiki Ueno [Tue, 11 May 2021 12:25:38 +0000 (14:25 +0200)] 
srptool: add missing fclose on error path

Spotted by gcc analyzer:
  srptool.c:113:32: warning: leak of FILE 'fp' [CWE-775] [-Wanalyzer-file-leak]
    113 |                         return -1;
        |                                ^
also:
  srptool.c:560:32: warning: leak of FILE 'fp' [CWE-775] [-Wanalyzer-file-leak]
    560 |                         return -1;
        |                                ^

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agotests: _check_wait_status: use only async-thread-safe function
Daiki Ueno [Thu, 13 May 2021 06:40:59 +0000 (08:40 +0200)] 
tests: _check_wait_status: use only async-thread-safe function

As this function shall be called in a signal handler, it shouldn't use
'exit' as it's not async-thread-safe.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agognutls-serv: use only async-signal-safe functions in signal handler
Daiki Ueno [Tue, 11 May 2021 12:23:45 +0000 (14:23 +0200)] 
gnutls-serv: use only async-signal-safe functions in signal handler

Spotted by gcc analyzer:
  serv.c:1138:9: warning: call to 'exit' from within signal handler [CWE-479] [-Wanalyzer-unsafe-call-within-signal-handler]
   1138 |         exit(1);
        |         ^~~~~~~

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agocerttool: tighten allocation check
Daiki Ueno [Tue, 11 May 2021 12:13:45 +0000 (14:13 +0200)] 
certtool: tighten allocation check

Spotted by gcc analyzer:
  certtool-cfg.c:856:24: warning: use of possibly-NULL 'copy' where non-null expected [CWE-690] [-Wanalyzer-possible-null-argument]
    856 |                 while (strcmp(pass, copy) != 0
        |                        ^~~~~~~~~~~~~~~~~~

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agopsktool: tighten allocation check
Daiki Ueno [Tue, 11 May 2021 12:08:33 +0000 (14:08 +0200)] 
psktool: tighten allocation check

Spotted by gcc analyzer:
  psk.c:275:21: warning: use of possibly-NULL '_username.data' where non-null expected [CWE-690] [-Wanalyzer-possible-null-argument]
    275 |                 if (strncmp(p, (const char *) _username.data,
        |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years ago.gitignore: ignore more files
Daiki Ueno [Tue, 11 May 2021 11:16:51 +0000 (13:16 +0200)] 
.gitignore: ignore more files

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years ago_tls13_{derive,expand}_secret2: fix array parameter mismatch
Daiki Ueno [Tue, 11 May 2021 09:08:59 +0000 (11:08 +0200)] 
_tls13_{derive,expand}_secret2: fix array parameter mismatch

This suppresses the warning with -Warray-parameter
  secrets.c:85:40: warning: argument 6 of type 'const uint8_t[64]' {aka 'const unsigned char[64]'} with mismatched bound [-Warray-parameter=]
     85 |                          const uint8_t secret[MAX_HASH_SIZE],
        |                          ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
  In file included from secrets.c:28:
  secrets.h:43:41: note: previously declared as 'const uint8_t[32]' {aka 'const unsigned char[32]'}
     43 |                           const uint8_t secret[MAX_CIPHER_KEY_SIZE],
        |                           ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years ago_gnutls_retrieve_pin: remove array declarator in function argument
Daiki Ueno [Tue, 11 May 2021 09:04:54 +0000 (11:04 +0200)] 
_gnutls_retrieve_pin: remove array declarator in function argument

This was originally to eliminate the warnings with -Warray-parameter:

  pin.c:70:27: warning: argument 5 of type 'char[256]' with mismatched bound [-Warray-parameter=]
     70 |                      char pin[GNUTLS_PKCS11_MAX_PIN_LEN], unsigned pin_size)
        |                      ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  In file included from pin.c:23:
  ./pin.h:9:48: note: previously declared as 'char *'
      9 |                      unsigned pin_flags, char *pin, unsigned pin_size);
        |                                          ~~~~~~^~~

though it turned out to be unnecessary because the function merely
delegate the call to the user-supplied callbacks.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agoMerge branch 'its-spelling' into 'master'
Daiki Ueno [Thu, 6 May 2021 07:10:42 +0000 (07:10 +0000)] 
Merge branch 'its-spelling' into 'master'

spelling: The possessive pronoun "its" has no apostrophe.

See merge request gnutls/gnutls!1426

5 years agospelling: The possessive pronoun "its" has no apostrophe.
Daniel Kahn Gillmor [Wed, 5 May 2021 22:05:29 +0000 (18:05 -0400)] 
spelling: The possessive pronoun "its" has no apostrophe.

"it's" is for contractions like "it is" or "it has".  "its" is a
possessive pronoun, like "his" or "hers" or "theirs", none of which
have an apostrophe in them either.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
5 years agoMerge branch 'fix-provable-constraints' into 'master'
Daiki Ueno [Wed, 5 May 2021 06:04:37 +0000 (06:04 +0000)] 
Merge branch 'fix-provable-constraints' into 'master'

certtool: Align warning about --provable with actual code

See merge request gnutls/gnutls!1425

5 years agocerttool: Align warning about --provable with actual code
Daniel Kahn Gillmor [Tue, 4 May 2021 19:08:08 +0000 (15:08 -0400)] 
certtool: Align warning about --provable with actual code

If I try to generate an ed25519 key, it is *not* an ECDSA key.  But I
see this warning:

    0 dkg@host:~$ certtool --generate-privkey --provable --key-type ed25519
    Generating a 256 bit EdDSA (Ed25519) private key ...
    The --provable parameter cannot be used with ECDSA keys.
    1 dkg@host:~$

Looking at the code and documentation, it's clear that --provable only
works for RSA and DSA.  This fix aligns the warning message with the
underlying mechanism.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
5 years agoMerge branch 'wip/dueno/trusted-ca-sha1' into 'master'
Daiki Ueno [Tue, 4 May 2021 18:45:03 +0000 (18:45 +0000)] 
Merge branch 'wip/dueno/trusted-ca-sha1' into 'master'

x509/verify: treat SHA-1 signed CA in the trusted set differently

Closes #1202

See merge request gnutls/gnutls!1423

5 years agox509/verify: treat SHA-1 signed CA in the trusted set differently
Daiki Ueno [Mon, 3 May 2021 14:35:43 +0000 (16:35 +0200)] 
x509/verify: treat SHA-1 signed CA in the trusted set differently

Suppose there is a certificate chain ending with an intermediate CA:
EE → ICA1 → ICA2.  If the system trust store contains a root CA
generated with the same key as ICA2 but signed with a prohibited
algorithm, such as SHA-1, the library previously reported a
verification failure, though the situation is not uncommon during a
transition period of root CA.

This changes the library behavior such that the check on signature
algorithm will be skipped when examining the trusted root CA.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agoMerge branch 'wip/dueno/implicit-init' into 'master'
Daiki Ueno [Tue, 4 May 2021 08:58:04 +0000 (08:58 +0000)] 
Merge branch 'wip/dueno/implicit-init' into 'master'

global: rename GNUTLS_NO_EXPLICIT_INIT to GNUTLS_NO_IMPLICIT_INIT

Closes #1178

See merge request gnutls/gnutls!1424

5 years agoglobal: rename GNUTLS_NO_EXPLICIT_INIT to GNUTLS_NO_IMPLICIT_INIT
Daiki Ueno [Mon, 3 May 2021 15:27:56 +0000 (17:27 +0200)] 
global: rename GNUTLS_NO_EXPLICIT_INIT to GNUTLS_NO_IMPLICIT_INIT

The old envvar still has effect but has been marked as deprecated.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agoMerge branch 'tlsv1.3-cb' into 'master'
Daiki Ueno [Mon, 3 May 2021 12:33:12 +0000 (12:33 +0000)] 
Merge branch 'tlsv1.3-cb' into 'master'

Implement new tls channel biding types

Closes #1214 and #1041

See merge request gnutls/gnutls!1422

5 years agocerttool: fix parsing of --verify-profile option
Daiki Ueno [Mon, 3 May 2021 12:19:22 +0000 (14:19 +0200)] 
certtool: fix parsing of --verify-profile option

Signed-off-by: Daiki Ueno <ueno@gnu.org>
5 years agoAdd tests for call gnutls_session_channel_binding
Ruslan N. Marchenko [Sun, 2 May 2021 21:29:39 +0000 (23:29 +0200)] 
Add tests for call gnutls_session_channel_binding

 Add test unit which executes positive and negative test scenarios
 using standard gnutls testing framework.

Signed-off-by: Ruslan N. Marchenko <me@ruff.mobi>