]> git.ipfire.org Git - thirdparty/strongswan.git/log
thirdparty/strongswan.git
3 years agoVersion bump to 5.9.3dr1 5.9.3dr1
Andreas Steffen [Wed, 31 Mar 2021 07:59:55 +0000 (09:59 +0200)] 
Version bump to 5.9.3dr1

3 years agotesting: Migrated p2pnat/medsrv-psk scenario to vici
Andreas Steffen [Tue, 30 Mar 2021 20:05:49 +0000 (22:05 +0200)] 
testing: Migrated p2pnat/medsrv-psk scenario to vici

3 years agotesting: Migrated p2pnat/behind-same-nat scenario to vici
Andreas Steffen [Tue, 30 Mar 2021 16:54:47 +0000 (18:54 +0200)] 
testing: Migrated p2pnat/behind-same-nat scenario to vici

3 years agotesting: Store mars credentials in the swanctl directory
Andreas Steffen [Sun, 28 Mar 2021 13:11:28 +0000 (15:11 +0200)] 
testing: Store mars credentials in the swanctl directory

3 years agotesting: Migrated redirect-active scenario to vici
Andreas Steffen [Sun, 28 Mar 2021 13:07:41 +0000 (15:07 +0200)] 
testing: Migrated redirect-active scenario to vici

3 years agotesting: Migrated ha/both-active scenario to vici
Andreas Steffen [Sat, 27 Mar 2021 21:15:13 +0000 (22:15 +0100)] 
testing: Migrated ha/both-active scenario to vici

3 years agotesting: Migrated ha/active-passive scenario to vici
Andreas Steffen [Sat, 27 Mar 2021 13:44:47 +0000 (14:44 +0100)] 
testing: Migrated ha/active-passive scenario to vici

3 years agotesting: Switched PTS measurements to /usr/sbin
Andreas Steffen [Tue, 23 Mar 2021 09:49:32 +0000 (10:49 +0100)] 
testing: Switched PTS measurements to /usr/sbin

Due to Debian 10 linking /bin to /usr/bin which drastically
increased the number of files in /bin, the PTS measurement
was switched to /usr/sbin with a lesser number of files.

3 years agowolfssl: Support SHAKE_256
Andreas Steffen [Fri, 19 Mar 2021 06:18:59 +0000 (07:18 +0100)] 
wolfssl: Support SHAKE_256

3 years agowolfssl: Support SHA3
Andreas Steffen [Thu, 18 Mar 2021 06:58:21 +0000 (07:58 +0100)] 
wolfssl: Support SHA3

3 years agowolfssl: Support AES_ECB
Andreas Steffen [Thu, 18 Mar 2021 06:28:00 +0000 (07:28 +0100)] 
wolfssl: Support AES_ECB

3 years agoopenssl: Migrate from deprecated EC_POINT_[set|get]_affine_coordinates_GFp() functions
Andreas Steffen [Fri, 19 Mar 2021 07:50:27 +0000 (08:50 +0100)] 
openssl: Migrate from deprecated EC_POINT_[set|get]_affine_coordinates_GFp() functions

3 years agolibcharon: Include libtpmtss in monolithic build
Petr Gotthard [Wed, 17 Mar 2021 11:14:47 +0000 (12:14 +0100)] 
libcharon: Include libtpmtss in monolithic build

3 years agotesting: Bump guest kernel to Linux 5.11
Andreas Steffen [Sun, 7 Mar 2021 13:39:44 +0000 (14:39 +0100)] 
testing: Bump guest kernel to Linux 5.11

3 years agoVersion bump to 5.9.2 5.9.2
Andreas Steffen [Fri, 26 Feb 2021 10:30:13 +0000 (11:30 +0100)] 
Version bump to 5.9.2

3 years agoMerge branch 'sha2-no-trunc'
Tobias Brunner [Tue, 23 Feb 2021 16:30:11 +0000 (17:30 +0100)] 
Merge branch 'sha2-no-trunc'

Closes strongswan/strongswan#215.

