set postQuantumSound=true.

BASIC HASH

The Basic Hash protocol as described in [A] is an RFID protocol involving:

  • a tag associated to a secret key;
  • generic readers having access to a database containing all these keys.

The protocol is as follows:

T --> R : <nT, h(nT,key)>
R --> T : ok

In this file, we prove two security properties for this protocol.

  • We first prove an authentication property for the reader.

  • We then prove unlinkability, i.e. the equivalence between a real system (where each tag can play multiple sessions) and an ideal system (where each tag plays only one session).

[A] Mayla Brusò, Kostas Chatzikokolakis, and Jerry den Hartog. Formal Verification of Privacy for RFID Systems. pages 75–88, July 2010.

When this option is set to true, Squirrel checks that proofs are also sound for quantum attackers.

include Basic. Goal eq_sym :
(x = y) = (y = x)
[goal> Focused goal (1/1):
System: any
Type variables: 'a
Variables: x,y:'a
----------------------------------------
(x = y) = (y = x)

[> Line 11: by (rewrite ...)
[goal> Goal eq_sym is proved
Exiting proof mode.


Goal neq_sym :
(x <> y) = (y <> x)
[goal> Focused goal (1/1):
System: any
Type variables: 'a
Variables: x,y:'a
----------------------------------------
(x <> y) = (y <> x)

[> Line 14: by (rewrite ...)
[goal> Goal neq_sym is proved
Exiting proof mode.


Goal eq_refl :
(x = x) = true
[goal> Focused goal (1/1):
System: any
Type variables: 'a
Variables: x:'a
----------------------------------------
(x = x) = true

[> Line 18: by (rewrite ...)
[goal> Goal eq_refl is proved
Exiting proof mode.


Goal false_true :
(false = true) = false
[goal> Focused goal (1/1):
System: any
----------------------------------------
(false = true) = false

[> Line 30: by (rewrite ...)
[goal> Goal false_true is proved
Exiting proof mode.


Goal eq_true :
(b = true) = b
[goal> Focused goal (1/1):
System: any
Variables: b:bool
----------------------------------------
(b = true) = b

[> Line 35: by (case b)
[goal> Goal eq_true is proved
Exiting proof mode.


Goal eq_true2 :
(true = b) = b
[goal> Focused goal (1/1):
System: any
Variables: b:bool
----------------------------------------
(true = b) = b

[> Line 39: by (case b)
[goal> Goal eq_true2 is proved
Exiting proof mode.


Goal not_not :
not(not(b)) = b
[goal> Focused goal (1/1):
System: any
Variables: b:bool
----------------------------------------
not(not(b)) = b

[> Line 54: by (case b)
[goal> Goal not_not is proved
Exiting proof mode.


Goal not_eq :
not(x = y) = (x <> y)
[goal> Focused goal (1/1):
System: any
Type variables: 'a
Variables: x,y:'a
----------------------------------------
not(x = y) = (x <> y)

[> Line 60: by (rewrite ...)
[goal> Goal not_eq is proved
Exiting proof mode.


Goal not_neq :
not(x <> y) = (x = y)
[goal> Focused goal (1/1):
System: any
Type variables: 'a
Variables: x,y:'a
----------------------------------------
not(x <> y) = (x = y)

[> Line 66: by (rewrite ...)
[goal> Goal not_neq is proved
Exiting proof mode.


Goal not_eqfalse :
(b = false) = not(b)
[goal> Focused goal (1/1):
System: any
Variables: b:bool
----------------------------------------
(b = false) = not(b)

[> Line 72: by (case b)
[goal> Goal not_eqfalse is proved
Exiting proof mode.


Goal eq_false :
((x = y) = false) = (x <> y)
[goal> Focused goal (1/1):
System: any
Type variables: 'a
Variables: x,y:'a
----------------------------------------
((x = y) = false) = (x <> y)

[> Line 80: (rewrite ...)
[goal> Focused goal (1/1):
System: any
Type variables: 'a
Variables: x,y:'a
----------------------------------------
((x = y) = false) = not(x = y)

[> Line 80: ((case (x = y));(intro _))
[goal> Focused goal (1/2):
System: any
Type variables: 'a
Variables: x,y:'a
_: x = y
----------------------------------------
(true = false) = not(true)

[> Line 80: simpl
[goal> Focused goal (1/2):
System: any
Type variables: 'a
Variables: x,y:'a
_: x = y
----------------------------------------
true

[> Line 80: auto
[goal> Focused goal (1/1):
System: any
Type variables: 'a
Variables: x,y:'a
_: not(x = y)
----------------------------------------
(false = false) = not(false)

[> Line 81: by (rewrite ...)
[goal> Goal eq_false is proved
Exiting proof mode.


Goal and_true_r :
(b && true) = b
[goal> Focused goal (1/1):
System: any
Variables: b:bool
----------------------------------------
(b && true) = b

[> Line 94: by (rewrite ... ...)
[goal> Goal and_true_r is proved
Exiting proof mode.


Goal and_false_r :
(b && false) = false
[goal> Focused goal (1/1):
System: any
Variables: b:bool
----------------------------------------
(b && false) = false

[> Line 101: by (rewrite ... ...)
[goal> Goal and_false_r is proved
Exiting proof mode.


Goal or_false_r :
(b || false) = b
[goal> Focused goal (1/1):
System: any
Variables: b:bool
----------------------------------------
(b || false) = b

[> Line 112: by (rewrite ... ...)
[goal> Goal or_false_r is proved
Exiting proof mode.


Goal or_true_r :
(b || true) = true
[goal> Focused goal (1/1):
System: any
Variables: b:bool
----------------------------------------
(b || true) = true

[> Line 119: by (rewrite ... ...)
[goal> Goal or_true_r is proved
Exiting proof mode.


Goal not_and :
not((a && b)) = (not(a) || not(b))
[goal> Focused goal (1/1):
System: any
Variables: a,b:bool
----------------------------------------
not((a && b)) = (not(a) || not(b))

[> Line 128: (rewrite ...)
[goal> Focused goal (1/1):
System: any
Variables: a,b:bool
----------------------------------------
not((a && b)) <=> not(a) || not(b)

[> Line 129: (((case a);(case b));(intro //=))
[goal> Goal not_and is proved
Exiting proof mode.


Goal not_or :
not((a || b)) = (not(a) && not(b))
[goal> Focused goal (1/1):
System: any
Variables: a,b:bool
----------------------------------------
not((a || b)) = (not(a) && not(b))

[> Line 134: (rewrite ...)
[goal> Focused goal (1/1):
System: any
Variables: a,b:bool
----------------------------------------
not((a || b)) <=> not(a) && not(b)

[> Line 135: (((case a);(case b));(intro //=))
[goal> Goal not_or is proved
Exiting proof mode.


Goal if_true :
b => if b then x else y = x
[goal> Focused goal (1/1):
System: any
Type variables: 'a
Variables: b:bool,x,y:'a
----------------------------------------
b => if b then x else y = x

[> Line 144: (intro *)
[goal> Focused goal (1/1):
System: any
Type variables: 'a
Variables: b:bool,x,y:'a
H: b
----------------------------------------
if b then x else y = x

[> Line 145: (case if b then x else y)
[goal> Focused goal (1/2):
System: any
Type variables: 'a
Variables: b:bool,x,y:'a
H: b
----------------------------------------
b && if b then x else y = x => x = x

[> Line 146: auto
[goal> Focused goal (1/1):
System: any
Type variables: 'a
Variables: b:bool,x,y:'a
H: b
----------------------------------------
not(b) && if b then x else y = y => y = x

[> Line 147: (intro [HH _])
[goal> Focused goal (1/1):
System: any
Type variables: 'a
Variables: b:bool,x,y:'a
H: b
HH: not(b)
_: if b then x else y = y
----------------------------------------
y = x

[> Line 147: by (have ... as )
[goal> Goal if_true is proved
Exiting proof mode.


Goal if_true0 :
if true then x else y = x
[goal> Focused goal (1/1):
System: any
Type variables: 'a
Variables: x,y:'a
----------------------------------------
if true then x else y = x

[> Line 153: by (rewrite ...)
[goal> Goal if_true0 is proved
Exiting proof mode.


Goal if_false :
not(b) => if b then x else y = y
[goal> Focused goal (1/1):
System: any
Type variables: 'a
Variables: b:bool,x,y:'a
----------------------------------------
not(b) => if b then x else y = y

[> Line 160: ((intro *);(case if b then x else y))
[goal> Focused goal (1/2):
System: any
Type variables: 'a
Variables: b:bool,x,y:'a
H: not(b)
----------------------------------------
b && if b then x else y = x => x = y

[> Line 161: (intro [HH _])
[goal> Focused goal (1/2):
System: any
Type variables: 'a
Variables: b:bool,x,y:'a
H: not(b)
HH: b
_: if b then x else y = x
----------------------------------------
x = y

[> Line 161: by (have ... as )
[goal> Focused goal (1/1):
System: any
Type variables: 'a
Variables: b:bool,x,y:'a
H: not(b)
----------------------------------------
not(b) && if b then x else y = y => y = y

[> Line 162: auto
[goal> Goal if_false is proved
Exiting proof mode.


Goal if_false0 :
if false then x else y = y
[goal> Focused goal (1/1):
System: any
Type variables: 'a
Variables: x,y:'a
----------------------------------------
if false then x else y = y

[> Line 168: by (rewrite ...)
[goal> Goal if_false0 is proved
Exiting proof mode.


Goal if_then_then :
if b then if b' then x else y else y = if (b && b') then x else y
[goal> Focused goal (1/1):
System: any
Type variables: 'a
Variables: b,b':bool,x,y:'a
----------------------------------------
if b then if b' then x else y else y = if (b && b') then x else y

[> Line 175: by ((case b);(case b'))
[goal> Goal if_then_then is proved
Exiting proof mode.


Goal if_then_implies :
if b then if b' then x else y else z =
if b then if (b => b') then x else y else z
[goal> Focused goal (1/1):
System: any
Type variables: 'a
Variables: b,b':bool,x,y,z:'a
----------------------------------------
if b then if b' then x else y else z =
if b then if (b => b') then x else y else z

[> Line 182: ((case b);
((intro H);((case b');((intro H');(simpl;(try auto))))))

[goal> Focused goal (1/2):
System: any
Type variables: 'a
Variables: b,b':bool,x,y,z:'a
H: b
H': b'
----------------------------------------
x = if (true => true) then x else y

[> Line 183: by (rewrite ...)
[goal> Focused goal (1/1):
System: any
Type variables: 'a
Variables: b,b':bool,x,y,z:'a
H: b
H': not(b')
----------------------------------------
y = if (true => false) then x else y

[> Line 184: (rewrite ...)
[goal> Focused goal (1/2):
System: any
Type variables: 'a
Variables: b,b':bool,x,y,z:'a
H: b
H': not(b')
----------------------------------------
not((true => false))

[> Line 185: ((intro Habs);by (have ... as ))
[goal> Focused goal (1/1):
System: any
Type variables: 'a
Variables: b,b':bool,x,y,z:'a
H: b
H': not(b')
----------------------------------------
y = y

[> Line 186: auto
[goal> Goal if_then_implies is proved
Exiting proof mode.


Goal if_same :
if b then x else x = x
[goal> Focused goal (1/1):
System: any
Type variables: 'a
Variables: b:bool,x:'a
----------------------------------------
if b then x else x = x

[> Line 192: by (case b)
[goal> Goal if_same is proved
Exiting proof mode.


Goal if_then :
b = b' => if b then if b' then x else y else z = if b then x else z
[goal> Focused goal (1/1):
System: any
Type variables: 'a
Variables: b,b':bool,x,y,z:'a
----------------------------------------
b = b' => if b then if b' then x else y else z = if b then x else z

[> Line 201: by ((intro ->);(case b'))
[goal> Goal if_then is proved
Exiting proof mode.


Goal if_else :
b = b' => if b then x else if b' then y else z = if b then x else z
[goal> Focused goal (1/1):
System: any
Type variables: 'a
Variables: b,b':bool,x,y,z:'a
----------------------------------------
b = b' => if b then x else if b' then y else z = if b then x else z

[> Line 210: by ((intro ->);(case b'))
[goal> Goal if_else is proved
Exiting proof mode.


Goal if_then_not :
b = not(b') => if b then if b' then x else y else z = if b then y else z
[goal> Focused goal (1/1):
System: any
Type variables: 'a
Variables: b,b':bool,x,y,z:'a
----------------------------------------
b = not(b') => if b then if b' then x else y else z = if b then y else z

[> Line 219: by ((intro ->);(case b'))
[goal> Goal if_then_not is proved
Exiting proof mode.


Goal if_else_not :
b = not(b') => if b then x else if b' then y else z = if b then x else y
[goal> Focused goal (1/1):
System: any
Type variables: 'a
Variables: b,b':bool,x,y,z:'a
----------------------------------------
b = not(b') => if b then x else if b' then y else z = if b then x else y

[> Line 228: by ((intro ->);(case b'))
[goal> Goal if_else_not is proved
Exiting proof mode.


Goal fst_pair :
fst(<x,y>) = x
[goal> Focused goal (1/1):
System: any
Variables: x,y:message
----------------------------------------
fst(<x,y>) = x

[> Line 236: auto
[goal> Goal fst_pair is proved
Exiting proof mode.


Goal snd_pair :
snd(<x,y>) = y
[goal> Focused goal (1/1):
System: any
Variables: x,y:message
----------------------------------------
snd(<x,y>) = y

[> Line 240: auto
[goal> Goal snd_pair is proved
Exiting proof mode.


Goal iff_refl :
(x <=> x) = true
[goal> Focused goal (1/1):
System: any
Variables: x:bool
----------------------------------------
(x <=> x) = true

[> Line 248: by (rewrite ...)
[goal> Goal iff_refl is proved
Exiting proof mode.


Goal iff_sym :
(x <=> y) = (y <=> x)
[goal> Focused goal (1/1):
System: any
Variables: x,y:bool
----------------------------------------
(x <=> y) = (y <=> x)

[> Line 254: by (rewrite ...)
[goal> Goal iff_sym is proved
Exiting proof mode.


Goal true_iff_false :
(true <=> false) = false
[goal> Focused goal (1/1):
System: any
----------------------------------------
(true <=> false) = false

[> Line 259: by (rewrite ...)
[goal> Goal true_iff_false is proved
Exiting proof mode.


Goal false_iff_true :
(false <=> true) = false
[goal> Focused goal (1/1):
System: any
----------------------------------------
(false <=> true) = false

[> Line 265: by (rewrite ...)
[goal> Goal false_iff_true is proved
Exiting proof mode.


Goal exists_false1 :
(exists (a:'a), false) = false
[goal> Focused goal (1/1):
System: any
Type variables: 'a
----------------------------------------
(exists (a:'a), false) = false

[> Line 277: by (rewrite ...)
[goal> Goal exists_false1 is proved
Exiting proof mode.


Goal exists_false2 :
(exists (a:'a,b:'b), false) = false
[goal> Focused goal (1/1):
System: any
Type variables: 'a, 'b
----------------------------------------
(exists (a:'a,b:'b), false) = false

[> Line 281: by (rewrite ...)
[goal> Goal exists_false2 is proved
Exiting proof mode.


Goal exists_false3 :
(exists (a:'a,b:'b,c:'c), false) = false
[goal> Focused goal (1/1):
System: any
Type variables: 'a, 'b, 'c
----------------------------------------
(exists (a:'a,b:'b,c:'c), false) = false

[> Line 285: by (rewrite ...)
[goal> Goal exists_false3 is proved
Exiting proof mode.


Goal exists_false4 :
(exists (a:'a,b:'b,c:'c,d:'d), false) = false
[goal> Focused goal (1/1):
System: any
Type variables: 'a, 'b, 'c, 'd
----------------------------------------
(exists (a:'a,b:'b,c:'c,d:'d), false) = false

[> Line 289: by (rewrite ...)
[goal> Goal exists_false4 is proved
Exiting proof mode.


Goal exists_false5 :
(exists (a:'a,b:'b,c:'c,d:'d,e:'e), false) = false
[goal> Focused goal (1/1):
System: any
Type variables: 'a, 'b, 'c, 'd, 'e
----------------------------------------
(exists (a:'a,b:'b,c:'c,d:'d,e:'e), false) = false

[> Line 293: by (rewrite ...)
[goal> Goal exists_false5 is proved
Exiting proof mode.


Goal exists_false6 :
(exists (a:'a,b:'b,c:'c,d:'d,e:'e,f:'f), false) = false
[goal> Focused goal (1/1):
System: any
Type variables: 'a, 'b, 'c, 'd, 'e, 'f
----------------------------------------
(exists (a:'a,b:'b,c:'c,d:'d,e:'e,f:'f), false) = false

[> Line 297: by (rewrite ...)
[goal> Goal exists_false6 is proved
Exiting proof mode.


Goal forall_true1 :
(forall (a:'a), true) = true
[goal> Focused goal (1/1):
System: any
Type variables: 'a
----------------------------------------
(forall (a:'a), true) = true

[> Line 307: auto
[goal> Goal forall_true1 is proved
Exiting proof mode.


Goal forall_true2 :
(forall (a:'a,b:'b), true) = true
[goal> Focused goal (1/1):
System: any
Type variables: 'a, 'b
----------------------------------------
(forall (a:'a,b:'b), true) = true

[> Line 311: auto
[goal> Goal forall_true2 is proved
Exiting proof mode.


Goal forall_true3 :
(forall (a:'a,b:'b,c:'c), true) = true
[goal> Focused goal (1/1):
System: any
Type variables: 'a, 'b, 'c
----------------------------------------
(forall (a:'a,b:'b,c:'c), true) = true

[> Line 315: auto
[goal> Goal forall_true3 is proved
Exiting proof mode.


Goal forall_true4 :
(forall (a:'a,b:'b,c:'c,d:'d), true) = true
[goal> Focused goal (1/1):
System: any
Type variables: 'a, 'b, 'c, 'd
----------------------------------------
(forall (a:'a,b:'b,c:'c,d:'d), true) = true

[> Line 319: auto
[goal> Goal forall_true4 is proved
Exiting proof mode.


Goal forall_true5 :
(forall (a:'a,b:'b,c:'c,d:'d,e:'e), true) = true
[goal> Focused goal (1/1):
System: any
Type variables: 'a, 'b, 'c, 'd, 'e
----------------------------------------
(forall (a:'a,b:'b,c:'c,d:'d,e:'e), true) = true

[> Line 323: auto
[goal> Goal forall_true5 is proved
Exiting proof mode.


Goal forall_true6 :
(forall (a:'a,b:'b,c:'c,d:'d,e:'e,f:'f), true) = true
[goal> Focused goal (1/1):
System: any
Type variables: 'a, 'b, 'c, 'd, 'e, 'f
----------------------------------------
(forall (a:'a,b:'b,c:'c,d:'d,e:'e,f:'f), true) = true

[> Line 327: auto
[goal> Goal forall_true6 is proved
Exiting proof mode.


[warning> loaded: Basic.sp <]

Include basic standard library, important helper lemmas and setting proof mode to autoIntro=false.

hash h

abstract ok : message
abstract ko : message.

We start by declaring the function symbol h for the hash function, as well as two public constants ok and ko (used by the reader).

name key : index -> message
name key' : index -> index -> message



channel cT
channel cR.

In order to model the real system and the ideal system, we will use two different name symbols for the tags’ secret keys. The symbol key has index arity 1 and will be used in the real system, while the symbol key' has index arity 2 and will be used in the ideal system so that each new session of a tag uses a new key.

Finally, we declare the channels used by the protocol.

process tag(i:index,k:index) =
new nT;
out(cT, <nT, h(nT,diff(key(i),key'(i,k)))>).

The tag’s role is modelled by the following process, indexed by i (for the identity of the tag) and by k (for the session of a given identity). The tag starts by generating a fresh random name nT, then outputs a message built using key(i) in the real system and key'(i,k) in the ideal system.

process reader(j:index) =
in(cT,x);
if exists (i,k:index), snd(x) = h(fst(x),diff(key(i),key'(i,k))) then
out(cR,ok)
else
out(cR,ko).

The reader’s role is modelled by the following process. Since readers are generic, the process is indexed only by j (for the session). The reader starts by inputting a message x before checking whether this message corresponds to a legitimate output performed by a tag. On the left side (the real system), the reader looks up for a key key(i) in the database (the one corresponding to the tag of identity i). On the right side (the ideal system), the reader looks up for a key key(i,k) in the database (the one used by the tag of identity i at session k).

system [BasicHash] ((!_j R: reader(j)) | (!_i !_k T: tag(i,k))). System before processing:

(!_j R: reader j) | (!_i !_k T: tag i k)

System after processing:

(!_j
in(cT,x);
if exists (i,k:index), (snd(x) = h(fst(x),diff(key(i),key'(i,k)))) then
R: out(cR,ok); null else R1: out(cR,ko); null) |
(!_i !_k T: out(cT,pair(nT(i,k),h(nT(i,k),diff(key(i),key'(i,k))))); null)

System BasicHash registered with actions (init,R,R1,T).

The system is finally defined by putting an unbounded number of tag and reader processes in parallel. This system is automatically translated to a set of actions:

  • the initial action (init);
  • one action for the tag (T);
  • two actions for the reader, corresponding to the two branches of the conditional (respectively R and R1).
goal [BasicHash] wa_R :
forall (tau:timestamp),
happens(tau) =>
((exists (i,k:index),
snd(input@tau) = h(fst(input@tau),diff(key(i),key'(i,k))))
=
(exists (i,k:index), T(i,k) < tau &&
fst(output@T(i,k)) = fst(input@tau) &&
snd(output@T(i,k)) = snd(input@tau))).
Goal wa_R :
forall (tau:timestamp),
happens(tau) =>
(exists (i,k:index),
snd(input@tau) = h(fst(input@tau),diff(key(i), key'(i,k)))) =
exists (i,k:index),
T(i,k) < tau &&
fst(output@T(i,k)) = fst(input@tau) &&
snd(output@T(i,k)) = snd(input@tau)

Whenever a reader accepts a message (i.e. the condition of the action R(j) evaluates to true), there exists an action T(i,k) that has been executed before the reader, and such that the input of the reader corresponds to the output of this tag (and conversely).

The same holds for R1 (the else branch of the reader) but with a negation. We will prove once and for all a property that is generalized for any tau, which will be useful later for tau = R(j) and tau = R1(j).

Note that we express our correspondence property on each projection of the pair. Indeed, for some implementations of the pairing primitive, the equality of projections does not imply the equality of pairs.

Proof. [goal> Focused goal (1/1):
System: left:BasicHash/left, right:BasicHash/right
----------------------------------------
forall (tau:timestamp),
happens(tau) =>
(exists (i,k:index),
snd(input@tau) = h(fst(input@tau),diff(key(i), key'(i,k)))) =
exists (i,k:index),
T(i,k) < tau &&
fst(output@T(i,k)) = fst(input@tau) &&
snd(output@T(i,k)) = snd(input@tau)

The high-level idea of the proof is to use the EUF cryptographic axiom: only the tag T(i,k) can forge h(nT(i,k),key(i)) because the secret key is not known by the attacker. Therefore, any message accepted by the reader must come from a tag that has played before. The converse implication is trivial because any honest tag output is accepted by the reader.

intro tau Hap. [> Line 130: (intro tau Hap)
[goal> Focused goal (1/1):
System: left:BasicHash/left, right:BasicHash/right
Variables: tau:timestamp
Hap: happens(tau)
----------------------------------------
(exists (i,k:index),
snd(input@tau) = h(fst(input@tau),diff(key(i), key'(i,k)))) =
exists (i,k:index),
T(i,k) < tau &&
fst(output@T(i,k)) = fst(input@tau) && snd(output@T(i,k)) = snd(input@tau)

We start by introducing the variable j and the hypothesis happens(R(j)), before unfolding the definiton of the cond macro, which corresponds to an existential quantification.

rewrite eq_iff; split => [i k Meq]. [> Line 133: (((rewrite ...);split);(intro [i k Meq]))
[goal> Focused goal (1/2):
System: left:BasicHash/left, right:BasicHash/right
Variables: i,k:index,tau:timestamp
Hap: happens(tau)
Meq: snd(input@tau) = h(fst(input@tau),diff(key(i), key'(i,k)))
----------------------------------------
exists (i,k:index),
T(i,k) < tau &&
fst(output@T(i,k)) = fst(input@tau) && snd(output@T(i,k)) = snd(input@tau)

We have to prove two implications (<=>): we thus split the proof in two parts. We now have two different goals to prove.

+ project. [> Line 136: project
[goal> Focused goal (1/3):
System: left:BasicHash/left
Variables: i,k:index,tau:timestamp
Hap: happens(tau)
Meq: snd(input@tau) = h(fst(input@tau),key(i))
----------------------------------------
exists (i,k:index),
T(i,k) < tau &&
fst(output@T(i,k)) = fst(input@tau) && snd(output@T(i,k)) = snd(input@tau)

For the first implication (=>), we actually prove it separately for the real system (left) and the ideal system (right).

++ (* LEFT *)
euf Meq => *.
[> Line 144: ((euf Meq);(intro *))
[goal> Focused goal (1/3):
System: left:BasicHash/left
Variables: i,k,k0:index,tau:timestamp
Clt: T(i,k0) < tau
Hap: happens(tau)
Meq: snd(input@tau) = h(fst(input@tau),key(i))
Meq0: nT(i,k0) = fst(input@tau)
----------------------------------------
exists (i,k:index),
T(i,k) < tau &&
fst(output@T(i,k)) = fst(input@tau) && snd(output@T(i,k)) = snd(input@tau)

The proof is very similar on both sides and relies on the euf tactic. Applying the euf tactic on the Meq hypothesis generates a new hypothesis stating that fst(input@R(j)) must be equal to some message that has already been hashed before. The only possibility is that this hash comes from the output of a tag that has played before (thus the new hypothesis on timestamps).

by exists i,k0. [> Line 144: by (exists i, k0)
[goal> Focused goal (1/2):
System: right:BasicHash/right
Variables: i,k:index,tau:timestamp
Hap: happens(tau)
Meq: snd(input@tau) = h(fst(input@tau),key'(i,k))
----------------------------------------
exists (i,k:index),
T(i,k) < tau &&
fst(output@T(i,k)) = fst(input@tau) && snd(output@T(i,k)) = snd(input@tau)


++ (* RIGHT *)
euf Meq => *.
[> Line 146: ((euf Meq);(intro *))
[goal> Focused goal (1/2):
System: right:BasicHash/right
Variables: i,k:index,tau:timestamp
Clt: T(i,k) < tau
H: i = i && k = k
Hap: happens(tau)
Meq: snd(input@tau) = h(fst(input@tau),key'(i,k))
Meq0: nT(i,k) = fst(input@tau)
----------------------------------------
exists (i,k:index),
T(i,k) < tau &&
fst(output@T(i,k)) = fst(input@tau) && snd(output@T(i,k)) = snd(input@tau)

by exists i,k. [> Line 146: by (exists i, k)
[goal> Focused goal (1/1):
System: left:BasicHash/left, right:BasicHash/right
Variables: i,k:index,tau:timestamp
Hap: happens(tau)
Meq: T(i,k) < tau &&
fst(output@T(i,k)) = fst(input@tau) &&
snd(output@T(i,k)) = snd(input@tau)
----------------------------------------
exists (i,k:index),
snd(input@tau) = h(fst(input@tau),diff(key(i), key'(i,k)))

+ by exists i,k. [> Line 149: by (exists i, k)
[goal> Goal wa_R is proved

For the second implication (<=), the conclusion of the goal can directly be obtained from the hypotheses.


Qed.
Exiting proof mode.


equiv [BasicHash] unlinkability. Goal unlinkability :
forall t:timestamp, equiv(frame@t)

We now prove an equivalence property expressing unlinkability of the protocol. This property is expressed by the logic formula forall t:timestamp, frame@t where frame@t is actually a bi-frame. We will have to prove that the left projection of frame@t (i.e. the real system) is indistinguishable from the right projection of frame@t (i.e. the ideal system).

Proof. [goal> Focused goal (1/1):
Systems: left:BasicHash/left, right:BasicHash/right (same for equivalences)
Variables: t:timestamp
H: [happens(t)]
----------------------------------------
0: frame@t


The high-level idea of the proof is as follows:

  • if t corresponds to a reader’s action, we show that the outcome of the conditional is the same on both sides and that this outcome only depends on information already available to the attacker;

  • if t corresponds to a tag’s action, we show that the new message added in the frame (i.e. the tag’s output) does not give any information to the attacker to distinguish the real system from the ideal one since hashes can intuitively be seen as fresh names thanks to the PRF cryptographic axiom.

induction t; 1: auto. [> Line 177: ((induction t); 1: auto)
[goal> Focused goal (1/3):
Systems: left:BasicHash/left, right:BasicHash/right (same for equivalences)
Variables: j:index
H: [happens(R(j))]
IH: equiv(frame@pred(R(j)))
----------------------------------------
0: frame@R(j)


The proof is done by induction over the timestamp t. The induction tactic also automatically introduces a case analysis over all the possible values for t. The first case, where t = init, is trivial. The other cases correspond to the 3 different actions of the protocol.

+ expand frame, exec, output. [> Line 181: (expand frame, exec, output)
[goal> Focused goal (1/3):
Systems: left:BasicHash/left, right:BasicHash/right (same for equivalences)
Variables: j:index
H: [happens(R(j))]
IH: equiv(frame@pred(R(j)))
----------------------------------------
0: <frame@pred(R(j)),
<of_bool(exec@pred(R(j)) && cond@R(j)),
if (exec@pred(R(j)) && cond@R(j)) then ok>>


Case where t = R(j): We start by expanding the macros and splitting the pairs.

fa !<_,_>. [> Line 181: (fa !pair(_,_))
[goal> Focused goal (1/3):
Systems: left:BasicHash/left, right:BasicHash/right (same for equivalences)
Variables: j:index
H: [happens(R(j))]
IH: equiv(frame@pred(R(j)))
----------------------------------------
0: frame@pred(R(j))
1: exec@pred(R(j)) && cond@R(j)


rewrite /cond (wa_R (R(j)) H). [> Line 186: (rewrite ... ...)
[goal> Focused goal (1/3):
Systems: left:BasicHash/left, right:BasicHash/right (same for equivalences)
Variables: j:index
H: [happens(R(j))]
IH: equiv(frame@pred(R(j)))
----------------------------------------
0: frame@pred(R(j))
1: exec@pred(R(j)) &&
exists (i,k:index),
T(i,k) < R(j) &&
fst(output@T(i,k)) = fst(input@R(j)) &&
snd(output@T(i,k)) = snd(input@R(j))


Using the authentication goal wa_R previously proved, we replace the formula cond@R(j) by an equivalent formula expressing the fact that a tag T(i,k) has played before and that the output of this tag is the message inputted by the reader.

by fadup 1. [> Line 191: by (fadup 1)
[goal> Focused goal (1/2):
Systems: left:BasicHash/left, right:BasicHash/right (same for equivalences)
Variables: j:index
H: [happens(R1(j))]
IH: equiv(frame@pred(R1(j)))
----------------------------------------
0: frame@R1(j)


We are now able to remove this formula from the frame because the attacker is able to compute it using information obtained in the past. Indeed, each element of this formula is already available in frame@pred(R(j)). This is done by the fadup tactic.

+ expand frame, exec, output. [> Line 195: (expand frame, exec, output)
[goal> Focused goal (1/2):
Systems: left:BasicHash/left, right:BasicHash/right (same for equivalences)
Variables: j:index
H: [happens(R1(j))]
IH: equiv(frame@pred(R1(j)))
----------------------------------------
0: <frame@pred(R1(j)),
<of_bool(exec@pred(R1(j)) && cond@R1(j)),
if (exec@pred(R1(j)) && cond@R1(j)) then ko>>


Case where t = R1(j):
This case is similar to the previous one.

fa !<_,_>. [> Line 195: (fa !pair(_,_))
[goal> Focused goal (1/2):
Systems: left:BasicHash/left, right:BasicHash/right (same for equivalences)
Variables: j:index
H: [happens(R1(j))]
IH: equiv(frame@pred(R1(j)))
----------------------------------------
0: frame@pred(R1(j))
1: exec@pred(R1(j)) && cond@R1(j)



rewrite /cond (wa_R (R1(j)) H).
[> Line 196: (rewrite ... ...)
[goal> Focused goal (1/2):
Systems: left:BasicHash/left, right:BasicHash/right (same for equivalences)
Variables: j:index
H: [happens(R1(j))]
IH: equiv(frame@pred(R1(j)))
----------------------------------------
0: frame@pred(R1(j))
1: exec@pred(R1(j)) &&
not(exists (i,k:index),
T(i,k) < R1(j) &&
fst(output@T(i,k)) = fst(input@R1(j)) &&
snd(output@T(i,k)) = snd(input@R1(j)))



by fadup 1.
[> Line 197: by (fadup 1)
[goal> Focused goal (1/1):
Systems: left:BasicHash/left, right:BasicHash/right (same for equivalences)
Variables: i,k:index
H: [happens(T(i,k))]
IH: equiv(frame@pred(T(i,k)))
----------------------------------------
0: frame@T(i,k)


+ expand frame, exec, cond, output. [> Line 201: (expand frame, exec, cond, output)
[goal> Focused goal (1/1):
Systems: left:BasicHash/left, right:BasicHash/right (same for equivalences)
Variables: i,k:index
H: [happens(T(i,k))]
IH: equiv(frame@pred(T(i,k)))
----------------------------------------
0: <frame@pred(T(i,k)),
<of_bool(exec@pred(T(i,k)) && true),
if (exec@pred(T(i,k)) && true) then
<nT(i,k),h(nT(i,k),diff(key(i), key'(i,k)))>>>


Case where t = T(i,k):
We start by expanding the macros and splitting the pairs.


fa !<_,_>, if _ then _, <_,_>.
[> Line 202: (fa !pair(_,_) if _ then _ else zero pair(_,_))
[goal> Focused goal (1/1):
Systems: left:BasicHash/left, right:BasicHash/right (same for equivalences)
Variables: i,k:index
H: [happens(T(i,k))]
IH: equiv(frame@pred(T(i,k)))
----------------------------------------
0: frame@pred(T(i,k))
1: nT(i,k)
2: h(nT(i,k),diff(key(i), key'(i,k)))


prf 2. [> Line 208: (prf 2)
[goal> Focused goal (1/1):
Systems: left:BasicHash/left, right:BasicHash/right (same for equivalences)
Variables: i,k:index
H: [happens(T(i,k))]
IH: equiv(frame@pred(T(i,k)))
----------------------------------------
0: frame@pred(T(i,k))
1: nT(i,k)
2: if (true &&
diff(
forall (j,i0:index),
R(j) < T(i,k) => i = i0 => nT(i,k) <> fst(input@R(j)),
forall (j,i0,k0:index),
R(j) < T(i,k) => i = i0 && k = k0 => nT(i,k) <> fst(input@R(j))) &&
diff(
(forall (j,i0:index),
R1(j) < T(i,k) => i = i0 => nT(i,k) <> fst(input@R1(j))) &&
forall (i0,k0:index),
T(i0,k0) < T(i,k) => i = i0 => nT(i,k) <> nT(i0,k0),
(forall (j,i0,k0:index),
R1(j) < T(i,k) => i = i0 && k = k0 => nT(i,k) <> fst(input@R1(j))) &&
forall (i0,k0:index),
T(i0,k0) < T(i,k) => i = i0 && k = k0 => nT(i,k) <> nT(i0,k0)))
then n_PRF
else h(nT(i,k),diff(key(i), key'(i,k)))


We now apply the prf tactic, in order to replace the hash by a fresh name. The tactic actually replaces the hash by a conditional term in which the then branch is the fresh name. The goal is now to prove that this condition always evaluates to true.

rewrite if_true. [> Line 208: (rewrite ...)
[goal> Focused goal (1/2):
System: left:BasicHash/left, right:BasicHash/right (same for equivalences)
Variables: i,k:index
H: [happens(T(i,k))]
IH: equiv(frame@pred(T(i,k)))
----------------------------------------
true &&
diff(
forall (j,i0:index), R(j) < T(i,k) => i = i0 => nT(i,k) <> fst(input@R(j)),
forall (j,i0,k0:index),
R(j) < T(i,k) => i = i0 && k = k0 => nT(i,k) <> fst(input@R(j))) &&
diff(
(forall (j,i0:index),
R1(j) < T(i,k) => i = i0 => nT(i,k) <> fst(input@R1(j))) &&
forall (i0,k0:index), T(i0,k0) < T(i,k) => i = i0 => nT(i,k) <> nT(i0,k0),
(forall (j,i0,k0:index),
R1(j) < T(i,k) => i = i0 && k = k0 => nT(i,k) <> fst(input@R1(j))) &&
forall (i0,k0:index),
T(i0,k0) < T(i,k) => i = i0 && k = k0 => nT(i,k) <> nT(i0,k0))

{
split; 1: true.
[> Line 209: (split; 1: true)
[goal> Focused goal (1/2):
System: left:BasicHash/left, right:BasicHash/right (same for equivalences)
Variables: i,k:index
H: [happens(T(i,k))]
IH: equiv(frame@pred(T(i,k)))
----------------------------------------
diff(
forall (j,i0:index), R(j) < T(i,k) => i = i0 => nT(i,k) <> fst(input@R(j)),
forall (j,i0,k0:index),
R(j) < T(i,k) => i = i0 && k = k0 => nT(i,k) <> fst(input@R(j))) &&
diff(
(forall (j,i0:index),
R1(j) < T(i,k) => i = i0 => nT(i,k) <> fst(input@R1(j))) &&
forall (i0,k0:index), T(i0,k0) < T(i,k) => i = i0 => nT(i,k) <> nT(i0,k0),
(forall (j,i0,k0:index),
R1(j) < T(i,k) => i = i0 && k = k0 => nT(i,k) <> fst(input@R1(j))) &&
forall (i0,k0:index),
T(i0,k0) < T(i,k) => i = i0 && k = k0 => nT(i,k) <> nT(i0,k0))

project; repeat split; intro *; by fresh Meq. [> Line 224: (project;((repeat split);((intro *);by (fresh Meq))))
[goal> Focused goal (1/1):
Systems: left:BasicHash/left, right:BasicHash/right (same for equivalences)
Variables: i,k:index
H: [happens(T(i,k))]
IH: equiv(frame@pred(T(i,k)))
----------------------------------------
0: frame@pred(T(i,k))
1: nT(i,k)
2: n_PRF


Several conjuncts must now be proved, the same tactic can be used on all of them. Here are representative cases:

  • In one case, nT(i,k) cannot occur in input@R(j) because R(j) < T(i,k).
  • In another case, nT(i,k) = nT(i0,k0) implies that i=i0 and k=k0, contradicting T(i0,k0)<T(i,k).

In both cases, the reasoning is performed by the fresh tactic on the message equality hypothesis Meq whose negation must initially be proved. To be able to use (split and) fresh, we first project the goal into into one goal for the left projection and one goal for the right projection of the initial bi-system.


}.
[> Line 225: ??
[goal> Focused goal (1/1):
Systems: left:BasicHash/left, right:BasicHash/right (same for equivalences)
Variables: i,k:index
H: [happens(T(i,k))]
IH: equiv(frame@pred(T(i,k)))
----------------------------------------
0: frame@pred(T(i,k))
1: nT(i,k)
2: n_PRF


fresh 2. [> Line 230: (fresh 2)
[goal> Focused goal (1/1):
Systems: left:BasicHash/left, right:BasicHash/right (same for equivalences)
Variables: i,k:index
H: [happens(T(i,k))]
IH: equiv(frame@pred(T(i,k)))
----------------------------------------
0: frame@pred(T(i,k))
1: nT(i,k)


We have now replaced the hash by a fresh name occurring nowhere else, so we can remove it using the fresh tactic.

fresh 1. [> Line 233: (fresh 1)
[goal> Focused goal (1/1):
Systems: left:BasicHash/left, right:BasicHash/right (same for equivalences)
Variables: i,k:index
H: [happens(T(i,k))]
IH: equiv(frame@pred(T(i,k)))
----------------------------------------
0: frame@pred(T(i,k))
1: if (forall (i0,k0:index), T(i0,k0) < T(i,k) => i0 <> i || k0 <> k) then
zero
else nT(i,k)


We can also remove the name nT(i,k), and conclude by induction hypothesis.


by rewrite if_true.
[> Line 234: by (rewrite ...)
[goal> Goal unlinkability is proved

Qed.
Exiting proof mode.


Press the left and right arrows to do and undo an instruction.

Alternatively, you can double-click on an instruction.

This zone shows a Squirrel file. You can double-click on a comment to collapse it for better readabilility.

This zone shows the output given by Squirrel.

This zone shows the output of the previous instruction, to help identifying the change caused by the instruction.

Previously: