Commit Graph
10768 Commits
Author SHA1 Message Date
Adrian-Ken Rueegsegger 9099d2ba0b Set ri_id to reqid when setting user certificate
Pass the reqid (of the first child config of an IKE SA) as remote identity id
when calling cc_set_user_certificate. May lead to the usage of the wrong id in
case an IKE SA has multiple child configurations/reqids.

This must be replaced with a proper lookup once the configuration backend is
implemented and provides remote identity ids to charon-tkm.
2013-03-19 15:23:49 +01:00
Adrian-Ken Rueegsegger 722d68803e Set sp_id to reqid when creating ESA
The reqid corresponds to the sp_id (security policy id) on the TKM side.
2013-03-19 15:23:49 +01:00
Adrian-Ken Rueegsegger 1c1400f007 Call Esa_Select after creation of child SA
This tells the TKM which child SA is the currently active SA.
2013-03-19 15:23:49 +01:00
Adrian-Ken Rueegsegger d2371b728c Check that chunk fits into sequence when converting 2013-03-19 15:23:49 +01:00
Reto Buerki 3360bad910 Remove result out parameter from EES Init
Error processing is done by the registered exception handler.
2013-03-19 15:23:49 +01:00
Adrian-Ken Rueegsegger 0f5e57fe26 Drop support for pre-shared key authentication 2013-03-19 15:23:49 +01:00
Reto Buerki c457128ab6 charon-tkm: Register TKM private key on startup 2013-03-19 15:23:49 +01:00
Reto Buerki 08d199fa3d Add TKM private key implementation
The key currently imitates the private key of [email protected] by
returning it's fingerprint in the get_fingerprint function.

This associates the private key with alice's X.509 cert and charon will
use it to create a signature over the local AUTH octets of the test
connection.

The private key serves as a proxy to the TKM ike_isa_sign operation and
extracts the required information from the auth octets chunk passed on
by the keymat.
2013-03-19 15:23:49 +01:00
Reto Buerki fe504b745d keymat: Store signature info in auth octets
Store the ISA context id and the initial message in the auth octets
chunk using the sign_info_t struct. Charon will pass on this information
to the TKM private key sign operation where it is extracted.
2013-03-19 15:23:49 +01:00
Reto Buerki a2f97ff860 Add AUTH signature info data structure
The sign_info_t type is used to transfer an ISA context id and the
initial message from the keymat to the TKM private key sign operation.
2013-03-19 15:23:49 +01:00
Adrian-Ken Rueegsegger ac90fcee2f charon-tkm: Register TKM public key on startup 2013-03-19 15:23:49 +01:00
Adrian-Ken Rueegsegger 9a5c51c44f Add TKM public key implementation
The key unconditionally returns TRUE for the verify operation if it is called
with a supported signature algorithm. All such verification operations are
performed by the TKM (e.g. trustchain or auth octets verification) anyway, so
this is safe.
2013-03-19 15:23:49 +01:00
Adrian-Ken Rueegsegger 832488b14a Authenticate ISA using certificates
The authentication of the ISA is now done using the certificate provided
by the peer.
2013-03-19 15:23:49 +01:00
Adrian-Ken Rueegsegger 49b1fdb24a Store peer IKE init message
The IKE init message sent to us by the peer is needed for authentication
in the authorization hook. Store the message as chunk in the keymat and
provide a getter to make it available.
2013-03-19 15:23:49 +01:00
Adrian-Ken Rueegsegger 351bd59de2 Build cc context in tkm listener authorize hook
Extract peer certificate information and build a TKM certificate chain
context in the authorize hook of the tkm_listener_t. The cc context will
be used for ISA authentication using certificates.
2013-03-19 15:23:49 +01:00
Adrian-Ken Rueegsegger 464eb54ba4 Add TKM_CTX_CC (Certificate chain context id) 2013-03-19 15:23:48 +01:00
Adrian-Ken Rueegsegger 0f0165c81f Add typelen parameter to chunk_to_sequence function
The parameter is used to initialize the given sequence to zero.
2013-03-19 15:23:48 +01:00
Reto Buerki 270b321e97 Implement Ada exception processing
Register a global exception action with the Ada runtime to log uncaught
exceptions to the daemon log and terminate.
2013-03-19 15:23:48 +01:00
Reto Buerki e0cb01f44d Implement Esa Event Service (EES)
The Esa Event Service can be used to trigger ESP SA (ESA) events such as
acquire or expire. The incoming events are forwarded to the hydra kernel
interface for processing.
2013-03-19 15:23:48 +01:00
Adrian-Ken Rueegsegger d9c6480688 Conditionally reset AE context in keymat destroy
The responsibility to reset an authenticated endpoint context is passed
from a parent IKE SA keymat to the new keymat by including it in the ISA
info data contained in the skd chunk. The last IKE SA to be destroyed
will also reset the associated AE context.
2013-03-19 15:23:48 +01:00
Adrian-Ken Rueegsegger 62b625430e Let tkm_keymat_t extend keymat_v2_t 2013-03-19 15:23:48 +01:00
Adrian-Ken Rueegsegger 2ac988bf4b Implement IKE SA rekeying
Use the TKM ike_isa_create_child exchange to rekey an IKE SA. The isa context id
is passed on (ab)using the rekey_skd chunk.
2013-03-19 15:23:48 +01:00
Adrian-Ken Rueegsegger e472129aa3 Add test for keymat derive_child_keys operation 2013-03-19 15:23:48 +01:00
Adrian-Ken Rueegsegger 4a1529203b Implement ESA rekeying with and without PFS
A child SA is being rekeyed if the esa information passed to the add_sa
function contains nonces. If it also contains a valid Diffie-Hellman
context id PFS is used.

