Commit Graph
582 Commits
Author SHA1 Message Date
Tobias Brunner 80f8f5e9d4 key-exchange: Rename function that verifies pubkey lengths
The previous name confused LLMs as they assume it is intended to actually
cryptographically verify the public key.  The new name more clearly
describes what it actually does.
2026-07-24 08:47:37 +02:00
Tobias Brunner 3b224a70ba xof: Fix mapping for SHA3-512 to a corresponding MGF1 identifier
Fixes: 3b7c49bc31 ("mgf1: Support of RSA PSS with SHA3 hash")
2026-05-19 17:27:33 +02:00
Tobias Brunner c6a2185c42 pkcs5: Fail decryption if data is empty
This avoids the previous bug early.
2026-04-21 16:48:56 +02:00
Tobias Brunner 4da84019cc pkcs5: Avoid NULL pointer dereference when verifying padding
Can be triggered via empty PKCS#7 encrypted content in IKEv1 CERT payload.

Fixes: 4076e3ee91 ("Extract PKCS#5 handling from pkcs8 plugin to separate helper class")
Fixes: CVE-2026-35329
2026-04-21 16:48:56 +02:00
Tobias Brunner b3011e8e87 Remove support for MD2
No part of IKE/IPsec or X.509 uses MD2 anymore, so there really is no
reason to still support it (unlike MD4 that is used in EAP-MSCHAPv2,
MD5 that's used in EAP-MD5, or SHA-1 that's used for e.g. NAT-D hashes).

It caused test vectors to fail on systems where OpenSSL is built with
MD2 support but has it disabled at runtime.
2025-09-23 15:59:35 +02:00
Tobias Brunner f88d824114 Fixed some typos, courtesy of codespell 2025-07-08 10:54:49 +02:00
Tobias Brunner 9fe58c83fb proposal: Add supported KE methods to default ESP/AH proposals, but optional
This allows accepting clients that send proposals with non-optional KE
methods during rekeying, while still accepting clients that use the
previous non-KE default proposals.
2025-04-10 08:31:10 +02:00
Tobias Brunner 6cbd93838b Add configure option to disable testing key exchange methods
If this is used, the functionality to set a private key/value/seed for
key exchange methods is removed (including from the interface to avoid
accidentally forgetting to wrap implementations and uses of set_seed()).

The set_seed() method is assigned outside the INIT() macro to avoid
potentially undefined behavior (preprocessing directives in macro
arguments).

The test done by the crypto tester is a simple functionality test.
2025-04-10 08:31:09 +02:00
Tobias BrunnerandThomas Egerer e7848e36fa ha: Add support to sync IKE and Child SAs with multiple key exchanges
Synchronization for the additional transforms in the IKE and Child SA
proposals is added.  Details of the IKE_SA synchronization are changed
to support IKE_INTERMEDIATE exchanges that cause multiple HA_IKE_ADD
messages and key derivations.  The cache has been extended to handle
multiple such messages.

