From fbc67bee6f05dcba8fcca2ade64a853fe4128e4a Mon Sep 17 00:00:00 2001 From: dufour Date: Wed, 18 Feb 2009 14:43:39 +0000 Subject: * cp/sec (see #177): - cp_secu_tek_gen need two hash keys of fixed length (no need to give it as arguments). git-svn-id: svn+ssh://pessac/svn/cesar/trunk@4034 017c9cb6-072f-447c-8318-d5b54f68fe89 --- cesar/cp/secu/src/secu.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'cesar/cp/secu/src') diff --git a/cesar/cp/secu/src/secu.c b/cesar/cp/secu/src/secu.c index 65ccd61e25..39bfd895c3 100644 --- a/cesar/cp/secu/src/secu.c +++ b/cesar/cp/secu/src/secu.c @@ -148,25 +148,25 @@ cp_secu_nmk2nid(cp_key_t nmk, u8 security_level) } void -cp_secu_tek_gen (const u32 left[], const uint left_len, - const u32 right[], const uint right_len, - cp_key_t *output) +cp_secu_tek_gen (const u32 left[], const u32 right[], cp_key_t *output) { - u8 sha_buff[left_len + right_len]; + u8 sha_buff[CP_SECU_HASH_KEY_FOR_TEK_SIZE * 2]; u8 output_buffer [CP_SECU_SHA256_SIZE]; dbg_assert (left); dbg_assert (right); dbg_assert (output); /* Insert the left part in the left part of the sha_buf. */ - memcpy (sha_buff + right_len, left, left_len); - memcpy (sha_buff, right, right_len); + memcpy (sha_buff + CP_SECU_HASH_KEY_FOR_TEK_SIZE, left, + CP_SECU_HASH_KEY_FOR_TEK_SIZE); + memcpy (sha_buff, right, CP_SECU_HASH_KEY_FOR_TEK_SIZE); /* Salt is NULL, no salt use for the tek * the first 0 is for the salt length * the second one is for the iteration number. * see HPAV section 7.10.7.2. Paragraph 4 .*/ - cp_secu_sha256 (sha_buff, left_len + right_len, output_buffer); + cp_secu_sha256 (sha_buff, CP_SECU_HASH_KEY_FOR_TEK_SIZE * 2, + output_buffer); /* Copy the leftmost 16 bytes. */ memcpy (output->key, output_buffer, 16); -- cgit v1.2.3