18106 Commits

Author SHA1 Message Date
Andreas Steffen
9e79ea07be scripts: Fixed NIST KAT scripts 2021-10-18 18:49:12 +02:00
Andreas Steffen
0dbb6e3160 oqs: Support of Falcon signature algorithms 2021-10-18 18:49:12 +02:00
Andreas Steffen
ac2127b35b oqs: Complete post-quantum signature support 2021-10-18 18:49:12 +02:00
Andreas Steffen
c75a20f6f5 ntru: Removed legacy NTRU key exchange method 2021-10-18 18:49:12 +02:00
Andreas Steffen
00520b3ae8 newhope: Removed legacy Newhope key exchange method 2021-10-18 18:49:12 +02:00
Andreas Steffen
09fbca96a9 bliss: Removed legacy BLISS signatures 2021-10-18 18:49:12 +02:00
Andreas Steffen
cbe8936fc3 oqs: Added signature tests 2021-10-18 18:49:12 +02:00
Andreas Steffen
a14d2b265f scripts: Added nist_sig_kat script 2021-10-18 18:49:12 +02:00
Andreas Steffen
e5964bdb4e oqs: Postponed freeing of kem object 2021-10-18 18:49:12 +02:00
Andreas Steffen
cad605a135 oqs: Support of Dilithium signature algorithms 2021-10-18 18:49:12 +02:00
Andreas Steffen
2686ac1205 oqs: Update to NIST round 3 KEM candidates 2021-10-18 18:49:12 +02:00
Andreas Steffen
d9670ff01b oqs: Removed BIKE round 1 version including test vectors 2021-10-18 18:49:12 +02:00
Andreas Steffen
8b83a44e26 testing: Added ikev2/rw-cert-qske scenario 2021-10-18 18:49:12 +02:00
Andreas Steffen
09d7c93754 wip: ikev2: Change multi-KE codepoints for testing 2021-10-18 18:49:12 +02:00
Andreas Steffen
a7efdcbad4 vici: List additional key exchanges
Co-authored-by: Tobias Brunner <tobias@strongswan.org>
2021-10-18 18:49:12 +02:00
Andreas Steffen
90c175ff08 frodo: FrodoKEM KE method 2021-10-18 18:49:12 +02:00
Andreas Steffen
5654889cbb oqs: Added post-quantum KEM methods based on liboqs 2021-10-18 18:49:12 +02:00
Andreas Steffen
d65234bc15 nist_kem_kat: Added script formating NIST KEM KAT records into ke_test vectors 2021-10-18 18:49:12 +02:00
Andreas Steffen
121869c47d test-vectors: Added NIST KEM test vectors 2021-10-18 18:49:12 +02:00
Andreas Steffen
f6baa4e488 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.
2021-10-18 18:49:12 +02:00
Andreas Steffen
3b864166e1 key-exchange: Added NIST round 2 submission KEM candidates 2021-10-18 18:49:12 +02:00
Tobias Brunner
211c4db369 wip: ike-init: Indicate support for IKE_INTERMEDIATE
wip: Not strictly necessary. I guess we should also add some checks if
the notify was not received.
2021-10-18 18:49:12 +02:00
Tobias Brunner
f1d342456d proposal: Prevent selection of duplicate key exchange methods
All additional (and the initial) key exchanges must use a different method.
2021-10-18 18:49:12 +02:00
Tobias Brunner
d48390c362 proposal: Add helper to check if additional key exchanges are contained 2021-10-18 18:49:12 +02:00
Tobias Brunner
946a6417ce proposal: Accept NONE for additional key exchanges also for IKE proposals 2021-10-18 18:49:12 +02:00
Tobias Brunner
50f5079387 unit-tests: Add tests for CHILD_SA rekeying with multiple key exchanges 2021-10-18 18:49:12 +02:00
Tobias Brunner
4631026dc8 unit-tests: Add tests for CHILD_SA creation with multiple key exchanges 2021-10-18 18:49:12 +02:00
Tobias Brunner
a40074dde1 unit-tests: Tests for additional key exchanges 2021-10-18 18:49:12 +02:00
Tobias Brunner
5181b47b08 unit-tests: Support multiple proposals in exchange tests 2021-10-18 18:49:12 +02:00
Tobias Brunner
7aed87e78c unit-tests: Hand out an actual shared secret in mock KE implementation
Makes key derivation a bit more realistic.
2021-10-18 18:49:12 +02:00
Tobias Brunner
cbb5d4e33a proposal: Add prefix for additional key exchanges when logging proposals 2021-10-18 18:49:12 +02:00
Tobias Brunner
caa87d26e0 key-exchange: Add dynamic parser for additional key exchange methods 2021-10-18 18:49:12 +02:00
Tobias Brunner
e44b7695c9 child-rekey: Support CHILD_SA rekeying with multiple key exchanges 2021-10-18 18:49:12 +02:00
Tobias Brunner
ce4a3d6d75 child-sa: Cache and forward actual initiator flag for outbound SA
Kernel interfaces (e.g. TKM) might rely on this flag to be correct.
2021-10-18 18:49:12 +02:00
Tobias Brunner
83721e865e unit-tests: Fix CHILD_SA rekey tests after INVALID_KE_PAYLOAD handling changes
The responder doesn't create a CHILD_SA and allocate an SPI anymore
when responding with an INVALID_KE_PAYLOAD notify.
2021-10-18 18:49:12 +02:00
Tobias Brunner
985c09f295 child-create: Add support for multiple key exchanges
It also changes that payloads are built before installing the CHILD_SA on
the responder, that is, the KE payload is generated before keys are derived,
so that key_exchange_t::get_public_key() is called before get_shared_secret(),
or it's internal equivalent, which could be relevant for KE implementations
that want to ensure that the key can't be used again after the key
derivation.
2021-10-18 18:49:12 +02:00
Tobias Brunner
bc2cb82d7f ike-rekey: Support IKE_SA rekeying with multiple key exchanges 2021-10-18 18:49:12 +02:00
Tobias Brunner
db139a02cb ikev2: Send deletes also for rekeyed SAs
This way we can use the IKE_REKEYED state for both redundant and old SAs
to suppress ike_updown().

