18005 Commits

Author SHA1 Message Date
Andreas Steffen
82679ea0c4 oqs: Update to NIST round 3 KEM candidates 2021-07-06 14:45:43 +02:00
Andreas Steffen
6f00f7346b oqs: Removed BIKE round 1 version including test vectors 2021-07-06 14:45:43 +02:00
Andreas Steffen
74a5f87e49 testing: Added ikev2/rw-cert-qske scenario 2021-07-06 14:45:43 +02:00
Andreas Steffen
2d96e2048c wip: ikev2: Change multi-KE codepoints for testing 2021-07-06 14:45:43 +02:00
Andreas Steffen
77862a72aa vici: List additional key exchanges
Co-authored-by: Tobias Brunner <tobias@strongswan.org>
2021-07-06 14:45:43 +02:00
Andreas Steffen
c4f6301f1e frodo: FrodoKEM KE method 2021-07-06 14:45:43 +02:00
Andreas Steffen
51b186a2f5 oqs: Added post-quantum KEM methods based on liboqs 2021-07-06 14:45:43 +02:00
Andreas Steffen
4042a92f18 nist_kem_kat: Added script formating NIST KEM KAT records into ke_test vectors 2021-07-06 14:45:43 +02:00
Andreas Steffen
2a0e7a8b91 test-vectors: Added NIST KEM test vectors 2021-07-06 14:45:43 +02:00
Andreas Steffen
ecec17c3d6 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-07-06 14:45:42 +02:00
Andreas Steffen
8250867ec5 key-exchange: Added NIST round 2 submission KEM candidates 2021-07-06 14:45:42 +02:00
Tobias Brunner
dcdaae737e 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-07-06 14:45:42 +02:00
Tobias Brunner
5d40fef5c9 proposal: Add helper to check if additional key exchanges are contained 2021-07-06 14:45:42 +02:00
Tobias Brunner
f8b967b85a proposal: Accept NONE for additional key exchanges also for IKE proposals 2021-07-06 14:45:42 +02:00
Tobias Brunner
3ba705bc82 unit-tests: Add tests for CHILD_SA rekeying with multiple key exchanges 2021-07-06 14:45:42 +02:00
Tobias Brunner
740691caec unit-tests: Add tests for CHILD_SA creation with multiple key exchanges 2021-07-06 14:45:42 +02:00
Tobias Brunner
aee41ac825 unit-tests: Tests for additional key exchanges 2021-07-06 14:45:42 +02:00
Tobias Brunner
f05a74e55b unit-tests: Support multiple proposals in exchange tests 2021-07-06 14:45:42 +02:00
Tobias Brunner
9c67e4c3c1 unit-tests: Hand out an actual shared secret in mock KE implementation
Makes key derivation a bit more realistic.
2021-07-06 14:45:42 +02:00
Tobias Brunner
92940acc4c proposal: Add prefix for additional key exchanges when logging proposals 2021-07-06 14:45:42 +02:00
Tobias Brunner
7f2a4805ef key-exchange: Add dynamic parser for additional key exchange methods 2021-07-06 14:45:42 +02:00
Tobias Brunner
bd1f8d0e1c child-rekey: Support CHILD_SA rekeying with multiple key exchanges 2021-07-06 14:45:42 +02:00
Tobias Brunner
772fd05e9d 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-07-06 14:45:42 +02:00
Tobias Brunner
d8c7d2ce70 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-07-06 14:45:42 +02:00
Tobias Brunner
dbf3ba314b child-create: Add support for multiple key exchanges 2021-07-06 14:45:42 +02:00
Tobias Brunner
6c3e576a70 ike-rekey: Support IKE_SA rekeying with multiple key exchanges 2021-07-06 14:45:42 +02:00
Tobias Brunner
fe3e057c09 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-07-06 14:45:42 +02:00
Tobias Brunner
b60a104559 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-07-06 14:45:42 +02:00
Tobias Brunner
21772fe3fc 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-07-06 14:45:42 +02:00
Tobias Brunner
690eba24ca 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-07-06 14:45:42 +02:00
Tobias Brunner
f535d2208d 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-07-06 14:45:42 +02:00
Tobias Brunner
f065fc4109 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-07-06 14:45:42 +02:00
Tobias Brunner
cfae243d96 bus: Support multiple key exchanges in ike/child_keys() events 2021-07-06 14:45:42 +02:00
Tobias Brunner
5765d7cbd0 keymat_v2: Support key derivation with multiple key exchanges 2021-07-06 14:45:42 +02:00
Tobias Brunner
a11ce277de key-exchange: Add helper to concatenate shared secrets of several key exchanges 2021-07-06 14:45:42 +02:00
Tobias Brunner
ad62440cf6 keymat_v2: Proper cleanup if derive_ike_keys() is called multiple times 2021-07-06 14:45:42 +02:00
Tobias Brunner
3d5a96bd56 ike-sa-manager: Log SPIs when checking in an IKE_SA 2021-07-06 14:45:42 +02:00
Tobias Brunner
7d028ab2c9 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-07-06 14:45:42 +02:00
Tobias Brunner
e4e48e6f7f ike-auth: Calculate and collect IntAuth for IKE_INTERMEDIATE exchanges 2021-07-06 14:45:42 +02:00
Tobias Brunner
27c80ae017 pubkey-authenticator: Handle IntAuth data 2021-07-06 14:45:42 +02:00
Tobias Brunner
03d24398f5 psk-authenticator: Handle IntAuth data 2021-07-06 14:45:42 +02:00
Tobias Brunner
425630702e eap-authenticator: Handle IntAuth data 2021-07-06 14:45:42 +02:00
Tobias Brunner
19349aaeef keymat_v2: Include optional IntAuth in signed octets 2021-07-06 14:45:42 +02:00
Tobias Brunner
e8c7dfb391 authenticator: Add optional method to set IntAuth data 2021-07-06 14:45:42 +02:00
Tobias Brunner
8429e401a2 message: Add method to generate data to authenticate IKE_INTERMEDIATE exchanges 2021-07-06 14:45:42 +02:00
Tobias Brunner
68ef0e919b generator: Make pointer to length field optional
Only useful if we generate an IKE header.
2021-07-06 14:45:42 +02:00
Tobias Brunner
92e709397f message: Fix payload type in last unprotected payload of a fragmented message 2021-07-06 14:45:42 +02:00
Tobias Brunner
fe243606b5 keymat_v2: Add method to calculate IntAuth for IKE_INTERMEDIATE exchanges 2021-07-06 14:45:42 +02:00
Tobias Brunner
df5453b33f 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.
2021-07-06 14:45:42 +02:00
Tobias Brunner
cc9e1c1e2f ikev2: Allow tasks to do work after processing requests/responses 2021-07-06 14:45:42 +02:00