]> git.ipfire.org Git - thirdparty/gnutls.git/log
thirdparty/gnutls.git
3 years agohandshake: clear server's session ticket indication at rehandshake
Daiki Ueno [Mon, 31 Oct 2022 11:15:48 +0000 (20:15 +0900)] 
handshake: clear server's session ticket indication at rehandshake

While OpenSSL server doesn't indicate a session ticket in the second
handshake of TLS 1.2 rehandshake, GnuTLS client previously waited for
it as it didn't clear the internal flag (session_ticket_renew) thus
the effect remained.  This patch clears the flag properly at the end
of each handshake.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
3 years agoMerge branch 'master' into 'master'
Daiki Ueno [Thu, 3 Nov 2022 08:37:02 +0000 (08:37 +0000)] 
Merge branch 'master' into 'master'

gnutls_init: Always initialize *session

See merge request gnutls/gnutls!1652

3 years agopriority: fix typos in documentation
Eric Blake [Thu, 13 Oct 2022 22:21:21 +0000 (17:21 -0500)] 
priority: fix typos in documentation

Fixes: ac2751d8049bf97cf486469d3c3407b83dd1fb3c
Signed-off-by: Eric Blake <eblake@redhat.com>
3 years agopriority: Use gnutls_free consistently
Eric Blake [Fri, 14 Oct 2022 19:02:14 +0000 (14:02 -0500)] 
priority: Use gnutls_free consistently

The whole point of gnutls_calloc() is to allow an alternative to
malloc() where that alternative takes over all aspects of heap
management; as such, it is never safe to pair bare free() with memory
managed by gnutls.  Not to mention that it looks bad to mix calls to
gnutls_free() and free() to the same variable within the same
function.

Signed-off-by: Eric Blake <eblake@redhat.com>
3 years agoprivkey: Allow deinit after failed export
Eric Blake [Wed, 2 Nov 2022 13:48:19 +0000 (08:48 -0500)] 
privkey: Allow deinit after failed export

The documentation for gnutls_privkey_export_* states that the caller
must use gnutls_*_deinit on key, without mentioning whether this
requirement is still present when the function fails.  But the
implementation has a code path where key is left uninitialized.
Similar to the recent fix for *_init, guarantee that *key is set to a
sane value on all exit paths.

Signed-off-by: Eric Blake <eblake@redhat.com>
3 years agolib: Consistenly return sane results for all *_init()
Eric Blake [Fri, 14 Oct 2022 18:40:50 +0000 (13:40 -0500)] 
lib: Consistenly return sane results for all *_init()

After looking at gnutls_init(), I went and audited all other
*_init(gnutls_*_t) functions, to see if Bug #1414 applies in more
situations.  We had an inconsistent mix: some functions that went out
of their way to leave the parameter uninitialized on failure (such as
gnutls_x509_crt_init()); many that always left the parameter
initialized on failure (such as gnutls_x509_ext_ct_scts_init()), often
by relying on the gnutls_free() macro that assigns the pointer to NULL
after using the gnutls_free_function() callback pointer (such as
gnutls_pkcs11_obj_init()); but a few others that left stale pointers
on certain failures (such as gnutls_priority_init2()) or even which
used the wrong deallocation function (such as
gnutls_pkcs11_privkey_init()).

As with gnutls_init(), portable programs should either pre-initialize
memory to zero before calling _init() if they plan to unconditionally
call _deinit() (safe for all but gnutls_pkcs11_privkey_init()), or
they should avoid calling _deinit() if _init() failed.  But since we
can't force all existing clients to change, it is safest if we
unconditionally and consistently initialize the client's memory before
ALL failure paths.

Rather than try to adjust documentation of each *_init() function
(including those not needing a change), I instead generalized
documentation into the manual.

Signed-off-by: Eric Blake <eblake@redhat.com>
3 years agognutls_init: Always initialize *session
Eric Blake [Thu, 13 Oct 2022 19:07:29 +0000 (14:07 -0500)] 
gnutls_init: Always initialize *session

We provide gnutls_session_t as an opaque type, therefore, unless we
document otherwise, client code should not assume that there is a safe
initialization value to assign to such storage, leaving the only way
to properly initialize the type as a call to gnutls_init().  Likewise,
the documentation was clear that gnutls_deinit(session) must be used
after success, but ambiguous as to whether that was necessary after
failure.