The fact that the encr_r encryption key is passed to add_sa in the
inbound case can be used to determine if we are initiator or not by
inspecting the is_encr_r flag of the esa information struct.
2013-03-19 15:23:48 +01:00
Adrian-Ken Rueegsegger d303221c0b Extend esa_info_t struct
Add additional fields to the esa_info_t struct so the necessary data can
be passed from the keymat to the kernel ipsec interface, where ESA
creation and key generation using the TKM takes place.

The information is used during the inbound add_sa call to create an ESP
SA. This makes the hack of storing the local SPI in a kernel interface
variable between subsequent add_sa calls unnecessary.
2013-03-19 15:23:48 +01:00
Adrian-Ken Rueegsegger de20230111 Use SAD to manage TKM ESA context information
An SAD entry is added after successfull creation of a TKM ESA context
in the add_sa() function. The corresponding entry is removed in
del_sa() using the SAD, src, dst, spi and protocol parameters.
2013-03-19 15:23:48 +01:00
Adrian-Ken Rueegsegger 1e13904f45 Implement TKM kernel SA database (SAD)
The TKM kernel SAD (security association database) stores information
about CHILD SAs.
2013-03-19 15:23:48 +01:00
Adrian-Ken Rueegsegger d1c0822759 Add TKM_CTX_ESA (ESP SA context id) 2013-03-19 15:23:48 +01:00
Adrian-Ken Rueegsegger d0ab667c99 Use rng to generate local ESP SPIs 2013-03-19 15:23:48 +01:00
Adrian-Ken Rueegsegger 6ed5c3bb1e charon-tkm: Register kernel_netlink_net
Explicitly register kernel netlink net implementation and avoid loading
the whole kernel-netlink plugin since the kernel netlink ipsec part is
unwanted.
2013-03-19 15:23:48 +01:00
Adrian-Ken Rueegsegger db97fd74d3 Do not return shared secret in TKM Diffie-Hellman
Since the TKM handles all relevant key material, charon-tkm must not
have access to it anymore. Thus the ike_dh_get_shared_secret operation
is not available anymore.
2013-03-19 15:23:48 +01:00
Adrian-Ken Rueegsegger a61ae27d16 Remove keymat proxy from TKM keymat
Since the TKM completely handles key derivation and installation there
is no need for the keymat proxy anymore.
2013-03-19 15:23:47 +01:00
Reto Buerki 6c237edb9a Remove netlink proxy from TKM kernel interface
The TKM is now able to manage simple child SAs, so there is no need for
the netlink proxy anymore.
2013-03-19 15:23:47 +01:00
Reto Buerki a642e3ba27 Avoid proxy for bypass_socket, enable_udp_decap
This is in preparation for the removal of the netlink kernel proxy. The
code is copied as-is from the kernel_netlink_ipsec plugin.
2013-03-19 15:23:47 +01:00
Adrian-Ken Rueegsegger b94a0befaf Implement CHILD SA key derivation using TKM
ESP SAs are created when adding CHILD SAs via the kernel ipsec
interface.

