- Much improvements to the proof output.
This commit is contained in:
parent
c993e17597
commit
be2df84f91
128
src/arachne.c
128
src/arachne.c
@ -187,7 +187,7 @@ add_read_goals (const int run, const int old, const int new)
|
|||||||
if (count == 0)
|
if (count == 0)
|
||||||
{
|
{
|
||||||
indentPrint ();
|
indentPrint ();
|
||||||
eprintf ("* Thus, we must also produce ");
|
eprintf ("Thus, we must also produce ");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -321,7 +321,6 @@ proof_select_goal (Binding b)
|
|||||||
Roledef rd;
|
Roledef rd;
|
||||||
|
|
||||||
rd = roledef_shift (sys->runs[b->run_to].start, b->ev_to);
|
rd = roledef_shift (sys->runs[b->run_to].start, b->ev_to);
|
||||||
indentDepth--;
|
|
||||||
indentPrint ();
|
indentPrint ();
|
||||||
eprintf ("Selected goal: Where does term ");
|
eprintf ("Selected goal: Where does term ");
|
||||||
termPrint (b->term);
|
termPrint (b->term);
|
||||||
@ -330,7 +329,6 @@ proof_select_goal (Binding b)
|
|||||||
eprintf ("* It is required for ");
|
eprintf ("* It is required for ");
|
||||||
roledefPrint (rd);
|
roledefPrint (rd);
|
||||||
eprintf (" at index %i in run %i\n", b->ev_to, b->run_to);
|
eprintf (" at index %i in run %i\n", b->ev_to, b->run_to);
|
||||||
indentDepth++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -426,11 +424,13 @@ bind_existing_to_goal (const Binding b, const int run, const int index)
|
|||||||
int flag;
|
int flag;
|
||||||
int old_length;
|
int old_length;
|
||||||
int newgoals;
|
int newgoals;
|
||||||
|
int found;
|
||||||
|
|
||||||
int subterm_iterate (Termlist substlist, Termlist keylist)
|
int subterm_iterate (Termlist substlist, Termlist keylist)
|
||||||
{
|
{
|
||||||
int flag;
|
int flag;
|
||||||
|
|
||||||
|
found++;
|
||||||
flag = 1;
|
flag = 1;
|
||||||
if (goal_bind (b, run, index))
|
if (goal_bind (b, run, index))
|
||||||
{
|
{
|
||||||
@ -442,7 +442,7 @@ bind_existing_to_goal (const Binding b, const int run, const int index)
|
|||||||
{
|
{
|
||||||
indentPrint ();
|
indentPrint ();
|
||||||
eprintf
|
eprintf
|
||||||
("* This introduces the obligation to produce the following keys: ");
|
("This introduces the obligation to produce the following keys: ");
|
||||||
termlistPrint (keylist);
|
termlistPrint (keylist);
|
||||||
eprintf ("\n");
|
eprintf ("\n");
|
||||||
}
|
}
|
||||||
@ -457,7 +457,9 @@ bind_existing_to_goal (const Binding b, const int run, const int index)
|
|||||||
keycount++;
|
keycount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
indentDepth++;
|
||||||
flag = flag && iterate ();
|
flag = flag && iterate ();
|
||||||
|
indentDepth--;
|
||||||
|
|
||||||
while (keycount > 0)
|
while (keycount > 0)
|
||||||
{
|
{
|
||||||
@ -485,8 +487,17 @@ bind_existing_to_goal (const Binding b, const int run, const int index)
|
|||||||
newgoals = 0;
|
newgoals = 0;
|
||||||
|
|
||||||
// Bind to existing run
|
// Bind to existing run
|
||||||
|
found = 0;
|
||||||
flag = termMguSubTerm (b->term, rd->message,
|
flag = termMguSubTerm (b->term, rd->message,
|
||||||
subterm_iterate, sys->know->inverses, NULL);
|
subterm_iterate, sys->know->inverses, NULL);
|
||||||
|
// Did it work?
|
||||||
|
if (found == 0 && sys->output == PROOF)
|
||||||
|
{
|
||||||
|
indentPrint ();
|
||||||
|
eprintf ("Cannot bind ");
|
||||||
|
termPrint (b->term);
|
||||||
|
eprintf (" to run %i, index %i because it does not subterm-unify.\n", run, index);
|
||||||
|
}
|
||||||
// Reset length
|
// Reset length
|
||||||
remove_read_goals (newgoals);
|
remove_read_goals (newgoals);
|
||||||
sys->runs[run].length = old_length;
|
sys->runs[run].length = old_length;
|
||||||
@ -679,8 +690,10 @@ bind_goal_new_m0 (const Binding b)
|
|||||||
{
|
{
|
||||||
Termlist m0tl;
|
Termlist m0tl;
|
||||||
int flag;
|
int flag;
|
||||||
|
int found;
|
||||||
|
|
||||||
flag = 1;
|
flag = 1;
|
||||||
|
found = 0;
|
||||||
m0tl = knowledgeSet (sys->know);
|
m0tl = knowledgeSet (sys->know);
|
||||||
while (flag && m0tl != NULL)
|
while (flag && m0tl != NULL)
|
||||||
{
|
{
|
||||||
@ -701,11 +714,12 @@ bind_goal_new_m0 (const Binding b)
|
|||||||
indentDepth++;
|
indentDepth++;
|
||||||
if (goal_bind (b, run, 0))
|
if (goal_bind (b, run, 0))
|
||||||
{
|
{
|
||||||
|
found++;
|
||||||
proof_suppose_binding (b);
|
proof_suppose_binding (b);
|
||||||
if (sys->output == PROOF)
|
if (sys->output == PROOF)
|
||||||
{
|
{
|
||||||
indentPrint ();
|
indentPrint ();
|
||||||
eprintf ("* Retrieving ");
|
eprintf ("* I.e. retrieving ");
|
||||||
termPrint (b->term);
|
termPrint (b->term);
|
||||||
eprintf (" from the initial knowledge.\n");
|
eprintf (" from the initial knowledge.\n");
|
||||||
}
|
}
|
||||||
@ -725,6 +739,13 @@ bind_goal_new_m0 (const Binding b)
|
|||||||
m0tl = m0tl->next;
|
m0tl = m0tl->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (found == 0 && sys->output == PROOF)
|
||||||
|
{
|
||||||
|
indentPrint ();
|
||||||
|
eprintf ("Term ");
|
||||||
|
termPrint (b->term);
|
||||||
|
eprintf (" cannot be constructed from the initial knowledge.\n");
|
||||||
|
}
|
||||||
termlistDelete (m0tl);
|
termlistDelete (m0tl);
|
||||||
return flag;
|
return flag;
|
||||||
}
|
}
|
||||||
@ -795,6 +816,16 @@ bind_goal_new_encrypt (const Binding b)
|
|||||||
remove_read_goals (newgoals);
|
remove_read_goals (newgoals);
|
||||||
roleInstanceDestroy (sys);
|
roleInstanceDestroy (sys);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (sys->output == PROOF)
|
||||||
|
{
|
||||||
|
indentPrint ();
|
||||||
|
eprintf ("Term ");
|
||||||
|
termPrint (b->term);
|
||||||
|
eprintf (" cannot be constructed by encryption.\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
return flag;
|
return flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -805,7 +836,20 @@ bind_goal_new_encrypt (const Binding b)
|
|||||||
int
|
int
|
||||||
bind_goal_new_intruder_run (const Binding b)
|
bind_goal_new_intruder_run (const Binding b)
|
||||||
{
|
{
|
||||||
return (bind_goal_new_m0 (b) && bind_goal_new_encrypt (b));
|
int flag;
|
||||||
|
|
||||||
|
if (sys->output == PROOF)
|
||||||
|
{
|
||||||
|
indentPrint ();
|
||||||
|
eprintf ("Can we bind ");
|
||||||
|
termPrint (b->term);
|
||||||
|
eprintf (" from a new intruder run?\n");
|
||||||
|
}
|
||||||
|
indentDepth++;
|
||||||
|
flag = bind_goal_new_m0 (b);
|
||||||
|
flag = flag && bind_goal_new_encrypt (b);
|
||||||
|
indentDepth--;
|
||||||
|
return flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Bind a regular goal
|
//! Bind a regular goal
|
||||||
@ -853,12 +897,17 @@ bind_goal_regular_run (const Binding b)
|
|||||||
|
|
||||||
// A good candidate
|
// A good candidate
|
||||||
found++;
|
found++;
|
||||||
|
if (sys->output == PROOF && found == 1)
|
||||||
|
{
|
||||||
|
indentPrint ();
|
||||||
|
eprintf ("The term ", found);
|
||||||
|
termPrint (b->term);
|
||||||
|
eprintf (" matches patterns from the role definitions. Investigate.\n");
|
||||||
|
}
|
||||||
if (sys->output == PROOF)
|
if (sys->output == PROOF)
|
||||||
{
|
{
|
||||||
indentPrint ();
|
indentPrint ();
|
||||||
eprintf ("* ");
|
eprintf ("%i. It matches the pattern ", found);
|
||||||
termPrint (b->term);
|
|
||||||
eprintf (" matches the pattern ");
|
|
||||||
termPrint (rd->message);
|
termPrint (rd->message);
|
||||||
eprintf (" from ");
|
eprintf (" from ");
|
||||||
termPrint (p->nameterm);
|
termPrint (p->nameterm);
|
||||||
@ -866,10 +915,12 @@ bind_goal_regular_run (const Binding b)
|
|||||||
termPrint (r->nameterm);
|
termPrint (r->nameterm);
|
||||||
eprintf (", at %i\n", index);
|
eprintf (", at %i\n", index);
|
||||||
}
|
}
|
||||||
|
indentDepth++;
|
||||||
// Bind to existing run
|
// Bind to existing run
|
||||||
flag = bind_existing_run (b, p, r, index);
|
flag = bind_existing_run (b, p, r, index);
|
||||||
// bind to new run
|
// bind to new run
|
||||||
flag = flag && bind_new_run (b, p, r, index);
|
flag = flag && bind_new_run (b, p, r, index);
|
||||||
|
indentDepth--;
|
||||||
return flag;
|
return flag;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -879,13 +930,6 @@ bind_goal_regular_run (const Binding b)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Bind to all possible sends of regular runs
|
// Bind to all possible sends of regular runs
|
||||||
#ifdef DEBUG
|
|
||||||
if (DEBUGL (5))
|
|
||||||
{
|
|
||||||
indentPrint ();
|
|
||||||
eprintf ("Try regular role send.\n");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
found = 0;
|
found = 0;
|
||||||
flag = iterate_role_sends (bind_this_role_send);
|
flag = iterate_role_sends (bind_this_role_send);
|
||||||
if (sys->output == PROOF && found == 0)
|
if (sys->output == PROOF && found == 0)
|
||||||
@ -905,15 +949,9 @@ bind_goal_old_intruder_run (Binding b)
|
|||||||
{
|
{
|
||||||
int run;
|
int run;
|
||||||
int flag;
|
int flag;
|
||||||
|
int found;
|
||||||
|
|
||||||
#ifdef DEBUG
|
found = 0;
|
||||||
if (DEBUGL (5))
|
|
||||||
{
|
|
||||||
indentPrint ();
|
|
||||||
eprintf ("Try existing intruder send.\n");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
flag = 1;
|
flag = 1;
|
||||||
for (run = 0; run < sys->maxruns; run++)
|
for (run = 0; run < sys->maxruns; run++)
|
||||||
{
|
{
|
||||||
@ -928,13 +966,26 @@ bind_goal_old_intruder_run (Binding b)
|
|||||||
{
|
{
|
||||||
if (rd->type == SEND)
|
if (rd->type == SEND)
|
||||||
{
|
{
|
||||||
|
found++;
|
||||||
|
if (sys->output == PROOF && found == 1)
|
||||||
|
{
|
||||||
|
indentPrint ();
|
||||||
|
eprintf ("Suppose it is from an existing intruder run.\n");
|
||||||
|
}
|
||||||
|
indentDepth++;
|
||||||
flag = flag && bind_existing_to_goal (b, run, ev);
|
flag = flag && bind_existing_to_goal (b, run, ev);
|
||||||
|
indentDepth--;
|
||||||
}
|
}
|
||||||
rd = rd->next;
|
rd = rd->next;
|
||||||
ev++;
|
ev++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (sys->output == PROOF && found == 0)
|
||||||
|
{
|
||||||
|
indentPrint ();
|
||||||
|
eprintf ("No existing intruder runs to match to.\n");
|
||||||
|
}
|
||||||
return flag;
|
return flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -947,28 +998,9 @@ bind_goal (const Binding b)
|
|||||||
int flag;
|
int flag;
|
||||||
|
|
||||||
proof_select_goal (b);
|
proof_select_goal (b);
|
||||||
if (sys->output == PROOF)
|
|
||||||
{
|
|
||||||
indentPrint ();
|
|
||||||
eprintf ("A. Suppose it is from a regular protocol role.\n");
|
|
||||||
}
|
|
||||||
indentDepth++;
|
indentDepth++;
|
||||||
flag = bind_goal_regular_run (b);
|
flag = bind_goal_regular_run (b);
|
||||||
indentDepth--;
|
|
||||||
if (sys->output == PROOF)
|
|
||||||
{
|
|
||||||
indentPrint ();
|
|
||||||
eprintf ("B. Suppose it is from an existing intruder run.\n");
|
|
||||||
}
|
|
||||||
indentDepth++;
|
|
||||||
flag = flag && bind_goal_old_intruder_run (b);
|
flag = flag && bind_goal_old_intruder_run (b);
|
||||||
indentDepth--;
|
|
||||||
if (sys->output == PROOF)
|
|
||||||
{
|
|
||||||
indentPrint ();
|
|
||||||
eprintf ("C. Suppose it is from a new intruder run.\n");
|
|
||||||
}
|
|
||||||
indentDepth++;
|
|
||||||
flag = flag && bind_goal_new_intruder_run (b);
|
flag = flag && bind_goal_new_intruder_run (b);
|
||||||
indentDepth--;
|
indentDepth--;
|
||||||
return flag;
|
return flag;
|
||||||
@ -1167,7 +1199,7 @@ iterate ()
|
|||||||
if (sys->output == PROOF)
|
if (sys->output == PROOF)
|
||||||
{
|
{
|
||||||
indentPrint ();
|
indentPrint ();
|
||||||
eprintf ("All goals are now bound.");
|
eprintf ("All goals are now bound.\n");
|
||||||
}
|
}
|
||||||
sys->claims = statesIncrease (sys->claims);
|
sys->claims = statesIncrease (sys->claims);
|
||||||
current_claim->count = statesIncrease (current_claim->count);
|
current_claim->count = statesIncrease (current_claim->count);
|
||||||
@ -1260,16 +1292,19 @@ arachne ()
|
|||||||
p = (Protocol) cl->protocol;
|
p = (Protocol) cl->protocol;
|
||||||
r = (Role) cl->role;
|
r = (Role) cl->role;
|
||||||
|
|
||||||
roleInstance (sys, p, r, NULL, NULL);
|
|
||||||
if (sys->output == PROOF)
|
if (sys->output == PROOF)
|
||||||
{
|
{
|
||||||
indentPrint ();
|
indentPrint ();
|
||||||
eprintf ("Testing Claim ");
|
eprintf ("Testing Claim ");
|
||||||
termPrint (cl->type);
|
termPrint (cl->type);
|
||||||
eprintf (" from ");
|
eprintf (" from ");
|
||||||
role_name_print (0);
|
termPrint (p->nameterm);
|
||||||
|
eprintf (", ");
|
||||||
|
termPrint (r->nameterm);
|
||||||
eprintf (" at index %i.\n", cl->ev);
|
eprintf (" at index %i.\n", cl->ev);
|
||||||
}
|
}
|
||||||
|
indentDepth++;
|
||||||
|
roleInstance (sys, p, r, NULL, NULL);
|
||||||
proof_suppose_run (0, 0, cl->ev + 1);
|
proof_suppose_run (0, 0, cl->ev + 1);
|
||||||
add_read_goals (sys->maxruns - 1, 0, cl->ev + 1);
|
add_read_goals (sys->maxruns - 1, 0, cl->ev + 1);
|
||||||
|
|
||||||
@ -1297,6 +1332,7 @@ arachne ()
|
|||||||
{
|
{
|
||||||
roleInstanceDestroy (sys);
|
roleInstanceDestroy (sys);
|
||||||
}
|
}
|
||||||
|
indentDepth--;
|
||||||
}
|
}
|
||||||
// next
|
// next
|
||||||
cl = cl->next;
|
cl = cl->next;
|
||||||
|
Loading…
Reference in New Issue
Block a user