- Single claim check branched.
This commit is contained in:
parent
ff87bf180f
commit
92a98a85cc
176
src/arachne.c
176
src/arachne.c
@ -2231,91 +2231,15 @@ iterate_buffer_attacks (void)
|
||||
}
|
||||
}
|
||||
|
||||
//! Main code for Arachne
|
||||
/**
|
||||
* For this test, we manually set up some stuff.
|
||||
*
|
||||
* But later, this will just iterate over all claims.
|
||||
*/
|
||||
//! Arachne single claim
|
||||
int
|
||||
arachne ()
|
||||
arachneClaim (Claimlist cl)
|
||||
{
|
||||
Claimlist cl;
|
||||
|
||||
int print_send (Protocol p, Role r, Roledef rd, int index)
|
||||
{
|
||||
eprintf ("IRS: ");
|
||||
termPrint (p->nameterm);
|
||||
eprintf (", ");
|
||||
termPrint (r->nameterm);
|
||||
eprintf (", %i, ", index);
|
||||
roledefPrint (rd);
|
||||
eprintf ("\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
int determine_encrypt_max (Protocol p, Role r, Roledef rd, int index)
|
||||
{
|
||||
int tlevel;
|
||||
|
||||
tlevel = term_encryption_level (rd->message);
|
||||
#ifdef DEBUG
|
||||
if (DEBUGL (3))
|
||||
{
|
||||
eprintf ("Encryption level %i found for term ", tlevel);
|
||||
termPrint (rd->message);
|
||||
eprintf ("\n");
|
||||
}
|
||||
#endif
|
||||
if (tlevel > max_encryption_level)
|
||||
max_encryption_level = tlevel;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* set up claim role(s)
|
||||
*/
|
||||
|
||||
if (switches.runs == 0)
|
||||
{
|
||||
// No real checking.
|
||||
return;
|
||||
}
|
||||
|
||||
if (sys->maxruns > 0)
|
||||
{
|
||||
error ("Something is wrong, number of runs >0.");
|
||||
}
|
||||
|
||||
sys->num_regular_runs = 0;
|
||||
sys->num_intruder_runs = 0;
|
||||
|
||||
max_encryption_level = 0;
|
||||
iterate_role_events (determine_encrypt_max);
|
||||
#ifdef DEBUG
|
||||
if (DEBUGL (1))
|
||||
{
|
||||
eprintf ("Maximum encryption level: %i\n", max_encryption_level);
|
||||
}
|
||||
#endif
|
||||
|
||||
fixAgentKeylevels ();
|
||||
|
||||
indentDepth = 0;
|
||||
proofDepth = 0;
|
||||
cl = sys->claimlist;
|
||||
while (cl != NULL)
|
||||
{
|
||||
/**
|
||||
* Check each claim
|
||||
*/
|
||||
|
||||
// Skip the dummy claims
|
||||
if (!isTermEqual (cl->type, CLAIM_Empty))
|
||||
{
|
||||
// Any other claims might be filterered
|
||||
if (switches.filterClaim == NULL
|
||||
|| switches.filterClaim == cl->type)
|
||||
if (switches.filterClaim == NULL || switches.filterClaim == cl->type)
|
||||
{
|
||||
// Some claims are always true!
|
||||
if (!cl->alwaystrue)
|
||||
@ -2439,10 +2363,104 @@ arachne ()
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//! Main code for Arachne
|
||||
/**
|
||||
* For this test, we manually set up some stuff.
|
||||
*
|
||||
* But later, this will just iterate over all claims.
|
||||
*/
|
||||
int
|
||||
arachne ()
|
||||
{
|
||||
Claimlist cl;
|
||||
int count;
|
||||
|
||||
int print_send (Protocol p, Role r, Roledef rd, int index)
|
||||
{
|
||||
eprintf ("IRS: ");
|
||||
termPrint (p->nameterm);
|
||||
eprintf (", ");
|
||||
termPrint (r->nameterm);
|
||||
eprintf (", %i, ", index);
|
||||
roledefPrint (rd);
|
||||
eprintf ("\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
int determine_encrypt_max (Protocol p, Role r, Roledef rd, int index)
|
||||
{
|
||||
int tlevel;
|
||||
|
||||
tlevel = term_encryption_level (rd->message);
|
||||
#ifdef DEBUG
|
||||
if (DEBUGL (3))
|
||||
{
|
||||
eprintf ("Encryption level %i found for term ", tlevel);
|
||||
termPrint (rd->message);
|
||||
eprintf ("\n");
|
||||
}
|
||||
#endif
|
||||
if (tlevel > max_encryption_level)
|
||||
max_encryption_level = tlevel;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* set up claim role(s)
|
||||
*/
|
||||
|
||||
if (switches.runs == 0)
|
||||
{
|
||||
// No real checking.
|
||||
return;
|
||||
}
|
||||
|
||||
if (sys->maxruns > 0)
|
||||
{
|
||||
error ("Something is wrong, number of runs >0.");
|
||||
}
|
||||
|
||||
sys->num_regular_runs = 0;
|
||||
sys->num_intruder_runs = 0;
|
||||
|
||||
max_encryption_level = 0;
|
||||
iterate_role_events (determine_encrypt_max);
|
||||
#ifdef DEBUG
|
||||
if (DEBUGL (1))
|
||||
{
|
||||
eprintf ("Maximum encryption level: %i\n", max_encryption_level);
|
||||
}
|
||||
#endif
|
||||
|
||||
fixAgentKeylevels ();
|
||||
|
||||
indentDepth = 0;
|
||||
proofDepth = 0;
|
||||
cl = sys->claimlist;
|
||||
count = 0;
|
||||
while (cl != NULL)
|
||||
{
|
||||
/**
|
||||
* Check each claim
|
||||
*/
|
||||
if (arachneClaim (cl))
|
||||
{
|
||||
count++;
|
||||
}
|
||||
|
||||
// next
|
||||
cl = cl->next;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
//! Construct knowledge set at some event, based on a semitrace.
|
||||
|
Loading…
Reference in New Issue
Block a user