Previously, the test suite checked the existence of faketime or
datefudge at "make check", multiple times when it is needed. This
moves the check to configure and check it only once.
Signed-off-by: Daiki Ueno <ueno@gnu.org> Co-authored-by: Andreas Metzler <ametzler@bebt.de>
This adds a new keyword in the configuration file, "tls-session-hash",
which shall appear in the [overrides] section and takes either
"request" or "require" as the argument. This is particularly useful
when reverting the EMS requirement in FIPS mode for interoperability
reasons.
Daiki Ueno [Thu, 29 Jun 2023 08:04:51 +0000 (10:04 +0200)]
tls1-prf: mark use of non-EMS PRF non-approved in FIPS
This adds service indicator transitions around the use of TLS 1.2 PRF.
As of May 16, 2023, the use of extended master secret is mandatory
according to FIPS 140-3 IG. This patch detects the usage of non-EMS
KDF by checking the label: if it is "master secret", the service
indicator transitions to a non-approved state.
Andreas Metzler [Sun, 4 Jun 2023 11:53:43 +0000 (13:53 +0200)]
Automate and fix manpage copyright year update
Handle manpage copyright year update in update-copyright-year
target, and fix the library manpage copyright year statement, $(YEAR)
expanded to an empty string
Daiki Ueno [Thu, 1 Jun 2023 14:08:24 +0000 (16:08 +0200)]
tests: update tests/suite/ciphersuite after a96b04ff
The commit a96b04ffcf8fd7375dc3c0f90602bf679f5a9791 introduced a new
field in gnutls_cipher_suite_entry_st for gnutls_ciphersuite_get. The
scan-gnutls.sh script needs to be updated to correctly parse the
ciphersuites list. This also fixes the include path so the test
doesn't require gnutls to be installed on the system.
tests: make testcompat-openssl-tls13-serv.sh less flaky
Bash has a special variable GROUPS[1] which clashes with our use in
testcompat-openssl-tls13-serv.sh as a list of key exchange groups.
This avoids using it as well as expands the logging message to
indicate what is tested.
pkcs11.c: In function 'gnutls_pkcs11_token_get_info':
pkcs11.c:2535:25: error: 'str' may be used uninitialized [-Werror=maybe-uninitialized]
2535 | memcpy(output, str, len);
| ^~~~~~~~~~~~~~~~~~~~~~~~
GCC analyzer from GCC 13 reports an error when a pointer dereference
followed by a memcpy:
x509_dn.c:54:17: error: check of '*name.data' for NULL after already dereferencing it [-Werror=analyzer-deref-before-check]
54 | memcpy(_oid, name->data, name->size);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This is a false-positive, because we check name->size is > 0 on a
previous line.
Asterisk sometimes generates this, and it seems like a valid case. If
the first fragment is 1 byte then subsequent fragments will still try to
merge into it so it needs to have a big enough buffer for this to happen.
Signed-off-by: Stephen Paul Weber <singpolyma@singpolyma.net>
Daiki Ueno [Thu, 11 May 2023 00:52:20 +0000 (09:52 +0900)]
crypto-selftests: mark CFB8 block sizes tests optional
It was not obvious that the second function supplied to CASE2 macro
was only called when GNUTLS_SELF_TEST_FLAG_ALL is set. This splits
the macro into two: the one to be required and the other to be
optional.
Daiki Ueno [Mon, 1 May 2023 23:41:08 +0000 (08:41 +0900)]
psk: Add basic support for RFC 9258 external PSK importer interface
This adds a minimal, callback-based API to import external PSK,
following RFC 9258. The client and the server importing external PSK
are supposed to set a callback to retrieve PSK, which returns flags
that may indicate the PSK is imported, along with the key:
Those callbacks are responsible to call
gnutls_psk_format_imported_identity() for external PSKs to build a
serialized PSK identity, and set GNUTLS_PSK_KEY_EXT in flags if the
identity is an imported one.
Daiki Ueno [Thu, 16 Mar 2023 01:33:14 +0000 (10:33 +0900)]
build: switch to using clang-format instead of GNU indent
GNU indent yields weird output when using the Linux kernel coding
style as in the below examples, which affects code readability.
- Too long lines cause unexpected indentation:
if (!
(priv->flags &
GNUTLS_PKCS11_OBJ_FLAG_RETRIEVE_DISTRUSTED)
&& (priv->flags & GNUTLS_PKCS11_OBJ_FLAG_OVERWRITE_TRUSTMOD_EXT)
&& data.size > 0) {
- Unary operators (`-` and `+`) after a type cast are not recognized
properly: `(time_t)-1` becomes `(time-t) - 1`
- Long conditionals are wrapped before binary operators, such as `&&`
or `||`. This is not mandatory in the style, but all the occurrences
are replaced with that style
This switches to using clang-format instead, with the configuration
used in the Linux kernel as of commit 596ff4a09b8981790e15572e8e7bc904df5835e7:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/.clang-format
This adds a mechanism to randomize the order of TLS extensions in the
ClientHello to make fingerprinting harder. The mechanism is enabled by
default and a new priority keyword %NO_EXTS_SHUFFLE has been added to
turn it off.
gnutls_psk_server_get_username only supports NUL-terminated usernames,
while we added support for non-NULL terminated usernames in d00638997fa269a975095d852633b48b2b64fbf9.
ktls: Do not return GNUTLS_E_INTERRUPTED/AGAIN from short writes
If sendmsg returns a short write, we end up going around the loop with
data_to_send being smaller. However if sendmsg then returns -EAGAIN
or -EINTR then we return an error. But we have "forgotten" that we
already sent some data.
This causes the caller to retry gnutls_record_send with the full
buffer (ie. with a buffer that has already been partially sent),
causing desynchronization.
Instead check if we sent some data in this case and return the number
of bytes sent.
Fixes: https://gitlab.com/gnutls/gnutls/-/issues/1470
Thanks: Dan Berrange for suggesting a fix Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
Daiki Ueno [Tue, 21 Feb 2023 05:46:09 +0000 (14:46 +0900)]
priority: add %FORCE_SESSION_HASH modifier
This adds a new priority string modifier %FORCE_SESSION_HASH, which
requires to negotiate extended master secret and aborts the connection
if the peer does not send the extension in hello messages.
Pedro Monreal [Thu, 16 Feb 2023 16:02:38 +0000 (17:02 +0100)]
pk: extend pair-wise consistency to cover DH key generation
Perform SP800 56A (rev 3) 5.6.2.1.4 Owner Assurance of Pair-wise
Consistency check, even if we only support ephemeral DH, as it is
required by FIPS 140-3 IG 10.3.A.
Signed-off-by: Pedro Monreal <pmgdeb@gmail.com> Co-authored-by: Daiki Ueno <ueno@gnu.org>