- Single claim check branched.

This commit is contained in:
ccremers 2006-08-01 06:04:01 +00:00
parent ff87bf180f
commit 92a98a85cc

View File

@ -2231,91 +2231,15 @@ iterate_buffer_attacks (void)
} }
} }
//! Main code for Arachne //! Arachne single claim
/**
* For this test, we manually set up some stuff.
*
* But later, this will just iterate over all claims.
*/
int 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 // Skip the dummy claims
if (!isTermEqual (cl->type, CLAIM_Empty)) if (!isTermEqual (cl->type, CLAIM_Empty))
{ {
// Any other claims might be filterered // Any other claims might be filterered
if (switches.filterClaim == NULL if (switches.filterClaim == NULL || switches.filterClaim == cl->type)
|| switches.filterClaim == cl->type)
{ {
// Some claims are always true! // Some claims are always true!
if (!cl->alwaystrue) 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 // next
cl = cl->next; cl = cl->next;
} }
return count;
} }
//! Construct knowledge set at some event, based on a semitrace. //! Construct knowledge set at some event, based on a semitrace.