In the ike-delete task we don't suppress events in state IKE_REKEYING as
that's the case when we delete an SA the peer is currently rekeying with
multiple key exchanges.
2021-10-18 18:49:12 +02:00
Tobias Brunner
3baf713767 ikev2: Let ike/child-rekey tasks indicate if the passive task was adopted
This gives us more flexibility with tasks that return NEED_MORE (currently
none of the colliding tasks do, but that will change with multi-KE
rekeyings).  The active task has to check itself if the passive task is
done and should be removed from the task manager.
2021-10-18 18:49:12 +02:00
Tobias Brunner
5673eb57d0 ike-rekey: Remove collision task type checks
Since f67199378df9 ("ike-rekey: Handle undetected collisions also if
delete is delayed") we only ever track tasks of type TASK_IKE_REKEY, so
there is no need to check the type or use the generic task_t interface.

Also changed some of the comments to clarify collision handling.
2021-10-18 18:49:12 +02:00
Tobias Brunner
6c739d8bb7 ike-rekey: Don't actively rekey already rekeyed SAs
If the peer successfully rekeyed the SA it gets marked as IKE_REKEYED
and it remains until the peer deletes it (or a timeout).  There is no
point in rekeying such SAs again.

IKE_REKEYING will be relevant if we have multi-KE rekeyings and are
waiting for followup key exchanges for a passive rekeying.
2021-10-18 18:49:12 +02:00
Tobias Brunner
4afd6d1726 ike-init: Ignore COOKIE payloads during rekeying
This ensures that process_i() only returns NEED_MORE due to multiple
key exchanges or an INVALID_KE_PAYLOAD notify.
2021-10-18 18:49:12 +02:00
Tobias Brunner
8378077602 ike-init: Add support for multiple key exchanges
Initially, this is handled with a key derivation for each
IKE_INTERMEDIATE exchange.  When rekeying the keys are derived only when
all IKE_FOLLOWUP_KE exchanges are done.
2021-10-18 18:49:12 +02:00
Tobias Brunner
e6535ecb03 bus: Support multiple key exchanges in ike/child_keys() events 2021-10-18 18:49:12 +02:00
Tobias Brunner
36d101f7e6 keymat_v2: Support key derivation with multiple key exchanges 2021-10-18 18:49:12 +02:00
Tobias Brunner
d9d0864349 key-exchange: Add helper to concatenate shared secrets of several key exchanges 2021-10-18 18:49:12 +02:00
Tobias Brunner
dcd5c945b5 keymat_v2: Proper cleanup if derive_ike_keys() is called multiple times 2021-10-18 18:49:12 +02:00
Tobias Brunner
5727ab2390 ike-sa-manager: Log SPIs when checking in an IKE_SA 2021-10-18 18:49:12 +02:00
Tobias Brunner
c52413e71e ikev2: Use hashes to detect retransmits
We avoid parsing messages with unexpected message IDs.  This allows us to
process and detect retransmits of messages for which we don't have the keys
anymore (i.e. IKE_INTERMEDIATE after IKE_SA_INIT and changing the keys).

This also changes how retransmits for fragmented messages are triggered,
previously we waited for all fragments and reconstructed the message
before retransmitting the response.  Now we only track the first
fragment and if we receive a retransmit of it respond immediately
without waiting for other fragments (which are now ignored).  This is in
compliance with RFC 7383, section 2.6.1.
2021-10-18 18:49:12 +02:00
Tobias Brunner
778f4e81cf ike-auth: Calculate and collect IntAuth for IKE_INTERMEDIATE exchanges 2021-10-18 18:49:12 +02:00