#include <daemon.h>
#include <utils/linked_list.h>
#include <utils/lexparser.h>
+#include <sa/keymat_v2.h>
#include <sa/task_manager_v2.h>
#include <sa/tasks/ike_init.h>
#include <sa/tasks/ike_natd.h>
flush_auth_cfgs(this);
this->keymat->destroy(this->keymat);
- this->keymat = keymat_create(this->ike_sa_id->is_initiator(this->ike_sa_id));
+ this->keymat = &(keymat_v2_create(this->ike_sa_id->is_initiator(this->ike_sa_id))->keymat);
this->task_manager->reset(this->task_manager, 0, 0);
}
.other_host = host_create_any(AF_INET),
.my_id = identification_create_from_encoding(ID_ANY, chunk_empty),
.other_id = identification_create_from_encoding(ID_ANY, chunk_empty),
- .keymat = keymat_create(ike_sa_id->is_initiator(ike_sa_id)),
.state = IKE_CREATED,
.stats[STAT_INBOUND] = time_monotonic(NULL),
.stats[STAT_OUTBOUND] = time_monotonic(NULL),
.keepalive_interval = lib->settings->get_time(lib->settings,
"charon.keep_alive", KEEPALIVE_INTERVAL),
);
+ this->keymat = &(keymat_v2_create(ike_sa_id->is_initiator(ike_sa_id))->keymat);
this->task_manager = &(task_manager_v2_create(&this->public)->task_manager);
this->my_host->set_port(this->my_host, IKEV2_UDP_PORT);
* for more details.
*/
-#include "keymat.h"
+#include "keymat_v2.h"
#include <daemon.h>
#include <crypto/prf_plus.h>
-typedef struct private_keymat_t private_keymat_t;
+typedef struct private_keymat_v2_t private_keymat_v2_t;
/**
* Private data of an keymat_t object.
*/
-struct private_keymat_t {
+struct private_keymat_v2_t {
/**
- * Public keymat_t interface.
+ * Public keymat_v2_t interface.
*/
- keymat_t public;
+ keymat_v2_t public;
/**
* IKE_SA Role, initiator or responder
}
METHOD(keymat_t, create_dh, diffie_hellman_t*,
- private_keymat_t *this, diffie_hellman_group_t group)
+ private_keymat_v2_t *this, diffie_hellman_group_t group)
{
return lib->crypto->create_dh(lib->crypto, group);;
}
/**
* Derive IKE keys for a combined AEAD algorithm
*/
-static bool derive_ike_aead(private_keymat_t *this, u_int16_t alg,
+static bool derive_ike_aead(private_keymat_v2_t *this, u_int16_t alg,
u_int16_t key_size, prf_plus_t *prf_plus)
{
aead_t *aead_i, *aead_r;
/**
* Derive IKE keys for traditional encryption and MAC algorithms
*/
-static bool derive_ike_traditional(private_keymat_t *this, u_int16_t enc_alg,
+static bool derive_ike_traditional(private_keymat_v2_t *this, u_int16_t enc_alg,
u_int16_t enc_size, u_int16_t int_alg, prf_plus_t *prf_plus)
{
crypter_t *crypter_i, *crypter_r;
}
METHOD(keymat_t, derive_ike_keys, bool,
- private_keymat_t *this, proposal_t *proposal, diffie_hellman_t *dh,
+ private_keymat_v2_t *this, proposal_t *proposal, diffie_hellman_t *dh,
chunk_t nonce_i, chunk_t nonce_r, ike_sa_id_t *id,
pseudo_random_function_t rekey_function, chunk_t rekey_skd)
{
}
METHOD(keymat_t, derive_child_keys, bool,
- private_keymat_t *this, proposal_t *proposal, diffie_hellman_t *dh,
+ private_keymat_v2_t *this, proposal_t *proposal, diffie_hellman_t *dh,
chunk_t nonce_i, chunk_t nonce_r, chunk_t *encr_i, chunk_t *integ_i,
chunk_t *encr_r, chunk_t *integ_r)
{
}
METHOD(keymat_t, get_skd, pseudo_random_function_t,
- private_keymat_t *this, chunk_t *skd)
+ private_keymat_v2_t *this, chunk_t *skd)
{
*skd = this->skd;
return this->prf_alg;
}
METHOD(keymat_t, get_aead, aead_t*,
- private_keymat_t *this, bool in)
+ private_keymat_v2_t *this, bool in)
{
return in ? this->aead_in : this->aead_out;
}
METHOD(keymat_t, get_auth_octets, chunk_t,
- private_keymat_t *this, bool verify, chunk_t ike_sa_init,
+ private_keymat_v2_t *this, bool verify, chunk_t ike_sa_init,
chunk_t nonce, identification_t *id, char reserved[3])
{
chunk_t chunk, idx, octets;
#define IKEV2_KEY_PAD_LENGTH 17
METHOD(keymat_t, get_psk_sig, chunk_t,
- private_keymat_t *this, bool verify, chunk_t ike_sa_init,
+ private_keymat_v2_t *this, bool verify, chunk_t ike_sa_init,
chunk_t nonce, chunk_t secret, identification_t *id, char reserved[3])
{
chunk_t key_pad, key, sig, octets;
}
METHOD(keymat_t, destroy, void,
- private_keymat_t *this)
+ private_keymat_v2_t *this)
{
DESTROY_IF(this->aead_in);
DESTROY_IF(this->aead_out);
/**
* See header
*/
-keymat_t *keymat_create(bool initiator)
+keymat_v2_t *keymat_v2_create(bool initiator)
{
- private_keymat_t *this;
+ private_keymat_v2_t *this;
INIT(this,
.public = {
- .create_dh = _create_dh,
- .derive_ike_keys = _derive_ike_keys,
- .derive_child_keys = _derive_child_keys,
- .get_skd = _get_skd,
- .get_aead = _get_aead,
- .get_auth_octets = _get_auth_octets,
- .get_psk_sig = _get_psk_sig,
- .destroy = _destroy,
+ .keymat = {
+ .create_dh = _create_dh,
+ .derive_ike_keys = _derive_ike_keys,
+ .derive_child_keys = _derive_child_keys,
+ .get_skd = _get_skd,
+ .get_aead = _get_aead,
+ .get_auth_octets = _get_auth_octets,
+ .get_psk_sig = _get_psk_sig,
+ .destroy = _destroy,
+ },
},
.initiator = initiator,
.prf_alg = PRF_UNDEFINED,
return &this->public;
}
-