Co-authored-by: Thomas Egerer <[email protected]>
2025-02-28 16:02:41 +01:00
Andreas Steffen 3b7c49bc31 mgf1: Support of RSA PSS with SHA3 hash 2024-11-22 14:05:36 +01:00
Andreas Steffen 1265d78cac ntru: Remove legacy NTRU key exchange method 2024-11-22 14:05:36 +01:00
Andreas Steffen 8e3a373e18 newhope: Remove legacy Newhope key exchange method 2024-11-22 14:05:36 +01:00
Andreas Steffen 4833f29b15 bliss: Remove legacy BLISS signatures 2024-11-22 14:05:36 +01:00
Tobias Brunner 09636199e6 key-exchange: Document how the interface is used with KEMs 2024-11-21 14:26:35 +01:00
Andreas Steffen 40676786aa key-exchange: Joint ke_test_vector format for DH and KEM
Both Diffie-Hellman (DH) and Key Encapsulation Mechanism (KEM) based
key exchange methods use a common ke_test_vector format. The
set_seed() function is used to provide deterministic private key
material for the crypto tests.
2024-11-21 14:26:35 +01:00
Tobias Brunner 47de9ef9a1 key-exchange: Add identifiers for ML-KEM algorithms 2024-11-21 14:26:35 +01:00
Tobias Brunner 12d2b6e2b4 key-exchange: Pass prefix array directly, not a pointer to it 2024-08-08 11:19:16 +02:00
Tobias Brunner 012d99ecf4 proposal: Prevent selection of duplicate key exchange methods
All additional (and the initial) key exchanges must use a different method.
2024-08-07 16:20:19 +02:00
Tobias Brunner 1d5e921911 proposal: Add helper to check if additional key exchanges are contained 2024-08-07 16:20:19 +02:00
Tobias Brunner 882ff93bfd proposal: Accept NONE for additional key exchanges also for IKE proposals 2024-08-07 16:20:19 +02:00
Tobias Brunner c5a6938b9e proposal: Add prefix for additional key exchanges when logging proposals 2024-08-07 16:20:18 +02:00
Tobias Brunner e05d86b27a key-exchange: Add dynamic parser for additional key exchange methods 2024-08-07 16:20:18 +02:00
Tobias Brunner c36eaf42da key-exchange: Add helper to concatenate shared secrets of several key exchanges 2024-08-07 16:20:18 +02:00
Tobias Brunner 9cc5f4a511 proposal: Make all key exchange transforms optional in ESP/AH proposals 2024-08-07 16:20:18 +02:00
Tobias Brunner fb6b8c833b proposal: Skip all KE transforms if PROPOSAL_SKIP_KE given 2024-08-07 16:20:18 +02:00
Tobias Brunner 2e059e0c27 transform: Add helper to check if transform type negotiates key exchange 2024-08-07 16:20:18 +02:00
Tobias Brunner 22550bd262 transform: Add additional key exchange transform types 2024-08-07 16:20:18 +02:00
Tobias Brunner 14bd0bc743 Fixed some typos, courtesy of codespell 2023-11-14 10:11:16 +01:00
Tobias Brunner f73d8699b3 crypto-tester: Fix build with DEBUG_LEVEL < 1 2023-05-08 14:06:43 +02:00
Tobias Brunner 0351b5af3b key-exchange: Warn about costly operations in set_public_key() 2022-06-29 10:28:50 +02:00
Tobias Brunner 3bebf5bf8d proposal: Generalize KE methods 2022-06-29 10:28:50 +02:00
Andreas Steffen b7c167f972 Rename MODP_NONE to KE_NONE 2022-06-29 10:28:50 +02:00
Tobias Brunner 3af7c6db87 Rename diffie_hellman_t to key_exchange_t and change the interface etc.
This makes it more generic so we can use it for QSKE methods.
2022-06-29 10:28:50 +02:00
Tobias Brunner 19ef2aec15 Update copyright headers after acquisition by secunet 2022-06-28 10:22:56 +02:00
Tobias Brunner 5cf82de69a proposal: Demote AES-XCBC/CMAC PRFs in default proposal
These are rarely used, so strictly propose HMAC-based PRFs first.

References strongswan/strongswan#1026
References strongswan/strongswan#1044
2022-05-10 09:04:42 +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 f535f1ed53 crypto: Remove unused prf_plus_t 2022-04-14 19:02:56 +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 963adc7637 xof: Fix typo in documentation for set_seed() 2022-02-17 16:34:56 +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
Andreas Steffen 695a04d146 openssl: Support of AES-CFB encryption 2021-12-06 12:52:37 +01:00
Tobias Brunner 8b2b5a647b proposal: Add aliases for AES-GCM/CCM without explicit ICV length
These are mapped to use the default, maximum ICV length of 16 bytes.
2021-02-12 14:35:23 +01:00
Tobias Brunner 85bde019d3 diffie-hellman: Classify x25519 and x448 as ECDH methods 2021-02-12 14:35:23 +01:00
Tobias Brunner 9514aa2dcc diffie-hellman: Add enum names that match proposal keywords 2021-02-12 14:35:23 +01:00