summaryrefslogtreecommitdiff
path: root/cesar/cp2
diff options
context:
space:
mode:
authorlaranjeiro2008-08-28 08:13:20 +0000
committerlaranjeiro2008-08-28 08:13:20 +0000
commitee76fd937ad61e34f2943d2e7b22874f9db23cc6 (patch)
tree7266eb024d3c060eed6a6f5462547d78330ff66a /cesar/cp2
parentf388788c731891ba8ee5086484983d9f47aa32a9 (diff)
cesar: Replace bitstream bad use by the correct use. Closes #97
git-svn-id: svn+ssh://pessac/svn/cesar/trunk@2779 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'cesar/cp2')
-rw-r--r--cesar/cp2/beacon/test/src/bentry.c10
-rw-r--r--cesar/cp2/cco/action/test/src/action-test.c3
-rw-r--r--cesar/cp2/secu/test/src/test-aes.c10
-rw-r--r--cesar/cp2/sta/mgr/test/src/cl_stub.c25
-rw-r--r--cesar/cp2/sta/mgr/test/src/sta-test.c10
-rw-r--r--cesar/cp2/sta/mgr/test/src/station_test.c4
6 files changed, 31 insertions, 31 deletions
diff --git a/cesar/cp2/beacon/test/src/bentry.c b/cesar/cp2/beacon/test/src/bentry.c
index e163466d43..134f8ace14 100644
--- a/cesar/cp2/beacon/test/src/bentry.c
+++ b/cesar/cp2/beacon/test/src/bentry.c
@@ -985,8 +985,9 @@ test_case_bentry_discover_info (test_t test)
test_case_begin (test, "Discover Info : Read");
- buffer [0] = CP_BENTRY_DISCOVER_INFO;
- buffer [1] = CP_BEACON_ENTRY_DISCOVER_INFO;
+ bitstream_init (&bitstream, buffer, 200, BITSTREAM_WRITE);
+ bitstream_write (&bitstream, CP_BENTRY_DISCOVER_INFO, 8);
+ bitstream_write (&bitstream, CP_BEACON_ENTRY_DISCOVER_INFO, 8);
info_struct.updated = true;
info_struct.cco_cap = 2;
@@ -999,8 +1000,7 @@ test_case_bentry_discover_info (test_t test)
info_struct.num_dis_net = 30;
info_struct.authentication = true;
info_struct.status_user_ap_cco = false;
-
- bitstream_init (&bitstream, buffer + 2, 10, BITSTREAM_WRITE);
+
bitstream_access (&bitstream, &info_struct.updated, 1);
bitstream_access (&bitstream, &info_struct.cco_cap, 2);
bitstream_access (&bitstream, &info_struct.proxy_net_cap, 1);
@@ -1058,7 +1058,7 @@ test_case_bentry_discover_info (test_t test)
bentry.read_write = CP_BEACON_BENTRY_WRITE;
cp_beacon_bentry_mgr_discover_info_bentry (&bentry, &info_struct);
-
+
test_begin (test, "verify")
{
test_fail_if (bitstream_memcmp(buffer, buffer2, 6) != true,
diff --git a/cesar/cp2/cco/action/test/src/action-test.c b/cesar/cp2/cco/action/test/src/action-test.c
index d68d76ae8e..900953d5fb 100644
--- a/cesar/cp2/cco/action/test/src/action-test.c
+++ b/cesar/cp2/cco/action/test/src/action-test.c
@@ -841,8 +841,7 @@ cp_msg_cm_get_key_req_receive (cp_t *ctx, cp_mme_rx_t *mme,
else
offset = 37;
- bitstream_memcpy (mme->p_mme + offset, &data->hash_key, mme->length -
- offset);
+ memcpy (mme->p_mme + offset, &data->hash_key, mme->length - offset);
return true;
}
diff --git a/cesar/cp2/secu/test/src/test-aes.c b/cesar/cp2/secu/test/src/test-aes.c
index d9c7d7cb02..60fd8e2820 100644
--- a/cesar/cp2/secu/test/src/test-aes.c
+++ b/cesar/cp2/secu/test/src/test-aes.c
@@ -42,11 +42,11 @@ test_case_aes (test_t test)
test_begin (test, "Verify")
{
- test_fail_if (bitstream_memcmp(output, result, 16) != true,
+ test_fail_if (memcmp(output, result, 16) != 0,
"Wrong encryption");
aes_decrypt (&aes, output, output);
- test_fail_if (bitstream_memcmp(output, input, 16) != true,
+ test_fail_if (memcmp(output, input, 16) != 0,
"Wrong encryption");
}
test_end;
@@ -76,11 +76,11 @@ test_case_aes_in_one_buffer (test_t test)
test_begin (test, "Verify")
{
- test_fail_if (bitstream_memcmp(buffer, result, 16) != true,
+ test_fail_if (memcmp(buffer, result, 16) != 0,
"Wrong encryption");
aes_decrypt (&aes, buffer, buffer);
- test_fail_if (bitstream_memcmp(buffer, input, 16) != true,
+ test_fail_if (memcmp(buffer, input, 16) != 0,
"Wrong encryption");
}
test_end;
@@ -111,7 +111,7 @@ test_case_aes_crypt_in_one_buffer (test_t test)
test_begin (test, "Verify")
{
aes_cbc_decrypt (&aes, key_cp, buffer, buffer, 224);
- test_fail_if (bitstream_memcmp(buffer, input, 224) != true,
+ test_fail_if (memcmp(buffer, input, 224) != 0,
"Wrong encryption");
}
test_end;
diff --git a/cesar/cp2/sta/mgr/test/src/cl_stub.c b/cesar/cp2/sta/mgr/test/src/cl_stub.c
index ca78f053a9..e9ff2f1556 100644
--- a/cesar/cp2/sta/mgr/test/src/cl_stub.c
+++ b/cesar/cp2/sta/mgr/test/src/cl_stub.c
@@ -9,17 +9,18 @@
* \file cl/cl_mactotei.h
* \brief mac to tei table interface between the CL and the CP
* \ingroup cl
- *
- */
+ *
+ */
#include "common/std.h"
#include "cl/cl_mactotei.h"
#include "lib/bitstream.h"
+#include <string.h>
/**
* Create a new table to be filled by the CP.
- *
- * \return a pointer to the new block to be fill with the mac to tei table
+ *
+ * \return a pointer to the new block to be fill with the mac to tei table
* data
*/
cl_mactotei_blk_t *
@@ -65,12 +66,12 @@ void cl_mactotei_addr_add (cl_mactotei_blk_t *table, mac_t mac_addr,
/**
* Request the CL to copy all the data corresponding to the tag.
- *
+ *
* \param ctx the cl context.
* \param table the mactotei new table to fill
* \param tag the tag to copy
*/
-void
+void
cl_mactotei_copy_tag (cl_t *ctx,
cl_mactotei_blk_t *table, u8 tag)
{
@@ -78,13 +79,13 @@ cl_mactotei_copy_tag (cl_t *ctx,
/**
* Request the CL to copy all the data corresponding to the tag and the tei.
- *
+ *
* \param ctx the cl context.
* \param table the mactotei new table to fill
* \param tei the tei to copy.
* \param tag the tag to copy
*/
-void
+void
cl_mactotei_copy_tei_and_tag (cl_t *ctx,
cl_mactotei_blk_t *table, u8 tei, u8 tag)
{
@@ -92,9 +93,9 @@ cl_mactotei_copy_tei_and_tag (cl_t *ctx,
/**
* Request the CL to use the new table and remove the old one.
- *
+ *
* \param ctx the CL context
- * \param table the new table to use.
+ * \param table the new table to use.
*/
void
cl_mactotei_use_table (cl_t *ctx, cl_mactotei_blk_t *table)
@@ -102,14 +103,14 @@ cl_mactotei_use_table (cl_t *ctx, cl_mactotei_blk_t *table)
dbg_assert (ctx);
dbg_assert (table);
- bitstream_memcpy ((u8 *) ctx, (u8 *)table, 512) ;
+ memcpy ((u8 *) ctx, (u8 *)table, 512) ;
blk_release (table);
}
/**
* Release the complete table from the memory.
- *
+ *
* \param ctx the convergence layer context
*/
void cl_mactotei_release_table (cl_t *ctx)
diff --git a/cesar/cp2/sta/mgr/test/src/sta-test.c b/cesar/cp2/sta/mgr/test/src/sta-test.c
index 68abb71aa1..ab22b07903 100644
--- a/cesar/cp2/sta/mgr/test/src/sta-test.c
+++ b/cesar/cp2/sta/mgr/test/src/sta-test.c
@@ -190,9 +190,9 @@ test_case_sta_npw (test_t test)
test_begin (test, "get the NPW")
{
- test_fail_if (bitstream_memcmp (
+ test_fail_if (memcmp (
(u8 *) cp_sta_own_data_get_npw(&cp),
- npw, sizeof (npw)) != true, "Wrong NPW");
+ npw, sizeof (npw)) != 0, "Wrong NPW");
}
test_end;
}
@@ -261,16 +261,16 @@ test_case_sta_dpw (test_t test)
test_begin (test, "store of the DPW")
{
- test_fail_if (bitstream_memcmp(data->dpw, dpw, sizeof(dpw)) != true,
+ test_fail_if (memcmp(data->dpw, dpw, sizeof(dpw)) != 0,
"wrong DPW");
}
test_end;
test_begin (test, "get the DPW")
{
- test_fail_if (bitstream_memcmp (
+ test_fail_if (memcmp (
(u8 *) cp_sta_own_data_get_dpw(&cp),
- dpw, sizeof (dpw)) != true, "Wrong NMK");
+ dpw, sizeof (dpw)) != 0, "Wrong NMK");
}
test_end;
}
diff --git a/cesar/cp2/sta/mgr/test/src/station_test.c b/cesar/cp2/sta/mgr/test/src/station_test.c
index e55e436e3b..e5235ef21d 100644
--- a/cesar/cp2/sta/mgr/test/src/station_test.c
+++ b/cesar/cp2/sta/mgr/test/src/station_test.c
@@ -39,8 +39,8 @@ test_case_station_init (test_t test)
test_case_begin (test, "Station init");
test_begin (test, "verify data")
{
- test_fail_if (bitstream_memcmp(sta, &station,
- sizeof(cp_sta_private_t)) != true,
+ test_fail_if (memcmp(sta, &station,
+ sizeof(cp_sta_private_t)) != 0,
"Wrong sta is not initialised");
}
test_end;