-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPUF_strong_mutual_noisy.spthy
281 lines (245 loc) · 7.93 KB
/
PUF_strong_mutual_noisy.spthy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
/******************************************************************************
* Mutual authentication based on stong PUFs and hashes - with noise
* It also models erasable PUFs (for the last lemma uncomment the restriction
* that enables erasable PUFs)
*
* check with:
* tamarin-prover --prove PUF_strong_mutual_noisy.spthy
******************************************************************************/
theory PUF_strong_mutual_noisy
begin
// PUF modelling functions are private
functions: spuf/2 [private], spufn/3 [private], gen/1, rep/2
builtins: hashing
// equational theory for removing noise
equations: rep( spufn(D,c,n) , gen( spuf(D,c)) ) = spuf(D,c)
/*
* Strong PUF model
*
* This version models "noise" with a gen() function producing the helper
* that is used to recover the correct puf(D) value
*/
rule PUFnoise:
[ PUFin(D,c), Fr(~n) ] --[ PUF(D,c) ]-> [ PUFout(D, c, spufn(D,c,~n)) ]
rule CRPnoise:
[ CRPin(A,D), Fr(~c) ] --[ CRP(A,D,~c) ]-> [ !CRPout(A,D,~c,spuf(D,~c)) ]
rule BreakPUFnoise:
[ In(<D,c>), Fr(~n) ] --[ BreakPUF(D,c) ]-> [ Out(spufn(D,c,~n)) ]
rule RevealCRPnoise:
[ !CRPout(A,D,c,p) ] --[ RevealCRP(A,D,c) ]-> [ Out(<c,p>) ]
// new rule for noisy PUFs
rule BreakGen:
[ In(gen(spuf(D,c))) ] --[ BreakGen(D,c) ]-> [ Out(spuf(D,c)) ]
rule Modelling:
[ In(<D,c,spufn(D,c1,n1)>), Fr(~n) ] --[ Model(D) ]-> [ Out(spufn(D,c,~n)) ]
/*
* Basic hash-based device mutual authentication.
* For strong agreement it is necessary that $A is included in the hash.
* Either we put m and n together in message 2 and just m in message 3:
* A -> D: c,r ( r is the helper used to compute puf by D )
* D -> A: m,h(A,spuf(D,c),m)
* A -> D: h(spuf(D,c),m)
*/
rule BuildWeakCRPs:
[ ] --> [ CRPin($A,$D) ] // builds CRPs for Server-Device pairs
rule Alice0:
[ ] --> [ Alice0($A) ]
rule Alice1:
[ Alice0(A),!CRPout(A,D,c,r) ]
// --[ Run(A,D,<'AstartD',~n,~n>) ]-> // used to look for minimal attacks
--[ Start(A,D,c) ]->
[ Out(<A,D,c,gen(r)>), Alice2(A,D,c,r) ] // gen(r) is sent together with n
rule Alice2:
[ Alice2(A,D,c,r), In(<D,A,m,h(A,r,m)>) ]
--[ Run(A,D,<'AtoD',c,m>), Commit(A,D,<'DtoA',c,m>) ]->
[ Out(<A,D,h(r,m)>) ]
rule Don0:
[ ] --> [ Don0($D) ]
rule Don1:
[ Don0(D),In(<A,D,c,r>), Fr(~m) ] // r is helper value
--[ Run(D,A,<'DtoA',c,~m>) ]->
[ PUFin(D,c), Don2(D,A,c,~m,r) ] // r is passed to next state
rule Don2:
[ Don2(D,A,c,m,r), PUFout(D,c,y) ] -->
[ Out(<D,A,m,h(A,rep(y,r),m)>), Don3(D,A,rep(y,r),c,m) ] // r is used to remove noise
rule Don3:
[ Don3(D,A,y,n,m), In(<A,D,h(y,m)>) ]
--[ Commit(D,A,<'AtoD',n,m>) ]->
[ ]
// ======================================
/*
* Initialization is before deployment
*/
restriction resCRPbeforePUF:
"All A D c1 c2 #i #j. CRP(A,D,c1)@i & PUF(D,c2)@j ==> i < j"
/*
* CRPs are not reused
*/
restriction resCRPnotReuse:
"All A D x #i #j. Run(A,D,x)@i & Run(A,D,x)@j & (Ex c r. x = <'AtoD',c,r>) ==> #i = #j"
/*
* sanity check: the protocol can commit in both directions
*/
lemma Sanity:
exists-trace
"
Ex A D c r #i. Commit(A,D,<'DtoA',c,r>)@i
&
Ex A D c r #i. Commit(A,D,<'AtoD',c,r>)@i
&
not (Ex A D c #k. RevealCRP(A,D,c)@k)
&
not (Ex D c #k. BreakPUF(D,c)@k)
&
not (Ex D #k. Model(D)@k)"
/*
* Helper lemma stating that Modeling requires another attack to
* intercept one PUF value. This is similar to the Secrecy_A
* property below. Interestingly, without this lemma next proofs
* do not converge.
*/
lemma modelPUF [use_induction, reuse]:
"All D #t. Model(D)@t ==>
(Ex c2 A #j.RevealCRP(A,D,c2)@j & j<t ) // CRP for D is revealed by one server
|
(Ex c #j.BreakPUF(D,c)@j & j<t) // PUF for D is broken
|
(Ex c #j.BreakGen(D,c)@j & j<t)
"
/*
* Property: Secrecy of PUF with respect to A
* with A = {BreakPUF(D,c), RevealCRP(a,D,c), BreakGen(D,c)}
*
* Intuition:
* puf values are only leaked if some CRP is explicity revealed or
* if puf has been broken.
*
* Note: Modelling is not possible without at least one PUF value. This
* is why we quantify over all possibles c's
*
* We prove it in two steps:
*/
lemma LemmaSecrecy_A [use_induction, reuse]:
"All D p n c #t. K(p)@t & p = spufn(D,c,n) ==>
(Ex c2 A #j.RevealCRP(A,D,c2)@j & j<t ) // CRP for D is revealed by one server
|
(Ex c #j.BreakPUF(D,c)@j & j<t) // PUF for D is broken
|
(Ex c #j.BreakGen(D,c)@j & j<t)
"
lemma Secrecy_A [use_induction, reuse]:
"All D p c #t. K(p)@t & p = spuf(D,c) ==>
(Ex c2 A #j.RevealCRP(A,D,c2)@j & j<t ) // CRP for D is revealed by one server
|
(Ex c #j.BreakPUF(D,c)@j & j<t) // PUF for D is broken
|
(Ex c #j.BreakGen(D,c)@j & j<t)
"
/*
* The following property is the same that we checked for weak PUFs!
* We use A = {BreakPUF(D,c), RevealCRP(a,D,c), BreakGen(D,c)} as for secrecy.
*/
lemma MutualAuthentication_A:
"All B C x #i. Commit(B,C,x)@i ==>
(
(Ex #j. Run(C,B,x)@j
& j<i
& not (Ex E G #k. Commit(E,G,x) @k & not (#k = #i)))
| (
(Ex n m. x = <'DtoA',n,m>) & // C is the Device
(
(Ex G c #r. RevealCRP(G,C,c)@r & r<i) // Need generic G if we don't add Model
|
(Ex c #r. BreakPUF(C,c)@r & r<i)
|
(Ex c #j.BreakGen(C,c)@j & j<i)
)
)
| (
(Ex n m. x = <'AtoD',n,m>) & // B is the device
(
(Ex E c #r. RevealCRP(E,B,c)@r & r<i) // It is enough that one party E that registered B reveals the CRP
|
(Ex c #r. BreakPUF(B,c)@r & r<i)
|
(Ex c #j.BreakGen(B,c)@j & j<i)
)
)
)
"
/*
* This is the stronger refined property
*
* it holds for sets
* A1 = {BreakPUF(D,c), RevealCRP(a,D,c), BreakGen(D,c)}
* A2 = {BreakPUF(D,X), RevealCRP(a,D,X), BreakGen(D,c)}
*/
lemma MutualAutentication_A1_A2:
"All B C x y c m #t. Commit(B,C,x)@t & x = <y,c,m > ==>
(
(Ex #j. Run(C,B,x)@j & j<t
& not (Ex E F #k. Commit(E,F,x) @k & not (#k = #t)))
|
(
y = 'DtoA' & // C is the Device
(
(
(Ex #r. Model(C)@r & r<t) &
(
(Ex E c2 #r. RevealCRP(E,C,c2)@r & r<t ) // It is enough that one party E that registered B reveals the CRP
|
(Ex c2 #r. BreakPUF(C,c2)@r & r<t )
|
(Ex c2 #r. BreakGen(C,c2)@r & r<t )
)
)
|
(Ex #r. RevealCRP(B,C,c)@r & r<t) // It is necessary that B revels its CRP!!!
|
(Ex #k #w. w<k & k<t & Start(B,C,c)@w & BreakPUF(C,c)@k )
|
(Ex #k #w. w<k & k<t & Start(B,C,c)@w & BreakGen(C,c)@k )
)
)
|
(
y = 'AtoD' & // B is the device
(
(
(Ex #r. Model(B)@r & r<t) &
(
(Ex E c2 #r. RevealCRP(E,B,c2)@r & r<t ) // It is enough that one party E that registered B reveals the CRP
|
(Ex c2 #r. BreakPUF(B,c2)@r & r<t )
|
(Ex c2 #r.BreakGen(B,c2)@r & r<t )
)
)
|
(Ex E #r. RevealCRP(E,B,c)@r & r<t) // It is enough that one party E that registered B reveals the CRP
|
(Ex #r. BreakPUF(B,c)@r & r<t)
|
(Ex #r.BreakGen(B,c)@r & r<t)
)
)
)
"
/*
* The following restriction implements an "erasable PUF", i.e.,
* a PUF that never generates the same value twice
*/
restriction erasablePUF:
"All D c #i #j. PUF(D,c)@i & PUF(D,c)@j ==> #i = #j"
/*
* The following property holds for erasable PUF (see above)
* When a PUF is erasable we can prove that a device will never
* commit twice on the same challenge, preventing the
* possibility of CRP reuse by the attacker
*/
lemma NoChallengeReuseErasable:
"All B C c1 c2 r1 r2 x1 x2 #i1 #i2 .
Commit(B,C,x1)@i1 & Commit(B,C,x2)@i2 & not(#i1=#i2)
& x1 = <'AtoD', c1, r1> & x2 = <'AtoD', c2, r2>
==> not (c1=c2)"
end