Add ISA context id getter to TKM keymat

This commit is contained in:
Reto Buerki 2012-08-31 11:24:45 +02:00 committed by Tobias Brunner
parent cdd4d73ff5
commit d91acfdb5d
3 changed files with 16 additions and 0 deletions

View File

@ -356,6 +356,12 @@ METHOD(keymat_t, destroy, void,
free(this);
}
METHOD(tkm_keymat_t, get_isa_id, isa_id_type,
private_tkm_keymat_t *this)
{
return this->isa_ctx_id;
}
/**
* See header.
*/
@ -377,6 +383,7 @@ tkm_keymat_t *tkm_keymat_create(bool initiator)
.get_skd = _get_skd,
.get_auth_octets = _get_auth_octets,
.get_psk_sig = _get_psk_sig,
.get_isa_id = _get_isa_id,
},
.initiator = initiator,
.isa_ctx_id = tkm->idmgr->acquire_id(tkm->idmgr, TKM_CTX_ISA),

View File

@ -106,6 +106,14 @@ struct tkm_keymat_t {
bool (*get_psk_sig)(tkm_keymat_t *this, bool verify, chunk_t ike_sa_init,
chunk_t nonce, chunk_t secret,
identification_t *id, char reserved[3], chunk_t *sig);
/**
* Get ISA context id.
*
* @return id of associated ISA context.
*/
isa_id_type (*get_isa_id)(tkm_keymat_t * const this);
};
/**

View File

@ -54,6 +54,7 @@ START_TEST(test_derive_ike_keys)
tkm_keymat_t *keymat = tkm_keymat_create(TRUE);
fail_if(!keymat, "Unable to create keymat");
fail_if(!keymat->get_isa_id(keymat), "Invalid ISA context id (0)");
chunk_t nonce;
tkm_nonceg_t *ng = tkm_nonceg_create();