17709 Commits

Author SHA1 Message Date
Andreas Steffen
f87adab953 oqs: Update to NIST round 3 KEM candidates 2020-12-07 13:32:56 +01:00
Andreas Steffen
e4c4d37241 oqs: Removed BIKE round 1 version including test vectors 2020-12-07 13:32:56 +01:00
Andreas Steffen
5bbc92fa6c testing: Added swanctl/rw-cert-qske scenario 2020-12-07 13:32:56 +01:00
Andreas Steffen
801613bf8d wip: ikev2: Change multi-KE codepoints for testing 2020-12-07 13:32:56 +01:00
Andreas Steffen
9325489241 vici: List additional key exchanges
Co-authored-by: Tobias Brunner <tobias@strongswan.org>
2020-12-07 13:32:56 +01:00
Andreas Steffen
5296a25c8d frodo: FrodoKEM KE method 2020-12-07 13:32:56 +01:00
Andreas Steffen
9ebbcc4be0 oqs: Added post-quantum KEM methods based on liboqs 2020-12-07 13:32:56 +01:00
Andreas Steffen
c7dd2ef715 nist_kem_kat: Added script formating NIST KEM KAT records into ke_test vectors 2020-12-07 13:32:56 +01:00
Andreas Steffen
a6e9489d6e test-vectors: Added NIST KEM test vectors 2020-12-07 13:32:56 +01:00
Andreas Steffen
6a37ff01d1 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.
2020-12-07 13:32:56 +01:00
Andreas Steffen
d05e72eed5 key-exchange: Added NIST round 2 submission KEM candidates 2020-12-07 13:32:56 +01:00
Tobias Brunner
aad8af60a5 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.
2020-12-07 13:32:56 +01:00
Tobias Brunner
198ba8f259 proposal: Add helper to check if additional key exchanges are contained 2020-12-07 13:32:56 +01:00
Tobias Brunner
c63899f9b5 proposal: Accept NONE for additional key exchanges also for IKE proposals 2020-12-07 13:32:56 +01:00
Tobias Brunner
2894ed17cc unit-tests: Add tests for CHILD_SA rekeying with multiple key exchanges 2020-12-07 13:32:56 +01:00
Tobias Brunner
c74fdd936b unit-tests: Add tests for CHILD_SA creation with multiple key exchanges 2020-12-07 13:32:56 +01:00
Tobias Brunner
6d0fea7c8e unit-tests: Tests for additional key exchanges 2020-12-07 13:32:56 +01:00
Tobias Brunner
23402b29f3 unit-tests: Support multiple proposals in exchange tests 2020-12-07 13:32:56 +01:00
Tobias Brunner
bf7b64e6da unit-tests: Hand out an actual shared secret in mock KE implementation
Makes key derivation a bit more realistic.
2020-12-07 13:32:56 +01:00
Tobias Brunner
55ab7e1949 proposal: Add prefix for additional key exchanges when logging proposals 2020-12-07 13:32:56 +01:00
Tobias Brunner
9aff25ad47 key-exchange: Add dynamic parser for additional key exchange methods 2020-12-07 13:32:56 +01:00
Tobias Brunner
e7ffc02292 child-rekey: Support CHILD_SA rekeying with multiple key exchanges 2020-12-07 13:32:51 +01:00
Tobias Brunner
187c2bb6ea child-sa: Cache and forward actual initiator flag for outbound SA
Kernel interfaces (e.g. TKM) might rely on this flag to be correct.
2020-12-07 13:28:34 +01:00
Tobias Brunner
2f6eb395bc 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.
2020-12-07 13:28:34 +01:00
Tobias Brunner
87b2ed3ce7 child-create: Add support for multiple key exchanges 2020-12-07 13:28:34 +01:00
Tobias Brunner
e93cde6ea6 ike-rekey: Support IKE_SA rekeying with multiple key exchanges 2020-12-07 13:28:34 +01:00
Tobias Brunner
9e8418f050 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.
2020-12-07 13:28:34 +01:00
Tobias Brunner
350f1a81f6 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.
2020-12-07 13:28:34 +01:00
Tobias Brunner
bbbdc8fb68 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.
2020-12-07 13:28:34 +01:00
Tobias Brunner
09f4f7fcb8 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.
2020-12-07 13:28:34 +01:00
Tobias Brunner
a63cfb9785 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.
2020-12-07 13:28:34 +01:00
Tobias Brunner
46eb7d9030 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.
2020-12-07 13:28:34 +01:00
Tobias Brunner
0ec45dfd56 bus: Support multiple key exchanges in ike/child_keys() events 2020-12-07 13:28:34 +01:00
Tobias Brunner
5be238d71e keymat_v2: Support key derivation with multiple key exchanges 2020-12-07 13:28:34 +01:00
Tobias Brunner
0321a2a304 key-exchange: Add helper to concatenate shared secrets of several key exchanges 2020-12-07 13:28:34 +01:00
Tobias Brunner
41842faad9 keymat_v2: Proper cleanup if derive_ike_keys() is called multiple times 2020-12-07 13:28:34 +01:00
Tobias Brunner
0d5a94c1db ike-sa-manager: Log SPIs when checking in an IKE_SA 2020-12-07 13:28:34 +01:00
Tobias Brunner
f25932be14 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.
2020-12-07 13:28:34 +01:00
Tobias Brunner
bc513b2848 ike-auth: Calculate and collect IntAuth for IKE_INTERMEDIATE exchanges 2020-12-07 13:28:34 +01:00
Tobias Brunner
40f49249a9 pubkey-authenticator: Handle IntAuth data 2020-12-07 13:28:34 +01:00
Tobias Brunner
6527e3961c psk-authenticator: Handle IntAuth data 2020-12-07 13:28:34 +01:00
Tobias Brunner
b315f6a8f7 eap-authenticator: Handle IntAuth data 2020-12-07 13:28:34 +01:00
Tobias Brunner
eb7f6d3108 keymat_v2: Include optional IntAuth in signed octets 2020-12-07 13:28:34 +01:00
Tobias Brunner
9f1be4ef71 authenticator: Add optional method to set IntAuth data 2020-12-07 13:28:34 +01:00
Tobias Brunner
90fd6457c3 message: Add method to generate data to authenticate IKE_INTERMEDIATE exchanges 2020-12-07 13:28:34 +01:00
Tobias Brunner
a1efa5510a generator: Make pointer to length field optional
Only useful if we generate an IKE header.
2020-12-07 13:28:34 +01:00
Tobias Brunner
21b4bc87c8 message: Fix payload type in last unprotected payload of a fragmented message 2020-12-07 13:28:34 +01:00
Tobias Brunner
9a5626d91a keymat_v2: Add method to calculate IntAuth for IKE_INTERMEDIATE exchanges 2020-12-07 13:28:34 +01:00
Tobias Brunner
1e82c9577a ike-rekey: Reset IKE_SA after processing CREATE_CHILD_SA request
This probably didn't cause any problems, as there wasn't really anything
happening between the calls, but reset it anyway, just to be safe.
2020-12-07 13:28:34 +01:00
Tobias Brunner
f7882a24b4 ikev2: Allow tasks to do work after processing requests/responses 2020-12-07 13:28:34 +01:00