- Reindented everything, so the layout is up to date again.
This commit is contained in:
parent
4d1362cb1b
commit
71c658051e
@ -14,7 +14,8 @@ int cTod = 0;
|
|||||||
*@param tb The attack buffer.
|
*@param tb The attack buffer.
|
||||||
*@param ev The reference event index.
|
*@param ev The reference event index.
|
||||||
*/
|
*/
|
||||||
void markback(const System sys, struct tracebuf *tb, int ev)
|
void
|
||||||
|
markback (const System sys, struct tracebuf *tb, int ev)
|
||||||
{
|
{
|
||||||
int run = tb->run[ev];
|
int run = tb->run[ev];
|
||||||
|
|
||||||
@ -53,7 +54,8 @@ void markback(const System sys, struct tracebuf *tb, int ev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! Minimize the attack.
|
//! Minimize the attack.
|
||||||
void attackMinimize(const System sys, struct tracebuf *tb)
|
void
|
||||||
|
attackMinimize (const System sys, struct tracebuf *tb)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int j;
|
int j;
|
||||||
|
39
src/claim.c
39
src/claim.c
@ -20,7 +20,8 @@
|
|||||||
#ifdef OKIDEBUG
|
#ifdef OKIDEBUG
|
||||||
int indac = 0;
|
int indac = 0;
|
||||||
|
|
||||||
void indact ()
|
void
|
||||||
|
indact ()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -48,8 +49,7 @@ events_match (const System sys, const int i, const int j)
|
|||||||
isTermEqual (rdi->from, rdj->from) &&
|
isTermEqual (rdi->from, rdj->from) &&
|
||||||
isTermEqual (rdi->to, rdj->to) &&
|
isTermEqual (rdi->to, rdj->to) &&
|
||||||
isTermEqual (rdi->label, rdj->label) &&
|
isTermEqual (rdi->label, rdj->label) &&
|
||||||
!(rdi->internal || rdj->internal)
|
!(rdi->internal || rdj->internal))
|
||||||
)
|
|
||||||
{
|
{
|
||||||
if (rdi->type == SEND && rdj->type == READ)
|
if (rdi->type == SEND && rdj->type == READ)
|
||||||
{
|
{
|
||||||
@ -99,7 +99,8 @@ oki_nisynch_full (const System sys, const Termmap label_to_index)
|
|||||||
|
|
||||||
//! Evaluate claims or internal reads (chooses)
|
//! Evaluate claims or internal reads (chooses)
|
||||||
__inline__ int
|
__inline__ int
|
||||||
oki_nisynch_other (const System sys, const int trace_index, const Termmap role_to_run, const Termmap label_to_index)
|
oki_nisynch_other (const System sys, const int trace_index,
|
||||||
|
const Termmap role_to_run, const Termmap label_to_index)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
@ -119,7 +120,8 @@ oki_nisynch_other (const System sys, const int trace_index, const Termmap role_t
|
|||||||
|
|
||||||
//! Evaluate reads
|
//! Evaluate reads
|
||||||
__inline__ int
|
__inline__ int
|
||||||
oki_nisynch_read (const System sys, const int trace_index, const Termmap role_to_run, const Termmap label_to_index)
|
oki_nisynch_read (const System sys, const int trace_index,
|
||||||
|
const Termmap role_to_run, const Termmap label_to_index)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Read is only relevant for already involved runs, and labels in prec
|
* Read is only relevant for already involved runs, and labels in prec
|
||||||
@ -144,13 +146,16 @@ oki_nisynch_read (const System sys, const int trace_index, const Termmap role_to
|
|||||||
int result;
|
int result;
|
||||||
|
|
||||||
label_to_index_buf = termmapDuplicate (label_to_index);
|
label_to_index_buf = termmapDuplicate (label_to_index);
|
||||||
label_to_index_buf = termmapSet (label_to_index_buf, rd->label, trace_index);
|
label_to_index_buf =
|
||||||
|
termmapSet (label_to_index_buf, rd->label, trace_index);
|
||||||
#ifdef OKIDEBUG
|
#ifdef OKIDEBUG
|
||||||
indact ();
|
indact ();
|
||||||
printf ("Exploring because this (read) run is involved.\n");
|
printf ("Exploring because this (read) run is involved.\n");
|
||||||
indac++;
|
indac++;
|
||||||
#endif
|
#endif
|
||||||
result = oki_nisynch (sys, trace_index-1, role_to_run, label_to_index_buf);
|
result =
|
||||||
|
oki_nisynch (sys, trace_index - 1, role_to_run,
|
||||||
|
label_to_index_buf);
|
||||||
#ifdef OKIDEBUG
|
#ifdef OKIDEBUG
|
||||||
indact ();
|
indact ();
|
||||||
printf (">%i<\n", result);
|
printf (">%i<\n", result);
|
||||||
@ -178,7 +183,8 @@ oki_nisynch_read (const System sys, const int trace_index, const Termmap role_to
|
|||||||
|
|
||||||
//! Evaluate sends
|
//! Evaluate sends
|
||||||
__inline__ int
|
__inline__ int
|
||||||
oki_nisynch_send (const System sys, const int trace_index, const Termmap role_to_run, const Termmap label_to_index)
|
oki_nisynch_send (const System sys, const int trace_index,
|
||||||
|
const Termmap role_to_run, const Termmap label_to_index)
|
||||||
{
|
{
|
||||||
Roledef rd;
|
Roledef rd;
|
||||||
int rid;
|
int rid;
|
||||||
@ -241,15 +247,20 @@ oki_nisynch_send (const System sys, const int trace_index, const Termmap role_to
|
|||||||
role_to_run_buf = termmapDuplicate (role_to_run);
|
role_to_run_buf = termmapDuplicate (role_to_run);
|
||||||
role_to_run_buf = termmapSet (role_to_run_buf, rolename, rid);
|
role_to_run_buf = termmapSet (role_to_run_buf, rolename, rid);
|
||||||
label_to_index_buf = termmapDuplicate (label_to_index);
|
label_to_index_buf = termmapDuplicate (label_to_index);
|
||||||
label_to_index_buf = termmapSet (label_to_index_buf, rd->label, LABEL_GOOD);
|
label_to_index_buf =
|
||||||
|
termmapSet (label_to_index_buf, rd->label, LABEL_GOOD);
|
||||||
#ifdef OKIDEBUG
|
#ifdef OKIDEBUG
|
||||||
indact ();
|
indact ();
|
||||||
printf ("In NI-Synch scan, assuming %i run is involved.\n", rid);
|
printf ("In NI-Synch scan, assuming %i run is involved.\n",
|
||||||
|
rid);
|
||||||
indact ();
|
indact ();
|
||||||
printf ("Exploring further assuming this matching, which worked.\n");
|
printf
|
||||||
|
("Exploring further assuming this matching, which worked.\n");
|
||||||
indac++;
|
indac++;
|
||||||
#endif
|
#endif
|
||||||
result = oki_nisynch (sys, trace_index-1, role_to_run_buf, label_to_index_buf);
|
result =
|
||||||
|
oki_nisynch (sys, trace_index - 1, role_to_run_buf,
|
||||||
|
label_to_index_buf);
|
||||||
#ifdef OKIDEBUG
|
#ifdef OKIDEBUG
|
||||||
indact ();
|
indact ();
|
||||||
printf (">%i<\n", result);
|
printf (">%i<\n", result);
|
||||||
@ -274,7 +285,8 @@ oki_nisynch_send (const System sys, const int trace_index, const Termmap role_to
|
|||||||
*@returns 1 iff the claim is allright, 0 iff it is violated.
|
*@returns 1 iff the claim is allright, 0 iff it is violated.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
oki_nisynch (const System sys, const int trace_index, const Termmap role_to_run, const Termmap label_to_index)
|
oki_nisynch (const System sys, const int trace_index,
|
||||||
|
const Termmap role_to_run, const Termmap label_to_index)
|
||||||
{
|
{
|
||||||
int type;
|
int type;
|
||||||
|
|
||||||
@ -428,4 +440,3 @@ check_claim_niagree (const System sys, const int i)
|
|||||||
termmapDelete (g);
|
termmapDelete (g);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -243,7 +243,8 @@ symbolFind (Symbol s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! Yield a basic global constant term (we suppose it exists) or NULL, given a string
|
//! Yield a basic global constant term (we suppose it exists) or NULL, given a string
|
||||||
Term findGlobalConstant (const char *s)
|
Term
|
||||||
|
findGlobalConstant (const char *s)
|
||||||
{
|
{
|
||||||
return levelFind (lookup (s), 0);
|
return levelFind (lookup (s), 0);
|
||||||
}
|
}
|
||||||
@ -286,7 +287,9 @@ defineUsertype (Tac tcdu)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* that's not right! */
|
/* that's not right! */
|
||||||
error ("Conflicting definitions in usertype definition on line %i.", tc->lineno);
|
error
|
||||||
|
("Conflicting definitions in usertype definition on line %i.",
|
||||||
|
tc->lineno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tc = tc->next;
|
tc = tc->next;
|
||||||
@ -303,7 +306,8 @@ levelTacDeclaration (Tac tc, int isVar)
|
|||||||
tscan = tc->t2.tac;
|
tscan = tc->t2.tac;
|
||||||
if (!isVar && tscan->next != NULL)
|
if (!isVar && tscan->next != NULL)
|
||||||
{
|
{
|
||||||
error ("Multiple type definition for constant on line %i.", tscan->lineno);
|
error ("Multiple type definition for constant on line %i.",
|
||||||
|
tscan->lineno);
|
||||||
}
|
}
|
||||||
while (tscan != NULL && tscan->op == TAC_STRING)
|
while (tscan != NULL && tscan->op == TAC_STRING)
|
||||||
{
|
{
|
||||||
@ -319,7 +323,8 @@ levelTacDeclaration (Tac tc, int isVar)
|
|||||||
{
|
{
|
||||||
if (!inTermlist (t->stype, TERM_Type))
|
if (!inTermlist (t->stype, TERM_Type))
|
||||||
{
|
{
|
||||||
error ("Non-type constant in type declaration on line %i.", tscan->lineno);
|
error ("Non-type constant in type declaration on line %i.",
|
||||||
|
tscan->lineno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
typetl = termlistAdd (typetl, t);
|
typetl = termlistAdd (typetl, t);
|
||||||
@ -385,7 +390,8 @@ commEvent (int event, Tac tc)
|
|||||||
/* now parse tuple info */
|
/* now parse tuple info */
|
||||||
if (trip == NULL || trip->next == NULL)
|
if (trip == NULL || trip->next == NULL)
|
||||||
{
|
{
|
||||||
error ("Problem with claim %i event on line %i.", event, tc->lineno);
|
error ("Problem with claim %i event on line %i.", event,
|
||||||
|
tc->lineno);
|
||||||
}
|
}
|
||||||
fromrole = tacTerm (trip);
|
fromrole = tacTerm (trip);
|
||||||
claimbig = tacTerm (tacTuple ((trip->next)));
|
claimbig = tacTerm (tacTuple ((trip->next)));
|
||||||
@ -394,8 +400,7 @@ commEvent (int event, Tac tc)
|
|||||||
torole = claim;
|
torole = claim;
|
||||||
|
|
||||||
/* check for ignored claim types */
|
/* check for ignored claim types */
|
||||||
if (sys->switchClaimToCheck != NULL &&
|
if (sys->switchClaimToCheck != NULL && sys->switchClaimToCheck != claim)
|
||||||
sys->switchClaimToCheck != claim)
|
|
||||||
{
|
{
|
||||||
/* abort the construction of the node */
|
/* abort the construction of the node */
|
||||||
return;
|
return;
|
||||||
@ -426,7 +431,8 @@ commEvent (int event, Tac tc)
|
|||||||
msg = deVar (claimbig)->right.op2;
|
msg = deVar (claimbig)->right.op2;
|
||||||
if (tupleCount (msg) != n)
|
if (tupleCount (msg) != n)
|
||||||
{
|
{
|
||||||
error ("Problem with claim tuple unfolding at line %i.", trip->next->lineno);
|
error ("Problem with claim tuple unfolding at line %i.",
|
||||||
|
trip->next->lineno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -462,7 +468,9 @@ commEvent (int event, Tac tc)
|
|||||||
{
|
{
|
||||||
if (n == 0)
|
if (n == 0)
|
||||||
{
|
{
|
||||||
error ("Secrecy claim requires a list of terms to be secret on line %i.",trip->next->lineno);
|
error
|
||||||
|
("Secrecy claim requires a list of terms to be secret on line %i.",
|
||||||
|
trip->next->lineno);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -470,7 +478,8 @@ commEvent (int event, Tac tc)
|
|||||||
{
|
{
|
||||||
if (n != 0)
|
if (n != 0)
|
||||||
{
|
{
|
||||||
error ("NISYNCH claim requires no parameters at line %i.", trip->next->lineno);
|
error ("NISYNCH claim requires no parameters at line %i.",
|
||||||
|
trip->next->lineno);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -478,7 +487,8 @@ commEvent (int event, Tac tc)
|
|||||||
{
|
{
|
||||||
if (n != 0)
|
if (n != 0)
|
||||||
{
|
{
|
||||||
error ("NIAGREE claim requires no parameters at line %i.", trip->next->lineno);
|
error ("NIAGREE claim requires no parameters at line %i.",
|
||||||
|
trip->next->lineno);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -518,7 +528,8 @@ normalDeclaration (Tac tc)
|
|||||||
knowledgeAddTermlist (sys->know, tacTermlist (tc->t1.tac));
|
knowledgeAddTermlist (sys->know, tacTermlist (tc->t1.tac));
|
||||||
break;
|
break;
|
||||||
case TAC_INVERSEKEYS:
|
case TAC_INVERSEKEYS:
|
||||||
knowledgeAddInverse (sys->know, tacTerm (tc->t1.tac), tacTerm (tc->t2.tac));
|
knowledgeAddInverse (sys->know, tacTerm (tc->t1.tac),
|
||||||
|
tacTerm (tc->t2.tac));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
/* abort with false */
|
/* abort with false */
|
||||||
@ -807,21 +818,18 @@ compute_prec_sets (const System sys)
|
|||||||
Claimlist cl;
|
Claimlist cl;
|
||||||
|
|
||||||
// Assist: compute index from role, lev
|
// Assist: compute index from role, lev
|
||||||
int
|
int index (int r, int lev)
|
||||||
index (int r, int lev)
|
|
||||||
{
|
{
|
||||||
return r * sys->roleeventmax + lev;
|
return r * sys->roleeventmax + lev;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Assist: compute matrix index from i*i
|
// Assist: compute matrix index from i*i
|
||||||
int
|
int index2 (int i1, int i2)
|
||||||
index2 (int i1, int i2)
|
|
||||||
{
|
{
|
||||||
return i1 * size + i2;
|
return i1 * size + i2;
|
||||||
}
|
}
|
||||||
// Assist: yield roledef from r, lev
|
// Assist: yield roledef from r, lev
|
||||||
Roledef
|
Roledef roledef_re (int r, int lev)
|
||||||
roledef_re (int r, int lev)
|
|
||||||
{
|
{
|
||||||
Protocol pr;
|
Protocol pr;
|
||||||
Role ro;
|
Role ro;
|
||||||
@ -863,8 +871,7 @@ compute_prec_sets (const System sys)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Assist: print matrix
|
// Assist: print matrix
|
||||||
void
|
void show_matrix (void)
|
||||||
show_matrix (void)
|
|
||||||
{
|
{
|
||||||
int r1, r2, ev1, ev2;
|
int r1, r2, ev1, ev2;
|
||||||
|
|
||||||
@ -881,7 +888,8 @@ compute_prec_sets (const System sys)
|
|||||||
ev2 = 0;
|
ev2 = 0;
|
||||||
while (ev2 < sys->roleeventmax)
|
while (ev2 < sys->roleeventmax)
|
||||||
{
|
{
|
||||||
printf ("%i ", prec[index2 (index (r2,ev2), index (r1, ev1))]);
|
printf ("%i ",
|
||||||
|
prec[index2 (index (r2, ev2), index (r1, ev1))]);
|
||||||
ev2++;
|
ev2++;
|
||||||
}
|
}
|
||||||
printf (" ");
|
printf (" ");
|
||||||
@ -969,7 +977,8 @@ compute_prec_sets (const System sys)
|
|||||||
Roledef rd2;
|
Roledef rd2;
|
||||||
|
|
||||||
rd2 = roledef_re (r2, ev2);
|
rd2 = roledef_re (r2, ev2);
|
||||||
if (rd2 != NULL && rd2->type == READ && isTermEqual(rd1->label, rd2->label))
|
if (rd2 != NULL && rd2->type == READ
|
||||||
|
&& isTermEqual (rd1->label, rd2->label))
|
||||||
{
|
{
|
||||||
prec[index2 (index (r1, ev1), index (r2, ev2))] = 1;
|
prec[index2 (index (r1, ev1), index (r2, ev2))] = 1;
|
||||||
}
|
}
|
||||||
@ -1039,15 +1048,18 @@ compute_prec_sets (const System sys)
|
|||||||
r1++;
|
r1++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (r1 < sys->rolecount && !isTermEqual (label, eventlabels[index(r1,ev1)]));
|
while (r1 < sys->rolecount
|
||||||
|
&& !isTermEqual (label, eventlabels[index (r1, ev1)]));
|
||||||
if (r1 == sys->rolecount)
|
if (r1 == sys->rolecount)
|
||||||
{
|
{
|
||||||
error ("Prec() setup: Could not find the event corresponding to a claim label.");
|
error
|
||||||
|
("Prec() setup: Could not find the event corresponding to a claim label.");
|
||||||
}
|
}
|
||||||
rd = roledef_re (r1, ev1);
|
rd = roledef_re (r1, ev1);
|
||||||
if (rd->type != CLAIM)
|
if (rd->type != CLAIM)
|
||||||
{
|
{
|
||||||
error ("Prec() setup: First event with claim label doesn't seem to be a claim.");
|
error
|
||||||
|
("Prec() setup: First event with claim label doesn't seem to be a claim.");
|
||||||
}
|
}
|
||||||
// Store in claimlist structure
|
// Store in claimlist structure
|
||||||
cl->r = r1;
|
cl->r = r1;
|
||||||
@ -1096,7 +1108,8 @@ compute_prec_sets (const System sys)
|
|||||||
tl_scan = cl->prec;
|
tl_scan = cl->prec;
|
||||||
while (tl_scan != NULL)
|
while (tl_scan != NULL)
|
||||||
{
|
{
|
||||||
sys->synchronising_labels = termlistAddNew (sys->synchronising_labels, tl_scan->term);
|
sys->synchronising_labels =
|
||||||
|
termlistAddNew (sys->synchronising_labels, tl_scan->term);
|
||||||
tl_scan = tl_scan->next;
|
tl_scan = tl_scan->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1125,7 +1138,8 @@ compute_prec_sets (const System sys)
|
|||||||
while (ev_scan < sys->roleeventmax)
|
while (ev_scan < sys->roleeventmax)
|
||||||
{
|
{
|
||||||
// if this event preceds the claim, replace the label term
|
// if this event preceds the claim, replace the label term
|
||||||
if (prec[index2 (index (r_scan, ev_scan), claim_index)] == 1)
|
if (prec[index2 (index (r_scan, ev_scan), claim_index)]
|
||||||
|
== 1)
|
||||||
{
|
{
|
||||||
Roledef rd;
|
Roledef rd;
|
||||||
|
|
||||||
@ -1140,7 +1154,8 @@ compute_prec_sets (const System sys)
|
|||||||
// Store only the last label
|
// Store only the last label
|
||||||
if (t_buf != NULL)
|
if (t_buf != NULL)
|
||||||
{
|
{
|
||||||
sys->synchronising_labels = termlistAddNew(sys->synchronising_labels, t_buf);
|
sys->synchronising_labels =
|
||||||
|
termlistAddNew (sys->synchronising_labels, t_buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
r_scan++;
|
r_scan++;
|
||||||
@ -1153,14 +1168,16 @@ compute_prec_sets (const System sys)
|
|||||||
{
|
{
|
||||||
termlistDelete (sys->synchronising_labels);
|
termlistDelete (sys->synchronising_labels);
|
||||||
sys->synchronising_labels = NULL;
|
sys->synchronising_labels = NULL;
|
||||||
warning ("Emptied synchronising labels set manually because --pp=100.");
|
warning
|
||||||
|
("Emptied synchronising labels set manually because --pp=100.");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
// Check for empty stuff
|
// Check for empty stuff
|
||||||
//@todo This is for debugging, mainly.
|
//@todo This is for debugging, mainly.
|
||||||
if (cl->prec == NULL)
|
if (cl->prec == NULL)
|
||||||
{
|
{
|
||||||
fprintf (stderr, "Warning: claim with empty prec() set at r:%i, ev:%i\n",
|
fprintf (stderr,
|
||||||
|
"Warning: claim with empty prec() set at r:%i, ev:%i\n",
|
||||||
r1, ev1);
|
r1, ev1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -285,7 +285,8 @@ inKnowledge (const Knowledge know, Term term)
|
|||||||
if (term->type == ENCRYPT)
|
if (term->type == ENCRYPT)
|
||||||
{
|
{
|
||||||
return inTermlist (know->encrypt, term) ||
|
return inTermlist (know->encrypt, term) ||
|
||||||
(inKnowledge (know, term->right.key) && inKnowledge (know, term->left.op));
|
(inKnowledge (know, term->right.key)
|
||||||
|
&& inKnowledge (know, term->left.op));
|
||||||
}
|
}
|
||||||
if (term->type == TUPLE)
|
if (term->type == TUPLE)
|
||||||
{
|
{
|
||||||
@ -440,7 +441,8 @@ knowledgeGetInverses (const Knowledge know)
|
|||||||
__inline__ Termlist
|
__inline__ Termlist
|
||||||
knowledgeGetBasics (const Knowledge know)
|
knowledgeGetBasics (const Knowledge know)
|
||||||
{
|
{
|
||||||
return termlistAddBasics (termlistAddBasics(NULL, know->basic), know->encrypt);
|
return termlistAddBasics (termlistAddBasics (NULL, know->basic),
|
||||||
|
know->encrypt);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! check whether any substitutions where made in a knowledge set.
|
//! check whether any substitutions where made in a knowledge set.
|
||||||
|
@ -1044,7 +1044,8 @@ attackDisplayLatex (const System sys)
|
|||||||
|
|
||||||
if (tb->link[i] != -1 && i < tb->length)
|
if (tb->link[i] != -1 && i < tb->length)
|
||||||
{
|
{
|
||||||
latexMessagePrintHighlight (tb, i, tb->link[i], highlights);
|
latexMessagePrintHighlight (tb, i, tb->link[i],
|
||||||
|
highlights);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
98
src/main.c
98
src/main.c
@ -82,13 +82,16 @@ main (int argc, char **argv)
|
|||||||
{
|
{
|
||||||
System sys;
|
System sys;
|
||||||
|
|
||||||
struct arg_file *infile = arg_file0(NULL,NULL,"FILE", "input file ('-' for stdin)");
|
struct arg_file *infile =
|
||||||
struct arg_file *outfile = arg_file0("o","output","FILE", "output file (default is stdout)");
|
arg_file0 (NULL, NULL, "FILE", "input file ('-' for stdin)");
|
||||||
struct arg_str *switch_check = arg_str0(NULL,"check","CLAIM","claim type to check (default is all)");
|
struct arg_file *outfile = arg_file0 ("o", "output", "FILE",
|
||||||
struct arg_int *switch_scenario =
|
"output file (default is stdout)");
|
||||||
arg_int0 ("s", "scenario", NULL, "select a scenario instance 1-n (-1 to count)");
|
struct arg_str *switch_check = arg_str0 (NULL, "check", "CLAIM",
|
||||||
struct arg_int *switch_scenario_size =
|
"claim type to check (default is all)");
|
||||||
arg_int0 ("S", "scenario-size", NULL, "scenario size (fixed trace prefix length)");
|
struct arg_int *switch_scenario = arg_int0 ("s", "scenario", NULL,
|
||||||
|
"select a scenario instance 1-n (-1 to count)");
|
||||||
|
struct arg_int *switch_scenario_size = arg_int0 ("S", "scenario-size", NULL,
|
||||||
|
"scenario size (fixed trace prefix length)");
|
||||||
struct arg_int *switch_traversal_method = arg_int0 ("t", "traverse", NULL,
|
struct arg_int *switch_traversal_method = arg_int0 ("t", "traverse", NULL,
|
||||||
"set traversal method, partial order reduction (default is 12)");
|
"set traversal method, partial order reduction (default is 12)");
|
||||||
struct arg_int *switch_match_method =
|
struct arg_int *switch_match_method =
|
||||||
@ -97,30 +100,47 @@ main (int argc, char **argv)
|
|||||||
arg_lit0 ("c", "cl", "use constraint logic, non-associative");
|
arg_lit0 ("c", "cl", "use constraint logic, non-associative");
|
||||||
struct arg_int *switch_pruning_method = arg_int0 ("p", "prune", NULL,
|
struct arg_int *switch_pruning_method = arg_int0 ("p", "prune", NULL,
|
||||||
"pruning method (default is 2)");
|
"pruning method (default is 2)");
|
||||||
struct arg_int *switch_prune_trace_length = arg_int0 ("l", "max-length", NULL,
|
struct arg_int *switch_prune_trace_length =
|
||||||
|
arg_int0 ("l", "max-length", NULL,
|
||||||
"prune traces longer than <int> events");
|
"prune traces longer than <int> events");
|
||||||
struct arg_lit *switch_incremental_trace_length = arg_lit0 (NULL, "increment-traces",
|
struct arg_lit *switch_incremental_trace_length =
|
||||||
|
arg_lit0 (NULL, "increment-traces",
|
||||||
"incremental search using the length of the traces.");
|
"incremental search using the length of the traces.");
|
||||||
struct arg_int *switch_maximum_runs =
|
struct arg_int *switch_maximum_runs =
|
||||||
arg_int0 ("r", "max-runs", NULL, "create at most <int> runs");
|
arg_int0 ("r", "max-runs", NULL, "create at most <int> runs");
|
||||||
struct arg_lit *switch_incremental_runs = arg_lit0 (NULL, "increment-runs",
|
struct arg_lit *switch_incremental_runs = arg_lit0 (NULL, "increment-runs",
|
||||||
"incremental search using the number of runs");
|
"incremental search using the number of runs");
|
||||||
struct arg_lit *switch_latex_output = arg_lit0 (NULL, "latex", "output attacks in LaTeX format");
|
struct arg_lit *switch_latex_output =
|
||||||
|
arg_lit0 (NULL, "latex", "output attacks in LaTeX format");
|
||||||
struct arg_lit *switch_empty =
|
struct arg_lit *switch_empty =
|
||||||
arg_lit0 ("e", "empty", "do not generate output");
|
arg_lit0 ("e", "empty", "do not generate output");
|
||||||
struct arg_lit *switch_progress_bar = arg_lit0 ("b", "progress-bar", "show progress bar");
|
struct arg_lit *switch_progress_bar =
|
||||||
struct arg_lit *switch_state_space_graph = arg_lit0 (NULL, "state-space", "output state space graph");
|
arg_lit0 ("b", "progress-bar", "show progress bar");
|
||||||
struct arg_lit *switch_implicit_choose = arg_lit0 (NULL, "implicit-choose", "allow implicit choose events (useful for few runs)");
|
struct arg_lit *switch_state_space_graph =
|
||||||
struct arg_lit *switch_choose_first = arg_lit0 (NULL, "choose-first", "priority to any choose events");
|
arg_lit0 (NULL, "state-space", "output state space graph");
|
||||||
struct arg_lit *switch_enable_read_symmetries = arg_lit0 (NULL, "read-symm", "enable read symmetry reductions");
|
struct arg_lit *switch_implicit_choose = arg_lit0 (NULL, "implicit-choose",
|
||||||
struct arg_lit *switch_disable_agent_symmetries = arg_lit0 (NULL, "no-agent-symm", "disable agent symmetry reductions");
|
"allow implicit choose events (useful for few runs)");
|
||||||
struct arg_lit *switch_enable_symmetry_order = arg_lit0 (NULL, "symm-order", "enable ordering symmetry reductions");
|
struct arg_lit *switch_choose_first =
|
||||||
struct arg_lit *switch_disable_noclaims_reductions = arg_lit0 (NULL, "no-noclaims-red", "disable no more claims reductions");
|
arg_lit0 (NULL, "choose-first", "priority to any choose events");
|
||||||
struct arg_lit *switch_disable_endgame_reductions = arg_lit0 (NULL, "no-endgame-red", "disable endgame reductions");
|
struct arg_lit *switch_enable_read_symmetries =
|
||||||
struct arg_lit *switch_summary = arg_lit0 (NULL, "summary", "show summary on stdout instead of stderr");
|
arg_lit0 (NULL, "read-symm", "enable read symmetry reductions");
|
||||||
struct arg_lit *switch_echo = arg_lit0 ("E", "echo", "echo command line to stdout");
|
struct arg_lit *switch_disable_agent_symmetries =
|
||||||
|
arg_lit0 (NULL, "no-agent-symm",
|
||||||
|
"disable agent symmetry reductions");
|
||||||
|
struct arg_lit *switch_enable_symmetry_order = arg_lit0 (NULL, "symm-order",
|
||||||
|
"enable ordering symmetry reductions");
|
||||||
|
struct arg_lit *switch_disable_noclaims_reductions =
|
||||||
|
arg_lit0 (NULL, "no-noclaims-red",
|
||||||
|
"disable no more claims reductions");
|
||||||
|
struct arg_lit *switch_disable_endgame_reductions =
|
||||||
|
arg_lit0 (NULL, "no-endgame-red", "disable endgame reductions");
|
||||||
|
struct arg_lit *switch_summary = arg_lit0 (NULL, "summary",
|
||||||
|
"show summary on stdout instead of stderr");
|
||||||
|
struct arg_lit *switch_echo =
|
||||||
|
arg_lit0 ("E", "echo", "echo command line to stdout");
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
struct arg_int *switch_por_parameter = arg_int0 (NULL, "pp", NULL, "POR parameter");
|
struct arg_int *switch_por_parameter =
|
||||||
|
arg_int0 (NULL, "pp", NULL, "POR parameter");
|
||||||
struct arg_lit *switch_debug_indent = arg_lit0 ("I", "debug-indent",
|
struct arg_lit *switch_debug_indent = arg_lit0 ("I", "debug-indent",
|
||||||
"indent the debug output using trace length");
|
"indent the debug output using trace length");
|
||||||
struct arg_int *switch_debug_level =
|
struct arg_int *switch_debug_level =
|
||||||
@ -212,7 +232,8 @@ main (int argc, char **argv)
|
|||||||
{
|
{
|
||||||
printf ("'%s' model checker for security protocols.\n", progname);
|
printf ("'%s' model checker for security protocols.\n", progname);
|
||||||
printf ("%s release.\n", releasetag);
|
printf ("%s release.\n", releasetag);
|
||||||
printf ("$Rev$ $Date$\n");
|
printf
|
||||||
|
("$Rev$ $Date$\n");
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf ("Compiled with debugging support.\n");
|
printf ("Compiled with debugging support.\n");
|
||||||
#endif
|
#endif
|
||||||
@ -247,9 +268,11 @@ main (int argc, char **argv)
|
|||||||
/* Lutger-tries-to-test-with-broken-methods detector */
|
/* Lutger-tries-to-test-with-broken-methods detector */
|
||||||
if (switch_clp->count > 0)
|
if (switch_clp->count > 0)
|
||||||
{
|
{
|
||||||
fprintf (stderr, "For the time being, this method is not supported, \n");
|
fprintf (stderr,
|
||||||
|
"For the time being, this method is not supported, \n");
|
||||||
fprintf (stderr, "as too many changes have been made to the normal \n");
|
fprintf (stderr, "as too many changes have been made to the normal \n");
|
||||||
fprintf (stderr, "matching logic, and CL simply isn't reliable in \nmany ");
|
fprintf (stderr,
|
||||||
|
"matching logic, and CL simply isn't reliable in \nmany ");
|
||||||
fprintf (stderr, "ways. Try again in a few weeks.\n");
|
fprintf (stderr, "ways. Try again in a few weeks.\n");
|
||||||
exit (0);
|
exit (0);
|
||||||
}
|
}
|
||||||
@ -261,7 +284,8 @@ main (int argc, char **argv)
|
|||||||
/* try to open */
|
/* try to open */
|
||||||
if (!freopen (outfile->filename[0], "w", stdout))
|
if (!freopen (outfile->filename[0], "w", stdout))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Could not create output file '%s'.\n", outfile->filename[0]);
|
fprintf (stderr, "Could not create output file '%s'.\n",
|
||||||
|
outfile->filename[0]);
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -273,7 +297,8 @@ main (int argc, char **argv)
|
|||||||
{
|
{
|
||||||
if (!freopen (infile->filename[0], "r", stdin))
|
if (!freopen (infile->filename[0], "r", stdin))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Could not open input file '%s'.\n", infile->filename[0]);
|
fprintf (stderr, "Could not open input file '%s'.\n",
|
||||||
|
infile->filename[0]);
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -328,7 +353,8 @@ main (int argc, char **argv)
|
|||||||
if (switch_enable_read_symmetries->count > 0)
|
if (switch_enable_read_symmetries->count > 0)
|
||||||
{
|
{
|
||||||
if (switch_enable_symmetry_order->count > 0)
|
if (switch_enable_symmetry_order->count > 0)
|
||||||
error ("--read-symm and --symm-order cannot be used at the same time.");
|
error
|
||||||
|
("--read-symm and --symm-order cannot be used at the same time.");
|
||||||
sys->switchReadSymm = 1;
|
sys->switchReadSymm = 1;
|
||||||
}
|
}
|
||||||
if (switch_enable_symmetry_order->count > 0)
|
if (switch_enable_symmetry_order->count > 0)
|
||||||
@ -363,11 +389,11 @@ main (int argc, char **argv)
|
|||||||
if (sys->switchScenario != 0 && sys->switchScenarioSize == 0)
|
if (sys->switchScenario != 0 && sys->switchScenarioSize == 0)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
warning ("Scenario selection without trace prefix length implies --choose-first.");
|
warning
|
||||||
|
("Scenario selection without trace prefix length implies --choose-first.");
|
||||||
#endif
|
#endif
|
||||||
sys->switchChooseFirst = 1;
|
sys->switchChooseFirst = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
sys->porparam = switch_por_parameter->ival[0];
|
sys->porparam = switch_por_parameter->ival[0];
|
||||||
#endif
|
#endif
|
||||||
@ -486,8 +512,7 @@ main (int argc, char **argv)
|
|||||||
if (switch_incremental_runs->count > 0 ||
|
if (switch_incremental_runs->count > 0 ||
|
||||||
switch_incremental_trace_length->count > 0)
|
switch_incremental_trace_length->count > 0)
|
||||||
{
|
{
|
||||||
if (sys->output != ATTACK &&
|
if (sys->output != ATTACK && sys->output != EMPTY)
|
||||||
sys->output != EMPTY)
|
|
||||||
{
|
{
|
||||||
error ("Incremental traversal only for empty or attack output.");
|
error ("Incremental traversal only for empty or attack output.");
|
||||||
}
|
}
|
||||||
@ -497,7 +522,6 @@ main (int argc, char **argv)
|
|||||||
{
|
{
|
||||||
warning ("-m2 is only supported for constraint logic programming.");
|
warning ("-m2 is only supported for constraint logic programming.");
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
warning ("Selected output method is %i", sys->output);
|
warning ("Selected output method is %i", sys->output);
|
||||||
#endif
|
#endif
|
||||||
@ -740,7 +764,8 @@ MC_incRuns (const System sys)
|
|||||||
systemReset (sys);
|
systemReset (sys);
|
||||||
sys->maxruns = runs;
|
sys->maxruns = runs;
|
||||||
systemRuns (sys);
|
systemRuns (sys);
|
||||||
fprintf (stderr, "%i of %i runs in incremental runs search.\n", runs, maxruns);
|
fprintf (stderr, "%i of %i runs in incremental runs search.\n",
|
||||||
|
runs, maxruns);
|
||||||
res = modelCheck (sys);
|
res = modelCheck (sys);
|
||||||
fprintf (stderr, "\n");
|
fprintf (stderr, "\n");
|
||||||
if (res)
|
if (res)
|
||||||
@ -794,7 +819,8 @@ MC_incTraces (const System sys)
|
|||||||
systemReset (sys);
|
systemReset (sys);
|
||||||
sys->maxtracelength = tracelen;
|
sys->maxtracelength = tracelen;
|
||||||
systemRuns (sys);
|
systemRuns (sys);
|
||||||
fprintf (stderr, "%i of %i trace length in incremental trace length search.\n",
|
fprintf (stderr,
|
||||||
|
"%i of %i trace length in incremental trace length search.\n",
|
||||||
tracelen, maxtracelen);
|
tracelen, maxtracelen);
|
||||||
res = modelCheck (sys);
|
res = modelCheck (sys);
|
||||||
fprintf (stderr, "\n");
|
fprintf (stderr, "\n");
|
||||||
@ -873,5 +899,3 @@ modelCheck (const System sys)
|
|||||||
}
|
}
|
||||||
return (sys->failed != STATES0);
|
return (sys->failed != STATES0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -384,7 +384,8 @@ sendAdd_clp (const System sys, const int run, const Termlist tl)
|
|||||||
/* simple case: no variable inside */
|
/* simple case: no variable inside */
|
||||||
knowledgeAddTerm (sys->know, t);
|
knowledgeAddTerm (sys->know, t);
|
||||||
tl2 = termlistShallow (tl->next);
|
tl2 = termlistShallow (tl->next);
|
||||||
if (inKnowledge (sys->know, invkey) && hasTermVariable (t->left.op))
|
if (inKnowledge (sys->know, invkey)
|
||||||
|
&& hasTermVariable (t->left.op))
|
||||||
tl2 = termlistAdd (tl2, t->left.op);
|
tl2 = termlistAdd (tl2, t->left.op);
|
||||||
sendAdd_clp (sys, run, tl2);
|
sendAdd_clp (sys, run, tl2);
|
||||||
termlistDelete (tl2);
|
termlistDelete (tl2);
|
||||||
|
@ -213,7 +213,8 @@ executeStep (const System sys, const int run)
|
|||||||
if (sys->switchS > 0)
|
if (sys->switchS > 0)
|
||||||
{
|
{
|
||||||
sys->interval = statesIncrease (sys->interval);
|
sys->interval = statesIncrease (sys->interval);
|
||||||
if (!statesSmallerThan (sys->interval, (unsigned long int) sys->switchS))
|
if (!statesSmallerThan
|
||||||
|
(sys->interval, (unsigned long int) sys->switchS))
|
||||||
{
|
{
|
||||||
globalError++;
|
globalError++;
|
||||||
sys->interval = STATES0;
|
sys->interval = STATES0;
|
||||||
@ -227,7 +228,8 @@ executeStep (const System sys, const int run)
|
|||||||
/* store new node numbder */
|
/* store new node numbder */
|
||||||
sys->traceNode[sys->step] = sys->states;
|
sys->traceNode[sys->step] = sys->states;
|
||||||
/* the construction below always assumes MAX_GRAPH_STATES to be smaller than the unsigned long it, which seems realistic. */
|
/* the construction below always assumes MAX_GRAPH_STATES to be smaller than the unsigned long it, which seems realistic. */
|
||||||
if (sys->output == STATESPACE && statesSmallerThan (sys->states, MAX_GRAPH_STATES))
|
if (sys->output == STATESPACE
|
||||||
|
&& statesSmallerThan (sys->states, MAX_GRAPH_STATES))
|
||||||
{
|
{
|
||||||
/* display graph */
|
/* display graph */
|
||||||
graphNode (sys);
|
graphNode (sys);
|
||||||
@ -240,7 +242,8 @@ executeStep (const System sys, const int run)
|
|||||||
*
|
*
|
||||||
*@todo "What is interesting" relies on the fact that there are only secrecy, sychnr and agreement properties.
|
*@todo "What is interesting" relies on the fact that there are only secrecy, sychnr and agreement properties.
|
||||||
*/
|
*/
|
||||||
Roledef removeIrrelevant (const System sys, const int run, Roledef rd)
|
Roledef
|
||||||
|
removeIrrelevant (const System sys, const int run, Roledef rd)
|
||||||
{
|
{
|
||||||
Roledef rdkill;
|
Roledef rdkill;
|
||||||
int killclaims;
|
int killclaims;
|
||||||
@ -284,7 +287,8 @@ Roledef removeIrrelevant (const System sys, const int run, Roledef rd)
|
|||||||
*\sa tryChoiceSend()
|
*\sa tryChoiceSend()
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
unblock_synchronising_labels (const System sys, const int run, const Roledef rd)
|
unblock_synchronising_labels (const System sys, const int run,
|
||||||
|
const Roledef rd)
|
||||||
{
|
{
|
||||||
if (rd->type != READ || rd->internal)
|
if (rd->type != READ || rd->internal)
|
||||||
return;
|
return;
|
||||||
@ -485,7 +489,8 @@ explorify (const System sys, const int run)
|
|||||||
error ("firstNonAgentRead is not a read?!");
|
error ("firstNonAgentRead is not a read?!");
|
||||||
}
|
}
|
||||||
ridSymm = sys->runs[run].prevSymmRun;
|
ridSymm = sys->runs[run].prevSymmRun;
|
||||||
if (isTermlistEqual (sys->runs[run].agents, sys->runs[ridSymm].agents))
|
if (isTermlistEqual
|
||||||
|
(sys->runs[run].agents, sys->runs[ridSymm].agents))
|
||||||
{
|
{
|
||||||
/* same agents, so relevant */
|
/* same agents, so relevant */
|
||||||
if (myStep > 0 && sys->runs[ridSymm].step < myStep)
|
if (myStep > 0 && sys->runs[ridSymm].step < myStep)
|
||||||
@ -540,7 +545,8 @@ explorify (const System sys, const int run)
|
|||||||
ridSymm = sys->runs[run].prevSymmRun;
|
ridSymm = sys->runs[run].prevSymmRun;
|
||||||
/* equal runs? */
|
/* equal runs? */
|
||||||
|
|
||||||
if (isTermlistEqual (sys->runs[run].agents, sys->runs[ridSymm].agents))
|
if (isTermlistEqual
|
||||||
|
(sys->runs[run].agents, sys->runs[ridSymm].agents))
|
||||||
{
|
{
|
||||||
/* so, we have an identical partner */
|
/* so, we have an identical partner */
|
||||||
/* is our partner there already? */
|
/* is our partner there already? */
|
||||||
@ -567,8 +573,7 @@ explorify (const System sys, const int run)
|
|||||||
if (sys->switchScenarioSize == 0)
|
if (sys->switchScenarioSize == 0)
|
||||||
{
|
{
|
||||||
/* only after chooses */
|
/* only after chooses */
|
||||||
if (myStep == 0 &&
|
if (myStep == 0 && rd->type == READ)
|
||||||
rd->type == READ)
|
|
||||||
{
|
{
|
||||||
if (run == sys->lastChooseRun)
|
if (run == sys->lastChooseRun)
|
||||||
{
|
{
|
||||||
@ -915,9 +920,7 @@ lastActiveRun (const System sys)
|
|||||||
__inline__ int
|
__inline__ int
|
||||||
isChooseRoledef (const System sys, const int run, const Roledef rd)
|
isChooseRoledef (const System sys, const int run, const Roledef rd)
|
||||||
{
|
{
|
||||||
return (rd == sys->runs[run].start &&
|
return (rd == sys->runs[run].start && rd->type == READ && rd->internal);
|
||||||
rd->type == READ &&
|
|
||||||
rd->internal);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Explore possible chooses first
|
//! Explore possible chooses first
|
||||||
@ -1080,7 +1083,8 @@ propertyCheck (const System sys)
|
|||||||
{
|
{
|
||||||
/* weird, should not occur */
|
/* weird, should not occur */
|
||||||
fprintf (stderr, "Violation, but cannot locate claim.\n");
|
fprintf (stderr, "Violation, but cannot locate claim.\n");
|
||||||
printf("A secrecy claim was supposed to be violated on term ");
|
printf
|
||||||
|
("A secrecy claim was supposed to be violated on term ");
|
||||||
termPrint (scan->term);
|
termPrint (scan->term);
|
||||||
printf (" but we couldn't find the corresponding claim.\n");
|
printf (" but we couldn't find the corresponding claim.\n");
|
||||||
exit (1);
|
exit (1);
|
||||||
@ -1164,8 +1168,7 @@ secrecyUnfolding (Term t, const Knowledge know)
|
|||||||
t = deVar (t);
|
t = deVar (t);
|
||||||
if (isTermTuple (t))
|
if (isTermTuple (t))
|
||||||
return termlistConcat (secrecyUnfolding (t->left.op1, know),
|
return termlistConcat (secrecyUnfolding (t->left.op1, know),
|
||||||
secrecyUnfolding(t->right.op2,know)
|
secrecyUnfolding (t->right.op2, know));
|
||||||
);
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (inKnowledge (know, t))
|
if (inKnowledge (know, t))
|
||||||
@ -1187,11 +1190,13 @@ secrecyUnfolding (Term t, const Knowledge know)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
Termlist
|
Termlist
|
||||||
claimViolationDetails (const System sys, const int run, const Roledef rd, const Knowledge know)
|
claimViolationDetails (const System sys, const int run, const Roledef rd,
|
||||||
|
const Knowledge know)
|
||||||
{
|
{
|
||||||
if (rd->type != CLAIM)
|
if (rd->type != CLAIM)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Trying to determine details of something other than a claim!\n");
|
fprintf (stderr,
|
||||||
|
"Trying to determine details of something other than a claim!\n");
|
||||||
exit (-1);
|
exit (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1433,4 +1438,3 @@ executeTry (const System sys, int run)
|
|||||||
}
|
}
|
||||||
return flag;
|
return flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
34
src/output.c
34
src/output.c
@ -497,7 +497,8 @@ attackDisplay (const System sys)
|
|||||||
*-------------------------------------------
|
*-------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void graphInit (const System sys)
|
void
|
||||||
|
graphInit (const System sys)
|
||||||
{
|
{
|
||||||
Termlist tl;
|
Termlist tl;
|
||||||
|
|
||||||
@ -524,7 +525,8 @@ void graphInit (const System sys)
|
|||||||
printf ("\tconcentrate=true;\n");
|
printf ("\tconcentrate=true;\n");
|
||||||
|
|
||||||
/* node/edge defaults */
|
/* node/edge defaults */
|
||||||
printf ("\tnode [shape=\"point\",fontsize=\"4\",fontname=\"Helvetica\"];\n");
|
printf
|
||||||
|
("\tnode [shape=\"point\",fontsize=\"4\",fontname=\"Helvetica\"];\n");
|
||||||
printf ("\tedge [fontsize=\"4\",fontname=\"Helvetica\"];\n");
|
printf ("\tedge [fontsize=\"4\",fontname=\"Helvetica\"];\n");
|
||||||
|
|
||||||
/* start with initial node 0 */
|
/* start with initial node 0 */
|
||||||
@ -537,13 +539,15 @@ void graphInit (const System sys)
|
|||||||
printf ("\"];\n");
|
printf ("\"];\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void graphDone (const System sys)
|
void
|
||||||
|
graphDone (const System sys)
|
||||||
{
|
{
|
||||||
/* drawing state space. close up. */
|
/* drawing state space. close up. */
|
||||||
printf ("}\n");
|
printf ("}\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void graphNode (const System sys)
|
void
|
||||||
|
graphNode (const System sys)
|
||||||
{
|
{
|
||||||
Termlist newtl;
|
Termlist newtl;
|
||||||
states_t thisNode, parentNode;
|
states_t thisNode, parentNode;
|
||||||
@ -578,11 +582,11 @@ void graphNode (const System sys)
|
|||||||
if (sys->switchScenario != 0 &&
|
if (sys->switchScenario != 0 &&
|
||||||
rd != NULL &&
|
rd != NULL &&
|
||||||
rd == sys->runs[run].start &&
|
rd == sys->runs[run].start &&
|
||||||
rd->type == READ &&
|
rd->type == READ && run == sys->lastChooseRun)
|
||||||
run == sys->lastChooseRun)
|
|
||||||
{
|
{
|
||||||
/* last choose; scenario selected */
|
/* last choose; scenario selected */
|
||||||
printf ("shape=box,height=0.2,label=\"Scenario %i: ", sys->countScenario);
|
printf ("shape=box,height=0.2,label=\"Scenario %i: ",
|
||||||
|
sys->countScenario);
|
||||||
scenarioPrint (sys);
|
scenarioPrint (sys);
|
||||||
printf ("\"");
|
printf ("\"");
|
||||||
}
|
}
|
||||||
@ -628,7 +632,8 @@ void graphNode (const System sys)
|
|||||||
printf (";\n");
|
printf (";\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void graphNodePath (const System sys, const int length, const char* nodepar)
|
void
|
||||||
|
graphNodePath (const System sys, const int length, const char *nodepar)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
states_t thisNode;
|
states_t thisNode;
|
||||||
@ -647,7 +652,8 @@ void graphNodePath (const System sys, const int length, const char* nodepar)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void graphEdgePath (const System sys, const int length, const char* edgepar)
|
void
|
||||||
|
graphEdgePath (const System sys, const int length, const char *edgepar)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
states_t thisNode, prevNode;
|
states_t thisNode, prevNode;
|
||||||
@ -670,7 +676,8 @@ void graphEdgePath (const System sys, const int length, const char* edgepar)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void graphPath (const System sys, int length)
|
void
|
||||||
|
graphPath (const System sys, int length)
|
||||||
{
|
{
|
||||||
graphNodePath (sys, length, "style=bold,color=red");
|
graphNodePath (sys, length, "style=bold,color=red");
|
||||||
graphEdgePath (sys, length - 1, "style=bold,color=red");
|
graphEdgePath (sys, length - 1, "style=bold,color=red");
|
||||||
@ -682,15 +689,12 @@ graphScenario (const System sys, const int run, const Roledef rd)
|
|||||||
{
|
{
|
||||||
/* Add scenario node */
|
/* Add scenario node */
|
||||||
printf ("\ts%i [shape=box,height=0.2,label=\"Scenario %i: ",
|
printf ("\ts%i [shape=box,height=0.2,label=\"Scenario %i: ",
|
||||||
sys->countScenario,
|
sys->countScenario, sys->countScenario);
|
||||||
sys->countScenario);
|
|
||||||
scenarioPrint (sys);
|
scenarioPrint (sys);
|
||||||
printf ("\"];\n");
|
printf ("\"];\n");
|
||||||
|
|
||||||
/* draw edge */
|
/* draw edge */
|
||||||
printf ("\tn%i -> s%i",
|
printf ("\tn%i -> s%i", sys->traceNode[sys->step], sys->countScenario);
|
||||||
sys->traceNode[sys->step],
|
|
||||||
sys->countScenario);
|
|
||||||
printf (" [color=blue,label=\"");
|
printf (" [color=blue,label=\"");
|
||||||
printf ("%i:", sys->runs[run].step);
|
printf ("%i:", sys->runs[run].step);
|
||||||
roledefPrint (rd);
|
roledefPrint (rd);
|
||||||
|
@ -8,10 +8,8 @@ void attackDisplay(const System sys);
|
|||||||
void graphInit (const System sys);
|
void graphInit (const System sys);
|
||||||
void graphDone (const System sys);
|
void graphDone (const System sys);
|
||||||
void graphNode (const System sys);
|
void graphNode (const System sys);
|
||||||
void graphNodePath (const System sys, const int length, const char*
|
void graphNodePath (const System sys, const int length, const char *nodepar);
|
||||||
nodepar);
|
void graphEdgePath (const System sys, const int length, const char *edgepar);
|
||||||
void graphEdgePath (const System sys, const int length, const char*
|
|
||||||
edgepar);
|
|
||||||
void graphPath (const System sys, int length);
|
void graphPath (const System sys, int length);
|
||||||
void graphScenario (const System sys, const int run, const Roledef rd);
|
void graphScenario (const System sys, const int run, const Roledef rd);
|
||||||
|
|
||||||
|
@ -166,7 +166,8 @@ roledefInit (int type, Term label, Term from, Term to, Term msg, Claimlist cl)
|
|||||||
*\sa roledefInit()
|
*\sa roledefInit()
|
||||||
*/
|
*/
|
||||||
Roledef
|
Roledef
|
||||||
roledefAdd (Roledef rd, int type, Term label, Term from, Term to, Term msg, Claimlist cl)
|
roledefAdd (Roledef rd, int type, Term label, Term from, Term to, Term msg,
|
||||||
|
Claimlist cl)
|
||||||
{
|
{
|
||||||
Roledef scan;
|
Roledef scan;
|
||||||
|
|
||||||
@ -235,5 +236,3 @@ rolesPrint (Role r)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
10
src/role.h
10
src/role.h
@ -8,7 +8,8 @@
|
|||||||
#include "constraint.h"
|
#include "constraint.h"
|
||||||
#include "states.h"
|
#include "states.h"
|
||||||
|
|
||||||
enum eventtype { READ, SEND, CLAIM };
|
enum eventtype
|
||||||
|
{ READ, SEND, CLAIM };
|
||||||
|
|
||||||
//! The container for the claim info list
|
//! The container for the claim info list
|
||||||
struct claimlist
|
struct claimlist
|
||||||
@ -110,11 +111,12 @@ Roledef roledefDuplicate1 (const Roledef rd);
|
|||||||
Roledef roledefDuplicate (Roledef rd);
|
Roledef roledefDuplicate (Roledef rd);
|
||||||
void roledefDelete (Roledef rd);
|
void roledefDelete (Roledef rd);
|
||||||
void roledefDestroy (Roledef rd);
|
void roledefDestroy (Roledef rd);
|
||||||
Roledef roledefInit (int type, Term label, Term from, Term to, Term msg, Claimlist cl);
|
Roledef roledefInit (int type, Term label, Term from, Term to, Term msg,
|
||||||
Roledef roledefAdd (Roledef rd, int type, Term label, Term from, Term to, Term msg, Claimlist cl);
|
Claimlist cl);
|
||||||
|
Roledef roledefAdd (Roledef rd, int type, Term label, Term from, Term to,
|
||||||
|
Term msg, Claimlist cl);
|
||||||
Role roleCreate (Term nameterm);
|
Role roleCreate (Term nameterm);
|
||||||
void rolePrint (Role r);
|
void rolePrint (Role r);
|
||||||
void rolesPrint (Role r);
|
void rolesPrint (Role r);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -14,7 +14,8 @@ typedef unsigned long int states_t;
|
|||||||
|
|
||||||
__inline__ states_t statesIncrease (const states_t states);
|
__inline__ states_t statesIncrease (const states_t states);
|
||||||
__inline__ double statesDouble (const states_t states);
|
__inline__ double statesDouble (const states_t states);
|
||||||
__inline__ int statesSmallerThan (const states_t states, unsigned long int reflint);
|
__inline__ int statesSmallerThan (const states_t states,
|
||||||
|
unsigned long int reflint);
|
||||||
__inline__ void statesFormat (const states_t states);
|
__inline__ void statesFormat (const states_t states);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -6,7 +6,8 @@
|
|||||||
*/
|
*/
|
||||||
#define HASHSIZE 997
|
#define HASHSIZE 997
|
||||||
|
|
||||||
enum symboltypes { T_UNDEF = -1, T_PROTOCOL, T_CONST, T_VAR, T_SYSCONST };
|
enum symboltypes
|
||||||
|
{ T_UNDEF = -1, T_PROTOCOL, T_CONST, T_VAR, T_SYSCONST };
|
||||||
|
|
||||||
#define EOS 0
|
#define EOS 0
|
||||||
|
|
||||||
|
36
src/system.c
36
src/system.c
@ -157,9 +157,7 @@ systemRuns (const System sys)
|
|||||||
Roledef rd;
|
Roledef rd;
|
||||||
|
|
||||||
rd = runPointerGet (sys, run);
|
rd = runPointerGet (sys, run);
|
||||||
if (rd != NULL &&
|
if (rd != NULL && rd->internal && rd->type == READ)
|
||||||
rd->internal &&
|
|
||||||
rd->type == READ)
|
|
||||||
{
|
{
|
||||||
/* increasing run traversal, so this yields max */
|
/* increasing run traversal, so this yields max */
|
||||||
sys->lastChooseRun = run;
|
sys->lastChooseRun = run;
|
||||||
@ -353,7 +351,8 @@ agentOfRun (const System sys, const int run)
|
|||||||
*
|
*
|
||||||
* Return -1 if there is no such symmetry.
|
* Return -1 if there is no such symmetry.
|
||||||
*/
|
*/
|
||||||
int staticRunSymmetry (const System sys,const int rid)
|
int
|
||||||
|
staticRunSymmetry (const System sys, const int rid)
|
||||||
{
|
{
|
||||||
int ridSymm; // previous symmetrical run
|
int ridSymm; // previous symmetrical run
|
||||||
Termlist agents; // list of agents for rid
|
Termlist agents; // list of agents for rid
|
||||||
@ -394,7 +393,8 @@ int staticRunSymmetry (const System sys,const int rid)
|
|||||||
/* case 1: variable, should match type */
|
/* case 1: variable, should match type */
|
||||||
if (isTermVariable (alSymm->term))
|
if (isTermVariable (alSymm->term))
|
||||||
{
|
{
|
||||||
if (!isTermlistEqual (al->term->stype, alSymm->term->stype))
|
if (!isTermlistEqual
|
||||||
|
(al->term->stype, alSymm->term->stype))
|
||||||
isEqual = 0;
|
isEqual = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -415,7 +415,8 @@ int staticRunSymmetry (const System sys,const int rid)
|
|||||||
{
|
{
|
||||||
/* this candidate is allright */
|
/* this candidate is allright */
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
warning ("Symmetry detection. #%i can depend on #%i.",rid,ridSymm);
|
warning ("Symmetry detection. #%i can depend on #%i.", rid,
|
||||||
|
ridSymm);
|
||||||
#endif
|
#endif
|
||||||
return ridSymm;
|
return ridSymm;
|
||||||
}
|
}
|
||||||
@ -429,7 +430,8 @@ int staticRunSymmetry (const System sys,const int rid)
|
|||||||
/**
|
/**
|
||||||
*@todo For now, we assume it is simply the first read after the choose, if there is one.
|
*@todo For now, we assume it is simply the first read after the choose, if there is one.
|
||||||
*/
|
*/
|
||||||
int firstNonAgentRead (const System sys, int rid)
|
int
|
||||||
|
firstNonAgentRead (const System sys, int rid)
|
||||||
{
|
{
|
||||||
int step;
|
int step;
|
||||||
Roledef rd;
|
Roledef rd;
|
||||||
@ -449,7 +451,9 @@ int firstNonAgentRead (const System sys, int rid)
|
|||||||
if (rd != NULL && !rd->internal && rd->type == READ) // assumes lazy LR eval
|
if (rd != NULL && !rd->internal && rd->type == READ) // assumes lazy LR eval
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
warning ("First read %i with dependency on symmetrical found in run %i.", step, rid);
|
warning
|
||||||
|
("First read %i with dependency on symmetrical found in run %i.",
|
||||||
|
step, rid);
|
||||||
#endif
|
#endif
|
||||||
return step;
|
return step;
|
||||||
}
|
}
|
||||||
@ -505,7 +509,9 @@ roleInstance (const System sys, const Protocol protocol, const Role role,
|
|||||||
/* newvar is apparently new, but it might occur
|
/* newvar is apparently new, but it might occur
|
||||||
* in the first event if it's a read, in which
|
* in the first event if it's a read, in which
|
||||||
* case we forget it */
|
* case we forget it */
|
||||||
if (sys->switchForceChoose || !(rd->type == READ && termOccurs (rd->message, scanfrom->term)))
|
if (sys->switchForceChoose
|
||||||
|
|| !(rd->type == READ
|
||||||
|
&& termOccurs (rd->message, scanfrom->term)))
|
||||||
{
|
{
|
||||||
/* this term is forced as a choose, or it does not occur in the (first) read event */
|
/* this term is forced as a choose, or it does not occur in the (first) read event */
|
||||||
/* TODO scan might be more complex, but
|
/* TODO scan might be more complex, but
|
||||||
@ -837,7 +843,8 @@ violatedClaimPrint (const System sys, const int i)
|
|||||||
* the redundant events but also the choose events.
|
* the redundant events but also the choose events.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int attackLength(struct tracebuf* tb)
|
int
|
||||||
|
attackLength (struct tracebuf *tb)
|
||||||
{
|
{
|
||||||
int len, i;
|
int len, i;
|
||||||
|
|
||||||
@ -870,7 +877,8 @@ commandlinePrint (FILE *stream, const System sys)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! Get the number of roles in the system.
|
//! Get the number of roles in the system.
|
||||||
int compute_rolecount (const System sys)
|
int
|
||||||
|
compute_rolecount (const System sys)
|
||||||
{
|
{
|
||||||
Protocol pr;
|
Protocol pr;
|
||||||
int n;
|
int n;
|
||||||
@ -886,7 +894,8 @@ int compute_rolecount (const System sys)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! Compute the maximum number of events in a single role in the system.
|
//! Compute the maximum number of events in a single role in the system.
|
||||||
int compute_roleeventmax (const System sys)
|
int
|
||||||
|
compute_roleeventmax (const System sys)
|
||||||
{
|
{
|
||||||
Protocol pr;
|
Protocol pr;
|
||||||
int maxev;
|
int maxev;
|
||||||
@ -910,7 +919,8 @@ int compute_roleeventmax (const System sys)
|
|||||||
n++;
|
n++;
|
||||||
rd = rd->next;
|
rd = rd->next;
|
||||||
}
|
}
|
||||||
if (n > maxev) maxev = n;
|
if (n > maxev)
|
||||||
|
maxev = n;
|
||||||
r = r->next;
|
r = r->next;
|
||||||
}
|
}
|
||||||
pr = pr->next;
|
pr = pr->next;
|
||||||
|
@ -12,7 +12,8 @@
|
|||||||
#define runPointerGet(sys,run) sys->runs[run].index
|
#define runPointerGet(sys,run) sys->runs[run].index
|
||||||
#define runPointerSet(sys,run,newp) sys->runs[run].index = newp
|
#define runPointerSet(sys,run,newp) sys->runs[run].index = newp
|
||||||
|
|
||||||
enum outputs { EMPTY, ATTACK, STATESPACE, SCENARIOS, SUMMARY };
|
enum outputs
|
||||||
|
{ EMPTY, ATTACK, STATESPACE, SCENARIOS, SUMMARY };
|
||||||
|
|
||||||
//! Protocol definition.
|
//! Protocol definition.
|
||||||
struct protocol
|
struct protocol
|
||||||
|
@ -7,7 +7,8 @@
|
|||||||
* TAC instructions
|
* TAC instructions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
enum tactypes {
|
enum tactypes
|
||||||
|
{
|
||||||
TAC_UNDEF,
|
TAC_UNDEF,
|
||||||
TAC_SYM,
|
TAC_SYM,
|
||||||
TAC_TUPLE,
|
TAC_TUPLE,
|
||||||
|
31
src/term.c
31
src/term.c
@ -159,15 +159,18 @@ hasTermVariable (Term term)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (realTermTuple (term))
|
if (realTermTuple (term))
|
||||||
return (hasTermVariable (term->left.op1) || hasTermVariable (term->right.op2));
|
return (hasTermVariable (term->left.op1)
|
||||||
|
|| hasTermVariable (term->right.op2));
|
||||||
else
|
else
|
||||||
return (hasTermVariable (term->left.op) || hasTermVariable (term->right.key));
|
return (hasTermVariable (term->left.op)
|
||||||
|
|| hasTermVariable (term->right.key));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Safe wrapper for isTermEqual
|
//! Safe wrapper for isTermEqual
|
||||||
|
|
||||||
int isTermEqualDebug (Term t1, Term t2)
|
int
|
||||||
|
isTermEqualDebug (Term t1, Term t2)
|
||||||
{
|
{
|
||||||
int test1, test2;
|
int test1, test2;
|
||||||
|
|
||||||
@ -218,7 +221,8 @@ isTermEqualFn (Term term1, Term term2)
|
|||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
int test;
|
int test;
|
||||||
|
|
||||||
test = (term1->left.symb == term2->left.symb && term1->right.runid == term2->right.runid);
|
test = (term1->left.symb == term2->left.symb
|
||||||
|
&& term1->right.runid == term2->right.runid);
|
||||||
if (test)
|
if (test)
|
||||||
{
|
{
|
||||||
error ("Strange node equality detected, should not occur.");
|
error ("Strange node equality detected, should not occur.");
|
||||||
@ -267,7 +271,8 @@ termOccurs (Term t, Term tsub)
|
|||||||
if (realTermLeaf (t))
|
if (realTermLeaf (t))
|
||||||
return 0;
|
return 0;
|
||||||
if (realTermTuple (t))
|
if (realTermTuple (t))
|
||||||
return (termOccurs (t->left.op1, tsub) || termOccurs (t->right.op2, tsub));
|
return (termOccurs (t->left.op1, tsub)
|
||||||
|
|| termOccurs (t->right.op2, tsub));
|
||||||
else
|
else
|
||||||
return (termOccurs (t->left.op, tsub) || termOccurs (t->right.key, tsub));
|
return (termOccurs (t->left.op, tsub) || termOccurs (t->right.key, tsub));
|
||||||
}
|
}
|
||||||
@ -787,11 +792,13 @@ termDistance(Term t1, Term t2)
|
|||||||
if (isTermEncrypt (t1))
|
if (isTermEncrypt (t1))
|
||||||
{
|
{
|
||||||
/* encryption */
|
/* encryption */
|
||||||
return (termDistance(t1->left.op, t2->left.op) + termDistance(t1->right.key, t2->right.key)) / 2;
|
return (termDistance (t1->left.op, t2->left.op) +
|
||||||
|
termDistance (t1->right.key, t2->right.key)) / 2;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return (termDistance(t1->left.op1, t2->left.op1) + termDistance(t1->right.op2, t2->right.op2)) / 2;
|
return (termDistance (t1->left.op1, t2->left.op1) +
|
||||||
|
termDistance (t1->right.op2, t2->right.op2)) / 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -801,7 +808,8 @@ termDistance(Term t1, Term t2)
|
|||||||
* Enforce a (arbitrary) ordering on terms
|
* Enforce a (arbitrary) ordering on terms
|
||||||
* <0 means a<b, 0 means a=b, >0 means a>b.
|
* <0 means a<b, 0 means a=b, >0 means a>b.
|
||||||
*/
|
*/
|
||||||
int termOrder (Term t1, Term t2)
|
int
|
||||||
|
termOrder (Term t1, Term t2)
|
||||||
{
|
{
|
||||||
char *name1;
|
char *name1;
|
||||||
char *name2;
|
char *name2;
|
||||||
@ -832,9 +840,7 @@ int termOrder (Term t1, Term t2)
|
|||||||
/* compare names */
|
/* compare names */
|
||||||
int comp;
|
int comp;
|
||||||
|
|
||||||
comp = strcmp (t1->left.symb->text,
|
comp = strcmp (t1->left.symb->text, t2->left.symb->text);
|
||||||
t2->left.symb->text
|
|
||||||
);
|
|
||||||
if (comp != 0)
|
if (comp != 0)
|
||||||
{
|
{
|
||||||
/* names differ */
|
/* names differ */
|
||||||
@ -845,7 +851,8 @@ int termOrder (Term t1, Term t2)
|
|||||||
/* equal names, compare run identifiers */
|
/* equal names, compare run identifiers */
|
||||||
if (t1->right.runid == t2->right.runid)
|
if (t1->right.runid == t2->right.runid)
|
||||||
{
|
{
|
||||||
error ("termOrder: two terms seem to be identical although local precondition says they aren't.");
|
error
|
||||||
|
("termOrder: two terms seem to be identical although local precondition says they aren't.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -4,7 +4,8 @@
|
|||||||
#include "symbol.h"
|
#include "symbol.h"
|
||||||
|
|
||||||
// type <= LEAF means it's a leaf, nkay?
|
// type <= LEAF means it's a leaf, nkay?
|
||||||
enum termtypes { GLOBAL, VARIABLE, LEAF, ENCRYPT, TUPLE };
|
enum termtypes
|
||||||
|
{ GLOBAL, VARIABLE, LEAF, ENCRYPT, TUPLE };
|
||||||
|
|
||||||
//! The most basic datatype in the modelchecker.
|
//! The most basic datatype in the modelchecker.
|
||||||
/**
|
/**
|
||||||
|
@ -394,7 +394,8 @@ termlistAddVariables (Termlist tl, Term t)
|
|||||||
t->right.key);
|
t->right.key);
|
||||||
else
|
else
|
||||||
return
|
return
|
||||||
termlistAddVariables (termlistAddVariables (tl, t->left.op1), t->right.op2);
|
termlistAddVariables (termlistAddVariables (tl, t->left.op1),
|
||||||
|
t->right.op2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -436,7 +437,8 @@ termlistAddRealVariables (Termlist tl, Term t)
|
|||||||
t->right.key);
|
t->right.key);
|
||||||
else
|
else
|
||||||
return
|
return
|
||||||
termlistAddVariables (termlistAddVariables (tl, t->left.op1), t->right.op2);
|
termlistAddVariables (termlistAddVariables (tl, t->left.op1),
|
||||||
|
t->right.op2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -455,9 +457,11 @@ termlistAddBasic (Termlist tl, Term t)
|
|||||||
if (!isTermLeaf (t))
|
if (!isTermLeaf (t))
|
||||||
{
|
{
|
||||||
if (isTermEncrypt (t))
|
if (isTermEncrypt (t))
|
||||||
return termlistAddBasic (termlistAddBasic (tl, t->left.op), t->right.key);
|
return termlistAddBasic (termlistAddBasic (tl, t->left.op),
|
||||||
|
t->right.key);
|
||||||
else
|
else
|
||||||
return termlistAddBasic (termlistAddBasic (tl, t->left.op1), t->right.op2);
|
return termlistAddBasic (termlistAddBasic (tl, t->left.op1),
|
||||||
|
t->right.op2);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -622,13 +626,17 @@ termLocal (const Term t, Termlist fromlist, Termlist tolist,
|
|||||||
Term newt = termDuplicate (t);
|
Term newt = termDuplicate (t);
|
||||||
if (realTermTuple (t))
|
if (realTermTuple (t))
|
||||||
{
|
{
|
||||||
newt->left.op1 = termLocal (t->left.op1, fromlist, tolist, locals, runid);
|
newt->left.op1 =
|
||||||
newt->right.op2 = termLocal (t->right.op2, fromlist, tolist, locals, runid);
|
termLocal (t->left.op1, fromlist, tolist, locals, runid);
|
||||||
|
newt->right.op2 =
|
||||||
|
termLocal (t->right.op2, fromlist, tolist, locals, runid);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
newt->left.op = termLocal (t->left.op, fromlist, tolist, locals, runid);
|
newt->left.op =
|
||||||
newt->right.key = termLocal (t->right.key, fromlist, tolist, locals, runid);
|
termLocal (t->left.op, fromlist, tolist, locals, runid);
|
||||||
|
newt->right.key =
|
||||||
|
termLocal (t->right.key, fromlist, tolist, locals, runid);
|
||||||
}
|
}
|
||||||
return newt;
|
return newt;
|
||||||
}
|
}
|
||||||
@ -755,7 +763,8 @@ termlistForward (Termlist tl)
|
|||||||
/**
|
/**
|
||||||
* Compare two termlists containing only basic terms, and yield ordering.
|
* Compare two termlists containing only basic terms, and yield ordering.
|
||||||
*/
|
*/
|
||||||
int termlistOrder (Termlist tl1, Termlist tl2)
|
int
|
||||||
|
termlistOrder (Termlist tl1, Termlist tl2)
|
||||||
{
|
{
|
||||||
int order;
|
int order;
|
||||||
|
|
||||||
@ -775,5 +784,3 @@ int termlistOrder (Termlist tl1, Termlist tl2)
|
|||||||
else
|
else
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -107,7 +107,8 @@ termmapDelete (const Termmap f)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! Print a function
|
//! Print a function
|
||||||
void termmapPrint (Termmap f)
|
void
|
||||||
|
termmapPrint (Termmap f)
|
||||||
{
|
{
|
||||||
if (f != NULL)
|
if (f != NULL)
|
||||||
{
|
{
|
||||||
|
@ -87,7 +87,8 @@ tracebufRebuildKnow(struct tracebuf *tb)
|
|||||||
struct tracebuf *
|
struct tracebuf *
|
||||||
tracebufInit (void)
|
tracebufInit (void)
|
||||||
{
|
{
|
||||||
struct tracebuf *tb = (struct tracebuf *) memAlloc(sizeof(struct tracebuf));
|
struct tracebuf *tb =
|
||||||
|
(struct tracebuf *) memAlloc (sizeof (struct tracebuf));
|
||||||
tb->length = 0;
|
tb->length = 0;
|
||||||
tb->reallength = 0;
|
tb->reallength = 0;
|
||||||
tb->event = NULL;
|
tb->event = NULL;
|
||||||
@ -162,7 +163,8 @@ tracebufSet (const System sys, int length, int claimev)
|
|||||||
tb->status = (int *) memAlloc (length * sizeof (int));
|
tb->status = (int *) memAlloc (length * sizeof (int));
|
||||||
tb->link = (int *) memAlloc (length * sizeof (int));
|
tb->link = (int *) memAlloc (length * sizeof (int));
|
||||||
tb->run = (int *) memAlloc (length * sizeof (int));
|
tb->run = (int *) memAlloc (length * sizeof (int));
|
||||||
tb->know = (Knowledge *) memAlloc((length + 1) * sizeof (struct knowledge*));
|
tb->know =
|
||||||
|
(Knowledge *) memAlloc ((length + 1) * sizeof (struct knowledge *));
|
||||||
|
|
||||||
/* when duplicating the knowledge, we want to instantiate the variables as well
|
/* when duplicating the knowledge, we want to instantiate the variables as well
|
||||||
*/
|
*/
|
||||||
|
@ -7,7 +7,8 @@
|
|||||||
#include "system.h"
|
#include "system.h"
|
||||||
|
|
||||||
/* STATUS symbols */
|
/* STATUS symbols */
|
||||||
enum statussymbols {
|
enum statussymbols
|
||||||
|
{
|
||||||
S_UNK, // UNKnown : unprocessed.
|
S_UNK, // UNKnown : unprocessed.
|
||||||
S_OKE, // OKE : done, but required for the attack.
|
S_OKE, // OKE : done, but required for the attack.
|
||||||
S_RED, // REDundant : is not needed for attack, we're sure.
|
S_RED, // REDundant : is not needed for attack, we're sure.
|
||||||
|
@ -90,5 +90,3 @@ varbufDone (Varbuf vb)
|
|||||||
memFree (vb, sizeof (struct varbuf));
|
memFree (vb, sizeof (struct varbuf));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user