Our implementation has always been such that the opaque types are
pointers under the hood, where gnutls_deinit(NULL) is a no-op, and
that (for gnutls_init at least) it is safe to omit a call to
gnutls_deinit(session) on failure.  But without documentation, clients
cannot rely on either of those facts; and our code base was
inconsistent on whether all other *_init/*_deinit function pairs
behave in the same manner (see the next commit).

A search of existing code in the wild shows that some clients
pre-initialize the memory to 0 (which happens to be safe although
currently undocumented), often by passing in a pointer to a
gnutls_session_t residing in a larger struct that was reserved with
calloc(), cleared with memset(), or similar; but this is not
universal, and there are other clients in the wild that pass in
uninitialized memory.  It's too late to change the documentation to
mandate that users should pre-initialize their memory to 0 prior to
gnutls_init(), although it doesn't hurt to recommend it for
portability when building for older versions of gnutls.

In most cases, using gnutls_deinit(session) after failure was a no-op
- most of our error exit paths use the gnutls_free() macro which has
the side effect of forcing the caller's pointer to NULL on failure
(since gnutls is built with GNUTLS_INTERNAL_BUILD defined).  We also
happen to be lucky for a user that pre-initializes their memory to 0
before calling gnutls_init() - any error exit path where we did not
touch the user's pointer leaves the client with gnutls_deinit(session)
being a no-op.  But if the client passes in an uninitialized pointer,
and FAIL_IF_LIB_ERROR triggers, then we fail the function while
leaving the pointer uninitialized, at which point the caller using
gnutls_deinit(session) attempts to free uninitialized memory, which
has potential security implications - yet we did not warn the client
to avoid gnutls_deinit() in that scenario.

The most robust fix is thus along two fronts: improving the
documentation to inform the user what they can expect, but also
tweaking our code to avoid undefined behavior with existing client
code bases by guaranteeing that whether or not the client
pre-initializes memory to 0 and/or calls gnutls_deinit() on failure,
they can't mess up.

Fixes: bug #1414.
Signed-off-by: Eric Blake <eblake@redhat.com>
3 years agobuild: Silence cppcheck false positive
Eric Blake [Wed, 2 Nov 2022 13:40:08 +0000 (08:40 -0500)] 
build: Silence cppcheck false positive

An upcoming patch will touch gnutls_pkcs11_privkey_init(), which is
sufficient to make the cppcheck portion of CI choke on a false
positive in the unrelated gnutls_pkcs11_privkey_import_url() because
the file becomes interesting again.  cppcheck is not smart enough to
realize that an out-of-scope memory reference stored in a[1] is not
going to be utilized by the later pkcs11_get_attribute_value(..., a,
1) outside the if block; but the solution is as simple as expanding
the scope of tval.

Signed-off-by: Eric Blake <eblake@redhat.com>
3 years agoMerge branch 'jas/drop-announcetxt' into 'master'
Simon Josefsson [Wed, 2 Nov 2022 08:31:00 +0000 (08:31 +0000)] 
Merge branch 'jas/drop-announcetxt' into 'master'

Drop stale doc/announce.txt.

See merge request gnutls/gnutls!1665

3 years agoMerge branch 'wip/dek-info' into 'master'
Daiki Ueno [Wed, 2 Nov 2022 06:55:59 +0000 (06:55 +0000)] 
Merge branch 'wip/dek-info' into 'master'

Handle private keys with lowercase hex digits in DEK-Info

Closes #1415

See merge request gnutls/gnutls!1655

3 years agoHandle private keys with lowercase hex digits in DEK-Info
Tim Kosse [Fri, 14 Oct 2022 13:51:28 +0000 (15:51 +0200)] 
Handle private keys with lowercase hex digits in DEK-Info

Some tools, for example win-acme, create encrypted private keys in OpenSSL's
traditional format containing lowercase hex digits in the IV part of the
DEK-Info PEM header. These key files are accepted by OpenSSL. Prior to this
patch, GnuTLS did reject these keys with GNUTLS_E_INVALID_REQUEST.

Signed-off-by: Tim Kosse <tim.kosse@filezilla-project.org>
Co-authored-by: Daiki Ueno <ueno@gnu.org>
3 years agoDrop stale doc/announce.txt.
Simon Josefsson [Mon, 31 Oct 2022 20:24:01 +0000 (21:24 +0100)] 
Drop stale doc/announce.txt.

Signed-off-by: Simon Josefsson <simon@josefsson.org>
3 years agoMerge branch 'jas/drop-guile' into 'master'
Simon Josefsson [Mon, 31 Oct 2022 20:20:46 +0000 (20:20 +0000)] 
Merge branch 'jas/drop-guile' into 'master'

Drop guile bindings.  See <https://gitlab.com/gnutls/guile/>.

See merge request gnutls/gnutls!1651

3 years agoMerge branch 'zfridric_devel3' into 'master'
Zoltán Fridrich [Mon, 31 Oct 2022 10:38:07 +0000 (10:38 +0000)] 
Merge branch 'zfridric_devel3' into 'master'

Fix removal of duplicate certs during verification

Closes #1335

See merge request gnutls/gnutls!1653

3 years agoFix removal of duplicate certs during verification
Zoltan Fridrich [Mon, 17 Oct 2022 13:27:37 +0000 (15:27 +0200)] 
Fix removal of duplicate certs during verification

Co-authored-by: Daiki Ueno <ueno@gnu.org>
Signed-off-by: Zoltan Fridrich <zfridric@redhat.com>
3 years agoDrop guile bindings. See <https://gitlab.com/gnutls/guile/>.
Simon Josefsson [Wed, 12 Oct 2022 13:02:35 +0000 (15:02 +0200)] 
Drop guile bindings.  See <https://gitlab.com/gnutls/guile/>.

Signed-off-by: Simon Josefsson <simon@josefsson.org>
3 years agoMerge branch 'zfridric_devel' into 'master'
Zoltán Fridrich [Wed, 26 Oct 2022 10:06:28 +0000 (10:06 +0000)] 
Merge branch 'zfridric_devel' into 'master'

Fix handshake segfault if no privkey is supplied

Closes #1412

See merge request gnutls/gnutls!1657

3 years agoMerge branch 'zfridric_devel2' into 'master'
Zoltán Fridrich [Wed, 26 Oct 2022 07:53:26 +0000 (07:53 +0000)] 
Merge branch 'zfridric_devel2' into 'master'

Ignore unknown algorithms received in compress_certificate extension

Closes #1416

See merge request gnutls/gnutls!1660

3 years agoMerge branch 'jas/update-libtasn1' into 'master'
Daiki Ueno [Wed, 26 Oct 2022 02:44:12 +0000 (02:44 +0000)] 
Merge branch 'jas/update-libtasn1' into 'master'

Update libtasn1 to 4.19.0.

See merge request gnutls/gnutls!1661

3 years agodoc: Add NEWS entry.
Simon Josefsson [Tue, 25 Oct 2022 12:46:30 +0000 (14:46 +0200)] 
doc: Add NEWS entry.

Signed-off-by: Simon Josefsson <simon@josefsson.org>
3 years agoUpdate libtasn1 to 4.19.0.
Simon Josefsson [Tue, 25 Oct 2022 12:45:29 +0000 (14:45 +0200)] 
Update libtasn1 to 4.19.0.

Signed-off-by: Simon Josefsson <simon@josefsson.org>
3 years agoMerge branch 'wip/dueno/ccm-tlen' into 'master'
Daiki Ueno [Tue, 25 Oct 2022 10:07:03 +0000 (10:07 +0000)] 
Merge branch 'wip/dueno/ccm-tlen' into 'master'

cipher: add restriction on CCM tag length under FIPS mode

See merge request gnutls/gnutls!1658

3 years agocipher: add restriction on CCM tag length under FIPS mode
Daiki Ueno [Fri, 21 Oct 2022 06:48:39 +0000 (15:48 +0900)] 
cipher: add restriction on CCM tag length under FIPS mode

This change prohibits any use of tag length other than 4, 6, 8, 10,
12, 14, and 16 bytes in CCM used under FIPS mode, in accordance with
SP800-38C A.1.  While use of tag lengths smaller than 8 bytes is not
recommended, we simply allow 4 and 6 bytes tags for now.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
3 years agocompress_certificate: fix err code on invalid length
Zoltan Fridrich [Mon, 24 Oct 2022 09:01:44 +0000 (11:01 +0200)] 
compress_certificate: fix err code on invalid length

Signed-off-by: Zoltan Fridrich <zfridric@redhat.com>
3 years agoIgnore unknown algorithms received in compress_certificate extension
Zoltan Fridrich [Fri, 21 Oct 2022 09:19:56 +0000 (11:19 +0200)] 
Ignore unknown algorithms received in compress_certificate extension

Signed-off-by: Zoltan Fridrich <zfridric@redhat.com>
3 years agoMerge branch 'wip/dueno/git-authors' into 'master'
Daiki Ueno [Fri, 21 Oct 2022 22:40:53 +0000 (22:40 +0000)] 
Merge branch 'wip/dueno/git-authors' into 'master'

build: fix AUTHORS generation

Closes #1409

See merge request gnutls/gnutls!1659

3 years agobuild: fix AUTHORS generation
Daiki Ueno [Fri, 21 Oct 2022 09:12:33 +0000 (18:12 +0900)] 
build: fix AUTHORS generation

Without revision supplied, git shortlog expects to read commits from
stdin and produces the following error:

    GEN      AUTHORS
  fatal: using multiple --group options with stdin is not supported

Signed-off-by: Daiki Ueno <ueno@gnu.org>
3 years agoFix handshake segfault if no privkey is supplied
Zoltan Fridrich [Thu, 20 Oct 2022 10:38:39 +0000 (12:38 +0200)] 
Fix handshake segfault if no privkey is supplied

Signed-off-by: Zoltan Fridrich <zfridric@redhat.com>
3 years agoMerge branch 'zfridric_devel2' into 'master'
Zoltán Fridrich [Wed, 19 Oct 2022 16:06:34 +0000 (16:06 +0000)] 
Merge branch 'zfridric_devel2' into 'master'

gnutls_rnd manage memory per-thread

Closes #1401

See merge request gnutls/gnutls!1647

3 years agognutls_rnd manage memory per-thread
Zoltan Fridrich [Fri, 23 Sep 2022 10:59:52 +0000 (12:59 +0200)] 
gnutls_rnd manage memory per-thread

Co-authored-by: Pedro Marzo <marzo.pedro@gmail.com>
Signed-off-by: Zoltan Fridrich <zfridric@redhat.com>
3 years agoMerge branch 'zfridric_devel' into 'master'
Zoltán Fridrich [Tue, 18 Oct 2022 12:30:14 +0000 (12:30 +0000)] 
Merge branch 'zfridric_devel' into 'master'

Add NO_STATUS_REQUEST priority string modifier

Closes #1378

See merge request gnutls/gnutls!1650

3 years agoAdd GNUTLS_NO_STATUS_REQUEST flag and NO_STATUS_REQUEST priority string modifier
Zoltan Fridrich [Tue, 4 Oct 2022 14:37:29 +0000 (16:37 +0200)] 
Add GNUTLS_NO_STATUS_REQUEST flag and NO_STATUS_REQUEST priority string modifier

Signed-off-by: Zoltan Fridrich <zfridric@redhat.com>
3 years agoMerge branch 'wip/dueno/symkey-limit' into 'master'
Daiki Ueno [Mon, 17 Oct 2022 12:29:17 +0000 (12:29 +0000)] 
Merge branch 'wip/dueno/symkey-limit' into 'master'

fips: mark symmetric key crypto operations with short key and output sizes non-approved

See merge request gnutls/gnutls!1643

3 years agofips: only mark HMAC as approved in PBKDF2
Daiki Ueno [Thu, 29 Sep 2022 12:19:26 +0000 (21:19 +0900)] 
fips: only mark HMAC as approved in PBKDF2

As ACVP only allows HMAC used with PBKDF2[1], this change marks other
hash algorithms not-approved.

1. https://pages.nist.gov/ACVP/draft-celi-acvp-pbkdf.html

Signed-off-by: Daiki Ueno <ueno@gnu.org>
3 years agofips: mark gnutls_key_generate with short key sizes non-approved
Daiki Ueno [Mon, 19 Sep 2022 16:25:51 +0000 (01:25 +0900)] 
fips: mark gnutls_key_generate with short key sizes non-approved

Signed-off-by: Daiki Ueno <ueno@gnu.org>
3 years agofips: mark PBKDF2 with short key and output sizes non-approved
Daiki Ueno [Mon, 19 Sep 2022 05:49:23 +0000 (14:49 +0900)] 
fips: mark PBKDF2 with short key and output sizes non-approved

Signed-off-by: Daiki Ueno <ueno@gnu.org>
3 years ago.gitignore: follow tests/fips-rsa-sizes naming change
Daiki Ueno [Thu, 6 Oct 2022 10:30:57 +0000 (19:30 +0900)] 
.gitignore: follow tests/fips-rsa-sizes naming change

Signed-off-by: Daiki Ueno <ueno@gnu.org>
3 years agotests: move FIPS service indicator functions to common file
Daiki Ueno [Mon, 17 Oct 2022 02:11:43 +0000 (11:11 +0900)] 
tests: move FIPS service indicator functions to common file

Signed-off-by: Daiki Ueno <ueno@gnu.org>
3 years agoMerge branch 'wip/dueno/ecdsa-hash-check' into 'master'
Daiki Ueno [Wed, 5 Oct 2022 22:34:01 +0000 (22:34 +0000)] 
Merge branch 'wip/dueno/ecdsa-hash-check' into 'master'

fips: fix checking on hash algorithm used in ECDSA

See merge request gnutls/gnutls!1644

3 years agoMerge branch 'wip/ktls_keyupdate' into 'master'
Daiki Ueno [Wed, 5 Oct 2022 21:56:35 +0000 (21:56 +0000)] 
Merge branch 'wip/ktls_keyupdate' into 'master'

KTLS key update support

See merge request gnutls/gnutls!1625

3 years agoKTLS: fallback to default
Frantisek Krenzelok [Mon, 5 Sep 2022 11:05:17 +0000 (13:05 +0200)] 
KTLS: fallback to default

If an error occurs during setting of keys either initial or key update
then fallback to default mode of operation (disable ktls) and let the
user know

Signed-off-by: Frantisek Krenzelok <krenzelok.frantisek@gmail.com>
3 years agoKTLS: rekey test
Frantisek Krenzelok [Tue, 9 Aug 2022 10:11:16 +0000 (12:11 +0200)] 
KTLS: rekey test

Signed-off-by: Frantisek Krenzelok <krenzelok.frantisek@gmail.com>
3 years agoKTLS: set write alert callback
Frantisek Krenzelok [Fri, 5 Aug 2022 14:38:02 +0000 (16:38 +0200)] 
KTLS: set write alert callback

Use callback for sending alerts.

Signed-off-by: Frantisek Krenzelok <krenzelok.frantisek@gmail.com>
3 years agoKTLS: receive key update
Frantisek Krenzelok [Mon, 22 Aug 2022 08:50:37 +0000 (10:50 +0200)] 
KTLS: receive key update

handle received GNUTLS_HANDSHAKE_KEY_UPDATE set keys accordingly

Signed-off-by: Frantisek Krenzelok <krenzelok.frantisek@gmail.com>
3 years agoKTLS: send update key request
Frantisek Krenzelok [Wed, 3 Aug 2022 12:20:35 +0000 (14:20 +0200)] 
KTLS: send update key request

Set hanshake send function after interface initialization
TODO: handel setting function differently

Signed-off-by: Frantisek Krenzelok <krenzelok.frantisek@gmail.com>
3 years agoKTLS: set new keys for keyupdate
Frantisek Krenzelok [Tue, 2 Aug 2022 11:35:39 +0000 (13:35 +0200)] 
KTLS: set new keys for keyupdate

set new keys durring gnutls_session_key_update()
setting keys

Signed-off-by: Frantisek Krenzelok <krenzelok.frantisek@gmail.com>
3 years agoKTLS: set key on specific interfaces
Frantisek Krenzelok [Tue, 2 Aug 2022 13:00:50 +0000 (15:00 +0200)] 
KTLS: set key on specific interfaces

It is now possible to set key on specific interface.
If interface given is not ktls enabled then it will be ignored.

Signed-off-by: Frantisek Krenzelok <krenzelok.frantisek@gmail.com>
3 years agoMerge branch 'zfridric_devel' into 'master'
Zoltán Fridrich [Mon, 3 Oct 2022 10:16:45 +0000 (10:16 +0000)] 
Merge branch 'zfridric_devel' into 'master'

Make XTS key check failure not fatal

Closes #1408

See merge request gnutls/gnutls!1648

3 years agoMake XTS key check failure not fatal
Zoltan Fridrich [Thu, 29 Sep 2022 13:31:28 +0000 (15:31 +0200)] 
Make XTS key check failure not fatal

Signed-off-by: Zoltan Fridrich <zfridric@redhat.com>
3 years agoMerge branch 'interop-nss' into 'master'
Daiki Ueno [Sat, 1 Oct 2022 09:44:26 +0000 (09:44 +0000)] 
Merge branch 'interop-nss' into 'master'

NSS interoperability test - 2way TLSv1.3

See merge request gnutls/gnutls!1649

3 years agoNSS interoperability test - 2way TLSv1.3
Stanislav Zidek [Fri, 30 Sep 2022 13:36:17 +0000 (15:36 +0200)] 
NSS interoperability test - 2way TLSv1.3

Signed-off-by: Stanislav Zidek <szidek@redhat.com>
3 years agoMerge branch 'zfridric_devel' into 'master'
Zoltán Fridrich [Thu, 29 Sep 2022 09:42:05 +0000 (09:42 +0000)] 
Merge branch 'zfridric_devel' into 'master'

Reduce sensitive language

See merge request gnutls/gnutls!1640

3 years agofips: mark composite signature API not-approved
Daiki Ueno [Thu, 29 Sep 2022 08:13:00 +0000 (17:13 +0900)] 
fips: mark composite signature API not-approved

This makes the FIPS service indicator to transit to not-approved when
gnutls_privkey_sign_hash* is used.  In FIPS, single-shot
API (gnutls_privkey_sign_data*) is preferred over composite API.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
3 years agofips: fix checking on hash algorithm used in ECDSA
Daiki Ueno [Tue, 20 Sep 2022 07:06:13 +0000 (16:06 +0900)] 
fips: fix checking on hash algorithm used in ECDSA

Previously we checked against the "preferred" hash algorithm based on
the curve, instead of the one actually used.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
3 years agoMerge branch '3.7.8' into 'master' 3.7.8
Zoltán Fridrich [Tue, 27 Sep 2022 12:39:17 +0000 (12:39 +0000)] 
Merge branch '3.7.8' into 'master'

Release 3.7.8

See merge request gnutls/gnutls!1646

3 years agoRelease 3.7.8
Alexander Sosedkin [Wed, 21 Sep 2022 12:56:49 +0000 (14:56 +0200)] 
Release 3.7.8

Not bumping LT_CURRENT / LT_AGE since abi-check reports no changes.

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 years agoNEWS: add an entry for allowlisting-relaxing functions restriction
Alexander Sosedkin [Wed, 21 Sep 2022 12:26:55 +0000 (14:26 +0200)] 
NEWS: add an entry for allowlisting-relaxing functions restriction

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 years agoMerge branch 'wip/dueno/cpuid-symbol-rename' into 'master'
Zoltán Fridrich [Tue, 27 Sep 2022 10:40:30 +0000 (10:40 +0000)] 
Merge branch 'wip/dueno/cpuid-symbol-rename' into 'master'

accelerated: avoid symbol export mismatch with _gnutls_x86_cpuid_s

Closes #1370

See merge request gnutls/gnutls!1642

3 years agoReduce sensitive language
Zoltan Fridrich [Tue, 13 Sep 2022 15:07:37 +0000 (17:07 +0200)] 
Reduce sensitive language

Signed-off-by: Zoltan Fridrich <zfridric@redhat.com>
3 years agoaccelerated: avoid symbol export mismatch with _gnutls_x86_cpuid_s
Daiki Ueno [Sun, 18 Sep 2022 22:40:01 +0000 (07:40 +0900)] 
accelerated: avoid symbol export mismatch with _gnutls_x86_cpuid_s

If the LD doesn't have support for version scripts,
_gnutls_x86_cpuid_s is exported through libtool's
--export-symbols-regex and that causes link error with clang:

  libtool: link: nmedit -s .libs/libgnutls-symbols.expsym .libs/libgnutls.30.dylib
  /Library/Developer/CommandLineTools/usr/bin/nmedit: error: symbols names listed in: .libs/libgnutls-symbols.expsym not in: /opt/local/var/macports/build/_Users_marius_Development_MacPorts_ports_devel_gnutls/gnutls-devel/work/gnutls-3.7.5/lib/.libs/libgnutls.30.dylib
  __gnutls_x86_cpuid_s
  make[4]: *** [libgnutls.la] Error 1

This patch renames _gnutls_x86_cpuid_s to GNUTLS_x86_cpuid_s to avoid
the issue.

Problem investigated and fix suggested by Clemens Lang in:
https://gitlab.com/gnutls/gnutls/-/issues/1370#note_967832583

Signed-off-by: Daiki Ueno <ueno@gnu.org>
3 years agoMerge branch 'wip/dueno/cert-compression-followup' into 'master'
Daiki Ueno [Mon, 19 Sep 2022 21:52:35 +0000 (21:52 +0000)] 
Merge branch 'wip/dueno/cert-compression-followup' into 'master'

compress-cert: support compression of client certificates

Closes #1397

See merge request gnutls/gnutls!1641

3 years agocompress-cert: support compression of client certificates
Daiki Ueno [Sun, 18 Sep 2022 08:38:46 +0000 (17:38 +0900)] 
compress-cert: support compression of client certificates

Previously the compress_certificate extension was sent by the server
as part of ServerHello, which violates RFC 8879.  This patch instead
send it as an extension of CertificateRequest.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
3 years agoMerge branch 'zfridric_devel' into 'master'
Zoltán Fridrich [Tue, 13 Sep 2022 07:35:33 +0000 (07:35 +0000)] 
Merge branch 'zfridric_devel' into 'master'

Report system config file location via gnutls-cli

Closes #1399

See merge request gnutls/gnutls!1639

3 years agoReport system config file location via gnutls-cli
Zoltan Fridrich [Fri, 9 Sep 2022 11:32:16 +0000 (13:32 +0200)] 
Report system config file location via gnutls-cli

Signed-off-by: Zoltan Fridrich <zfridric@redhat.com>
3 years agoMerge branch 'fix_nettle_alignment' into 'master'
Daiki Ueno [Tue, 30 Aug 2022 00:22:35 +0000 (00:22 +0000)] 
Merge branch 'fix_nettle_alignment' into 'master'

cipher: Ensure correct alignment

See merge request gnutls/gnutls!1633

3 years agoMerge branch 'wip/dueno/cb-fixes' into 'master'
Daiki Ueno [Mon, 29 Aug 2022 07:47:13 +0000 (07:47 +0000)] 
Merge branch 'wip/dueno/cb-fixes' into 'master'

doc: mention GNUTLS_CB_TLS_EXPORTER

Closes #1391

See merge request gnutls/gnutls!1636

3 years agosrc: request tls-exporter only when unique master secrets are used
Daiki Ueno [Sat, 20 Aug 2022 02:06:07 +0000 (11:06 +0900)] 
src: request tls-exporter only when unique master secrets are used

This is to comply with RFC9266 4.2.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
3 years agognutls_session_channel_binding: perform check on "tls-exporter"
Daiki Ueno [Sun, 28 Aug 2022 21:41:46 +0000 (06:41 +0900)] 
gnutls_session_channel_binding: perform check on "tls-exporter"

According to RFC9622 4.2, the "tls-exporter" channel binding is only
usable when the handshake is bound to a unique master secret.  This
adds a check whether either TLS 1.3 or extended master secret
extension is negotiated.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
3 years agodoc: mention GNUTLS_CB_TLS_EXPORTER
Daiki Ueno [Sat, 20 Aug 2022 01:58:23 +0000 (10:58 +0900)] 
doc: mention GNUTLS_CB_TLS_EXPORTER

Signed-off-by: Daiki Ueno <ueno@gnu.org>
3 years agocipher: Ensure correct alignment
Doug Nazar [Tue, 16 Aug 2022 05:47:49 +0000 (01:47 -0400)] 
cipher: Ensure correct alignment

Unsigned math is required to calculate the current alignment.

Signed-off-by: Doug Nazar <nazard@nazar.ca>
3 years agoMerge branch 'wip/dueno/cpuid-fixes' into 'master'
Daiki Ueno [Wed, 24 Aug 2022 13:37:56 +0000 (13:37 +0000)] 
Merge branch 'wip/dueno/cpuid-fixes' into 'master'

accelerated: clear AVX bits if it cannot be queried through XSAVE

Closes #1282

See merge request gnutls/gnutls!1631

3 years agoMerge branch 'unload' into 'master'
Daiki Ueno [Tue, 23 Aug 2022 14:56:56 +0000 (14:56 +0000)] 
Merge branch 'unload' into 'master'

Unload custom allocators in gnutls_crypto_deinit()

Closes #1398

See merge request gnutls/gnutls!1637

3 years agoUnload custom allocators in gnutls_crypto_deinit()
Tobias Heider [Tue, 23 Aug 2022 11:47:38 +0000 (13:47 +0200)] 
Unload custom allocators in gnutls_crypto_deinit()

Closes #1398

Signed-off-by: Tobias Heider <tobias.heider@canonical.com>
3 years agoaccelerated: clear AVX bits if it cannot be queried through XSAVE
Daiki Ueno [Mon, 15 Aug 2022 00:39:18 +0000 (09:39 +0900)] 
accelerated: clear AVX bits if it cannot be queried through XSAVE

The algorithm to detect AVX is described in 14.3 of "Intel® 64 and IA-32
Architectures Software Developer’s Manual".

GnuTLS previously only followed that algorithm when registering the
crypto backend, while the CRYPTOGAMS derived SHA code assembly expects
that the extension bits are propagated to _gnutls_x86_cpuid_s.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
3 years agoMerge branch 'wip/dueno/cligen-update' into 'master'
Daiki Ueno [Thu, 18 Aug 2022 06:58:51 +0000 (06:58 +0000)] 
Merge branch 'wip/dueno/cligen-update' into 'master'

srptool: resurrect default value for -i

Closes #1394

See merge request gnutls/gnutls!1634

3 years agosrptool: resurrect default value for -i
Daiki Ueno [Thu, 18 Aug 2022 00:01:20 +0000 (09:01 +0900)] 
srptool: resurrect default value for -i

The default option value for -i (--index) was dropped during the
cligen conversion.  This adds it back for compatibility with the
existing command line usage.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
3 years agocligen: update git submodule
Daiki Ueno [Thu, 18 Aug 2022 00:00:44 +0000 (09:00 +0900)] 
cligen: update git submodule

Signed-off-by: Daiki Ueno <ueno@gnu.org>
3 years agoMerge branch 'restrict-allowlisting-api' into 'master'
Daiki Ueno [Wed, 17 Aug 2022 08:59:54 +0000 (08:59 +0000)] 
Merge branch 'restrict-allowlisting-api' into 'master'

restrict allowlisting api to before priority string initialization

See merge request gnutls/gnutls!1533

3 years agoMerge branch 'wip/dueno/fips-rsa-key-sizes' into 'master'
Daiki Ueno [Tue, 16 Aug 2022 14:20:15 +0000 (14:20 +0000)] 
Merge branch 'wip/dueno/fips-rsa-key-sizes' into 'master'

fips: mark RSA SigVer operation approved for known modulus sizes

See merge request gnutls/gnutls!1630

3 years agotests: add fips-rsa-sizes
Alexander Sosedkin [Tue, 16 Aug 2022 08:34:05 +0000 (10:34 +0200)] 
tests: add fips-rsa-sizes

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 years agoMerge branch 'int-conversion' into 'master'
Daiki Ueno [Tue, 16 Aug 2022 07:50:23 +0000 (07:50 +0000)] 
Merge branch 'int-conversion' into 'master'

windows: Avoid -Wint-conversion errors

See merge request gnutls/gnutls!1632

3 years agoupdate documentation on allowlisting API
Alexander Sosedkin [Wed, 16 Feb 2022 13:36:48 +0000 (14:36 +0100)] 
update documentation on allowlisting API

(in a separate commit so that it's easier to compare)

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 years agoplumb allowlisting API through the config, restrict usage to early times
Alexander Sosedkin [Wed, 16 Feb 2022 13:28:18 +0000 (14:28 +0100)] 
plumb allowlisting API through the config, restrict usage to early times

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 years agowindows: Avoid -Wint-conversion errors
Martin Storsjo [Mon, 15 Aug 2022 20:50:16 +0000 (23:50 +0300)] 
windows: Avoid -Wint-conversion errors

Clang 15 made "incompatible pointer to integer conversion" an error
instead of a plain warning. This fixes errors like these:

system/keys-win.c:257:13: error: incompatible pointer to integer conversion initializing 'HCRYPTHASH' (aka 'unsigned long') with an expression of type 'void *' [-Wint-conversion]
        HCRYPTHASH hHash = NULL;
                   ^       ~~~~

Signed-off-by: Martin Storsjo <martin@martin.st>
3 years agolib/priority: extract parts of cfg_apply into cfg_*_set_array*
Alexander Sosedkin [Tue, 15 Feb 2022 15:26:52 +0000 (16:26 +0100)] 
lib/priority: extract parts of cfg_apply into cfg_*_set_array*

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 years agolib/priority: move sigalgs filtering to set_ciphersuite_list
Alexander Sosedkin [Mon, 14 Feb 2022 17:00:25 +0000 (18:00 +0100)] 
lib/priority: move sigalgs filtering to set_ciphersuite_list

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 years agoMerge branch 'drop-3des-selftest' into 'master'
Daiki Ueno [Fri, 12 Aug 2022 23:07:11 +0000 (23:07 +0000)] 
Merge branch 'drop-3des-selftest' into 'master'

fips: disable GNUTLS_CIPHER_3DES_CBC self-test

See merge request gnutls/gnutls!1629

3 years agonettle: mark RSA SigVer operation approved for known modulus sizes
Daiki Ueno [Wed, 3 Aug 2022 07:39:47 +0000 (16:39 +0900)] 
nettle: mark RSA SigVer operation approved for known modulus sizes

SP800-131A rev2 suggests certain RSA modulus sizes under 2048
bits (1024, 1280, 1536, and 1792) may continue to be used for
signature verification but not for signature generation.  This loosen
the current service indicator report to approve them.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
3 years agonettle: check RSA modulus size in bits rather than bytes
Daiki Ueno [Tue, 9 Aug 2022 03:55:04 +0000 (12:55 +0900)] 
nettle: check RSA modulus size in bits rather than bytes

Previously we checked RSA modulus size clamped to byte unit instead of
bits.  This makes the check stricter by explicitly calculating the
modulus size in bits.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
3 years agofips: disable GNUTLS_CIPHER_3DES_CBC self-test
Alexander Sosedkin [Tue, 9 Aug 2022 10:08:24 +0000 (12:08 +0200)] 
fips: disable GNUTLS_CIPHER_3DES_CBC self-test

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
3 years agoMerge branch 'wip/dueno/interruptible' into 'master'
Daiki Ueno [Tue, 9 Aug 2022 10:31:48 +0000 (10:31 +0000)] 
Merge branch 'wip/dueno/interruptible' into 'master'

.gitlab-ci.yml: mark all CI jobs interruptible

Closes #1390

See merge request gnutls/gnutls!1628

3 years agoMerge branch 'interop' into 'master'
Daiki Ueno [Tue, 9 Aug 2022 09:44:36 +0000 (09:44 +0000)] 
Merge branch 'interop' into 'master'

interoperability testing with openssl

See merge request gnutls/gnutls!1623

3 years agoMerge branch 'tmp-ametzler-2022-bashism' into 'master'
Andreas Metzler [Tue, 9 Aug 2022 08:17:41 +0000 (08:17 +0000)] 
Merge branch 'tmp-ametzler-2022-bashism' into 'master'

Avoid &> redirection bashism in testsuite

See merge request gnutls/gnutls!1627

3 years ago.gitlab-ci.yml: mark all CI jobs interruptible
Daiki Ueno [Mon, 8 Aug 2022 04:54:13 +0000 (13:54 +0900)] 
.gitlab-ci.yml: mark all CI jobs interruptible

This allows previous pipelines to be cancelled if a new job is
submitted subsequently:
https://docs.gitlab.com/ee/ci/yaml/#interruptible

Suggested-by: Zoltán Fridrich <zfridric@redhat.com>
Signed-off-by: Daiki Ueno <ueno@gnu.org>
3 years agoMoved TLS interoperability tests to submodule.
Stanislav Zidek [Mon, 8 Aug 2022 21:07:21 +0000 (23:07 +0200)] 
Moved TLS interoperability tests to submodule.

Signed-off-by: Stanislav Zidek <szidek@redhat.com>
3 years agoAvoid &> redirection bashism in testsuite
Andreas Metzler [Sun, 31 Jul 2022 08:28:15 +0000 (10:28 +0200)] 
Avoid &> redirection bashism in testsuite

Broken by 7b700dbcd5907944a7dd2f74cd26ad8586cd4bac

Signed-off-by: Andreas Metzler <ametzler@bebt.de>
3 years agointeroperability testing with openssl
Stanislav Zidek [Thu, 11 Feb 2021 12:57:27 +0000 (13:57 +0100)] 
interoperability testing with openssl

GitLab CI extended to run 2way interoperability tests with openssl on
Fedora. Also prepared for adding further interoperability tests once
they are in better shape.

Signed-off-by: Stanislav Zidek <szidek@redhat.com>
3 years agoMerge branch 'wip/dueno/fips-pbes1' into 'master'
Daiki Ueno [Thu, 4 Aug 2022 09:28:58 +0000 (09:28 +0000)] 
Merge branch 'wip/dueno/fips-pbes1' into 'master'

_gnutls_decrypt_pbes1_des_md5_data: use public crypto API

Closes #1392

See merge request gnutls/gnutls!1626

3 years ago_gnutls_decrypt_pbes1_des_md5_data: use public crypto API
Daiki Ueno [Thu, 4 Aug 2022 07:37:51 +0000 (16:37 +0900)] 
_gnutls_decrypt_pbes1_des_md5_data: use public crypto API

This is a follow-up of e7f9267342bc2231149a640163c82b63c86f1dfd.  In
the decryption code path with PBES1, algorithm checks for FIPS was not
applied, because it used internal functions that bypass those checks.

Signed-off-by: Daiki Ueno <ueno@gnu.org>
3 years agoMerge branch 'jas/doc-fix-tls-exporter' into 'master'
Daiki Ueno [Sun, 31 Jul 2022 01:41:27 +0000 (01:41 +0000)] 
Merge branch 'jas/doc-fix-tls-exporter' into 'master'

Update doc for GNUTLS_CB_TLS_EXPORTER towards RFC9266.

See merge request gnutls/gnutls!1621