summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNélio Laranjeiro2012-04-27 14:35:59 +0200
committerNélio Laranjeiro2012-06-12 11:40:42 +0200
commit9853e3eac30110fa2e964b10f040d77f8093183b (patch)
tree5c9fa51dd83cae3da9de0253f33ea03cbc2a8ce1
parent091e3735860363c2cf08f9ddc92750b4d9085e2e (diff)
cesar/cp/cco/action: remove old occurrences of eks, closes #2914
-rw-r--r--cesar/cp/av/cco/action/src/cco_action.c13
-rw-r--r--cesar/cp/av/cco/action/test/utest/src/nek.c10
-rw-r--r--cesar/cp/cco/action/inc/cco_action.h6
-rw-r--r--cesar/cp/cco/action/src/cco_action.c1
4 files changed, 6 insertions, 24 deletions
diff --git a/cesar/cp/av/cco/action/src/cco_action.c b/cesar/cp/av/cco/action/src/cco_action.c
index eb049cd3cd..6ed05a7047 100644
--- a/cesar/cp/av/cco/action/src/cco_action.c
+++ b/cesar/cp/av/cco/action/src/cco_action.c
@@ -1408,8 +1408,7 @@ cp_av_cco_action_cm_set_key_cnf_receive (cp_t *ctx, cp_mme_rx_t *mme)
data_req.key_type = CP_MSG_KEY_NEK;
data_req.cco_cap = CP_CCO_LEVEL;
data_req.nid = cp_sta_own_data_get_nid (ctx);
- data_req.new_eks = CP_CCO_ACTION_EKS_NEXT
- (ctx->cco_action.eks_current);
+ data_req.new_eks = bsu_nek_index_current (ctx->bsu);
for (i = 0; i < COUNT (ctx->cco_action.nek_new.key); i++)
data_req.new_key.key[i] = ctx->cco_action.nek_new.key[i];
@@ -1471,13 +1470,9 @@ cp_av_cco_action_nek_change_prevent (cp_t *ctx)
if (cp_sta_own_data_get_cco_status (ctx))
{
cp_beacon_change_nek (ctx,
- CP_CCO_ACTION_EKS_NEXT(ctx->cco_action.eks_current),
- ctx->cco_action.nek_new,
- false /* central beacon change. */);
-
- /* Set the EKS_current to the new one. */
- ctx->cco_action.eks_current =
- CP_CCO_ACTION_EKS_NEXT(ctx->cco_action.eks_current);
+ bsu_nek_index_next (ctx->bsu),
+ ctx->cco_action.nek_new,
+ false /* central beacon change. */);
}
}
diff --git a/cesar/cp/av/cco/action/test/utest/src/nek.c b/cesar/cp/av/cco/action/test/utest/src/nek.c
index b1bb93dd31..77c1dfa1bb 100644
--- a/cesar/cp/av/cco/action/test/utest/src/nek.c
+++ b/cesar/cp/av/cco/action/test/utest/src/nek.c
@@ -53,7 +53,6 @@ nek_change (test_t t)
SCENARIO_END
};
scenario_run (t, entries, &globals);
- test_fail_unless (ctx.cp.cco_action.eks_current == 0);
}
test_end;
@@ -109,7 +108,7 @@ nek_change (test_t t)
.key_type = CP_MSG_KEY_NEK,
.cco_cap = CP_CCO_LEVEL,
.nid = cp_sta_own_data_get_nid (&ctx.cp),
- .new_eks = 1,
+ .new_eks = bsu_nek_index_current (ctx.cp.bsu),
.new_key = ctx.cp.cco_action.nek_new),
SCENARIO_EVENT (cp_fsm_event_bare_new,
.type =
@@ -153,7 +152,6 @@ nek_change (test_t t)
SCENARIO_END
};
scenario_run (t, entries, &globals);
- test_fail_unless (ctx.cp.cco_action.eks_current == 0);
}
test_end;
@@ -209,7 +207,7 @@ nek_change (test_t t)
.key_type = CP_MSG_KEY_NEK,
.cco_cap = CP_CCO_LEVEL,
.nid = cp_sta_own_data_get_nid (&ctx.cp),
- .new_eks = 1,
+ .new_eks = bsu_nek_index_current (ctx.cp.bsu),
.new_key = ctx.cp.cco_action.nek_new),
SCENARIO_EVENT (cp_fsm_event_bare_new,
.type =
@@ -243,7 +241,6 @@ nek_change (test_t t)
SCENARIO_END
};
scenario_run (t, entries, &globals);
- test_fail_unless (ctx.cp.cco_action.eks_current == 0);
}
test_end;
@@ -283,7 +280,6 @@ nek_change (test_t t)
SCENARIO_END
};
scenario_run (t, entries, &globals);
- test_fail_unless (ctx.cp.cco_action.eks_current == 0);
}
test_end;
@@ -318,7 +314,6 @@ nek_change (test_t t)
SCENARIO_END
};
scenario_run (t, entries, &globals);
- test_fail_unless (ctx.cp.cco_action.eks_current == 0);
}
test_end;
@@ -353,7 +348,6 @@ nek_change (test_t t)
SCENARIO_END
};
scenario_run (t, entries, &globals);
- test_fail_unless (ctx.cp.cco_action.eks_current == 0);
}
test_end;
diff --git a/cesar/cp/cco/action/inc/cco_action.h b/cesar/cp/cco/action/inc/cco_action.h
index ebbef697e4..c4ee733edf 100644
--- a/cesar/cp/cco/action/inc/cco_action.h
+++ b/cesar/cp/cco/action/inc/cco_action.h
@@ -23,10 +23,6 @@
#define CP_CCO_ACTION_TEI_FLAGS_ROW_SIZE_BITS 32 /* 32 bits. */
-/* Return the next EKS value from the previous one. */
-#define CP_CCO_ACTION_EKS_NEXT(val) \
- (((val) + 1 > MAC_EKS_MAX) ? MAC_EKS_MIN : val + 1)
-
#define CP_CCO_ACTION_TEI_FLAGS_ROW 8
/* Conversion of minutes to eCos ticks. */
@@ -41,8 +37,6 @@ struct cp_cco_action_t
cp_sta_core_timed_event_def_t nek_change;
/** EKS timeout. */
cp_sta_core_timed_event_def_t eks_timer;
- /** EKS value to change. */
- uint eks_current;
/** The new NEK. */
cp_key_t nek_new;
/** Station's TEI with the one the transaction as started. */
diff --git a/cesar/cp/cco/action/src/cco_action.c b/cesar/cp/cco/action/src/cco_action.c
index 45db57a927..f26b01fb67 100644
--- a/cesar/cp/cco/action/src/cco_action.c
+++ b/cesar/cp/cco/action/src/cco_action.c
@@ -69,4 +69,3 @@ cp_cco_action_gen_nek_now (cp_t *ctx)
CP_SECU_PBKDF1_ITERATION_NEK, &key);
cp_beacon_change_nek (ctx, 0, key, true /* now. */);
}
-