-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
streamline msgterm assumptions (#308)
- Loading branch information
Showing
6 changed files
with
60 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Copyright 2020 Anapaya Systems | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
// +gobra | ||
|
||
package path | ||
|
||
import "verification/io" | ||
|
||
// At the moment, we assume that all cryptographic operations performed at the code level | ||
// imply the desired properties at the IO spec level because we cannot currently prove in | ||
// Gobra the correctness of these operations. Given that we do not prove any properties | ||
// about this function, we currently do not provide a definition for it. | ||
|
||
ghost | ||
decreases | ||
pure func AbsUInfoFromUint16(SegID uint16) set[io.IO_msgterm] | ||
|
||
ghost | ||
decreases | ||
pure func AbsMac(mac [MacLen]byte) (io.IO_msgterm) | ||
|
||
// The following function converts a slice with at least `MacLen` elements into | ||
// an (exclusive) array containing the mac. Note that there are no permissions | ||
// involved for accessing exclusive arrays. This functions is abstract for now | ||
// because Gobra does not allow for array literals in pure functions, even though | ||
// they are no more side-effectful than creating an instance of a struct type. | ||
// This will soon be fixed in Gobra. | ||
ghost | ||
requires MacLen <= len(mac) | ||
requires forall i int :: { &mac[i] } 0 <= i && i < MacLen ==> acc(&mac[i], _) | ||
ensures len(res) == MacLen | ||
ensures forall i int :: { res[i] } 0 <= i && i < MacLen ==> mac[i] == res[i] | ||
decreases | ||
pure func FromSliceToMacArray(mac []byte) (res [MacLen]byte) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters