Skip to content
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

Add CBMC proof of checkDataType function #293

Merged
merged 60 commits into from
Oct 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
0bbf408
Add CBMC-proofs infrastructure
Bujain Aug 4, 2021
95529f8
Add CBMC-proofs infrastructure (#242)
Bujain Aug 5, 2021
21ee448
Added value to not update the submodule
Bujain Aug 5, 2021
4b189aa
Added Include paths and preprocessor defines
Bujain Aug 5, 2021
ae17c09
Added template define file
Bujain Aug 5, 2021
4a2ed43
Updated to ignore the output files on git push
Bujain Aug 5, 2021
6c5d6f5
Added words
Bujain Aug 5, 2021
b4a774c
Updated Project Name
Bujain Aug 5, 2021
db409b7
Updated source directory path
Bujain Aug 5, 2021
402e6b8
Merge branch 'cbmc-proof' into cbmc_infra
AniruddhaKanhere Aug 5, 2021
92b5b00
Update ci.yml
AniruddhaKanhere Aug 5, 2021
62ddec4
Add checks on the branch
AniruddhaKanhere Aug 5, 2021
67ad6b0
Updated Submodule update value
Bujain Aug 5, 2021
1f5668f
Merge branch 'cbmc_infra' of https://github.com/Bujain/ota-for-aws-io…
Bujain Aug 5, 2021
3bda16a
Added litani submodule update
Bujain Aug 5, 2021
2c7f2ee
Update Project name
Bujain Aug 5, 2021
e88c8c0
Added new line in the end of the file
Bujain Aug 5, 2021
d274f81
Remove whitespace
AniruddhaKanhere Aug 5, 2021
a085b6a
Addition to CBMC infrastructure (#243)
Bujain Aug 5, 2021
fcb1efe
Added CBMC proof of setDataInterface function (#245)
Bujain Aug 6, 2021
f561a6c
Added template inside proof directory
Bujain Aug 9, 2021
6122c14
Merge pull request #2 from aws/main
Bujain Aug 9, 2021
e684033
Added CBMC proof of OTA_HTTP_strerror function (#252)
Bujain Aug 12, 2021
08fa29e
Add CBMC proofs for RequestdataBlock_Http function (#248)
Bujain Aug 12, 2021
5a72e20
Added CBMC proofs for OTA_MQTT_strerror function (#247)
Bujain Aug 12, 2021
d470ee5
Added CBMC proofs for setControlInterface function (#246)
Bujain Aug 12, 2021
4a2b21d
removed extra line
Bujain Aug 17, 2021
08b6b5c
Merge branch 'cbmc_infra' of https://github.com/Bujain/ota-for-aws-io…
Bujain Aug 17, 2021
b331892
Uncrustified'
Bujain Aug 17, 2021
8f4d71e
CBMC Proof of initFileTransfer_Http function (#249)
Bujain Aug 19, 2021
98cfba1
CBMC proof of decodeFileBlock_Http function (#250)
Bujain Aug 19, 2021
194fca7
Added CBMC proof of CleanupData_Http function (#251)
Bujain Aug 19, 2021
3bc7195
Added CBMC proof for stringBuilderUInt32Hex function (#253)
Bujain Aug 19, 2021
71ce0bf
Added CBMC proof of stringBuilderUInt32Decimal function (#254)
Bujain Aug 19, 2021
f42bbba
Updated source directory
Bujain Aug 23, 2021
7228b93
Merge pull request #7 from aws/cbmc-proof
Bujain Aug 23, 2021
4e24408
Add spellings
Bujain Aug 23, 2021
c544dba
Update doxygen in cbmc-proof branch (#275)
Bujain Aug 23, 2021
8778e86
Merge branch 'aws:main' into cbmc_infra
Bujain Aug 24, 2021
1b443e3
Merge pull request #11 from aws/cbmc-proof
Bujain Aug 24, 2021
b10eaf1
Add CBMC proof of checkDataType function
Bujain Aug 24, 2021
667bcb8
Resolve conflicts
Bujain Sep 27, 2021
094d06e
add words
Bujain Sep 27, 2021
cd3c2d9
Merge branch 'main' into checkDataType
Bujain Sep 27, 2021
23a3835
Fix spell check errors
Bujain Sep 27, 2021
92afbdd
Merge branch 'checkDataType' of https://github.com/Bujain/ota-for-aws…
Bujain Sep 27, 2021
8c01a98
Fix spell check error
Bujain Sep 27, 2021
632b2de
Removed unused variables
Bujain Sep 28, 2021
b3b01fb
Add return value check
Bujain Oct 18, 2021
2854e0c
Merge branch 'main' into checkDataType
Bujain Oct 18, 2021
e805e06
uncrustified
Bujain Oct 18, 2021
ab9451d
Merge branch 'checkDataType' of https://github.com/Bujain/ota-for-aws…
Bujain Oct 18, 2021
9b519d6
Merge branch 'main' into checkDataType
Bujain Oct 19, 2021
245ac12
Add check for return value
Bujain Oct 19, 2021
0d0efbf
Merge branch 'checkDataType' of https://github.com/Bujain/ota-for-aws…
Bujain Oct 19, 2021
3927400
Uncrustified
Bujain Oct 19, 2021
837e9d1
Merge branch 'main' into checkDataType
Bujain Oct 21, 2021
74a5c64
remove optional variables
Bujain Oct 22, 2021
55375df
Merge branch 'checkDataType' of https://github.com/Bujain/ota-for-aws…
Bujain Oct 22, 2021
851523c
Merge branch 'main' into checkDataType
Bujain Oct 25, 2021
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
2 changes: 1 addition & 1 deletion source/ota.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* AWS IoT Over-the-air Update v3.1.0
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Copyright (C) 2021 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
Expand Down
19 changes: 19 additions & 0 deletions test/cbmc/proofs/checkDataType/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
HARNESS_ENTRY = checkDataType_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 = checkDataType

INCLUDES += -I$(SRCDIR)/source/dependency/3rdparty/tinycbor/src/

PROOF_SOURCES += $(PROOFDIR)/$(HARNESS_FILE).c
PROJECT_SOURCES += $(SRCDIR)/source/ota_cbor.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
20 changes: 20 additions & 0 deletions test/cbmc/proofs/checkDataType/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
checkDataType proof
==============

This directory contains a memory safety proof for checkDataType.

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`).
2 changes: 2 additions & 0 deletions test/cbmc/proofs/checkDataType/cbmc-proof.txt
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.
6 changes: 6 additions & 0 deletions test/cbmc/proofs/checkDataType/cbmc-viewer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{ "expected-missing-functions":
[
],
"proof-name": "checkDataType",
"proof-root": "test/cbmc/proofs"
}
45 changes: 45 additions & 0 deletions test/cbmc/proofs/checkDataType/checkDataType_harness.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* AWS IoT Over-the-air Update v3.1.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.
*/

/**
Copy link
Member

Choose a reason for hiding this comment

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

Should this file have the same header and license as the other proofs?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The copyright license needs to be updated in all the proofs with the updated version. There has been discussion going on. I will need to run a script in the main repo to update all the licenses in all the proofs.

* @file checkDataType_harness.c
* @brief Implements the proof harness for checkDataType function.
*/
/* Include headers for cbor parsing. */
#include "cbor.h"
#include "ota_cbor_private.h"

CborError __CPROVER_file_local_ota_cbor_c_checkDataType( CborType expectedType,
CborValue * cborValue );


void checkDataType_harness()
{
CborType expectedType;
CborValue cborvalue;
CborError cborResult;

cborResult = __CPROVER_file_local_ota_cbor_c_checkDataType( expectedType, &cborvalue );

__CPROVER_assert( cborResult == CborNoError || cborResult == CborErrorIllegalType,
"Invalid cborResult value: Expected either CborNoError or CborErrorIllegalType." );
}
1 change: 1 addition & 0 deletions tools/lexicon.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ certfile
certfilepath
certfilepathmaxsize
certfilepathsize
checkdatatype
checkforupdate
cli
clienttoken
Expand Down