Tobias Brunner
70b8c73562
unit-tests: Support multiple proposals in exchange tests
2021-03-21 12:22:43 +01:00
Tobias Brunner
67a0a6a27e
unit-tests: Hand out an actual shared secret in mock KE implementation
...
Makes key derivation a bit more realistic.
2021-03-21 12:22:43 +01:00
Tobias Brunner
200e19cd95
proposal: Add prefix for additional key exchanges when logging proposals
2021-03-21 12:22:43 +01:00
Tobias Brunner
50414d06c5
key-exchange: Add dynamic parser for additional key exchange methods
2021-03-21 12:22:43 +01:00
Tobias Brunner
bed581c732
child-rekey: Support CHILD_SA rekeying with multiple key exchanges
2021-03-21 12:22:43 +01:00
Tobias Brunner
9a41dae9a1
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-03-21 12:22:43 +01:00
Tobias Brunner
1b547e291d
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-03-21 12:22:43 +01:00
Tobias Brunner
cc63aa0d29
child-create: Add support for multiple key exchanges
2021-03-21 12:22:43 +01:00
Tobias Brunner
b8e9b71aa9
ike-rekey: Support IKE_SA rekeying with multiple key exchanges
2021-03-21 12:22:43 +01:00
Tobias Brunner
ef1e4fff1a
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-03-21 12:22:43 +01:00
Tobias Brunner
fd8b973edd
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-03-21 12:22:43 +01:00
Tobias Brunner
9a6e95dea9
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-03-21 12:22:43 +01:00
Tobias Brunner
6de79119f8
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-03-21 12:22:43 +01:00
Tobias Brunner
c8a5ae2def
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-03-21 12:22:43 +01:00
Tobias Brunner
0c6758c135
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-03-21 12:22:43 +01:00
Tobias Brunner
99c61737d4
bus: Support multiple key exchanges in ike/child_keys() events
2021-03-21 12:22:43 +01:00
Tobias Brunner
0743040675
keymat_v2: Support key derivation with multiple key exchanges
2021-03-21 12:22:43 +01:00
Tobias Brunner
6c9231d549
key-exchange: Add helper to concatenate shared secrets of several key exchanges
2021-03-21 12:22:43 +01:00
Tobias Brunner
12779db7cc
keymat_v2: Proper cleanup if derive_ike_keys() is called multiple times
2021-03-21 12:22:43 +01:00
Tobias Brunner
8893ecf79d
ike-sa-manager: Log SPIs when checking in an IKE_SA
2021-03-21 12:22:43 +01:00
Tobias Brunner
e4b67d3368
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-03-21 12:22:43 +01:00
Tobias Brunner
f33b1e42ce
ike-auth: Calculate and collect IntAuth for IKE_INTERMEDIATE exchanges
2021-03-21 12:22:43 +01:00
Tobias Brunner
5d0cfcdb2a
pubkey-authenticator: Handle IntAuth data
2021-03-21 12:22:43 +01:00
Tobias Brunner
eb8703dc1c
psk-authenticator: Handle IntAuth data
2021-03-21 12:22:43 +01:00
Tobias Brunner
5a2fd6f4f6
eap-authenticator: Handle IntAuth data
2021-03-21 12:22:43 +01:00
Tobias Brunner
3326cf05ef
keymat_v2: Include optional IntAuth in signed octets
2021-03-21 12:22:43 +01:00
Tobias Brunner
07f8611423
authenticator: Add optional method to set IntAuth data
2021-03-21 12:22:43 +01:00
Tobias Brunner
9a4ca41539
message: Add method to generate data to authenticate IKE_INTERMEDIATE exchanges
2021-03-21 12:22:43 +01:00
Tobias Brunner
85ccee4468
generator: Make pointer to length field optional
...
Only useful if we generate an IKE header.
2021-03-21 12:22:43 +01:00
Tobias Brunner
9c03cbb03c
message: Fix payload type in last unprotected payload of a fragmented message
2021-03-21 12:22:43 +01:00
Tobias Brunner
03a032de6f
keymat_v2: Add method to calculate IntAuth for IKE_INTERMEDIATE exchanges
2021-03-21 12:22:43 +01:00
Tobias Brunner
ee76b4bc5c
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-03-21 12:22:43 +01:00
Tobias Brunner
c2360ec499
ikev2: Allow tasks to do work after processing requests/responses
2021-03-21 12:22:43 +01:00
Tobias Brunner
e86110338b
task: Add optional post_process() method
...
This will allows tasks to do some work after a message has been
processed.
2021-03-21 12:22:43 +01:00
Tobias Brunner
2550cfde6e
ikev2: Allow tasks to do work after generating requests/responses
2021-03-21 12:22:43 +01:00
Tobias Brunner
8731d24bb5
task: Add optional post_build() method
...
This will allow tasks to do some work after the message has been
generated.
2021-03-21 12:22:43 +01:00
Tobias Brunner
304c7615bd
ike-auth: Support IKE_INTERMEDIATE exchange between IKE_SA_INIT and IKE_AUTH
2021-03-21 12:22:43 +01:00
Tobias Brunner
1e08167fc0
child-create: Support IKE_INTERMEDIATE exchange between IKE_SA_INIT and IKE_AUTH
2021-03-21 12:22:43 +01:00
Tobias Brunner
5094ad602d
ike-mobike: Support IKE_INTERMEDIATE exchange between IKE_SA_INIT and IKE_AUTH
...
This changes the MID of the first IKE_AUTH message.
2021-03-21 12:22:42 +01:00
Tobias Brunner
7e7c2778f0
ike-config: Support IKE_INTERMEDIATE exchange between IKE_SA_INIT and IKE_AUTH
...
This changes the MID of the first IKE_AUTH message.
2021-03-21 12:22:42 +01:00
Tobias Brunner
f3f3f25676
ike-cert-post: Make absolutely sure certificates are only added to IKE_AUTH
...
The AUTH payload check should be fine, but add some extra checks just to make
really sure and also for clarification.
2021-03-21 12:22:42 +01:00
Tobias Brunner
a6fee86af4
ike-cert-pre: Support IKE_INTERMEDIATE exchange between IKE_SA_INIT and IKE_AUTH
...
The first IKE_AUTH does not have MID 1 if that's the case.
2021-03-21 12:22:42 +01:00
Tobias Brunner
6059db73c2
status: Add return_need_more() utility function
2021-03-21 12:22:42 +01:00
Tobias Brunner
259ee217cf
message: Add rules for IKE_FOLLOWUP_KE exchanges
2021-03-21 12:22:42 +01:00
Tobias Brunner
5cab54fe54
wip: ike-header: Add IKE_FOLLOWUP_KE exchange type
2021-03-21 12:22:42 +01:00
Tobias Brunner
9f9b165cca
message: Add rules for IKE_INTERMEDIATE exchanges
2021-03-21 12:22:42 +01:00
Tobias Brunner
5be6907b0e
wip: ike-header: Add IKE_INTERMEDIATE exchange type
2021-03-21 12:22:42 +01:00
Tobias Brunner
0274431403
wip: notify-payload: Add notify types for multiple key exchanges
2021-03-21 12:22:42 +01:00
Tobias Brunner
6d94980fb3
wip: notify-payload: Add notify type for IKE_INTERMEDIATE exchange
2021-03-21 12:22:42 +01:00
Tobias Brunner
a6d5cb6c81
proposal-substructure: Encode additional key exchange methods
2021-03-21 12:22:42 +01:00