-
Notifications
You must be signed in to change notification settings - Fork 5
[WIP] SIF #394
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
[WIP] SIF #394
Changes from 17 commits
d606c27
f5603b6
9328a95
df0fed8
973541b
8acf6c4
05df206
389235f
1831b53
094d917
0e6eff1
85d1d0a
f7db996
b0795a9
2e41d12
82a3239
e5d6e3d
9620262
4f88e97
c8b7b5c
799cd4d
2380d49
9863f30
ccd088c
9e1a702
d72140a
1280d92
12c655e
e8ca70a
5728d9e
69f6de4
41c38db
9e03a1a
3eda2f0
e9e9ef0
2e6d9d5
75df8c6
8283193
e1ea5e1
576461f
19627eb
efd776c
7d185ea
20e891c
4a7404b
85f858f
085f827
6366aa7
c91d9db
3e12921
ea50e39
86b6484
9743687
005ed12
8e17e27
a353468
e2e8827
c94f229
d16b7c9
f0ced95
f63a7d6
44a0b6d
01950a7
6c3067e
9304eb3
439ff54
5772210
1e0500b
29e7444
1b4a07c
890558a
a83dde0
0b6ec9c
d5f94cb
ca4cf53
56b6396
32f8f6f
6c50035
ba47020
17c535d
3781fa0
da722cb
33b9948
79f7d31
aa7fd1d
6edbb0c
910d03f
3b3762c
a19e521
9acac01
b89413f
8f3c41c
9b3fada
d6d212f
a8b3c64
2fd3750
10042fb
09da9b3
43b4ab3
21aa6a9
f51c894
182a483
c799b92
23a050f
d9dfcf5
1d9a1d7
5446132
a05c2a0
0a210ed
eaed1c5
8f933aa
064c6eb
9120830
b509ded
24ace34
feed939
2c57016
4457ac8
2f96475
20a1b8f
2125136
b4084b5
aca63f2
7bf7104
8f64df5
d833312
3520a56
2b6f1bf
e475136
424dbdb
e59f604
b8d8b82
06a4907
886fbe5
315a653
d14eb1e
ceacce8
8a3278f
8dce993
9686422
e270180
92a35f7
0003f81
65aebc6
09e4f2f
240fe92
5ed0d5b
2bd4ffd
f24f0b3
27f66a5
714e7f7
555f91a
000a7d9
b5f9d9c
296be69
94be47a
f01b621
7bad729
00c70ae
b53945a
acebe54
5598aa7
4d936ca
c72c877
7f5f579
64814a8
d43f141
c0ed125
f93c449
b807f2b
3eab3a9
15f776b
392bb5a
0f8b583
e36e88d
cf5e90f
5377dd5
7eaabb1
355f924
bb19940
e22daf9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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. | ||
|
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) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
|
|
@@ -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. | ||
|
henriman marked this conversation as resolved.
Outdated
|
||
| // @ requires low(ioAbsPkts) | ||
|
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) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 | ||
|
|
@@ -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. */ | ||
|
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() | ||
|
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)) | ||
| } | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if we drop the field |
||
|
|
||
| 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) ==> | ||
|
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 | ||
|
|
@@ -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 | ||
|
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) | ||
|
henriman marked this conversation as resolved.
Outdated
|
||
| ensures token(dp4s_iospec_bio4s_decl_T(t, v)) | ||
| ensures low(v.IO_decl_val_sigma) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if we drop the field |
||
| func Decl(ghost t Place, ghost v IO_val) | ||
|
|
||
| /** End of helper functions to perfrom BIO operations **/ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this field seems unnecessary
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add a comment here explaining why we are keeping the field
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ping for me to check |
||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.