From fe25a53232b5dacb37f5657f8c895d696105229c Mon Sep 17 00:00:00 2001 From: Cas Cremers Date: Fri, 24 May 2013 11:05:30 +0200 Subject: [PATCH] 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 --- src/compiler.c | 6 ++++++ src/parser.y | 12 +++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/compiler.c b/src/compiler.c index 126db58..ae50de5 100644 --- a/src/compiler.c +++ b/src/compiler.c @@ -1103,6 +1103,12 @@ hashfunctions (Tac tcstart) } knowledgeAddInverseKeys (sys->know, hfuncs->term, hinvs->term); 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); hfuncs = hfuncs->next; hinvs = hinvs->next; diff --git a/src/parser.y b/src/parser.y index 4d8c01d..ed96dd6 100644 --- a/src/parser.y +++ b/src/parser.y @@ -368,11 +368,11 @@ declaration : secretpref CONST basictermlist typeinfo1 ';' t->t1.tac= $2; $$ = t; } - | HASHFUNCTION basictermlist ';' + | secretpref funcORhash basictermlist ';' { Tac t = tacCreate(TAC_HASHFUNCTION); - t->t1.tac = $2; + t->t1.tac = $3; t->t2.tac = tacCreate(TAC_UNDEF); - t->t3.tac = NULL; // Not secret: public + t->t3.tac = $1; // secret or not $$ = t; } | macrodecl @@ -381,6 +381,12 @@ declaration : secretpref CONST basictermlist typeinfo1 ';' } ; +funcORhash : FUNCTION + { } + | HASHFUNCTION + { } + ; + secretpref : /* empty */ { $$ = NULL;