-
Notifications
You must be signed in to change notification settings - Fork 706
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
Unbounded proof and contracts for s2n_constant_time_equals #4704
Open
rod-chapman
wants to merge
8
commits into
aws:main
Choose a base branch
from
rod-chapman:unbound_ct_equals
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
d924397
Update Makefile.common from PR#4703 to work with unbounded proofs
rod-chapman 08adf1d
Add CONTRACT_DECREASES macro for unbounded loop proofs.
rod-chapman e45bc83
Add new partial and total versions of s2n_constant_time_equals and th…
rod-chapman 1633e5d
Correct specification, contracts and code for case when len == 0
rod-chapman 57910fa
Merge branch 'aws:main' into unbound_ct_equals
rod-chapman 976761d
Address review comments from colmmac:
rod-chapman 1b2dddc
Tell goto-cc not to export file-local symbols to complete this proof
rod-chapman 0ed160a
Update utils/s2n_safety.c
rod-chapman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
42 changes: 42 additions & 0 deletions
42
tests/cbmc/proofs/s2n_constant_time_equals_partial/Makefile
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,42 @@ | ||
# | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"). You may not use | ||
# this file except in compliance with the License. A copy of the License is | ||
# located at | ||
# | ||
# http://aws.amazon.com/apache2.0/ | ||
# | ||
# or in the "license" file accompanying this file. This file 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. | ||
|
||
|
||
# Use the default set of CBMC flags | ||
CHECKFLAGS += | ||
|
||
PROOF_UID = s2n_constant_time_equals_partial | ||
HARNESS_ENTRY = $(PROOF_UID)_harness | ||
HARNESS_FILE = $(HARNESS_ENTRY).c | ||
|
||
# Uncomment and complete this if this function calls other functions that have pre- and post-conditions | ||
#USE_FUNCTION_CONTRACTS = | ||
|
||
CHECK_FUNCTION_CONTRACTS=$(PROOF_UID) | ||
FUNCTION_NAME = $(PROOF_UID) | ||
APPLY_LOOP_CONTRACTS=on | ||
USE_DYNAMIC_FRAMES=1 | ||
|
||
# Use SMT back-end and disable default SAT backend | ||
EXTERNAL_SAT_SOLVER= | ||
CBMCFLAGS=--bitwuzla | ||
|
||
|
||
PROOF_SOURCES += $(PROOFDIR)/$(HARNESS_FILE) | ||
|
||
PROJECT_SOURCES += $(SRCDIR)/utils/s2n_safety.c | ||
|
||
# Set Verbose=on to see what litani is actually running | ||
VERBOSE=on | ||
|
||
include ../Makefile.common |
1 change: 1 addition & 0 deletions
1
tests/cbmc/proofs/s2n_constant_time_equals_partial/cbmc-proof.txt
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 @@ | ||
# This file marks this directory as containing a CBMC proof. |
29 changes: 29 additions & 0 deletions
29
...s/cbmc/proofs/s2n_constant_time_equals_partial/s2n_constant_time_equals_partial_harness.c
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,29 @@ | ||
/* | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). | ||
* You may not use this file except in compliance with the License. | ||
* A copy of the License is located at | ||
* | ||
* http://aws.amazon.com/apache2.0 | ||
* | ||
* or in the "license" file accompanying this file. This file 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. | ||
*/ | ||
|
||
#include <assert.h> | ||
|
||
#include "utils/s2n_safety.h" | ||
|
||
void s2n_constant_time_equals_partial_harness() | ||
{ | ||
/* Non-deterministic inputs. */ | ||
uint32_t len; | ||
uint8_t *a; | ||
uint8_t *b; | ||
bool result; | ||
|
||
result = s2n_constant_time_equals_partial(a, b, len); | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The CBMC results uploaded to the Github action summary indicates that this harness has 0% code coverage:
Is there potentially an issue with this harness? The
s2n_constant_time_equals_total
harness looks okay. Is there maybe an issue with forward declarings2n_constant_time_equals_partial()
since it's static?