summaryrefslogtreecommitdiff
path: root/cesar/cp
diff options
context:
space:
mode:
authorJérémy Dufour2010-09-22 15:53:20 +0200
committerJérémy Dufour2010-09-23 13:35:10 +0200
commitf3529c2b0f783cf808a0f0bc818da45aedeec7c5 (patch)
tree0837ebeea400acba9a29ac409aa95a3afd70f5ce /cesar/cp
parent5fcef864110498447dd8c55fa3e84c16ee8ad832 (diff)
cesar/cp/secu: in TEK generation, don't revert order of hash keys, closes #1893
Parameters as been renamed for easier understanding.
Diffstat (limited to 'cesar/cp')
-rw-r--r--cesar/cp/secu/secu.h6
-rw-r--r--cesar/cp/secu/src/secu.c10
-rw-r--r--cesar/cp/secu/test/src/test-nmk.c2
3 files changed, 9 insertions, 9 deletions
diff --git a/cesar/cp/secu/secu.h b/cesar/cp/secu/secu.h
index 8e72b43098..f33edd596e 100644
--- a/cesar/cp/secu/secu.h
+++ b/cesar/cp/secu/secu.h
@@ -206,12 +206,12 @@ cp_secu_nmk2nid(cp_t *ctx, cp_key_t nmk, u8 security_level);
/**
* Generate the TEK.
- * \param left the left hash key in the cm_get_key.req MME.
- * \param right the right hash key in the cm_get_key.cnf MME.
+ * \param first the first hash key (the one in cm_get_key.req MME)
+ * \param second the second hash key (the one in cm_get_key.cnf MME)
* \param output the output buffer.
*/
void
-cp_secu_tek_gen (const u32 left[], const u32 right[], cp_key_t *output);
+cp_secu_tek_gen (const u32 first[], const u32 second[], cp_key_t *output);
/**
* Generate some hash.
diff --git a/cesar/cp/secu/src/secu.c b/cesar/cp/secu/src/secu.c
index ef129ea36f..bb01a51635 100644
--- a/cesar/cp/secu/src/secu.c
+++ b/cesar/cp/secu/src/secu.c
@@ -144,22 +144,22 @@ cp_secu_nmk2nid(cp_t *ctx, const cp_key_t nmk, const u8 security_level)
}
void
-cp_secu_tek_gen (const u32 left[], const u32 right[], cp_key_t *output)
+cp_secu_tek_gen (const u32 first[], const u32 second[], cp_key_t *output)
{
u8 sha_buff[CP_SECU_HASH_KEY_FOR_TEK_SIZE * 2];
u8 output_buffer [CP_SECU_SHA256_SIZE];
uint i, j;
- dbg_assert (left);
- dbg_assert (right);
+ dbg_assert (first);
+ dbg_assert (second);
dbg_assert (output);
for (i = 0; i < CP_SECU_HASH_KEY_FOR_TEK_SIZE; i += 4)
- PUT_UINT32 (right[i/4], sha_buff, i);
+ PUT_UINT32 (first[i/4], sha_buff, i);
for (i = CP_SECU_HASH_KEY_FOR_TEK_SIZE, j = 0;
j < CP_SECU_HASH_KEY_FOR_TEK_SIZE;
j += 4, i += 4)
- PUT_UINT32 (left[j/4], sha_buff, i);
+ PUT_UINT32 (second[j/4], sha_buff, i);
/* Salt is NULL, no salt use for the tek
* the first 0 is for the salt length
diff --git a/cesar/cp/secu/test/src/test-nmk.c b/cesar/cp/secu/test/src/test-nmk.c
index ed06b8fa83..644047f99b 100644
--- a/cesar/cp/secu/test/src/test-nmk.c
+++ b/cesar/cp/secu/test/src/test-nmk.c
@@ -148,7 +148,7 @@ test_case_tek_generation (test_t test)
u32 res[4] = {0x2d3b6a36, 0xddc60f8a, 0x56c5e8ca, 0xeb4b7d36};
cp_key_t tek;
- cp_secu_tek_gen (cnf, req, &tek);
+ cp_secu_tek_gen (req, cnf, &tek);
for (i = 0; i < 4; i++)
test_fail_unless (tek.key[i] == res[i]);