-
Notifications
You must be signed in to change notification settings - Fork 74
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
Added CBMC proof of setDataInterface function #245
Merged
Merged
Changes from 22 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
0bbf408
Add CBMC-proofs infrastructure
Bujain 21ee448
Added value to not update the submodule
Bujain 4b189aa
Added Include paths and preprocessor defines
Bujain ae17c09
Added template define file
Bujain 4a2ed43
Updated to ignore the output files on git push
Bujain 6c5d6f5
Added words
Bujain b4a774c
Updated Project Name
Bujain db409b7
Updated source directory path
Bujain 402e6b8
Merge branch 'cbmc-proof' into cbmc_infra
AniruddhaKanhere 62ddec4
Add checks on the branch
AniruddhaKanhere 67ad6b0
Updated Submodule update value
Bujain 1f5668f
Merge branch 'cbmc_infra' of https://github.com/Bujain/ota-for-aws-io…
Bujain 3bda16a
Added litani submodule update
Bujain 2c7f2ee
Update Project name
Bujain e88c8c0
Added new line in the end of the file
Bujain d274f81
Remove whitespace
AniruddhaKanhere f54e3bd
Added CBMC proof for setDataInterface function
Bujain 6584e87
removed unnecessary variables
Bujain 00c584f
Updated documentation
Bujain b18f3a7
Merge branch 'cbmc-proof' into setDataInterface
Bujain 11e33e5
Uncrustified
Bujain 5052aae
Merge branch 'setDataInterface' of https://github.com/Bujain/ota-for-…
Bujain 2d459ee
Updated year in copyright notice
Bujain 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
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,25 @@ | ||
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
HARNESS_ENTRY = setDataInterface_harness | ||
HARNESS_FILE = $(HARNESS_ENTRY) | ||
|
||
# This should be a unique identifier for this proof, and will appear on the | ||
# Litani dashboard. It can be human-readable and contain spaces if you wish. | ||
PROOF_UID = setDataInterface | ||
|
||
DEFINES += | ||
|
||
REMOVE_FUNCTION_BODY += | ||
UNWINDSET += | ||
|
||
PROOF_SOURCES += $(PROOFDIR)/$(HARNESS_FILE).c | ||
PROJECT_SOURCES += $(SRCDIR)/source/ota_interface.c | ||
|
||
# If this proof is found to consume huge amounts of RAM, you can set the | ||
# EXPENSIVE variable. With new enough versions of the proof tools, this will | ||
# restrict the number of EXPENSIVE CBMC jobs running at once. See the | ||
# documentation in Makefile.common under the "Job Pools" heading for details. | ||
# EXPENSIVE = true | ||
|
||
include ../Makefile.common |
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,20 @@ | ||
setDataInterface proof | ||
============== | ||
|
||
This directory contains a memory safety proof for setDataInterface. | ||
|
||
To run the proof. | ||
------------- | ||
|
||
* Add `cbmc`, `goto-cc`, `goto-instrument`, `goto-analyzer`, and `cbmc-viewer` | ||
to your path. | ||
* Run `make`. | ||
* Open html/index.html in a web browser. | ||
|
||
To use [`arpa`](https://github.com/awslabs/aws-proof-build-assistant) to simplify writing Makefiles. | ||
------------- | ||
|
||
* Run `make arpa` to generate a Makefile.arpa that contains relevant build information for the proof. | ||
* Use Makefile.arpa as the starting point for your proof Makefile by: | ||
1. Modifying Makefile.arpa (if required). | ||
2. Including Makefile.arpa into the existing proof Makefile (add `sinclude Makefile.arpa` at the bottom of the Makefile, right before `include ../Makefile.common`). |
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,2 @@ | ||
# This file marks this directory as containing a CBMC proof. | ||
# This file is required by the run-cbmc-proofs.py to differentiate between a proof directory from a normal directory. |
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,6 @@ | ||
{ "expected-missing-functions": | ||
[ | ||
], | ||
"proof-name": "setDataInterface", | ||
"proof-root": "test/cbmc/proofs" | ||
} |
49 changes: 49 additions & 0 deletions
49
test/cbmc/proofs/setDataInterface/setDataInterface_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,49 @@ | ||
/* | ||
* AWS IoT Over-the-air Update v3.0.0 | ||
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
* this software and associated documentation files (the "Software"), to deal in | ||
* the Software without restriction, including without limitation the rights to | ||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
* the Software, and to permit persons to whom the Software is furnished to do so, | ||
* subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
*/ | ||
|
||
/** | ||
* @file setDataInterface_harness.c | ||
* @brief Implements the proof harness for setDataInterface function. | ||
*/ | ||
/* Ota interface includes. */ | ||
#include "ota_interface_private.h" | ||
|
||
void setDataInterface_harness() | ||
{ | ||
OtaDataInterface_t * pDataInterface; | ||
OtaDataInterface_t dataInterface; | ||
OtaErr_t err; | ||
|
||
/* The input to the setDataInterface is a buffer statically initialized in the | ||
* source code with its size defined by OTA_PROTOCOL_BUFFER_SIZE. This macro is | ||
* not user configurable and thus the input does not require any constraint. */ | ||
uint8_t pProtocol[ OTA_PROTOCOL_BUFFER_SIZE ]; | ||
|
||
pDataInterface = &dataInterface; | ||
|
||
err = setDataInterface( pDataInterface, pProtocol ); | ||
|
||
/* The function return can only be either of two values i.e OtaErrNone or | ||
* OtaErrInvalidDataProtocol. */ | ||
__CPROVER_assert( ( err == OtaErrInvalidDataProtocol ) || ( err == OtaErrNone ), | ||
"The function return can be either of those values." ); | ||
} |
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.
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.
I have updated the same.