Skip to content
Draft
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
181 commits
Select commit Hold shift + click to select a range
d606c27
Add MWE for proving SIF
henriman Nov 26, 2024
f5603b6
Add MWE2
henriman Dec 9, 2024
9328a95
Address PR feedback
henriman Dec 17, 2024
df0fed8
Fix package names and remove state.lastMsg3
henriman Dec 17, 2024
973541b
Merge branch 'master' into master
jcp19 Dec 19, 2024
8acf6c4
Merge branch 'master' into master
jcp19 Jan 13, 2025
05df206
Extend io-spec with declassification spec
henriman Jan 20, 2025
389235f
Fix declassification spec
henriman Jan 20, 2025
1831b53
Fix adding decl to dp3s_iospec_ordered
henriman Jan 20, 2025
094d917
Start implementing IOD spec
henriman Jan 22, 2025
0e6eff1
Start implementing classification spec
henriman Jan 22, 2025
85d1d0a
Merge remote-tracking branch 'base/master' into sif
henriman Jan 22, 2025
f7db996
Merge branch 'sif' into sif-io-spec
henriman Jan 22, 2025
b0795a9
Mostly finished implementing security policy
henriman Jan 29, 2025
2e41d12
Verify private/topology/underlay
henriman Jan 29, 2025
82a3239
Finish implementing security policy
henriman Jan 30, 2025
e5d6e3d
Merge branch 'sif-io-spec' into sif-private-topology-underlay
henriman Feb 1, 2025
9620262
Add additional annotations to private/topology/underlay
henriman Feb 1, 2025
4f88e97
Add minimum annotations to verify private/topology
henriman Feb 1, 2025
c8b7b5c
Add appropriate postconditions to private/topology
henriman Feb 1, 2025
799cd4d
Add `low` precondition to `fmt.Sprintf`
henriman Feb 1, 2025
2380d49
Merge branch 'sif-private-topology-underlay' into sif-private-topology
henriman Feb 1, 2025
9863f30
Add assumption due to Gobra issue #835
henriman Feb 1, 2025
ccd088c
Add minimum annotations to pkg/addr
henriman Feb 2, 2025
9e1a702
Remove MWEs here
henriman Feb 2, 2025
d72140a
Merge branch 'sif' into sif-io-spec
henriman Feb 2, 2025
1280d92
Merge branch 'sif-io-spec' into sif-private-topology-underlay
henriman Feb 2, 2025
12c655e
Merge branch 'sif-private-topology-underlay' into sif-private-topology
henriman Feb 2, 2025
e8ca70a
Merge branch 'sif-private-topology' into sif-pkg-addr
henriman Feb 2, 2025
5728d9e
Clean up and minor fixes and improvements
henriman Feb 2, 2025
69f6de4
Add additional postconditions to pkg/addr/fmt.go
henriman Feb 4, 2025
41c38db
Change sensitivity requirements of mt.Sprintf and serrors.New
henriman Feb 11, 2025
9e03a1a
Merge branch 'sif-private-topology-underlay' into sif-private-topology
henriman Feb 11, 2025
3eda2f0
Change pkg/slayers/doc.go to prevent parsing error
henriman Feb 13, 2025
e9e9ef0
Merge branch 'sif' into sif-io-spec
henriman Feb 13, 2025
2e6d9d5
Merge branch 'sif-io-spec' into sif-private-topology-underlay
henriman Feb 13, 2025
75df8c6
Merge branch 'sif-private-topology-underlay' into sif-private-topology
henriman Feb 13, 2025
8283193
Introduce functions to express assumptions
henriman Feb 14, 2025
e1ea5e1
Merge branch 'sif-private-topology' into sif-pkg-addr
henriman Feb 14, 2025
576461f
Delete verification/scratch/mwe2/mwe2.gobra
jcp19 Feb 14, 2025
19627eb
Delete verification/scratch/mwe1/mwe1.gobra
jcp19 Feb 14, 2025
efd776c
Merge branch 'sif-io-spec' of https://github.com/henriman/VerifiedSCI…
henriman Feb 15, 2025
7d185ea
Improve style
henriman Feb 24, 2025
20e891c
Align pre- and postconditions
henriman Feb 24, 2025
4a7404b
Merge branch 'master' of https://github.com/viperproject/VerifiedSCIO…
henriman Feb 24, 2025
85f858f
Merge branch 'sif-io-spec' into sif-private-topology-underlay
henriman Feb 24, 2025
085f827
Adjust to sif.LowBytes
henriman Feb 24, 2025
6366aa7
Fix typo
henriman Feb 27, 2025
c91d9db
Merge branch 'sif-io-spec' into sif-private-topology-underlay
henriman Feb 27, 2025
3e12921
Merge branch 'sif-private-topology-underlay' into sif-private-topology
henriman Feb 27, 2025
ea50e39
Merge branch 'master' of https://github.com/viperproject/VerifiedSCIO…
henriman Mar 2, 2025
86b6484
Merge branch 'master' of https://github.com/viperproject/VerifiedSCIO…
henriman Mar 2, 2025
9743687
Merge branch 'master' of https://github.com/viperproject/VerifiedSCIO…
henriman Mar 2, 2025
005ed12
Verify private/underlay/conn
henriman Mar 3, 2025
8e17e27
Verify pkg/slayers/path/empty except for implementation proof
henriman Mar 5, 2025
a353468
Address PR feedback and clean up
henriman Mar 10, 2025
e2e8827
Declassify concrete instead of abstract MAC tag
henriman Mar 11, 2025
c94f229
Use `trusted` to suppress problems with closure implementation proof …
henriman Mar 11, 2025
d16b7c9
Verify pkg/slayers/path
henriman Mar 11, 2025
f0ced95
Verify pkg/slayers/path/onehop
henriman Mar 11, 2025
f63a7d6
Verify pkg/slayers/path/epic
henriman Mar 11, 2025
44a0b6d
Merge branch 'sif-private-topology' of https://github.com/henriman/Ve…
henriman Mar 13, 2025
01950a7
Fix typo
henriman Mar 13, 2025
6c3067e
Clean up
henriman Apr 10, 2025
9304eb3
Merge branch 'sif-io-spec' into sif-private-topology-underlay
henriman Apr 10, 2025
439ff54
Fix contract of `serrors.New`
henriman Apr 14, 2025
5772210
Merge branch 'sif-private-topology-underlay' into sif-private-topology
henriman Apr 14, 2025
1e0500b
Clean up
henriman Apr 14, 2025
29e7444
Rename `AssumeLowSliceToLowString` to `LowSliceImpliesLowString`
henriman Apr 14, 2025
1b4a07c
Merge branch 'sif-private-topology' into sif-pkg-addr
henriman Apr 14, 2025
890558a
Stop using `sif.LowBytes`
henriman Apr 14, 2025
a83dde0
Clean up
henriman Apr 14, 2025
0b6ec9c
Use abstract pure Boolean functions instead of `LowMem` etc.
henriman Apr 14, 2025
d5f94cb
Clean up
henriman Apr 14, 2025
ca4cf53
Fix contract of `TextUnmarshaler.UnmarshalText`
henriman Apr 14, 2025
56b6396
Merge branch 'sif-pkg-addr' into sif-private-underlay-conn
henriman Apr 19, 2025
32f8f6f
Address feedback
henriman Jun 18, 2025
6c50035
Address missed feedback
henriman Jun 18, 2025
ba47020
Merge branch 'master' of https://github.com/viperproject/VerifiedSCIO…
henriman Jun 26, 2025
17c535d
Merge branch 'sif-io-spec' into sif-private-topology-underlay
henriman Jun 26, 2025
3781fa0
Merge branch 'sif-private-topology-underlay' into sif-private-topology
henriman Jun 26, 2025
da722cb
Minor style adjustments
henriman Jun 26, 2025
33b9948
Merge branch 'sif-private-topology' into sif-pkg-addr
henriman Jun 26, 2025
79f7d31
Make verification/dependencies/net verify
henriman Jun 26, 2025
aa7fd1d
Merge branch 'sif-pkg-addr' into sif-pkg-addr-rework
henriman Jun 26, 2025
6edbb0c
Minor style adjustments
henriman Jun 26, 2025
910d03f
Merge branch 'sif-pkg-addr-rework' into sif-private-underlay-conn
henriman Jun 26, 2025
3b3762c
Explain need for longer names for `IsLow`
henriman Jul 1, 2025
a19e521
Replace Low predicates with abstract IsLow functions
henriman Jul 2, 2025
9acac01
Adjust annotations of serrors
henriman Jul 2, 2025
b89413f
Merge branch 'sif-private-topology-underlay' into sif-private-topology
henriman Jul 2, 2025
8f3c41c
Remove workaround for Gobra issue #835/#890
henriman Jul 2, 2025
9b3fada
Merge branch 'sif-private-topology' into sif-pkg-addr
henriman Jul 2, 2025
d6d212f
Adjust annotations for serrors
henriman Jul 2, 2025
a8b3c64
Remove unnecessary annotations
henriman Jul 2, 2025
2fd3750
Merge branch 'sif-pkg-addr' into sif-pkg-addr-rework
henriman Jul 2, 2025
10042fb
Merge branch 'sif-pkg-addr-rework' into sif-private-underlay-conn
henriman Jul 2, 2025
09da9b3
Fix sensitivity annotations of pointers
henriman Jul 2, 2025
43b4ab3
Clean up
henriman Jul 2, 2025
21aa6a9
Add some clarifications
henriman Jul 3, 2025
f51c894
Fix merge
henriman Jul 3, 2025
182a483
Clean up
henriman Jul 3, 2025
c799b92
Merge branch 'sif-pkg-slayers-path-empty' into sif-pkg-slayers-path
henriman Jul 3, 2025
23a050f
Clean up
henriman Jul 3, 2025
d9dfcf5
Merge branch 'sif-pkg-slayers-path' into sif-pkg-slayers-path-epic
henriman Jul 3, 2025
1d9a1d7
Rework sensitivity in interfaces
henriman Jul 5, 2025
5446132
Improve stability and make BatchConn match
henriman Jul 17, 2025
a05c2a0
"Introduce body" to `isZeros` and improve stability of `NewReadMessages`
henriman Jul 24, 2025
0a210ed
Avoid requiring input of `fmt.Sprintf` to be low
henriman Jul 25, 2025
eaed1c5
Merge branch 'master' of https://github.com/viperproject/VerifiedSCIO…
henriman Jul 30, 2025
8f933aa
Merge branch 'sif-io-spec' into sif-private-topology-underlay
henriman Jul 30, 2025
064c6eb
Merge branch 'sif-private-topology-underlay' into sif-private-topology
henriman Jul 30, 2025
9120830
Merge branch 'sif-private-topology' into sif-pkg-addr
henriman Jul 30, 2025
b509ded
Merge branch 'sif-private-topology' into sif-pkg-addr-rework
henriman Jul 30, 2025
24ace34
Merge branch 'sif-pkg-addr' into sif-private-underlay-conn
henriman Jul 30, 2025
feed939
Merge branch 'sif-private-underlay-conn' into sif-pkg-slayers-path-empty
henriman Jul 30, 2025
2c57016
Merge branch 'sif-private-underlay-conn' into sif-pkg-slayers-path
henriman Jul 30, 2025
4457ac8
Add comments
henriman Jul 30, 2025
2f96475
Clean up
henriman Jul 31, 2025
20a1b8f
Add //@ before assert
henriman Jul 31, 2025
2125136
Clean up
henriman Jul 31, 2025
b4084b5
Clean up
henriman Jul 31, 2025
aca63f2
Merge branch 'sif-pkg-addr' into sif-private-underlay-conn
henriman Jul 31, 2025
7bf7104
Clean up further and add notes (NOTE[henri])
henriman Aug 5, 2025
8f64df5
Address PR feedback
henriman Aug 5, 2025
d833312
Merge branch 'sif-pkg-addr' into sif-private-underlay-conn
henriman Aug 5, 2025
3520a56
Merge branch 'sif-private-underlay-conn' into sif-pkg-slayers-path-empty
henriman Aug 5, 2025
2b6f1bf
Merge branch 'sif-pkg-slayers-path-empty' into sif-pkg-slayers-path
henriman Aug 5, 2025
e475136
Minor adjustments
henriman Aug 5, 2025
424dbdb
Merge branch 'sif-pkg-slayers-path' into sif-pkg-slayers-path-epic
henriman Aug 5, 2025
e59f604
Clean up
henriman Aug 6, 2025
b8d8b82
Make pkg/slayers/path/empty verify again
henriman Aug 6, 2025
06a4907
Further clean up
henriman Aug 6, 2025
886fbe5
Add explicit contract to `TrimSuffix`
henriman Aug 6, 2025
315a653
Adapt pure annotations elsewhere
henriman Aug 6, 2025
d14eb1e
Adapt pure annotations that I missed
henriman Aug 6, 2025
ceacce8
Address PR feedback and add `&& low(i) ==>`
henriman Aug 12, 2025
8a3278f
Merge branch 'sif-private-topology-underlay' into sif-private-topology
henriman Aug 12, 2025
8dce993
Merge branch 'sif-private-topology' into sif-pkg-addr
henriman Aug 12, 2025
9686422
Make contract of `net.IP.To4` less implementation-specific
henriman Aug 12, 2025
e270180
Add `&& low(i) ==>` in quantified assertions where appropriate
henriman Aug 12, 2025
92a35f7
Clean up
henriman Aug 12, 2025
0003f81
Remove `&& low(i) ==>` from one assertion not dealing with sensitivity
henriman Aug 12, 2025
65aebc6
Merge branch 'sif-private-topology' into sif-pkg-addr
henriman Aug 12, 2025
09e4f2f
Remove occurrences of `&& low(i) ==>` added accidentally
henriman Aug 12, 2025
240fe92
Merge branch 'sif-pkg-addr' into sif-private-underlay-conn
henriman Aug 13, 2025
5ed0d5b
Address PR feedback
henriman Aug 13, 2025
2bd4ffd
Add `&& low(i) ==>`
henriman Aug 13, 2025
f24f0b3
Refer to Gobra issue #957 on NewReadMessages
henriman Aug 13, 2025
27f66a5
Remove assumption for Gobra issue 831
henriman Aug 18, 2025
714e7f7
Merge branch 'sif-private-topology' into sif-pkg-addr
henriman Aug 18, 2025
555f91a
Add TODO to IsLow regarding adding hyper
henriman Aug 18, 2025
000a7d9
Add TODO to IsLow regarding adding hyper
henriman Aug 18, 2025
b5f9d9c
Merge branch 'sif-pkg-addr' into sif-private-underlay-conn
henriman Aug 18, 2025
296be69
Add TODO regarding hyper to DataPlane as well
henriman Aug 18, 2025
94be47a
Merge branch 'sif-private-underlay-conn' into sif-pkg-slayers-path-empty
henriman Aug 18, 2025
f01b621
Merge branch 'sif-pkg-slayers-path-empty' into sif-pkg-slayers-path
henriman Aug 18, 2025
7bad729
Address PR feedback
henriman Aug 18, 2025
00c70ae
Merge branch 'sif-pkg-slayers-path' into sif-pkg-slayers-path-epic
henriman Aug 18, 2025
b53945a
Add TODO to IsLow regarding adding hyper
henriman Aug 18, 2025
acebe54
Merge branch 'sif-pkg-slayers-path-empty' into sif-pkg-slayers-path-o…
henriman Aug 18, 2025
5598aa7
Use abstract functions instead of predicate and clean up
henriman Aug 19, 2025
4d936ca
Merge pull request #1 from henriman/sif-private-topology-underlay
henriman Sep 19, 2025
c72c877
Align contract clauses
henriman Sep 19, 2025
7f5f579
Merge pull request #2 from henriman/sif-private-topology
henriman Sep 19, 2025
64814a8
Remove addressed NOTE[henri] comments
henriman Sep 19, 2025
d43f141
Merge pull request #5 from henriman/sif-pkg-addr
henriman Sep 19, 2025
c0ed125
Merge branch 'sif-io-spec' into sif-private-underlay-conn
henriman Sep 19, 2025
f93c449
Address PR feedback
henriman Sep 19, 2025
b807f2b
Remove `trusted` from `UDPConn.IsLow`
henriman Sep 20, 2025
3eab3a9
Fix comment on `NewReadMessages`
henriman Sep 20, 2025
15f776b
Merge pull request #6 from henriman/sif-private-underlay-conn
henriman Sep 20, 2025
392bb5a
Merge branch 'sif-io-spec' into sif-pkg-slayers-path-empty
henriman Sep 20, 2025
0f8b583
Merge pull request #7 from henriman/sif-pkg-slayers-path-empty
henriman Sep 20, 2025
e36e88d
Merge branch 'sif-io-spec' into sif-pkg-slayers-path
henriman Sep 20, 2025
cf5e90f
Merge pull request #8 from henriman/sif-pkg-slayers-path
henriman Sep 20, 2025
5377dd5
Merge branch 'sif-io-spec' into sif-pkg-slayers-path-epic
henriman Sep 20, 2025
7eaabb1
Merge pull request #9 from henriman/sif-pkg-slayers-path-epic
henriman Sep 20, 2025
355f924
Merge branch 'sif-io-spec' into sif-pkg-slayers-path-onehop
henriman Sep 23, 2025
bb19940
Clean up
henriman Sep 25, 2025
e22daf9
Merge pull request #12 from henriman/sif-pkg-slayers-path-onehop
henriman Oct 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions pkg/slayers/scion_spec.gobra
Original file line number Diff line number Diff line change
Expand Up @@ -412,20 +412,21 @@ requires acc(sl.Bytes(ub, 0, len(ub)), _)
decreases
func (s *SCION) EqAbsHeader(ub []byte) bool {
return unfolding acc(s.Mem(ub), _) in
let low := CmnHdrLen+s.AddrHdrLenSpecInternal() in
// SIF: rename due to conflict with low assertion
Comment thread
henriman marked this conversation as resolved.
Outdated
let low_ := CmnHdrLen+s.AddrHdrLenSpecInternal() in
let high := s.HdrLen*LineLen in
GetAddressOffset(ub) == low &&
GetAddressOffset(ub) == low_ &&
GetLength(ub) == int(high) &&
// Might be worth introducing EqAbsHeader as an interface method on Path
// to avoid doing these casts, especially when we add support for EPIC.
typeOf(s.Path) == (*scion.Raw) &&
unfolding acc(s.Path.Mem(ub[low:high]), _) in
unfolding acc(s.Path.Mem(ub[low_:high]), _) in
unfolding acc(sl.Bytes(ub, 0, len(ub)), _) in
let _ := Asserting(forall k int :: {&ub[low:high][k]} 0 <= k && k < high ==>
&ub[low:high][k] == &ub[low + k]) in
let _ := Asserting(forall k int :: {&ub[low:high][:scion.MetaLen][k]} 0 <= k && k < scion.MetaLen ==>
&ub[low:high][:scion.MetaLen][k] == &ub[low:high][k]) in
let metaHdr := scion.DecodedFrom(binary.BigEndian.Uint32(ub[low:high][:scion.MetaLen])) in
let _ := Asserting(forall k int :: {&ub[low_:high][k]} 0 <= k && k < high ==>
&ub[low_:high][k] == &ub[low_ + k]) in
let _ := Asserting(forall k int :: {&ub[low_:high][:scion.MetaLen][k]} 0 <= k && k < scion.MetaLen ==>
&ub[low_:high][:scion.MetaLen][k] == &ub[low_:high][k]) in
let metaHdr := scion.DecodedFrom(binary.BigEndian.Uint32(ub[low_:high][:scion.MetaLen])) in
let seg1 := int(metaHdr.SegLen[0]) in
let seg2 := int(metaHdr.SegLen[1]) in
let seg3 := int(metaHdr.SegLen[2]) in
Expand All @@ -442,10 +443,11 @@ requires acc(s.Mem(ub), _)
decreases
func (s *SCION) ValidScionInitSpec(ub []byte) bool {
return unfolding acc(s.Mem(ub), _) in
let low := CmnHdrLen+s.AddrHdrLenSpecInternal() in
// SIF: rename due to conflict with low assertion
Comment thread
henriman marked this conversation as resolved.
Outdated
let low_ := CmnHdrLen+s.AddrHdrLenSpecInternal() in
let high := s.HdrLen*LineLen in
typeOf(s.Path) == (*scion.Raw) &&
s.Path.(*scion.Raw).GetBase(ub[low:high]).WeaklyValid()
s.Path.(*scion.Raw).GetBase(ub[low_:high]).WeaklyValid()
}

// Checks if the common path header is valid in the serialized scion packet.
Expand Down
13 changes: 13 additions & 0 deletions router/dataplane.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,21 @@ type BatchConn interface {
// @ ensures err == nil ==>
// @ forall i int :: { &msgs[i] } 0 <= i && i < n ==>
// @ MsgToAbsVal(&msgs[i], ingressID) == old(MultiReadBioIO_val(place, n)[i])
// SIF: classification spec
// NOTE: The postcondition for recv specifies that received messages are low.
// TODO: I have decided to mark the abstraction as low for now.
// And also used MultiReadBioIOI_val instead of MsgToAbsVal to match what is
// used in permissions.
Comment thread
henriman marked this conversation as resolved.
Outdated
// @ ensures err == nil ==>
// @ forall i int :: { MutliReadBioIO_val(place, n)[i] } 0 <= i && i < n ==>
// @ low(old(MultiReadBioIO_val(place, n)[i]))
ReadBatch(msgs underlayconn.Messages /*@, ghost ingressID uint16, ghost prophecyM int, ghost place io.Place @*/) (n int, err error)
// @ requires acc(addr.Mem(), _)
// @ requires acc(Mem(), _)
// @ preserves acc(sl.Bytes(b, 0, len(b)), R10)
// @ ensures err == nil ==> 0 <= n && n <= len(b)
// @ ensures err != nil ==> err.ErrorMem()
// SIF: add to classification spec later as well (bfdSend)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For these kinds of TODOs, I'd rather open an issue on VerifiedSCION's issue tracker

WriteTo(b []byte, addr *net.UDPAddr) (n int, err error)
// @ requires acc(Mem(), _)
// (VerifiedSCION) opted for less reusable spec for WriteBatch for
Expand All @@ -161,6 +170,10 @@ type BatchConn interface {
// preconditions for IO-spec:
// @ requires MsgToAbsVal(&msgs[0], egressID) == ioAbsPkts
// @ requires io.token(place) && io.CBioIO_bio3s_send(place, ioAbsPkts)
// SIF: classification spec
// NOTE: I mark `ioAbsPkts` instead of `MsgToAbsVal(...)` as low here to
// match variable used in send permission.
Comment thread
henriman marked this conversation as resolved.
Outdated
// @ requires low(ioAbsPkts)
Comment thread
henriman marked this conversation as resolved.
Outdated
// @ ensures acc(msgs[0].Mem(), R50) && msgs[0].HasActiveAddr()
// @ ensures acc(sl.Bytes(msgs[0].GetFstBuffer(), 0, len(msgs[0].GetFstBuffer())), R50)
// @ ensures err == nil ==> 0 <= n && n <= len(msgs)
Expand Down
30 changes: 30 additions & 0 deletions router/io-spec-atomic-events.gobra
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,36 @@ func AtomicXover(oldPkt io.IO_pkt2, ingressID option[io.IO_ifs], newPkt io.IO_pk
UpdateElemWitness(s.obuf, ioSharedArg.OBufY, egressID, newPkt)
ghost *ioSharedArg.State = io.dp3s_add_obuf(s, egressID, newPkt)
ghost *ioSharedArg.Place = tN
fold SharedInv!< dp, ioSharedArg !>()
ghost ioLock.Unlock()
}

ghost
// NOTE: I don't think I need this here
// requires dp.Valid()
Comment thread
henriman marked this conversation as resolved.
Outdated
requires low(beta) && low(ts) && low(inif) && low(egif)
requires sigma == io.nextMsgtermSpec(dp.Asid(), inif, egif, ts, beta)
preserves acc(ioLock.LockP(), _)
Comment thread
henriman marked this conversation as resolved.
Outdated
preserves ioLock.LockInv() == SharedInv!< dp, ioSharedArg !>
ensures low(sigma)
// NOTE: Seems to be needed bc. lock might not terminate
Comment thread
henriman marked this conversation as resolved.
Outdated
decreases _
func AtomicDecl(beta set[io.IO_msgterm], ts uint, inif, egif option[io.IO_ifs], sigma io.IO_msgterm, ioLock gpointer[gsync.GhostMutex], ioSharedArg SharedArg, dp io.DataPlaneSpec) {
ghost ioLock.Lock()
unfold SharedInv!< dp, ioSharedArg !>()

t, s := *ioSharedArg.Place, *ioSharedArg.State
ghost tag := io.IO_val(io.IO_decl_val{beta, ts, inif, egif, sigma})

assert dp.dp4s_iospec_bio4s_decl_guard(s, t, tag)
unfold dp.dp3s_iospec_ordered(s, t)
unfold dp.dp4s_iospec_bio4s_decl(s, t)

io.TriggerBodyIoDecl(tag)
tN := io.dp4s_iospec_bio4s_decl_T(t, tag)
io.Decl(t, tag)
ghost *ioSharedArg.Place = tN

fold SharedInv!< dp, ioSharedArg !>()
ghost ioLock.Unlock()
}
63 changes: 62 additions & 1 deletion verification/io/io-spec.gobra
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ pred (dp DataPlaneSpec) dp3s_iospec_ordered(s IO_dp3s_state_local, t Place) {
dp.dp3s_iospec_bio3s_send(s, t) &&
dp.dp3s_iospec_bio3s_recv(s, t) &&
dp.dp3s_iospec_skip(s, t) &&
dp.dp3s_iospec_stop(s, t)
dp.dp3s_iospec_stop(s, t) &&
// SIF:
dp.dp4s_iospec_bio4s_decl(s, t)
}

type Place int
Expand Down Expand Up @@ -299,6 +301,55 @@ pred (dp DataPlaneSpec) dp3s_iospec_stop(s IO_dp3s_state_local, t Place) {
true
}

/* SIF: Declassification specification.
I use "4s" to distinguish additions of the refined event system. */
Comment thread
henriman marked this conversation as resolved.
Outdated
pred CBio_IN_bio4s_decl(t Place, v IO_val)

// SIF: Return next place
ghost
// SIF: I left out `requires CBio_IN_bio4s_decl(t, v)` as we deem it not necessary.
decreases
pure func dp4s_iospec_bio4s_decl_T(t Place, v IO_val) Place

ghost
requires v.isIO_decl_val
// NOTE: Not sure I need this here
// requires dp.Valid()
Comment thread
henriman marked this conversation as resolved.
Outdated
decreases
pure func (dp DataPlaneSpec) dp4s_iospec_bio4s_decl_guard(s IO_dp3s_state_local, t Place, v IO_val) bool {
// SIF: cf. `hf_valid` in `router.gobra`
// NOTE: For some reason, formatting this differently leads to a parsing error.
return v.IO_decl_val_sigma == (nextMsgtermSpec(
dp.Asid(),
v.IO_decl_val_inif,
v.IO_decl_val_egif,
v.IO_decl_val_ts,
v.IO_decl_val_beta))
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we drop the field IO_decl_val_sigma, then we may drop this guard as well


pred (dp DataPlaneSpec) dp4s_iospec_bio4s_decl(s IO_dp3s_state_local, t Place) {
// SIF: just copying with `TriggerBodyIoEnter` for now.
// NOTE: here as well we need some specific formatting
forall v IO_val :: { TriggerBodyIoDecl(v) } (
match v {
case IO_decl_val{?beta, ?ts, ?inif, ?egif, ?sigma}:
let _ignored := TriggerBodyIoDecl(v) in
// NOTE: Not sure I need this here
// (dp.Valid() && dp.dp4s_iospec_bio4s_decl_guard(s, t, v) ==>
Comment thread
henriman marked this conversation as resolved.
Outdated
(dp.dp4s_iospec_bio4s_decl_guard(s, t, v) ==>
(CBio_IN_bio4s_decl(t, v) &&
dp.dp3s_iospec_ordered(
s,
dp4s_iospec_bio4s_decl_T(t, v))))
default:
true
})
}

ghost
decreases
pure func TriggerBodyIoDecl(v IO_val) BogusTrigger { return BogusTrigger{} }

/** BIO operations **/
ghost
decreases
Expand All @@ -318,4 +369,14 @@ requires token(t) && CBio_IN_bio3s_exit(t, v)
ensures token(old(dp3s_iospec_bio3s_exit_T(t, v)))
func Exit(ghost t Place, ghost v IO_val)

// SIF: declassification action
// TODO: maybe it's a good idea to split up sigma and p in IO_val
Comment thread
henriman marked this conversation as resolved.
Outdated
ghost
decreases
requires token(t) && CBio_IN_bio4s_decl(t, v)
requires v.isIO_decl_val && low(v.IO_decl_val_inif) && low(v.IO_decl_val_egif) && low(v.IO_decl_val_ts) && low(v.IO_decl_val_beta)
Comment thread
henriman marked this conversation as resolved.
Outdated
ensures token(dp4s_iospec_bio4s_decl_T(t, v))
ensures low(v.IO_decl_val_sigma)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we drop the field IO_decl_val_sigma, we can replace the post here with a call to nextMsgtermSpec

func Decl(ghost t Place, ghost v IO_val)

/** End of helper functions to perfrom BIO operations **/
13 changes: 13 additions & 0 deletions verification/io/values.gobra
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,17 @@ type IO_val adt {
IO_Internal_val2_2 IO_pkt3
IO_Internal_val2_3 IO_ifs
}

/* SIF: Output (to env.) for declassification action.
This consists of the segment identifier `beta`, the timestamp `ts, the
ingress and egress interfaces `inif` and `egif` (resp.), and a hop
authenticator `sigma`.
Also see `router.gobra` for types. */
IO_decl_val {
IO_decl_val_beta set[IO_msgterm] // uinfo
IO_decl_val_ts uint
IO_decl_val_inif option[IO_ifs]
IO_decl_val_egif option[IO_ifs]
IO_decl_val_sigma IO_msgterm
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this field seems unnecessary

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a comment here explaining why we are keeping the field sigma even though it is logically redundant

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ping for me to check

}
}