summaryrefslogtreecommitdiff
path: root/cesar/cp/sta/action
diff options
context:
space:
mode:
authorJérémy Dufour2010-09-23 13:34:17 +0200
committerJérémy Dufour2010-09-24 16:49:40 +0200
commit79e91a31cd7dd3b7ea174da74274bf9e57fffeb1 (patch)
tree8f3bfb5b14dc7a2e476f0f710471eeb8cddfca1f /cesar/cp/sta/action
parent68284c431cd6284d7bf3c7c0d355271614b045f7 (diff)
cesar/cp/{sta/action,msg}: hash key stored and read on 32 bits, refs #1892
Diffstat (limited to 'cesar/cp/sta/action')
-rw-r--r--cesar/cp/sta/action/inc/context.h2
-rw-r--r--cesar/cp/sta/action/src/assoc.c4
-rw-r--r--cesar/cp/sta/action/src/sc.c6
-rw-r--r--cesar/cp/sta/action/test/utest/inc/scenario_defs.h8
-rw-r--r--cesar/cp/sta/action/test/utest/src/msg_stub.c8
-rw-r--r--cesar/cp/sta/action/test/utest/src/sc.c14
6 files changed, 21 insertions, 21 deletions
diff --git a/cesar/cp/sta/action/inc/context.h b/cesar/cp/sta/action/inc/context.h
index 13ecc57c56..6701db62af 100644
--- a/cesar/cp/sta/action/inc/context.h
+++ b/cesar/cp/sta/action/inc/context.h
@@ -75,7 +75,7 @@ struct cp_sta_action_sc_t
/** SC peer with witch we are doing the SC procedure. */
cp_mme_peer_t peer;
/** Hash key generated for TEK. */
- u8 hash_key[CP_HASH_KEY_SIZE];
+ u32 hash_key[CP_HASH_KEY_SIZE / sizeof (u32)];
/** CP Secu Protocol Run. */
cp_secu_protocol_run_t prun;
/** TEK generated. */
diff --git a/cesar/cp/sta/action/src/assoc.c b/cesar/cp/sta/action/src/assoc.c
index 8ffd55dbbf..abc821f9fa 100644
--- a/cesar/cp/sta/action/src/assoc.c
+++ b/cesar/cp/sta/action/src/assoc.c
@@ -405,10 +405,10 @@ cp_sta_action_assoc__sc_associated__cm_get_key_req_pid_3 (cp_t *ctx,
cnf.nid = cp_sta_own_data_get_nid (ctx);
cnf.eks = CP_MME_PEKS_TEK_MIN;
/* Generate an hash key. */
- cp_secu_generate_hash (ctx, lib_rnd32 (&ctx->rnd), cnf.hash_key,
+ cp_secu_generate_hash (ctx, lib_rnd32 (&ctx->rnd), (u8 *) cnf.hash_key,
CP_SECU_HASH_KEY_FOR_TEK_SIZE);
/* Generate TEK with hash key from CM_HET_KEY REQ and CNF. */
- cp_secu_tek_gen ((u32 *)req.hash_key, (u32 *)cnf.hash_key,
+ cp_secu_tek_gen (req.hash_key, cnf.hash_key,
&ctx->sta_action.sc.tek);
/* Send CM_GET_KEY.CNF. */
cp_secu_protocol_next (&ctx->sta_action.assoc.prun, &ctx->rnd, false);
diff --git a/cesar/cp/sta/action/src/sc.c b/cesar/cp/sta/action/src/sc.c
index d39b09df30..67de6d7b47 100644
--- a/cesar/cp/sta/action/src/sc.c
+++ b/cesar/cp/sta/action/src/sc.c
@@ -298,7 +298,7 @@ cp_sta_action_sc__sc_wait_peer_associated__new_sta_associated (cp_t *ctx,
req.key_type = CP_MSG_KEY_HASH_KEY;
req.nid = cp_sta_own_data_get_nid (ctx);
/* Generate hash key. */
- cp_secu_generate_hash (ctx, lib_rnd32 (&ctx->rnd), req.hash_key,
+ cp_secu_generate_hash (ctx, lib_rnd32 (&ctx->rnd), (u8 *) req.hash_key,
CP_SECU_HASH_KEY_FOR_TEK_SIZE);
/* Keep a copy of the hash key. */
memcpy (ctx->sta_action.sc.hash_key, req.hash_key, CP_HASH_KEY_SIZE);
@@ -478,8 +478,8 @@ cp_sta_action_sc__sc_building_tek__cm_get_key_cnf_pid3 (cp_t *ctx,
{
/* Hash key exchange for TEK succeed. */
/* Compute TEK. */
- cp_secu_tek_gen ((u32 *)ctx->sta_action.sc.hash_key,
- (u32 *)cnf.hash_key,
+ cp_secu_tek_gen (ctx->sta_action.sc.hash_key,
+ cnf.hash_key,
&ctx->sta_action.sc.tek);
/* Set the TEK for encryption. */
cp_sta_own_data_set_tek (ctx, ctx->sta_action.sc.tek);
diff --git a/cesar/cp/sta/action/test/utest/inc/scenario_defs.h b/cesar/cp/sta/action/test/utest/inc/scenario_defs.h
index d952227ec3..9f85bbd9f2 100644
--- a/cesar/cp/sta/action/test/utest/inc/scenario_defs.h
+++ b/cesar/cp/sta/action/test/utest/inc/scenario_defs.h
@@ -607,17 +607,17 @@ __mrk (cp_msg_cm_set_key_req_receive,
__msk (cp_msg_cm_set_key_cnf_send, enum cp_msg_cm_set_key_cnf_result_t result,
u8 cco_cap)
__msk (cp_msg_cm_get_key_req_send, bool relayed,
- enum cp_msg_key_type_t key_type, cp_nid_t nid, u8 *hash_key)
+ enum cp_msg_key_type_t key_type, cp_nid_t nid, u32 *hash_key)
__mrk (cp_msg_cm_get_key_cnf_receive,
enum cp_msg_cm_get_key_cnf_result_t result,
- enum cp_msg_key_type_t key_type, cp_nid_t nid, u8 eks, u8 *hash_key,
+ enum cp_msg_key_type_t key_type, cp_nid_t nid, u8 eks, u32 *hash_key,
cp_key_t *key)
__mrk (cp_msg_cm_get_key_req_receive,
bool relayed,
- enum cp_msg_key_type_t key_type, cp_nid_t nid, u8 *hash_key)
+ enum cp_msg_key_type_t key_type, cp_nid_t nid, u32 *hash_key)
__msk (cp_msg_cm_get_key_cnf_send,
enum cp_msg_cm_get_key_cnf_result_t result,
- enum cp_msg_key_type_t key_type, cp_nid_t nid, u8 eks, u8 *hash_key)
+ enum cp_msg_key_type_t key_type, cp_nid_t nid, u8 eks, u32 *hash_key)
__mr (cp_msg_cm_hfid_req_receive, enum cp_msg_cm_hfid_req_reqtype_t req_type,
cp_nid_t nid, char *hfid)
__ms (cp_msg_cm_hfid_cnf_send, enum cp_msg_cm_hfid_cnf_restype_t restype,
diff --git a/cesar/cp/sta/action/test/utest/src/msg_stub.c b/cesar/cp/sta/action/test/utest/src/msg_stub.c
index c4b017bab2..e04173637f 100644
--- a/cesar/cp/sta/action/test/utest/src/msg_stub.c
+++ b/cesar/cp/sta/action/test/utest/src/msg_stub.c
@@ -374,23 +374,23 @@ __msk (cp_msg_cm_get_key_cnf_send, cp_msg_cm_get_key_cnf_t,
(enum cp_msg_key_type_t, key_type, assign),
(cp_nid_t, nid, assign),
(u8, eks, assign),
- (u8 *, hash_key, hash_key))
+ (u32 *, hash_key, hash_key))
__msk (cp_msg_cm_get_key_req_send, cp_msg_cm_get_key_req_t,
(bool, relayed, assign),
(enum cp_msg_key_type_t, key_type, assign),
(cp_nid_t, nid, assign),
- (u8 *, hash_key, hash_key))
+ (u32 *, hash_key, hash_key))
__mrk (cp_msg_cm_get_key_req_receive, cp_msg_cm_get_key_req_t,
(bool, relayed, assign),
(enum cp_msg_key_type_t, key_type, assign),
(cp_nid_t, nid, assign),
- (u8 *, hash_key, hash_key))
+ (u32 *, hash_key, hash_key))
__mrk (cp_msg_cm_get_key_cnf_receive, cp_msg_cm_get_key_cnf_t,
(enum cp_msg_cm_get_key_cnf_result_t, result, assign),
(enum cp_msg_key_type_t, key_type, assign),
(cp_nid_t, nid, assign),
(u8, eks, assign),
- (u8 *, hash_key, hash_key),
+ (u32 *, hash_key, hash_key),
(cp_key_t, key, assign_deref))
__mr (cp_msg_cm_hfid_req_receive,
(enum cp_msg_cm_hfid_req_reqtype_t, req_type, assign),
diff --git a/cesar/cp/sta/action/test/utest/src/sc.c b/cesar/cp/sta/action/test/utest/src/sc.c
index 19a2a1fe0c..c219dcbf4d 100644
--- a/cesar/cp/sta/action/test/utest/src/sc.c
+++ b/cesar/cp/sta/action/test/utest/src/sc.c
@@ -41,7 +41,7 @@ sc_basic_test_cases (test_t t)
const uint sc_periodic_sc_join_req_bcast_ms_min = 750;
const uint sc_periodic_sc_join_req_bcast_ms_max = 1250;
- const uint second_hash_key[] = {
+ uint second_hash_key[] = {
0xfcfdfeff, 0xf8f9fafb, 0xf4f5f6f7, 0xf0f1f2f3, 0xecedeeef,
0xe8e9eaeb, 0xe4e5e6e7, 0xe0e1e2e3, 0xdcdddedf, 0xd8d9dadb,
0xd4d5d6d7, 0xd0d1d2d3, 0xcccdcecf, 0xc8c9cacb, 0xc4c5c6c7,
@@ -610,7 +610,7 @@ sc_basic_test_cases (test_t t)
.result = CP_MSG_CM_GET_KEY_CNF_RESULT_KEY_GRANTED,
.key_type = CP_MSG_KEY_HASH_KEY, .nid = nid,
.eks = CP_MME_PEKS_TEK_MIN + 1,
- .hash_key = (u8 *) second_hash_key),
+ .hash_key = second_hash_key),
/* Send the NMK. */
SCENARIO_EVENT (cp_msg_cm_set_key_req_send,
.peer = sc_join_peer,
@@ -743,7 +743,7 @@ sc_basic_test_cases (test_t t)
.result = CP_MSG_CM_GET_KEY_CNF_RESULT_KEY_GRANTED,
.key_type = CP_MSG_KEY_HASH_KEY, .nid = nid,
.eks = CP_MME_PEKS_TEK_MIN + 2,
- .hash_key = (u8 *) second_hash_key),
+ .hash_key = second_hash_key),
/* Send the NMK. */
SCENARIO_EVENT (cp_msg_cm_set_key_req_send,
.peer = sc_join_peer,
@@ -1011,7 +1011,7 @@ sc_basic_test_cases (test_t t)
.relayed = false, .key_type = CP_MSG_KEY_HASH_KEY,
.nid = nid, .pid = 3, .new_my_nonce = true,
.new_your_nonce = false, .new_prn = true,
- .pmn = 1, .hash_key = (u8 *) second_hash_key,
+ .pmn = 1, .hash_key = second_hash_key,
.peks = CP_MME_PEKS_SPC_NOT_EMBEDDED),
/* Send reply. */
SCENARIO_EVENT (cp_msg_cm_get_key_cnf_send, .peer = sc_add_peer,
@@ -1265,7 +1265,7 @@ sc_basic_test_cases (test_t t)
.relayed = false, .key_type = CP_MSG_KEY_HASH_KEY,
.nid = nid, .pid = 3, .new_my_nonce = true,
.new_your_nonce = false, .new_prn = true,
- .pmn = 1, .hash_key = (u8 *) second_hash_key,
+ .pmn = 1, .hash_key = second_hash_key,
.peks = CP_MME_PEKS_SPC_NOT_EMBEDDED),
/* Send reply. */
SCENARIO_EVENT (cp_msg_cm_get_key_cnf_send, .peer = sc_add_peer,
@@ -1471,7 +1471,7 @@ sc_basic_test_cases (test_t t)
.result = CP_MSG_CM_GET_KEY_CNF_RESULT_KEY_GRANTED,
.key_type = CP_MSG_KEY_HASH_KEY, .nid = nid,
.eks = CP_MME_PEKS_TEK_MIN + 3,
- .hash_key = (u8 *) second_hash_key),
+ .hash_key = second_hash_key),
/* Send the NMK encrypted with the TEK. */
SCENARIO_EVENT (cp_msg_cm_set_key_req_send,
.peer = sc_join_peer_assoc,
@@ -1647,7 +1647,7 @@ sc_basic_test_cases (test_t t)
.result = CP_MSG_CM_GET_KEY_CNF_RESULT_KEY_GRANTED,
.key_type = CP_MSG_KEY_HASH_KEY, .nid = nid,
.eks = CP_MME_PEKS_TEK_MIN + 4,
- .hash_key = (u8 *) second_hash_key),
+ .hash_key = second_hash_key),
/* Send the NMK encrypted with the TEK. */
SCENARIO_EVENT (cp_msg_cm_set_key_req_send,
.peer = sc_join_peer_assoc,