- Many cleanups to make -Wall happy. Next up is pedantic...
This commit is contained in:
parent
92090142a0
commit
89c3a20acf
@ -42,6 +42,8 @@
|
||||
#include "arachne.h"
|
||||
#include "hidelevel.h"
|
||||
#include "depend.h"
|
||||
#include "xmlout.h"
|
||||
#include "heuristic.h"
|
||||
|
||||
extern int *graph;
|
||||
extern int nodes;
|
||||
@ -70,7 +72,6 @@ static FILE *attack_stream;
|
||||
*/
|
||||
|
||||
int iterate ();
|
||||
void printSemiState ();
|
||||
|
||||
/*
|
||||
* Program code
|
||||
@ -81,7 +82,6 @@ void
|
||||
arachneInit (const System mysys)
|
||||
{
|
||||
Roledef rd;
|
||||
Termlist tl, know0;
|
||||
|
||||
void add_event (int event, Term message)
|
||||
{
|
||||
@ -666,7 +666,6 @@ create_decryptor (const Term term, const Term key)
|
||||
if (term != NULL && isTermEncrypt (term))
|
||||
{
|
||||
Roledef rd;
|
||||
Term tempkey;
|
||||
int run;
|
||||
|
||||
#ifdef DEBUG
|
||||
@ -692,15 +691,13 @@ create_decryptor (const Term term, const Term key)
|
||||
|
||||
return run;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
globalError++;
|
||||
eprintf ("Term for which a decryptor instance is requested: ");
|
||||
termPrint (term);
|
||||
eprintf ("\n");
|
||||
error
|
||||
("Trying to build a decryptor instance for a non-encrypted term.");
|
||||
}
|
||||
error ("Trying to build a decryptor instance for a non-encrypted term.");
|
||||
return -1;
|
||||
}
|
||||
|
||||
//! Get the priority level of a key that is needed for a term (typical pk/sk distinction)
|
||||
@ -1085,7 +1082,6 @@ printSemiState ()
|
||||
{
|
||||
int run;
|
||||
int open;
|
||||
List bl;
|
||||
|
||||
int binding_state_print (void *dt)
|
||||
{
|
||||
@ -2237,7 +2233,7 @@ iterate_buffer_attacks (void)
|
||||
}
|
||||
|
||||
//! Arachne single claim test
|
||||
int
|
||||
void
|
||||
arachneClaimTest (Claimlist cl)
|
||||
{
|
||||
// others we simply test...
|
||||
@ -2377,10 +2373,7 @@ arachneClaim (Claimlist cl)
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2389,6 +2382,8 @@ arachneClaim (Claimlist cl)
|
||||
* For this test, we manually set up some stuff.
|
||||
*
|
||||
* But later, this will just iterate over all claims.
|
||||
*
|
||||
* @TODO what does it return? And is that -1 valid, if nothing is tested?
|
||||
*/
|
||||
int
|
||||
arachne ()
|
||||
@ -2433,7 +2428,7 @@ arachne ()
|
||||
if (switches.runs == 0)
|
||||
{
|
||||
// No real checking.
|
||||
return;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (sys->maxruns > 0)
|
||||
|
@ -12,5 +12,9 @@ int isTriviallyKnownAtArachne (const System sys, const Term t, const int run,
|
||||
const int index);
|
||||
int isTriviallyKnownAfterArachne (const System sys, const Term t,
|
||||
const int run, const int index);
|
||||
void arachneOutputAttack ();
|
||||
void printSemiState ();
|
||||
int countIntruderActions ();
|
||||
void role_name_print (const int run);
|
||||
|
||||
#endif
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "arachne.h"
|
||||
#include "switches.h"
|
||||
#include "depend.h"
|
||||
#include "error.h"
|
||||
#ifndef OSXHOST
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
@ -178,6 +179,8 @@ goal_unbind (const Binding b)
|
||||
//! Bind a goal as a dummy (block)
|
||||
/**
|
||||
* Especially made for tuple expansion
|
||||
*
|
||||
* @TODO Weird that this returns a value (always true, otherwise error)
|
||||
*/
|
||||
int
|
||||
binding_block (Binding b)
|
||||
@ -187,13 +190,14 @@ binding_block (Binding b)
|
||||
b->blocked = true;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
error ("Trying to block a goal again.");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//! Unblock a binding
|
||||
/*
|
||||
* @TODO Weird that this returns a value (always true, otherwise error)
|
||||
*/
|
||||
int
|
||||
binding_unblock (Binding b)
|
||||
{
|
||||
@ -202,10 +206,8 @@ binding_unblock (Binding b)
|
||||
b->blocked = false;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
error ("Trying to unblock a non-blocked goal.");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -18,6 +18,8 @@
|
||||
#include "specialterm.h"
|
||||
#include "switches.h"
|
||||
#include "color.h"
|
||||
#include "cost.h"
|
||||
#include "timer.h"
|
||||
|
||||
//! When none of the runs match
|
||||
#define MATCH_NONE 0
|
||||
@ -39,6 +41,10 @@ extern int attack_leastcost;
|
||||
// Debugging the NI-SYNCH checks
|
||||
//#define OKIDEBUG
|
||||
|
||||
// Forward declaration
|
||||
int oki_nisynch (const System sys, const int trace_index,
|
||||
const Termmap role_to_run, const Termmap label_to_index);
|
||||
|
||||
/*
|
||||
* Validity checks for claims
|
||||
*
|
||||
@ -367,6 +373,7 @@ oki_nisynch (const System sys, const int trace_index,
|
||||
* Exception: no claim, no send, no read, what is it?
|
||||
*/
|
||||
error ("Unrecognized event type in claim scanner at %i.", trace_index);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -6,4 +6,7 @@ extern char *COLOR_Red;
|
||||
extern char *COLOR_Green;
|
||||
extern char *COLOR_Bold;
|
||||
|
||||
void colorInit (void);
|
||||
void colorDone (void);
|
||||
|
||||
#endif
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "hidelevel.h"
|
||||
#include "debug.h"
|
||||
#include "intruderknowledge.h"
|
||||
#include "error.h"
|
||||
|
||||
/*
|
||||
Simple sys pointer as a global. Yields cleaner code although it's against programming standards.
|
||||
@ -438,7 +439,6 @@ claimCreate (const System sys, const Protocol protocol, const Role role,
|
||||
const Term claim, Term label, const Term msg)
|
||||
{
|
||||
Claimlist cl;
|
||||
Term labeltuple;
|
||||
|
||||
/* generate full unique label */
|
||||
/* is the label empty or used? */
|
||||
@ -556,6 +556,7 @@ claimCreate (const System sys, const Protocol protocol, const Role role,
|
||||
claimvars = claimvars->next;
|
||||
}
|
||||
}
|
||||
return cl;
|
||||
}
|
||||
|
||||
//! Parse a communication event tc of type event, and add a role definition event for it.
|
||||
@ -1390,7 +1391,6 @@ compute_prec_sets (const System sys)
|
||||
int size; // temp constant: rolecount * roleeventmax
|
||||
int rowsize;
|
||||
int r1, r2, ev1, ev2; // some counters
|
||||
int i, j;
|
||||
Claimlist cl;
|
||||
|
||||
// Assist: compute index from role, lev
|
||||
@ -1583,7 +1583,6 @@ compute_prec_sets (const System sys)
|
||||
cl = sys->claimlist;
|
||||
while (cl != NULL)
|
||||
{
|
||||
Term t;
|
||||
Roledef rd;
|
||||
Term label;
|
||||
int claim_index;
|
||||
|
@ -8,6 +8,8 @@
|
||||
*/
|
||||
#include "switches.h"
|
||||
#include "system.h"
|
||||
#include "binding.h"
|
||||
#include "error.h"
|
||||
#include <limits.h>
|
||||
|
||||
//************************************************************************
|
||||
@ -68,4 +70,5 @@ attackCost (const System sys)
|
||||
return cost;
|
||||
}
|
||||
error ("Unknown pruning method (cost function not found)");
|
||||
return 0;
|
||||
}
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "depend.h"
|
||||
#include "type.h"
|
||||
#include "debug.h"
|
||||
#include "error.h"
|
||||
|
||||
extern Protocol INTRUDER; // Pointers, to be set by the Init of arachne.c
|
||||
extern Role I_M; // Same here.
|
||||
@ -1645,7 +1646,6 @@ void
|
||||
dotSemiState (const System mysys)
|
||||
{
|
||||
static int attack_number = 0;
|
||||
int run;
|
||||
Protocol p;
|
||||
int *ranks;
|
||||
int maxrank;
|
||||
|
@ -7,12 +7,15 @@
|
||||
*/
|
||||
|
||||
#include <float.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "binding.h"
|
||||
#include "system.h"
|
||||
#include "specialterm.h"
|
||||
#include "switches.h"
|
||||
#include "hidelevel.h"
|
||||
#include "arachne.h"
|
||||
#include "error.h"
|
||||
|
||||
//! Check whether a binding (goal) is selectable
|
||||
int
|
||||
@ -211,8 +214,6 @@ float
|
||||
weighHidelevel (const System sys, const Term t, const float massknow,
|
||||
const float massprot)
|
||||
{
|
||||
unsigned int hl;
|
||||
|
||||
switch (hidelevelFlag (sys, t))
|
||||
{
|
||||
case HLFLAG_NONE:
|
||||
@ -253,6 +254,7 @@ term_constcount (const System sys, Term t)
|
||||
n++;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
n = 0;
|
||||
|
@ -125,7 +125,7 @@ initialIntruderKnowledge (const System sys)
|
||||
* Hack. Enumerating is not always good (or even desirable).
|
||||
* If some I knows sk(I), sk should not be in the intruder knowledge.
|
||||
* But for hash(I), we typically would have h; but if it is never used differently, it would suffice.
|
||||
* To sommarize, the operational semantics definition is perfectly fine, but maybe a bit strict sometimes.
|
||||
* To summarize, the operational semantics definition is perfectly fine, but maybe a bit strict sometimes.
|
||||
*
|
||||
* The hack is that if function application:
|
||||
*/
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "knowledge.h"
|
||||
#include "system.h"
|
||||
#include "debug.h"
|
||||
#include "error.h"
|
||||
|
||||
/*
|
||||
* Knowledge stuff
|
||||
|
@ -56,7 +56,6 @@ Termlist knowledgeNew (const Knowledge oldk, const Knowledge newk);
|
||||
//! Harnass macro for recursive procedures.
|
||||
#define mindwipe(k,recurse) \
|
||||
Termlist tl; \
|
||||
Term oldsubst; \
|
||||
int flag; \
|
||||
if (k != NULL && k->vars != NULL) { \
|
||||
tl = k->vars; \
|
||||
|
@ -53,6 +53,8 @@
|
||||
#include "color.h"
|
||||
#include "error.h"
|
||||
#include "claim.h"
|
||||
#include "arachne.h"
|
||||
#include "xmlout.h"
|
||||
|
||||
//! The global system state pointer
|
||||
System sys;
|
||||
@ -75,7 +77,6 @@ int modelCheck (const System sys);
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
int nerrors;
|
||||
int exitcode = EXIT_NOATTACK;
|
||||
|
||||
/* initialize symbols */
|
||||
@ -217,7 +218,6 @@ main (int argc, char **argv)
|
||||
/* memory clean up? */
|
||||
strings_cleanup ();
|
||||
|
||||
exit:
|
||||
return exitcode;
|
||||
}
|
||||
|
||||
|
520
src/parser.c
520
src/parser.c
File diff suppressed because it is too large
Load Diff
14
src/parser.h
14
src/parser.h
@ -38,8 +38,7 @@
|
||||
# define YYTOKENTYPE
|
||||
/* Put the tokens into the symbol table, so that GDB and other debuggers
|
||||
know about them. */
|
||||
enum yytokentype
|
||||
{
|
||||
enum yytokentype {
|
||||
ID = 258,
|
||||
PROTOCOL = 259,
|
||||
ROLE = 260,
|
||||
@ -59,7 +58,7 @@ enum yytokentype
|
||||
HASHFUNCTION = 274,
|
||||
KNOWS = 275,
|
||||
TRUSTED = 276
|
||||
};
|
||||
};
|
||||
#endif
|
||||
/* Tokens. */
|
||||
#define ID 258
|
||||
@ -87,19 +86,20 @@ enum yytokentype
|
||||
|
||||
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
||||
typedef union YYSTYPE
|
||||
#line 13 "parser.y"
|
||||
#line 14 "parser.y"
|
||||
{
|
||||
char *str;
|
||||
struct tacnode *tac;
|
||||
char* str;
|
||||
struct tacnode* tac;
|
||||
Symbol symb;
|
||||
int value;
|
||||
}
|
||||
/* Line 1529 of yacc.c. */
|
||||
#line 98 "parser.h"
|
||||
YYSTYPE;
|
||||
YYSTYPE;
|
||||
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
||||
# define YYSTYPE_IS_DECLARED 1
|
||||
# define YYSTYPE_IS_TRIVIAL 1
|
||||
#endif
|
||||
|
||||
extern YYSTYPE yylval;
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include "pheading.h"
|
||||
/* #include "lex.yy.c" */
|
||||
#include "tac.h"
|
||||
#include "error.h"
|
||||
|
||||
struct tacnode* spdltac;
|
||||
|
||||
@ -319,6 +320,7 @@ int yyerror(char *s)
|
||||
extern char *yytext; //!< defined and maintained in lex.c
|
||||
|
||||
error ("%s at symbol '%s' on line %i.\n", s, yytext, yylineno);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -11,6 +11,10 @@
|
||||
#include "termlist.h"
|
||||
#include "list.h"
|
||||
#include "switches.h"
|
||||
#include "timer.h"
|
||||
#include "arachne.h"
|
||||
#include "system.h"
|
||||
#include "cost.h"
|
||||
|
||||
extern int attack_length;
|
||||
extern int attack_leastcost;
|
||||
@ -27,9 +31,6 @@ extern int max_encryption_level;
|
||||
int
|
||||
prune_bounds (const System sys)
|
||||
{
|
||||
Termlist tl;
|
||||
List bl;
|
||||
|
||||
/* prune for time */
|
||||
if (passed_time_limit ())
|
||||
{
|
||||
|
@ -13,6 +13,10 @@
|
||||
#include "binding.h"
|
||||
#include "specialterm.h"
|
||||
#include "hidelevel.h"
|
||||
#include "depend.h"
|
||||
#include "arachne.h"
|
||||
#include "error.h"
|
||||
#include "type.h"
|
||||
|
||||
extern Protocol INTRUDER;
|
||||
extern int proofDepth;
|
||||
@ -106,9 +110,8 @@ correctLocalOrder (const System sys)
|
||||
globalError--;
|
||||
error ("Abort");
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return iterateLocalToOther (sys, r1, checkTerm);
|
||||
@ -162,7 +165,6 @@ initiatorAgentsType (const System sys)
|
||||
int
|
||||
prune_theorems (const System sys)
|
||||
{
|
||||
Termlist tl;
|
||||
List bl;
|
||||
int run;
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "knowledge.h"
|
||||
#include "system.h"
|
||||
#include "debug.h"
|
||||
#include "error.h"
|
||||
#include "role.h"
|
||||
|
||||
extern int protocolCount; // from system.c
|
||||
|
900
src/scanner.c
900
src/scanner.c
File diff suppressed because it is too large
Load Diff
@ -3,6 +3,7 @@
|
||||
#include "term.h"
|
||||
#include "termlist.h"
|
||||
#include "compiler.h"
|
||||
#include "error.h"
|
||||
|
||||
/*
|
||||
* Some macros
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
#include "term.h"
|
||||
#include "termlist.h"
|
||||
#include "system.h"
|
||||
|
||||
/*
|
||||
* Some declarations in spercialterm.c
|
||||
@ -25,6 +26,7 @@ extern Term CLAIM_Reachable;
|
||||
|
||||
extern Termlist CLAIMS_dep_prec;
|
||||
|
||||
void specialTermInit (const System sys);
|
||||
int isTicketTerm (Term t);
|
||||
int hasTicketSubterm (Term t);
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include "states.h"
|
||||
#include "symbol.h"
|
||||
|
||||
/* States counter operations
|
||||
*
|
||||
|
@ -282,7 +282,6 @@ switcher (const int process, int index, int commandline)
|
||||
char **argv;
|
||||
|
||||
char *arg_pointer;
|
||||
int arg_index;
|
||||
|
||||
//! Check whether there are still n options left
|
||||
int enough_arguments_left (const int n, char shortopt, char *longopt)
|
||||
|
@ -266,6 +266,7 @@ symbolNextFree (Symbol prefixsymbol)
|
||||
}
|
||||
error ("We ran out of numbers (%i) when trying to generate a fresh symbol.",
|
||||
n);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//! Fix all the unset keylevels
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "knowledge.h"
|
||||
#include "system.h"
|
||||
#include "debug.h"
|
||||
#include "error.h"
|
||||
#include "role.h"
|
||||
#include "mgu.h"
|
||||
#include "switches.h"
|
||||
@ -148,7 +149,6 @@ systemRuns (const System sys)
|
||||
void
|
||||
systemDone (const System sys)
|
||||
{
|
||||
int run;
|
||||
int s;
|
||||
|
||||
/* clear globals, which were defined in systemStart */
|
||||
|
@ -212,6 +212,7 @@ int selfResponder (const System sys, const int run);
|
||||
int selfResponders (const System sys);
|
||||
int selfInitiator (const System sys, const int run);
|
||||
int selfInitiators (const System sys);
|
||||
int enoughAttacks (const System sys);
|
||||
|
||||
|
||||
//! Equality for run structure naming
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include "tac.h"
|
||||
#include "memory.h"
|
||||
#include "switches.h"
|
||||
#include "error.h"
|
||||
|
||||
extern int yylineno;
|
||||
|
||||
@ -183,6 +184,8 @@ tacTuple (Tac taclist)
|
||||
error ("Unknown tupling mode (--tupling=%i)", switches.tupling);
|
||||
}
|
||||
}
|
||||
// @TODO this should be considered an error
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include <string.h>
|
||||
#include "term.h"
|
||||
#include "debug.h"
|
||||
#include "error.h"
|
||||
#include "ctype.h"
|
||||
#include "specialterm.h"
|
||||
|
||||
@ -866,9 +867,6 @@ termDistance (Term t1, Term t2)
|
||||
int
|
||||
termOrder (Term t1, Term t2)
|
||||
{
|
||||
char *name1;
|
||||
char *name2;
|
||||
|
||||
t1 = deVar (t1);
|
||||
t2 = deVar (t2);
|
||||
if (isTermEqual (t1, t2))
|
||||
@ -938,6 +936,8 @@ termOrder (Term t1, Term t2)
|
||||
else
|
||||
return compR;
|
||||
}
|
||||
// @TODO Should be considered an error
|
||||
return 0;
|
||||
}
|
||||
|
||||
//! Generic term iteration
|
||||
@ -1177,7 +1177,6 @@ term_constrain_level (const Term term)
|
||||
{
|
||||
int vars;
|
||||
int structure;
|
||||
int flag;
|
||||
|
||||
void tcl_iterate (Term t)
|
||||
{
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include "termlist.h"
|
||||
#include "specialterm.h"
|
||||
#include "debug.h"
|
||||
#include "error.h"
|
||||
|
||||
/*
|
||||
* Shared stuff
|
||||
@ -912,6 +913,8 @@ termlist_to_tuple (Termlist tl)
|
||||
return termDuplicate (tl->term);
|
||||
}
|
||||
}
|
||||
// @TODO Should be considered an error
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//! Split a tuple term into termlist components.
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "specialterm.h"
|
||||
#include "claim.h"
|
||||
#include "dotout.h"
|
||||
#include "type.h"
|
||||
|
||||
#include "xmlout.h"
|
||||
|
||||
@ -614,8 +615,6 @@ xmlOutEvent (const System sys, Roledef rd, const int run, const int index)
|
||||
|
||||
// Display any incoming bindings
|
||||
{
|
||||
int incomingArrows;
|
||||
|
||||
int xmlBindingState (void *dt)
|
||||
{
|
||||
Binding b;
|
||||
|
Loading…
Reference in New Issue
Block a user