-
Notifications
You must be signed in to change notification settings - Fork 1
/
mls-04a.spthy
192 lines (168 loc) · 3.91 KB
/
mls-04a.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
theory MLS04
begin
builtins: hashing, signing, asymmetric-encryption
// MAC
functions: mac/2
// PKI Provisioning
rule RegisterPK:
[ Fr(~ltk) ]
-->
[
!Ltk($A, ~ltk),
!Pk($A, pk(~ltk)),
Out(pk(~ltk))
]
rule RevealLTK:
[ !Ltk(A, ltk) ]
--[ LtkReveal(A) ]->
[ Out(ltk) ]
// Client logic
rule ClientInit:
let
gx = pk(~x)
pkC = pk(ltkC)
sig = sign(<gx, C, pkC>, ltkC)
uik = <gx, C, pkC, sig>
in
[
!Ltk(C, ltkC),
Fr(~x)
]
--[ ClientPostedInitKey(C, gx) ]->
[
ClientWait(C, ~x, ltkC),
Out(uik)
]
rule ClientFinish:
let
gx = pk(x)
pkC = pk(ltkC)
// welcomeInfo = <gy, k, S, pkS>
welcomeInfo = adec(welcome, x)
gy = fst(welcomeInfo)
k = fst(snd(welcomeInfo))
S = fst(snd(snd(welcomeInfo)))
pkS = snd(snd(snd(welcomeInfo)))
// add = <'add', gx, C, pkC, sig>
addTag = fst(add)
gxIn = fst(snd(add))
CIn = fst(snd(snd(add)))
pkCIn = fst(snd(snd(snd(add))))
macData = add
state = <C, S, pkC, pkS, gx, gy>
confirmKey = mac(k, state)
macValVer = mac(confirmKey, macData)
in
[
ClientWait(C, x, ltkC),
!Pk(S, pkS),
In(<welcome, add, addMAC, addSig>)
]
--[ Neq(gx, gy),
Eq(addTag, 'add'),
Eq(gxIn, gx),
Eq(CIn, C),
Eq(pkCIn, pkC),
Eq(verify(addSig, <add, addMAC>, pkS), true),
Eq(macValVer, addMAC),
ClientDone(C, S, gx, gy, k) ]->
[]
// Server logic
rule ServerInit:
let
uik = <gx, C, pkC, sig>
gy = pk(~y)
pkS = pk(ltkS)
welcomeInfo = <gy, ~k, S, pkS>
welcome = aenc(welcomeInfo, gx)
add = <'add', uik>
macData = add
state = <C, S, pkC, pkS, gx, gy>
confirmKey = mac(~k, state)
addMAC = mac(confirmKey, macData)
sigData = <add, addMAC>
addSig = sign(sigData, ltkS)
in
[
In(<gx, C, sig>),
!Pk(C, pkC),
!Ltk(S, ltkS),
Fr(~y),
Fr(~k)
]
--[ Eq(verify(sig, <gx, C, pkC>, pkC), true),
ServerDone(S, C, gx, gy, ~k) ]->
[
Out(<welcome, add, addSig, addMAC>)
]
// Restrictions
restriction Equality:
"All x y #i. Eq(x,y) @i ==> x = y"
restriction Inequality:
"All x y #i. Neq(x,y) @i ==> not(x = y)"
// Functionality test
lemma HonestServerTrace:
exists-trace
"
Ex C S gx gy k #j.
ServerDone(S, C, gx, gy, k) @ #j
& not(Ex A #k. LtkReveal(A) @ #k)
"
lemma HonestTrace:
exists-trace
"
Ex C S gx gy k #i #j.
ClientDone(C, S, gx, gy, k) @ #i
& ServerDone(S, C, gx, gy, k) @ #j
& not(Ex A #k. LtkReveal(A) @ #k)
"
// If a client has established a session key,
// ... then the server has the same key,
// ... and it is not known to the attacker
// ... unless one of the long-term keys was compromised
lemma KeySecrecy:
"
not(Ex C S gx gy k #i #j #k.
ClientDone(C, S, gx, gy, k) @ #i
& ServerDone(S, C, gx, gy, k) @ #j
& K(k) @ #k
& not(Ex #rc. LtkReveal(C) @ #rc)
& not(Ex #rs. LtkReveal(S) @ #rs)
)
"
// If a client has established a session key
// ... then it's based on a response from a server
lemma ServerLiveness:
"
All C S gx gy k #i.
ClientDone(C, S, gx, gy, k) @ #i
==> ( (Ex #j. (ServerDone(S, C, gx, gy, k) @ #j) & (#j < #i))
| (Ex #rc. LtkReveal(C) @ #rc)
| (Ex #rs. LtkReveal(S) @ #rs)
)
"
// If a server has established a session key
// ... then it's based on a client's init key
lemma ClientLiveness:
"
All C S gx gy k #i.
ServerDone(S, C, gx, gy, k) @ #i
==> ( (Ex #j. (ClientPostedInitKey(C, gx) @ #j) & (#j < #i))
| (Ex #rc. LtkReveal(C) @ #rc)
| (Ex #rs. LtkReveal(S) @ #rs)
)
"
// ... injective agreement
lemma InjectiveAgreement:
"
All C S gx gy k #i.
ServerDone(S, C, gx, gy, k) @ #i
==> ( not(Ex C2 S2 gx2 gy2 #i2.
ServerDone(S2, C2, gx2, gy2, k) @ #i2
& not(#i2 = #i)
)
| (Ex #rc. LtkReveal(C) @ #rc)
| (Ex #rs. LtkReveal(S) @ #rs)
)
"
end