summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlaranjeiro2008-06-25 09:44:35 +0000
committerlaranjeiro2008-06-25 09:44:35 +0000
commitc9b1d919bfed160d88b41a90d26eae2a2639ba6b (patch)
treed0db17216534babec619cc518b90a6deff49df21
parent9b2ae34d1350e70f90fb82e700920120aa90067a (diff)
cp2/msg : Added the test to verify the data in the payload of a Encrypted MME.
git-svn-id: svn+ssh://pessac/svn/cesar/trunk@2431 017c9cb6-072f-447c-8318-d5b54f68fe89
-rw-r--r--cesar/cp2/msg/src/msg.c3
-rw-r--r--cesar/cp2/msg/test/src/test-msg.c18
2 files changed, 20 insertions, 1 deletions
diff --git a/cesar/cp2/msg/src/msg.c b/cesar/cp2/msg/src/msg.c
index 71353a62a7..265a4dec70 100644
--- a/cesar/cp2/msg/src/msg.c
+++ b/cesar/cp2/msg/src/msg.c
@@ -630,6 +630,9 @@ cp_msg_mme_read_header_enc (cp_t *ctx, cp_mme_rx_t *mme)
// MMTYPE.
bitstream_access (&mme->bitstream, &mme->mmtype, 16);
+ // FMI
+ bitstream_access (&mme->bitstream, &data, 16);
+
return true;
}
diff --git a/cesar/cp2/msg/test/src/test-msg.c b/cesar/cp2/msg/test/src/test-msg.c
index ca939531bd..cc7d112110 100644
--- a/cesar/cp2/msg/test/src/test-msg.c
+++ b/cesar/cp2/msg/test/src/test-msg.c
@@ -642,6 +642,8 @@ test_case_msg_mme_rx_with_vlan_tag (test_t test)
prun.my_nonce = 0x3;
prun.your_nonce = 0x4;
+ test_case_begin (test, "Reading a CM_ENC_Payload");
+
cp_sta_own_data_set_mac_address (sta, 0x123456789ABCull, &cp);
mme = cp_msg_mme_init_encrypted (&cp, &peer, 0xb0, 2, &prun);
mme->length = 200-23;
@@ -668,9 +670,23 @@ test_case_msg_mme_rx_with_vlan_tag (test_t test)
slab_release (mme);
data = cp_msg_mme_read_header_enc (&cp, mme_rx);
-
dbg_check (data);
+ // Test the data.
+ test_begin (test, "Verify")
+ {
+ test_fail_if (mme_rx->mmtype != 0xb0, "Wrong MMType");
+ test_fail_if (mme_rx->length != 200-23, "Wrong Length");
+
+ for (i = 0; i < mme_rx->length - 2; i++)
+ {
+ bitstream_access (&mme_rx->bitstream, &data, 8);
+ test_fail_if (data != 0xAA, "Wrong data index : %d", i);
+ }
+ }
+ test_end;
+
+
slab_release (mme_rx);
cp_msg_uninit (&cp);
}