3 years agosave-keys: Fix length of AES-GCM with 12-byte ICV
Tobias Brunner [Tue, 23 Feb 2021 14:28:36 +0000 (15:28 +0100)] 
save-keys: Fix length of AES-GCM with 12-byte ICV

3 years agosave-keys: Add support for full-length HMAC-SHA256 for ESP
Michał Skalski [Mon, 22 Feb 2021 15:41:23 +0000 (16:41 +0100)] 
save-keys: Add support for full-length HMAC-SHA256 for ESP

Wireshark doesn't really support it, but this way it at least decodes
the ESP packets correctly and the encryption keys are saved and the
packets can be decrypted.  The full-length versions of SHA-384 and
SHA-512 are not supported by Wireshark as 256-bit is the longest ICV
it is able to decode currently.

3 years agokernel-netlink: Add support for full-length HMAC-SHA2 algorithms
Michał Skalski [Fri, 5 Feb 2021 05:59:13 +0000 (06:59 +0100)] 
kernel-netlink: Add support for full-length HMAC-SHA2 algorithms

3 years agokeymat: Add support for full-length HMAC-SHA2 algorithms
Michał Skalski [Mon, 22 Feb 2021 14:25:45 +0000 (15:25 +0100)] 
keymat: Add support for full-length HMAC-SHA2 algorithms

3 years agoaf-alg: Fix typo in algorithm mapping for full-size HMAC-SHA-256
Michał Skalski [Mon, 22 Feb 2021 14:48:37 +0000 (15:48 +0100)] 
af-alg: Fix typo in algorithm mapping for full-size HMAC-SHA-256

3 years agoVersion bump to 5.9.2rc2 5.9.2rc2
Andreas Steffen [Sun, 21 Feb 2021 09:40:34 +0000 (10:40 +0100)] 
Version bump to 5.9.2rc2

3 years agotesting: Use TLS 1.3 in TNC PT-TLS tests
Andreas Steffen [Sun, 21 Feb 2021 08:48:34 +0000 (09:48 +0100)] 
testing: Use TLS 1.3 in TNC PT-TLS tests

3 years agotesting: Added mgf1 plugin to load statement
Andreas Steffen [Fri, 19 Feb 2021 16:41:44 +0000 (17:41 +0100)] 
testing: Added mgf1 plugin to load statement

3 years agoMerge branch 'tls-fixes' 5.9.2rc1
Andreas Steffen [Thu, 18 Feb 2021 19:28:33 +0000 (20:28 +0100)] 
Merge branch 'tls-fixes'

3 years agoVersion bump to 5.9.2rc1
Andreas Steffen [Wed, 17 Feb 2021 12:34:06 +0000 (13:34 +0100)] 
Version bump to 5.9.2rc1

3 years agopt-tls-server: Make TLS client authentication optional as appropriate
Tobias Brunner [Thu, 18 Feb 2021 14:41:52 +0000 (15:41 +0100)] 
pt-tls-server: Make TLS client authentication optional as appropriate

3 years agotls-test: Add option to make client authentication optional
Tobias Brunner [Thu, 18 Feb 2021 14:36:59 +0000 (15:36 +0100)] 
tls-test: Add option to make client authentication optional

3 years agotls-server: Add flag that makes client authentication optional
Tobias Brunner [Thu, 18 Feb 2021 14:10:42 +0000 (15:10 +0100)] 
tls-server: Add flag that makes client authentication optional

This allows clients to send an empty certificate payload if the server
sent a certificate request.  If an identity was set previously, it will
be reset so get_peer_id() may be used to check if the client was
authenticated.

3 years agolibtls: Add control flags and replace GENERIC_NULLOK purpose with one
Tobias Brunner [Thu, 18 Feb 2021 14:03:29 +0000 (15:03 +0100)] 
libtls: Add control flags and replace GENERIC_NULLOK purpose with one

3 years agopt-tls-server: Explicitly request client authentication if necessary
Tobias Brunner [Thu, 18 Feb 2021 11:34:29 +0000 (12:34 +0100)] 
pt-tls-server: Explicitly request client authentication if necessary

The PT_TLS_AUTH_TLS_OR_SASL case currently can't be implemented properly
as TLS authentication will be enforced if a client identity is configured
on the TLS server socket.

