Regression-fix: Reintroduced option for alternative PKI.

Changes:

1. Reverted restricted use of 'hashfunction': 'function' can now be used as an alternative (but they are identical).
2. Functions can be specified to be secret, as we had before.

Together with the newer 'inversekeyfunctions' declaration, this allows for the clean definition of alternative key infrastructures.

Example usage:

  secret function sk2;
  function pk2;
  inversekeyfunctions (sk2,pk2);

Conflicts:
	src/compiler.c
This commit is contained in:
Cas Cremers 2013-05-24 11:05:30 +02:00
parent 5c2eded8f9
commit fe25a53232
2 changed files with 15 additions and 3 deletions

View File

@ -1103,6 +1103,12 @@ hashfunctions (Tac tcstart)
} }
knowledgeAddInverseKeys (sys->know, hfuncs->term, hinvs->term); knowledgeAddInverseKeys (sys->know, hfuncs->term, hinvs->term);
hfuncs->term->stype = termlistAdd (NULL, TERM_Function); hfuncs->term->stype = termlistAdd (NULL, TERM_Function);
if (tcstart->t3.tac == NULL)
{
// Not secret
knowledgeAddTerm (sys->know, hfuncs->term);
knowledgeAddPublicFunction (sys->know, hfuncs->term);
}
hinvs->term->stype = termlistAdd (NULL, TERM_Function); hinvs->term->stype = termlistAdd (NULL, TERM_Function);
hfuncs = hfuncs->next; hfuncs = hfuncs->next;
hinvs = hinvs->next; hinvs = hinvs->next;

View File

@ -368,11 +368,11 @@ declaration : secretpref CONST basictermlist typeinfo1 ';'
t->t1.tac= $2; t->t1.tac= $2;
$$ = t; $$ = t;
} }
| HASHFUNCTION basictermlist ';' | secretpref funcORhash basictermlist ';'
{ Tac t = tacCreate(TAC_HASHFUNCTION); { Tac t = tacCreate(TAC_HASHFUNCTION);
t->t1.tac = $2; t->t1.tac = $3;
t->t2.tac = tacCreate(TAC_UNDEF); t->t2.tac = tacCreate(TAC_UNDEF);
t->t3.tac = NULL; // Not secret: public t->t3.tac = $1; // secret or not
$$ = t; $$ = t;
} }
| macrodecl | macrodecl
@ -381,6 +381,12 @@ declaration : secretpref CONST basictermlist typeinfo1 ';'
} }
; ;
funcORhash : FUNCTION
{ }
| HASHFUNCTION
{ }
;
secretpref : /* empty */ secretpref : /* empty */
{ {
$$ = NULL; $$ = NULL;