summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlaranjeiro2008-07-15 15:37:32 +0000
committerlaranjeiro2008-07-15 15:37:32 +0000
commit972f9275c9aee58745c4d71a04ca214469b4fb33 (patch)
treea6f61fa58d283db89ac62e5f9ff61df379cf11da
parent03247f080aed6b595e5155e13a4bbb2829be02ba (diff)
cp2/secu: Resolving some wrong implementation on the protocol run initialisation. Closes #93
git-svn-id: svn+ssh://pessac/svn/cesar/trunk@2616 017c9cb6-072f-447c-8318-d5b54f68fe89
-rw-r--r--cesar/cp2/secu/src/secu.c4
-rw-r--r--cesar/cp2/secu/test/src/test-prun.c4
2 files changed, 6 insertions, 2 deletions
diff --git a/cesar/cp2/secu/src/secu.c b/cesar/cp2/secu/src/secu.c
index 03fad86c46..067a11aa79 100644
--- a/cesar/cp2/secu/src/secu.c
+++ b/cesar/cp2/secu/src/secu.c
@@ -34,8 +34,10 @@ cp_secu_protocol_run_new (cp_secu_protocol_run_t *prun, u8 pid, uint rand)
dbg_assert (pid <= 4);
memset (prun, 0, sizeof (cp_secu_protocol_run_t));
+ prun->pmn = 1;
prun->pid = pid;
prun->prn = rand;
+ prun->my_nonce = rand;
}
/**
@@ -66,7 +68,7 @@ cp_secu_protocol_check (const cp_secu_protocol_run_t *prun,
}
else
{
- if (prun_recv->pmn != 0)
+ if (prun_recv->pmn != 1)
return CP_SECU_PROTOCOL_RUN_CHECK_RESULT_FAILURE;
else
return CP_SECU_PROTOCOL_RUN_CHECK_RESULT_NEW;
diff --git a/cesar/cp2/secu/test/src/test-prun.c b/cesar/cp2/secu/test/src/test-prun.c
index 80ddd9cb25..0f511dee8b 100644
--- a/cesar/cp2/secu/test/src/test-prun.c
+++ b/cesar/cp2/secu/test/src/test-prun.c
@@ -27,8 +27,10 @@ test_case_secu_prun_init (test_t test)
test_begin (test, "Verify")
{
+ test_fail_if (prun.pmn != 0x1, "Wrong PMN");
test_fail_if (prun.pid != 0x1, "Wrong protocol run PID");
test_fail_if (prun.prn != 0x34, "Wrong PRN");
+ test_fail_if (prun.my_nonce != 0x34);
}
test_end;
}
@@ -154,7 +156,7 @@ test_case_secu_protocol_next (test_t test)
cp_secu_protocol_next (&prun, false);
test_begin (test, "Verify")
{
- test_fail_if (prun.pmn != 1, "Wrong PMN");
+ test_fail_if (prun.pmn != 2, "Wrong PMN");
}
test_end;