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

Conversation

Bujain
Copy link
Contributor

@Bujain Bujain commented Sep 21, 2021

Add CBMC proof of checkDataType function

Description

This PR adds files required for the CBMC proof of checkDataType function.

Checklist:

  • I have tested my changes. No regression in existing tests.
  • My code is formatted using Uncrustify.
  • I have read and applied the rules stated in CONTRIBUTING.md.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Bujain and others added 30 commits August 4, 2021 23:32
Co-authored-by: Aniruddha Kanhere <[email protected]>
* Add CBMC-proofs infrastructure

* Added value to not update the submodule

* Added Include paths and preprocessor defines

* Added template define file

* Updated to ignore the output files on git push

* Added words

* Updated Project Name

* Updated source directory path

* Add checks on the branch

* Updated Submodule update value

* Added litani submodule update

* Update Project name

Co-authored-by: Aniruddha Kanhere <[email protected]>

* Added new line in the end of the file

* Remove whitespace

Co-authored-by: Aniruddha Kanhere <[email protected]>
* Add CBMC-proofs infrastructure

* Added value to not update the submodule

* Added Include paths and preprocessor defines

* Added template define file

* Updated to ignore the output files on git push

* Added words

* Updated Project Name

* Updated source directory path

* Add checks on the branch

* Updated Submodule update value

* Added litani submodule update

* Update Project name

Co-authored-by: Aniruddha Kanhere <[email protected]>

* Added new line in the end of the file

* Remove whitespace

* Added CBMC proof for setDataInterface function

* removed unnecessary variables

* Updated documentation

* Uncrustified

* Updated year in copyright notice

Co-authored-by: Aniruddha Kanhere <[email protected]>
Add assert checks for http interface functions (aws#231)
* Add CBMC-proofs infrastructure

* Added value to not update the submodule

* Added Include paths and preprocessor defines

* Added template define file

* Updated to ignore the output files on git push

* Added words

* Updated Project Name

* Updated source directory path

* Add checks on the branch

* Updated Submodule update value

* Added litani submodule update

* Update Project name

Co-authored-by: Aniruddha Kanhere <[email protected]>

* Added new line in the end of the file

* Remove whitespace

* Add CBMC proof of OTA_HTTP_strerror function

* Removed extra line and updated error log

* Updated error log

Co-authored-by: Aniruddha Kanhere <[email protected]>
* Add CBMC-proofs infrastructure

* Added value to not update the submodule

* Added Include paths and preprocessor defines

* Added template define file

* Updated to ignore the output files on git push

* Added words

* Updated Project Name

* Updated source directory path

* Add checks on the branch

* Updated Submodule update value

* Added litani submodule update

* Update Project name

Co-authored-by: Aniruddha Kanhere <[email protected]>

* Added new line in the end of the file

* Remove whitespace

* Added CBMC Proof of requestDataBlock_Http function

* Removed extra line

* Update Comments

Co-authored-by: Aniruddha Kanhere <[email protected]>
* Add CBMC-proofs infrastructure

* Added value to not update the submodule

* Added Include paths and preprocessor defines

* Added template define file

* Updated to ignore the output files on git push

* Added words

* Updated Project Name

* Updated source directory path

* Add checks on the branch

* Updated Submodule update value

* Added litani submodule update

* Update Project name

Co-authored-by: Aniruddha Kanhere <[email protected]>

* Added new line in the end of the file

* Remove whitespace

* Added CBMC proof for OTA_MQTT_strerror function

* Removed extra line

* Updated comments

* Fixed formatting errors

* Updated error log

Co-authored-by: Aniruddha Kanhere <[email protected]>
* Add CBMC-proofs infrastructure

* Added value to not update the submodule

* Added Include paths and preprocessor defines

* Added template define file

* Updated to ignore the output files on git push

* Added words

* Updated Project Name

* Updated source directory path

* Add checks on the branch

* Updated Submodule update value

* Added litani submodule update

* Update Project name

Co-authored-by: Aniruddha Kanhere <[email protected]>

* Added new line in the end of the file

* Remove whitespace

* Added CBMC proof for setControlInterface function

* Removed extra line

* Added macro for the function

* Fix formating errors

* Fix spell check errors

* Added preprocessor definition for setControlInterface function

Co-authored-by: Aniruddha Kanhere <[email protected]>
* Add CBMC-proofs infrastructure

* Added value to not update the submodule

* Added Include paths and preprocessor defines

* Added template define file

* Updated to ignore the output files on git push

* Added words

* Updated Project Name

* Updated source directory path

* Add checks on the branch

* Updated Submodule update value

* Added litani submodule update

* Update Project name

Co-authored-by: Aniruddha Kanhere <[email protected]>

* Added new line in the end of the file

* Remove whitespace

* Add CBMC proof of initFileTransfer_Http function

* Removed extra line

* Updated Comments

* Updated error log and comments

* Updated comments

* Fix formatting errors

Co-authored-by: Aniruddha Kanhere <[email protected]>
Comment on lines 11 to 15
DEFINES +=
INCLUDES += -I$(SRCDIR)/source/dependency/3rdparty/tinycbor/src/

REMOVE_FUNCTION_BODY +=
UNWINDSET +=
Copy link
Contributor

Choose a reason for hiding this comment

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

Please remove unused vars.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated in 632b2de

divekarshubham
divekarshubham previously approved these changes Sep 28, 2021
/* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. */
/* SPDX-License-Identifier: Apache-2.0 */

/**
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.

* before checkDataType is called. */
pcborValue = &cborvalue;

__CPROVER_file_local_ota_cbor_c_checkDataType( expectedType, pcborValue );
Copy link
Member

Choose a reason for hiding this comment

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

Should the return value be checked?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There are multiple return values for different tests. It would be difficult to check for the return value. If the return value is certain only then are we checking it.

Copy link
Member

Choose a reason for hiding this comment

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

I agree with @paulbartell, we can assert on the range of all the values using below (pseudo)code:

__CPROVER_assert( ( returnValue >= LOWEST_CborError_VALUE ) && ( returnValue <= HIGHEST_CborError_VALUE ) );

* before checkDataType is called. */
pcborValue = &cborvalue;

cborResult = __CPROVER_file_local_ota_cbor_c_checkDataType( expectedType, pcborValue );
Copy link
Member

Choose a reason for hiding this comment

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

Is it not possible to directly do the following:

cborResult = __CPROVER_file_local_ota_cbor_c_checkDataType( expectedType, &cborvalue);

Or is this something that you need for CBMC?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is not required for the CBMC and I have updated that in 55375df

@Bujain Bujain merged commit cee0641 into aws:main Oct 25, 2021
@Bujain Bujain deleted the checkDataType branch November 1, 2021 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants