Commit Graph
3927 Commits
Author SHA1 Message Date
Tobias Brunner 544fb1cf92 pkcs8: Parse the decrypted PKCS#8 structure via regular builders
This allows other plugins to parse such structures directly.  The pkcs8
plugin is called recursively again if necessary.
2022-04-14 19:05:44 +02:00
Tobias Brunner 21b586c61c openssl: Fixes for RSA with OpenSSL 3.0 2022-04-14 19:05:44 +02:00
Tobias Brunner 36cf74f5d9 openssl: Fixes for DH with OpenSSL 3.0
While we could assign the DH object to a EVP_PKEY object, this won't work
with BoringSSL as it doesn't seem to support EVP_PKEY_derive() for DH.
2022-04-14 19:05:44 +02:00
Tobias Brunner f5710c9ccb openssl: Fixes for ECDH with OpenSSL 3.0
Uses new and non-deprecated APIs to create/generate key pairs.
2022-04-14 19:05:44 +02:00
Tobias Brunner 13efce489e openssl: PRF_KEYED_SHA1 might not be supported
The old API has been deprecated with OpenSSL 3 and direct access to the
state isn't possible via EVP API.  In the future we might just remove this
implementation but we'd probably have to implement EAP-AKA' first, which
uses HMAC-SHA-256 with IKEv2's prf+ construct to derive keys instead
of this weird construct (plus what fips-prf builds around it) that's used
by EAP-AKA.
2022-04-14 19:05:44 +02:00
Tobias Brunner 519bc22091 leak-detective: Whitelist OpenSSL 3.0 functions 2022-04-14 19:05:44 +02:00
Tobias Brunner 1c1213f4b6 openssl: Move shared secret calculation to get_shared_secret()
This is a change from the multi-KE branch.
2022-04-14 19:05:44 +02:00
Tobias Brunner 56afc6e298 wolfssl: Implement HMAC-based IKEv2 PRFs via wolfSSL's HKDF implementation 2022-04-14 19:02:56 +02:00
Tobias Brunner 7498769aba botan: Implement HMAC-based IKEv2 PRFs via Botan's HKDF implementation 2022-04-14 19:02:56 +02:00
Tobias Brunner e0fc786ecd openssl: Implement HMAC-based IKEv2 PRFs via OpenSSL's HKDF implementation 2022-04-14 19:02:56 +02:00
Tobias Brunner 0339ce34f6 kdf: Implement wrapper for IKEv2 PRFs 2022-04-14 19:02:56 +02:00
Tobias Brunner ad0e94b6ed test-vectors: Add vectors for HMAC-based IKEv2 PRFs 2022-04-14 19:02:56 +02:00
Tobias Brunner 37dbc87960 crypto: Add new KDF type for IKEv2 PRFs 2022-04-14 19:02:56 +02:00
Tobias Brunner 7bde56a9bc crypto: Adapt kdf_t interface to support KDFs with fixed output length 2022-04-14 19:02:56 +02:00
Tobias Brunner 96c7692661 wolfssl: Implement prf+ via wolfSSL's HKDF implementation 2022-04-14 19:02:56 +02:00
Tobias Brunner cb8f924051 botan: Implement prf+ via Botan's HKDF implementation 2022-04-14 19:02:56 +02:00
Tobias Brunner f535f1ed53 crypto: Remove unused prf_plus_t 2022-04-14 19:02:56 +02:00
Tobias Brunner f0957d1250 kdf: Implement prf+ directly without relying on prf_plus_t 2022-04-14 19:02:56 +02:00
Tobias Brunner be07b9dc01 unit-tests: Use plugin-provided prf+ in unit test
This tests the params API and the counter overflow.
2022-04-14 19:02:56 +02:00
Tobias Brunner 2b9b579af9 openssl: Add a prf+ implementation based on OpenSSL's HKDF implementation
The HKDF-Expand() function defined in RFC 5869 is basically the same as
IKEv2's prf+(), so we can use the former to implement the latter.
However, we can only support HMAC-based PRFs this way, which should be
fine as others are rarely used.
2022-04-14 18:54:24 +02:00
Tobias Brunner 9e228de60a kdf: Add plugin that provides a default prf+ implementation 2022-04-14 18:54:24 +02:00
Tobias Brunner ce431366e6 test-vectors: Add test vectors for prf+ 2022-04-14 18:54:24 +02:00
Tobias Brunner 71ba969884 plugin-feature: Add plugin feature for KDFs 2022-04-14 18:54:24 +02:00
Tobias Brunner 961cb781b9 plugin-feature: Remove 'default' case in plugin_feature_un|load() 2022-04-14 18:54:24 +02:00
Tobias Brunner 86d526876d test-vectors: Add support for KDF test vectors 2022-04-14 18:54:24 +02:00
Tobias Brunner 02f7d63e52 crypto-factory: Use actual plugin name when testing during construction 2022-04-14 18:54:24 +02:00
Tobias Brunner 0c6baa8997 crypto-tester: Add facility to test KDFs 2022-04-14 18:54:24 +02:00
Tobias Brunner fbb0bdebe7 crypto-factory: Add constructor and methods to create KDFs
Using some arguments directly in the constructor will allow us to fall
back on other implementations.
2022-04-14 18:54:24 +02:00
Tobias Brunner 35ad267fce pkcs5: Rename kdf_t to avoid conflict 2022-04-14 18:54:24 +02:00
Tobias Brunner e93882c6a0 transform: Add private transform for KDFs 2022-04-14 18:54:24 +02:00
Tobias Brunner 40a09613d2 crypto: Add interface for key derivation functions 2022-04-14 18:54:24 +02:00
Tobias Brunner d71d181d28 traffic-selector: Add TS_SECLABEL type 2022-04-14 18:42:01 +02:00
Tobias Brunner ebb99484e3 leak-detective: Whitelist selinux_check_access() 2022-04-14 18:42:01 +02:00
Tobias Brunner 2dd60e4946 sec-label: Add enum for security label mode 2022-04-14 18:42:01 +02:00
Tobias Brunner decfe44433 sec-label: Add class to represent security labels
In accordance with SELinux, we include the null-terminator in the encoding
for now.
2022-04-14 18:42:01 +02:00
Tobias Brunner fe5f27336d configure: Add option to link against libselinux 2022-04-14 18:42:01 +02:00
Tobias Brunner 7137fd96c2 enum: Add helper to parse enum flags from strings
Individual flag names are separated by |.
2022-04-14 18:42:01 +02:00
Tobias Brunner 927103ece4 enum: Allow specifying the name used when none of the flags are set 2022-04-14 18:42:01 +02:00
Tobias Brunner 3c028686de traffic-selector: Avoid out-of-bound array access when calculating range
This happens for `/0` subnet masks.  In practice, it's not an issue because
if `bytes` is 0, then so are `netbits`, `bits` and `mask`.  So the two
incorrectly addressed array elements are not actually modified.  The first
operation is a `&= 0xff` and the second a `|= 0`, so nothing changes.
But some tools might not consider the values and report this as undefined
behavior, which it technically is.
2022-03-16 11:54:34 +01:00
Tobias Brunner 3eecd40cec openssl: Don't unload providers
There is a conflict between atexit() handlers registered by OpenSSL and
some executables (e.g. swanctl or pki) to deinitialize libstrongswan.
Because plugins are usually loaded after atexit() has been called, the
handler registered by OpenSSL will run before our handler.  So when the
latter destroys the plugins it's a bad idea to try to access any OpenSSL
objects as they might already be invalid.

Fixes: f556fce16b ("openssl: Load "legacy" provider in OpenSSL 3 for algorithms like MD4, DES etc.")
Closes strongswan/strongswan#921
2022-02-24 15:03:09 +01:00
Tobias Brunner 9e3978259e mgf1: Fix Doxygen group for XOF implementation 2022-02-17 16:34:56 +01:00
Tobias Brunner 963adc7637 xof: Fix typo in documentation for set_seed() 2022-02-17 16:34:56 +01:00
Tobias Brunner 34a6cb858d openssl: Return correct number of plugin features if ECDH groups are omitted
Fixes: 46a6b06282 ("openssl: Only announce ECDH groups actually supported by OpenSSL")
2022-02-04 16:30:51 +01:00
Martin Willi 956b25a4cc proposal: Add ESN transform to default ESP AEAD proposal
The commit mentioned below adds an AES-GCM default proposal for ESP. That
proposal does not include any ESN or non-ESN transform to indicate if
extended sequence numbers are supported.

A standards-compliant peer will include one or more ESN support transforms,
and will be unable to select this proposal due to a proposal mismatch.

Fix the default AES-GCM proposal by adding a NO_ESN algorithm. While ESN has
been supported in the Linux kernel for a while, having it in the default
proposal can be problematic with kernel-libipsec or on other platforms.

Fixes: c7bef954ee ("proposal: Add AES-GCM to the ESP default AEAD proposal")
Closes strongswan/strongswan#868
2022-02-01 13:06:42 +01:00
Tobias Brunner 627eaa22ff Fixed some typos, courtesy of codespell 2022-01-20 10:44:42 +01:00
Tobias Brunner 21b2b124a1 agent: Log socket path if connecting to it failed 2022-01-20 10:02:54 +01:00
Tobias Brunner e3d84bc6f6 packet: Add helper function to create a clone without data 2022-01-14 10:13:21 +01:00
Tobias Brunner 93583d23d6 packet: Add getter/setter for metadata handling 2022-01-14 10:13:21 +01:00
Tobias Brunner 269ca19f13 metadata-set: Add implementation for a collection of metadata objects 2022-01-14 10:13:21 +01:00
Tobias BrunnerandThomas Egerer 531335ad20 metadata: Add metadata factory and implementation for integer types
Co-authored-by: Thomas Egerer <[email protected]>
2022-01-14 10:13:21 +01:00