3 years agotls-server: Use subject DN as peer identity if it was ID_ANY
Tobias Brunner [Thu, 18 Feb 2021 11:31:17 +0000 (12:31 +0100)] 
tls-server: Use subject DN as peer identity if it was ID_ANY

To request client authentication if we don't know the client's identity,
it's possible to use ID_ANY.  However, if we don't change the identity
get_peer_id() would still report ID_ANY after the authentication.

3 years agotesting: Adapt some checks as SHA-384 is now preferred for TLS signatures
Tobias Brunner [Thu, 18 Feb 2021 11:01:02 +0000 (12:01 +0100)] 
testing: Adapt some checks as SHA-384 is now preferred for TLS signatures

3 years agotls-eap: Only servers conclude EAP method after processing packets
Tobias Brunner [Thu, 18 Feb 2021 09:46:56 +0000 (10:46 +0100)] 
tls-eap: Only servers conclude EAP method after processing packets

As client with older TLS versions, we have to ack the receipt of the server's
Finished message instead.

Fixes: 083f38259c79 ("tls-eap: Conclude EAP method also after processing packets")
3 years agoike-sa: Properly set timing info for delete after rekeying
Stefan Berghofer [Thu, 18 Feb 2021 08:43:10 +0000 (09:43 +0100)] 
ike-sa: Properly set timing info for delete after rekeying

The job is queued properly, yet the timing information is wrong.

Signed-off-by: Stefan Berghofer <stefan.berghofer@secunet.com>
Fixes: ee61471113c2 ("implemented RFC4478 (repeated authentication)...")
3 years agoNEWS: Add news for 5.9.2
Tobias Brunner [Wed, 17 Feb 2021 14:24:36 +0000 (15:24 +0100)] 
NEWS: Add news for 5.9.2

3 years agodhcp: Properly initialize struct when binding to interface
Tobias Brunner [Tue, 16 Feb 2021 14:22:18 +0000 (15:22 +0100)] 
dhcp: Properly initialize struct when binding to interface

3 years agopts: Don't rely on BIOS event buffer to be null terminated
Tobias Brunner [Tue, 16 Feb 2021 14:15:38 +0000 (15:15 +0100)] 
pts: Don't rely on BIOS event buffer to be null terminated

3 years agotls-crypto: Fix potential memory leak
Tobias Brunner [Tue, 16 Feb 2021 13:50:50 +0000 (14:50 +0100)] 
tls-crypto: Fix potential memory leak

Fixes: d8e42a3d4e3c ("tls-crypto: Share private key search between client and server")
3 years agoike-sa-manager: Ensure we were able to create a new IKE_SA
Tobias Brunner [Tue, 16 Feb 2021 13:43:52 +0000 (14:43 +0100)] 
ike-sa-manager: Ensure we were able to create a new IKE_SA

This may happen if we are unable to allocate an SPI.

3 years agogithub: Bump wolfSSL to 4.7.0
Tobias Brunner [Tue, 16 Feb 2021 08:08:12 +0000 (09:08 +0100)] 
github: Bump wolfSSL to 4.7.0

3 years agocirrus: Use FreeBSD 12.2
Fedor Korotkov [Mon, 15 Feb 2021 18:58:55 +0000 (13:58 -0500)] 
cirrus: Use FreeBSD 12.2

This seems to fix the build with Autotools that recently started to fail
with:

autom4te-2.69: need GNU m4 1.4 or later: /usr/local/bin/gm4
aclocal: error: /usr/local/bin/autom4te-2.69 failed with exit status: 1
autoreconf-2.69: aclocal failed with exit status: 1

Closes strongswan/strongswan#197.

3 years agogithub: Fix emojis in templates
Tobias Brunner [Mon, 15 Feb 2021 14:30:03 +0000 (15:30 +0100)] 
github: Fix emojis in templates

3 years agogithub: Add security policy
Tobias Brunner [Thu, 21 Jan 2021 16:10:22 +0000 (17:10 +0100)] 
github: Add security policy

3 years agogithub: Add issue templates
Tobias Brunner [Thu, 21 Jan 2021 15:19:25 +0000 (16:19 +0100)] 
github: Add issue templates

3 years agobotan: Use strongSwan's RNG interface in Botan plugin
René Fischer [Fri, 22 Jan 2021 12:38:01 +0000 (13:38 +0100)] 
botan: Use strongSwan's RNG interface in Botan plugin

This allows using rng_t implementations provided by other plugins to
serve as RNG for Botan.

Closes strongswan/strongswan#192.

3 years agobotan: Extract helper function to map RNG quality to Botan RNG names
Tobias Brunner [Fri, 29 Jan 2021 15:48:03 +0000 (16:48 +0100)] 
botan: Extract helper function to map RNG quality to Botan RNG names

3 years agobotan: Look for Botan 3 in configure script
Tobias Brunner [Fri, 29 Jan 2021 15:45:02 +0000 (16:45 +0100)] 
botan: Look for Botan 3 in configure script

3 years agoike-sa: Avoid possible integer underflow when scheduling reauth after rekeying
Tobias Brunner [Fri, 15 Jan 2021 15:19:49 +0000 (16:19 +0100)] 
ike-sa: Avoid possible integer underflow when scheduling reauth after rekeying

If the reauthentication is scheduled while rekeying, the difference
might be negative, however, schedule_job() takes an unsigned int,
so the reauth would get scheduled very far in the future.

3 years agoha: Register new IKE_SAs before calling inherit_post()
Tobias Brunner [Fri, 15 Jan 2021 15:28:24 +0000 (16:28 +0100)] 
ha: Register new IKE_SAs before calling inherit_post()

3 years agoike-rekey: Register new IKE_SA before calling inherit_post()
Tobias Brunner [Fri, 15 Jan 2021 15:25:54 +0000 (16:25 +0100)] 
ike-rekey: Register new IKE_SA before calling inherit_post()

If rekeying and reauthetication coincided, the reauth job could get
scheduled to run immediately i.e. before checkin() was called.  So the
new IKE_SA would not get reauthenticated, however, the further delayed
delete job would later find the new IKE_SA and delete it.

3 years agoike-sa-manager: Add a method to register/check out new IKE_SAs
Tobias Brunner [Fri, 15 Jan 2021 15:09:59 +0000 (16:09 +0100)] 
ike-sa-manager: Add a method to register/check out new IKE_SAs

This way, jobs for new IKE_SAs (created via create_new()) may be
scheduled/queued before checkin() is called.  If they run before
that happens, they will now correctly block in checkout() instead of
doing nothing because the IKE_SA was not found.

3 years agoike-sa-manager: Rename checkout_new() to create_new()
Tobias Brunner [Fri, 15 Jan 2021 15:08:20 +0000 (16:08 +0100)] 
ike-sa-manager: Rename checkout_new() to create_new()

We don't actually check that SA out (i.e. it's not registered with the
manager).  That was originally different but had to be changed with
86993d6b9037 to avoid that SAs created for rekeying don't block other
threads on the manager.

3 years agoRemove redundant calls to set peer config after checking out IKE_SAs by config
Tobias Brunner [Fri, 15 Jan 2021 16:14:07 +0000 (17:14 +0100)] 
Remove redundant calls to set peer config after checking out IKE_SAs by config

3 years agoike-sa-manager: Make checkout_by_config() atomic
Tobias Brunner [Tue, 17 Mar 2020 08:39:17 +0000 (09:39 +0100)] 
ike-sa-manager: Make checkout_by_config() atomic

These changes should ensure that concurrent calls to checkout_by_config()
result in a single IKE_SA.  For instance, when acquires for different
children of the same connection are triggered concurrently.

There are two major changes to the interface:

 1) The peer config object is now always set on the returned IKE_SA.
    That was previously only the case if an existing IKE_SA was
    returned.

 2) The IKE_SA is now always registered with the manager and properly
    checked out, which also was only the case for existing IKE_SAs
    before.

3 years agoMerge branch 'tls13'
Tobias Brunner [Fri, 12 Feb 2021 14:14:37 +0000 (15:14 +0100)] 
Merge branch 'tls13'

This adds support for TLS 1.3 to libtls and adds several new features to
existing TLS versions (e.g. support for x25519/x448, EdDSA or RSA-PSS).

Unfortunately, TLS 1.3 is not really usable for TLS-based EAP methods in
practice because, in particular, key derivation is not yet standardized.
While it works between two strongSwan instances and even FreeRADIUS 3.0.21,
there will be compatibility issues in the future when implementations move
to a standardized scheme.  There are currently two Internet-Drafts in
development to specify that (see 121ac4b9e37e for details).  Until they are
more stable, the default maximum version is set to 1.2.

The default minimum version has also been increased to 1.2 and several
older/weaker cipher suites have been removed (e.g. with 3DES and MD5).

3 years agotls-crypto: Simplify and extend cipher config filter
Tobias Brunner [Thu, 11 Feb 2021 17:10:56 +0000 (18:10 +0100)] 
tls-crypto: Simplify and extend cipher config filter

This way we automatically can filter for newer algorithms (e.g.
chacha20poly1305).

3 years agoproposal: Add aliases for AES-GCM/CCM without explicit ICV length
Tobias Brunner [Thu, 11 Feb 2021 17:06:49 +0000 (18:06 +0100)] 
proposal: Add aliases for AES-GCM/CCM without explicit ICV length

These are mapped to use the default, maximum ICV length of 16 bytes.

3 years agotls-server: Support x25519/448 for TLS 1.2
Tobias Brunner [Thu, 11 Feb 2021 16:47:55 +0000 (17:47 +0100)] 
tls-server: Support x25519/448 for TLS 1.2

3 years agotls-crypto: Fallback to any supported ECDH group
Tobias Brunner [Thu, 11 Feb 2021 16:46:17 +0000 (17:46 +0100)] 
tls-crypto: Fallback to any supported ECDH group

If the default group listed in the cipher suite is not supported, we try
to use any other supported group (the groups are negotiated separately
so we are not locked in to a specific group).

3 years agotls-crypto: Don't filter suites with specific ECDH group if any is available
Tobias Brunner [Thu, 11 Feb 2021 16:09:04 +0000 (17:09 +0100)] 
tls-crypto: Don't filter suites with specific ECDH group if any is available

Since DH groups (or with TLS < 1.3 curves) are negotiated separately,
it doesn't matter which one is listed in the cipher suite as any one could
be used.

3 years agodiffie-hellman: Classify x25519 and x448 as ECDH methods
Tobias Brunner [Thu, 11 Feb 2021 16:00:05 +0000 (17:00 +0100)] 
diffie-hellman: Classify x25519 and x448 as ECDH methods

3 years agotls-crypto: Add signature scheme config file filter
Pascal Knecht [Mon, 1 Feb 2021 20:41:56 +0000 (21:41 +0100)] 
tls-crypto: Add signature scheme config file filter

And add signature scheme unit tests.

3 years agotls-crypto: Rename DH group/key exchange method config option
Pascal Knecht [Mon, 18 Jan 2021 17:11:55 +0000 (18:11 +0100)] 
tls-crypto: Rename DH group/key exchange method config option

TLS key exchange methods are now configured with `ke_group`.

3 years agolibtls: Increase default min version to 1.2
Tobias Brunner [Wed, 27 Jan 2021 13:40:22 +0000 (14:40 +0100)] 
libtls: Increase default min version to 1.2

The older versions are generally considered deprecated (there is an
Internet-Draft that aims to do that formally).

3 years agotls-peer: Verify server selects the same cipher suite after HelloRetryRequest
Tobias Brunner [Fri, 22 Jan 2021 09:19:57 +0000 (10:19 +0100)] 
tls-peer: Verify server selects the same cipher suite after HelloRetryRequest

This is as per RFC 8446, section 4.1.4.

3 years agotls-server: Select cipher suite also when handling HelloRetryRequest
Tobias Brunner [Fri, 22 Jan 2021 09:06:05 +0000 (10:06 +0100)] 
tls-server: Select cipher suite also when handling HelloRetryRequest

This was previously treated like a resumption, which it is clearly not.
Also added a check that verifies that the same cipher suite is selected
during the retry, as per RFC 8446, section 4.1.4.

3 years agotls-server: Remove unused variable
Tobias Brunner [Fri, 22 Jan 2021 08:41:22 +0000 (09:41 +0100)] 
tls-server: Remove unused variable

3 years agolibtls: Add downgrade protection for TLS 1.3 and TLS 1.2
Pascal Knecht [Sun, 17 Jan 2021 15:33:02 +0000 (16:33 +0100)] 
libtls: Add downgrade protection for TLS 1.3 and TLS 1.2

Section 4.1.3 in RFC 8446 defines a new downgrade protection mechanism
that also affects TLS 1.2.

3 years agotls-server: Optionally omit CAs in CertificateRequest messages
Shmulik Ladkani [Fri, 15 Jan 2021 13:45:34 +0000 (14:45 +0100)] 
tls-server: Optionally omit CAs in CertificateRequest messages

Usually, the DNs of all loaded CA certificates are included in the
CertificateRequest messages sent by the server.

Alas, certain EAP-TLS clients fail to process this message if the
list is too long, returning the fatal TLS alert 'illegal parameter'.

This new option allows configuring whether CAs are included or an
empty list is sent (TLS 1.2), or the certificate_authorities extension
is omitted (TLS 1.3).  The list only serves as hint/constraint
for clients during certificate selection, they still have to provide
a certificate but are free to select any one they have available.

Closes strongswan/strongswan#187.

3 years agotls-eap: Conclude EAP method also after processing packets
Tobias Brunner [Thu, 14 Jan 2021 17:02:00 +0000 (18:02 +0100)] 
tls-eap: Conclude EAP method also after processing packets

With TLS 1.3, the server sends its Finished message first, so the
session is complete after processing the client's Finished message,
without having to send anything else (in particular no acknowledgement
as the last message from the client is no fragment).

3 years agolibtls: Only run socket tests with EdDSA keys if they are supported
Tobias Brunner [Thu, 14 Jan 2021 14:45:34 +0000 (15:45 +0100)] 
libtls: Only run socket tests with EdDSA keys if they are supported

ECDSA support is currently required to run the tests because ECDSA
cipher suites are not filtered when determining the supported cipher
suites.  Also required are ECDH groups.

3 years agotls-peer: Don't log anything if we are not sending supported groups
Tobias Brunner [Thu, 14 Jan 2021 15:14:47 +0000 (16:14 +0100)] 
tls-peer: Don't log anything if we are not sending supported groups

3 years agotls-crypto: Only log modified TLS versions if successfully set
Tobias Brunner [Thu, 14 Jan 2021 14:11:13 +0000 (15:11 +0100)] 
tls-crypto: Only log modified TLS versions if successfully set

If no cipher suites are available, the new versions are the previous
values but reversed (i.e. the versions were not changed but we still
ended up with a log message saying "TLS min/max TLS 1.3/TLS 1.0 ...").

Also switched to using the numeric version names to avoid the repeated
"TLS" prefix.

3 years agolibtls: Reduce default max version to 1.2
Tobias Brunner [Wed, 13 Jan 2021 14:26:33 +0000 (15:26 +0100)] 
libtls: Reduce default max version to 1.2

Using TLS 1.3 with various EAP methods is not yet fully standardized, so we
don't enable it by default yet.

3 years agolibtls: Make min/max TLS version configurable
Tobias Brunner [Wed, 13 Jan 2021 13:40:40 +0000 (14:40 +0100)] 
libtls: Make min/max TLS version configurable

Except for the tls_test tool, the versions now default to those
configured in strongswan.conf.

3 years agotest-hkdf: Add two test cases and restructure all tests
Pascal Knecht [Sun, 22 Nov 2020 20:37:37 +0000 (21:37 +0100)] 
test-hkdf: Add two test cases and restructure all tests

RFC 8448 contains multiple TLS 1.3 message traces, this commit adds two
new test cases focusing on key derivation:

- Simple 1-RTT Handshake
- Resumed 0-RTT Handshake

Additionally, the whole test suite is restructured and duplicate code is
removed and consolidated.

3 years agotls-hkdf: Implement binder PSK generation
Pascal Knecht [Fri, 4 Dec 2020 18:01:00 +0000 (19:01 +0100)] 
tls-hkdf: Implement binder PSK generation

3 years agotls-hkdf: Implement resumption key generation
Pascal Knecht [Sun, 22 Nov 2020 20:30:45 +0000 (21:30 +0100)] 
tls-hkdf: Implement resumption key generation

3 years agotls-peer: Mutual authentication support for TLS 1.3
Pascal Knecht [Tue, 10 Nov 2020 13:50:59 +0000 (14:50 +0100)] 
tls-peer: Mutual authentication support for TLS 1.3

3 years agotls-peer: Derive application traffic keys after server finished message
Pascal Knecht [Tue, 10 Nov 2020 13:44:51 +0000 (14:44 +0100)] 
tls-peer: Derive application traffic keys after server finished message

The inbound key is used right away, the outbound key only after the
client finished message has been sent.

3 years agotls-peer: Use private key enumeration also in TLS versions < 1.2
Pascal Knecht [Tue, 17 Nov 2020 16:54:55 +0000 (17:54 +0100)] 
tls-peer: Use private key enumeration also in TLS versions < 1.2

Until now, key selection was based on tls_client_certificate_type_t and now
uses a simple mapping from these types to tls_signature_scheme_t.

3 years agotls-crypto: Share private key search between client and server
Pascal Knecht [Tue, 10 Nov 2020 09:22:12 +0000 (10:22 +0100)] 
tls-crypto: Share private key search between client and server

This way the client also properly considers the TLS version and the signature
schemes supported by the server.

Co-authored-by: Tobias Brunner <tobias@strongswan.org>
3 years agotls-test: Add support to require/verify client certificates
Pascal Knecht [Sun, 1 Nov 2020 15:39:00 +0000 (16:39 +0100)] 
tls-test: Add support to require/verify client certificates

Also add detailed usage output with description of all options.

3 years agotls-server: Mutual authentication support for TLS 1.3
Pascal Knecht [Fri, 30 Oct 2020 14:15:30 +0000 (15:15 +0100)] 
tls-server: Mutual authentication support for TLS 1.3

This commit also addresses the side effect that additional messages have
an influence on the derivation of the application traffic secrets. Therefore,
key derivation is relocated after the server finished message has been sent,
so the additional messages from the client (Certificate, CertificateVerify)
don't affect the key derivation. Only the outbound key is switched there, the
inbound key remains in use until the client's finished message has been
processed.

3 years agotls-server: Terminate connection if peer certificate is required but not sent
Pascal Knecht [Wed, 4 Nov 2020 12:07:49 +0000 (13:07 +0100)] 
tls-server: Terminate connection if peer certificate is required but not sent

This change mainly affects legacy TLS versions because TLS 1.3
connections are terminated by the server once the peer does not send a
CertificateVerify message next to its empty Certificate message.

3 years agotls-server: Make CertificateRequest conditional in old TLS versions
Pascal Knecht [Wed, 4 Nov 2020 11:22:58 +0000 (12:22 +0100)] 
tls-server: Make CertificateRequest conditional in old TLS versions

The server implementation now only sends a CertificateRequest message if
it has identity information to verify client certificates.

3 years agotls-server: Share trusted public key search between client and server
Pascal Knecht [Sun, 1 Nov 2020 16:01:14 +0000 (17:01 +0100)] 
tls-server: Share trusted public key search between client and server

3 years agotls-crypto: Move AEAD ownership to the protection layer
Pascal Knecht [Wed, 28 Oct 2020 20:54:09 +0000 (21:54 +0100)] 
tls-crypto: Move AEAD ownership to the protection layer

This separates key derivation from key switching.

3 years agotls-hkdf: Always use correct base key to derive finished message
Pascal Knecht [Sun, 8 Nov 2020 14:34:39 +0000 (15:34 +0100)] 
tls-hkdf: Always use correct base key to derive finished message

The cached traffic secrets change once the application traffic secrets
are derived, but we must always use the correct base key to derive the
finished message, which are the handshake traffic secrets (RFC 8446,
section 4.4).