The encr_i key is used to transfer the context id of the parent IKE SA
from the keymat to the TKM kernel ipsec interface.
2013-03-19 15:23:47 +01:00
Adrian-Ken Rueegsegger cc169cb16e Register TKM kernel ipsec interface in charon-tkm 2013-03-19 15:23:47 +01:00
Adrian-Ken Rueegsegger 8a780242e2 Add TKM kernel ipsec skeleton
The existing kernel netlink ipsec interface is currently used as proxy
to perform the actual work. It will be gradually removed as the TKM
implements the needed features.
2013-03-19 15:23:47 +01:00
Reto Buerki 8f1dfb3d9e chunk_map: Store key, value pair in entry_t struct
To make the chunk map more robust it now stores a clone of the data
chunk given on insertion. The entry struct is needed to properly free
the allocated chunk after use.
2013-03-19 15:23:47 +01:00
Reto Buerki 3972769690 Call ike_isa_auth_psk in listener authorize hook
This exchange initiates the AUTH verification in the TKM.
2013-03-19 15:23:47 +01:00
Reto Buerki 9df5645623 listener: Register message hook
Use the message hook to save the AUTHENTICATION payload of an incoming
IKE_AUTH message.

The AUTH payload will be passed on to the TKM ike_isa_auth operation in
the authorize hook.
2013-03-19 15:23:47 +01:00
Reto Buerki 071e792a85 keymat: Add AUTH payload setter/getter functions
These functions are used in the TKM specific bus listener to
store/retrieve the AUTH payload chunk in the message/authorize hooks.
2013-03-19 15:23:47 +01:00
Reto Buerki d0ce4116b0 Register TKM bus listener in charon-tkm 2013-03-19 15:23:47 +01:00
Reto Buerki c6c8d74026 Add TKM specific bus listener skeleton
This listener gets informed about IKE authorization rounds and will be
used to call ike_isa_auth on a given ISA.
2013-03-19 15:23:47 +01:00
Reto Buerki d91acfdb5d Add ISA context id getter to TKM keymat 2013-03-19 15:23:47 +01:00
Reto Buerki cdd4d73ff5 keymat: Acquire AE context ID on initialization 2013-03-19 15:23:47 +01:00
Reto Buerki c755645032 Add TKM_CTX_AE (Authenticated Endpoint context) 2013-03-19 15:23:47 +01:00
Reto Buerki bf1034a776 keymat: Acquire ISA context ID on initialization 2013-03-19 15:23:47 +01:00
Reto Buerki 7fb3e5ed10 Add TKM_CTX_ISA (IKE SA context) 2013-03-19 15:23:46 +01:00
Reto Buerki fa22fc2419 Use remote PSK signature computed by TKM 2013-03-19 15:23:46 +01:00
Reto Buerki e7a497c307 keymat: Check for aes256-sha512 in derive_ike_keys
Return FALSE if peers try to use other algorithm combinations.
2013-03-19 15:23:46 +01:00