Skip to content

Commit f174a6b

Browse files
committed
adds explanation provided on HotCRP to artifact
1 parent 2b87eac commit f174a6b

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

dh/implementation/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ This allows us to treat outgoing messages as being untainted from a taint analys
1010
For this purpose, `library/io.go` provides a function `PerformVirtualOutputOperation` that enforces (via its specification) that a caller gives up an I/O permission for sending a message.
1111
Thus, we configure the taint analysis (in `../argot-proofs/argot-config-dh.yaml`) to treat this function as a sanitizer, i.e., that this returns untainted data.
1212

13+
Protocol steps in the Core are easy to locate as each step requires justification by the I/O specification. I.e., `unfold io.P_Alice(...)` (`unfold iospec.P_Agent(...)` in the SSM Agent case study) applies the I/O specification to obtain the I/O permission for the subsequent operation such as sending or receiving a message or performing an internal operation. These internal operations directly correspond to a transition in the Tamarin model.
14+
15+
`dh/implementation/initiator/initiator.go` provides detailed comments explaining the application of the I/O specification for the `ProduceHsMsg1` method in the DH case study.
16+
1317

1418
## Building & Running the Initiator Role
1519
Build:

dh/implementation/initiator/initiator.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,14 @@ func (i *Initiator) ProduceHsMsg1() (msg []byte, success bool) {
173173
//@ t0, ridT, s0 := i.token, i.rid, i.absState
174174

175175
// create x
176+
// ----------
177+
// Generate DH secret key by invoking the random number generator.
178+
// In the model, this adds a fresh fact to the abstract state.
176179
//@ unfold io.P_Alice(t0, ridT, s0)
177180
//@ unfold io.phiRF_Alice_5(t0, ridT, s0)
178181
//@ assert acc(io.e_FrFact(t0, ridT))
179182
//@ i.xT = io.get_e_FrFact_r1(t0, ridT)
183+
// ----------
180184
//@ ghost var t1 pl.Place
181185
var err error
182186
i.x, err /*@, t1 @*/ = i.l.CreateNonce( /*@ t0, ridT @*/ )
@@ -200,6 +204,12 @@ func (i *Initiator) ProduceHsMsg1() (msg []byte, success bool) {
200204
return
201205
}
202206

207+
// ----------
208+
// Perform Alice's first internal operation to justify the first protocol message.
209+
// This corresponds to applying the first transition (`dh/model/protocol-model.spthy` L56-61)
210+
// in Alice's protocol model, which adds an out fact to the abstract state (note the close
211+
// correspondence between the multisets occurring in the implementation (L208f, L210, L211f)
212+
// and the transition in the abstract model).
203213
//@ unfold io.P_Alice(t1, ridT, s1)
204214
//@ unfold io.phiR_Alice_0(t1, ridT, s1)
205215
//@ idAT := tm.integer32(i.idA)
@@ -214,6 +224,7 @@ func (i *Initiator) ProduceHsMsg1() (msg []byte, success bool) {
214224
//@ assert io.e_Alice_send(t1, ridT, idAT, idBT, i.skAT, i.skBT, i.xT, l, a, r)
215225
//@ t2 := io.internBIO_e_Alice_send(t1, ridT, idAT, idBT, i.skAT, i.skBT, i.xT, l, a, r)
216226
//@ s2 := ft.U(l, r, s1)
227+
// ----------
217228

218229
msg1 := &Msg1{X: i.X}
219230
//@ fold acc(msg1.Mem(), 1/8)
@@ -228,12 +239,23 @@ func (i *Initiator) ProduceHsMsg1() (msg []byte, success bool) {
228239
return
229240
}
230241

242+
// ----------
243+
// Exchange out fact in the abstract state for a permission to send the
244+
// corresponding message. Instead of directly sending this message to the
245+
// network, we invoke `PerformVirtualOutputOperation`` that sanitizes this
246+
// message by consuming the permission for sending this message (because we
247+
// are allowed to send it). I.e., this message can afterwards be returned
248+
// to the App that then sends it. Sending this message in the App does not
249+
// violate I/O independence despite depending on protocol secrets (the
250+
// message contains the DH half key g^x where x is a protocol secret)
251+
// because the Core sanitized the message.
231252
//@ unfold io.P_Alice(t2, ridT, s2)
232253
//@ unfold io.phiRG_Alice_4(t2, ridT, s2)
233254
//@ assert io.e_OutFact(t2, ridT, XT)
234255
//@ ghost var t3 pl.Place
235256
msg /*@, t3 @*/ = PerformVirtualOutputOperation(msg /*@, t2, ridT, XT @*/)
236257
//@ s3 := s2 setminus mset[ft.Fact]{ ft.OutFact_Alice(ridT, XT) }
258+
// ----------
237259
//@ fold ProducedHsMsg1Pred(ridT, i.idA, i.idB, i.skAT, i.skBT, i.xT, s3)
238260
i.initiatorState = ProducedHsMsg1
239261
//@ i.token = t3

0 commit comments

Comments
 (0)