From ce461bbd13c5ea6a94ba0b34cbb4d1be8159b67e Mon Sep 17 00:00:00 2001 From: Martin Willi Date: Tue, 14 Feb 2006 14:52:00 +0000 Subject: - refactored ike proposal - uses now proposal_t, wich is also used by child proposals - ike key derivation refactored - crypter_t api has get_key_size now - some other improvements here and there --- Source/charon/transforms/prfs/hmac_prf.c | 10 ++++++++++ Source/charon/transforms/prfs/prf.h | 8 ++++++++ 2 files changed, 18 insertions(+) (limited to 'Source/charon/transforms/prfs') diff --git a/Source/charon/transforms/prfs/hmac_prf.c b/Source/charon/transforms/prfs/hmac_prf.c index af307a4d0..ce4330090 100644 --- a/Source/charon/transforms/prfs/hmac_prf.c +++ b/Source/charon/transforms/prfs/hmac_prf.c @@ -67,6 +67,15 @@ static size_t get_block_size(private_hmac_prf_t *this) return this->hmac->get_block_size(this->hmac); } +/** + * Implementation of prf_t.get_block_size. + */ +static size_t get_key_size(private_hmac_prf_t *this) +{ + /* for HMAC prfs, IKEv2 uses block size as key size */ + return this->hmac->get_block_size(this->hmac); +} + /** * Implementation of prf_t.set_key. */ @@ -94,6 +103,7 @@ hmac_prf_t *hmac_prf_create(hash_algorithm_t hash_algorithm) this->public.prf_interface.get_bytes = (void (*) (prf_t *,chunk_t,u_int8_t*))get_bytes; this->public.prf_interface.allocate_bytes = (void (*) (prf_t*,chunk_t,chunk_t*))allocate_bytes; this->public.prf_interface.get_block_size = (size_t (*) (prf_t*))get_block_size; + this->public.prf_interface.get_key_size = (size_t (*) (prf_t*))get_key_size; this->public.prf_interface.set_key = (void (*) (prf_t *,chunk_t))set_key; this->public.prf_interface.destroy = (void (*) (prf_t *))destroy; diff --git a/Source/charon/transforms/prfs/prf.h b/Source/charon/transforms/prfs/prf.h index d96fc66ae..17b1110b2 100644 --- a/Source/charon/transforms/prfs/prf.h +++ b/Source/charon/transforms/prfs/prf.h @@ -97,6 +97,14 @@ struct prf_t { */ size_t (*get_block_size) (prf_t *this); + /** + * @brief Get the key size of this prf_t object. + * + * @param this calling object + * @return key size in bytes + */ + size_t (*get_key_size) (prf_t *this); + /** * @brief Set the key for this prf_t object. * -- cgit v1.2.3