3 years agolibtls: Add unit tests for Ed25519 and Ed448 keys
Pascal Knecht [Fri, 23 Oct 2020 20:56:03 +0000 (22:56 +0200)] 
libtls: Add unit tests for Ed25519 and Ed448 keys

TLS 1.0 to TLS 1.3 socket connection tests with each key type.

3 years agotls-test: Load keys of any type
Pascal Knecht [Fri, 23 Oct 2020 14:01:03 +0000 (16:01 +0200)] 
tls-test: Load keys of any type

Only RSA keys were possible until now.

3 years agotls-crypto: Support EdDSA keys with ECDSA cipher suites
Pascal Knecht [Fri, 23 Oct 2020 14:17:16 +0000 (16:17 +0200)] 
tls-crypto: Support EdDSA keys with ECDSA cipher suites

Ed25519 and Ed448 are now usable in all TLS versions for connections that
use an ECDSA cipher suite, as per RFC 8422.

3 years agotls-server: Consider supported signature algorithms when selecting key/certificate
Pascal Knecht [Mon, 12 Oct 2020 16:58:53 +0000 (18:58 +0200)] 
tls-server: Consider supported signature algorithms when selecting key/certificate

This won't work if the client doesn't send a `signature_algorithms`
extension.  But since the default is SHA1/RSA, most will send it to at
least announce stronger hash algorithms if not ECDSA.

3 years agotls-crypto: Distinguish between signing and verifying signature schemes
Pascal Knecht [Tue, 13 Oct 2020 11:54:38 +0000 (13:54 +0200)] 
tls-crypto: Distinguish between signing and verifying signature schemes

strongSwan supports RSA_PSS_RSAE schemes for signing but does not
differentiate between rsaEncryption and rsassaPss encoding. Thus
RSA_PSS_PSS schemes are only used for verifying signatures.

3 years agotls-server: Check if peer sent hash and signature algorithms
Pascal Knecht [Fri, 16 Oct 2020 07:28:49 +0000 (09:28 +0200)] 
tls-server: Check if peer sent hash and signature algorithms

It is mandatory to receive the `signature_algorithms` extension when a
server is authenticating with a certificate, which is always the case.

3 years agotls-crypto: Add missing signature scheme constants
Pascal Knecht [Sat, 10 Oct 2020 15:10:37 +0000 (17:10 +0200)] 
tls-crypto: Add missing signature scheme constants

Some peers, e.g. Firefox, send a wide range of signature algorithms. To
prevent numeric identifiers in the log these algorithms are added here.

3 years agotls-server: Fix invalid signature algorithm and supported groups parsing
Pascal Knecht [Fri, 9 Oct 2020 17:14:11 +0000 (19:14 +0200)] 
tls-server: Fix invalid signature algorithm and supported groups parsing

The extension's content length field was wrongly added to the content data.

Fixes: 06109c4717 ("Implemented "signature algorithm" hello extension")
3 years agotls-server: Support multiple client key shares
Pascal Knecht [Fri, 2 Oct 2020 16:11:45 +0000 (18:11 +0200)] 
tls-server: Support multiple client key shares

A client can send one or multiple key shares from which the server picks
one it supports (checked in its preferred order).  A retry is requested if
none of the key shares are supported.

3 years agolibtls: Add TLS version negotiation test cases
Pascal Knecht [Tue, 29 Sep 2020 12:15:19 +0000 (14:15 +0200)] 
libtls: Add TLS version negotiation test cases

These client to server negotiation test cases are implemented:
- TLS 1.0 => TLS 1.3
- TLS 1.1 => TLS 1.3
- TLS 1.2 => TLS 1.3
- TLS 1.3 => TLS 1.3

- TLS 1.3 => TLS 1.0
- TLS 1.3 => TLS 1.1
- TLS 1.3 => TLS 1.2
- TLS 1.3 => TLS 1.3

- TLS 1.0 => TLS 1.2
- TLS 1.1 => TLS 1.2
- TLS 1.2 => TLS 1.2
- TLS 1.3 => TLS 1.2