chore: migrate project into clean repository

This commit is contained in:
yuuux
2026-08-13 16:50:52 +08:00
commit d1d25a09e7
27405 changed files with 9422808 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
/*
* coreMQTT Agent <v1.3.1>
* 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
* 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 MQTTAgentCommand_Connect_harness.c
* @brief Implements the proof harness for MQTTAgentCommand_Connect function.
*/
/* MQTT agent include. */
#include "core_mqtt_agent_command_functions.h"
#include "mqtt_agent_cbmc_state.h"
void harness()
{
MQTTAgentContext_t * pMqttAgentContext;
MQTTAgentCommandFuncReturns_t * pReturnFlags;
MQTTAgentConnectArgs_t * pConnectArgs;
pMqttAgentContext = malloc( sizeof( MQTTAgentContext_t ) );
__CPROVER_assume( pMqttAgentContext != NULL );
pReturnFlags = malloc( sizeof( MQTTAgentCommandFuncReturns_t ) );
__CPROVER_assume( pReturnFlags != NULL );
pConnectArgs = allocateConnectArgs( NULL );
__CPROVER_assume( pConnectArgs != NULL );
MQTTAgentCommand_Connect( pMqttAgentContext, pConnectArgs, pReturnFlags );
}

View File

@@ -0,0 +1,21 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
HARNESS_ENTRY = harness
HARNESS_FILE = MQTTAgentCommand_Connect_harness
# 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 = MQTTAgentCommand_Connect
DEFINES +=
INCLUDES +=
REMOVE_FUNCTION_BODY +=
UNWINDSET +=
PROOF_SOURCES += $(PROOFDIR)/$(HARNESS_FILE).c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/sources/mqtt_agent_cbmc_state.c
PROJECT_SOURCES += $(SRCDIR)/source/core_mqtt_agent_command_functions.c
include ../Makefile.common

View File

@@ -0,0 +1,23 @@
MQTTAgentCommand_Connect proof
==============
This directory contains a memory safety proof for MQTTAgentCommand_Connect.
The proof runs within 10 seconds on a t2.2xlarge. It provides complete coverage of:
* MQTTAgentCommand_Connect()
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://awslabs.github.io/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`).

View File

@@ -0,0 +1 @@
# This file marks this directory as containing a CBMC proof.

View File

@@ -0,0 +1,7 @@
{ "expected-missing-functions":
[
],
"proof-name": "MQTTAgentCommand_Connect",
"proof-root": "test/cbmc/proofs"
}

View File

@@ -0,0 +1,43 @@
/*
* coreMQTT Agent <v1.3.1>
* 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
* 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 MQTTAgentCommand_Disconnect_harness.c
* @brief Implements the proof harness for MQTTAgentCommand_Disconnect function.
*/
/* MQTT agent include. */
#include "core_mqtt_agent_command_functions.h"
void harness()
{
MQTTAgentContext_t * pMqttAgentContext;
MQTTAgentCommandFuncReturns_t * pReturnFlags;
pMqttAgentContext = malloc( sizeof( MQTTAgentContext_t ) );
__CPROVER_assume( pMqttAgentContext != NULL );
pReturnFlags = malloc( sizeof( MQTTAgentCommandFuncReturns_t ) );
__CPROVER_assume( pReturnFlags != NULL );
MQTTAgentCommand_Disconnect( pMqttAgentContext, NULL, pReturnFlags );
}

View File

@@ -0,0 +1,20 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
HARNESS_ENTRY = harness
HARNESS_FILE = MQTTAgentCommand_Disconnect_harness
# 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 = MQTTAgentCommand_Disconnect
DEFINES +=
INCLUDES +=
REMOVE_FUNCTION_BODY +=
UNWINDSET +=
PROOF_SOURCES += $(PROOFDIR)/$(HARNESS_FILE).c
PROJECT_SOURCES += $(SRCDIR)/source/core_mqtt_agent_command_functions.c
include ../Makefile.common

View File

@@ -0,0 +1,23 @@
MQTTAgentCommand_Disconnect proof
==============
This directory contains a memory safety proof for MQTTAgentCommand_Disconnect.
The proof runs within 10 seconds on a t2.2xlarge. It provides complete coverage of:
* MQTTAgentCommand_Disconnect()
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://awslabs.github.io/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`).

View File

@@ -0,0 +1 @@
# This file marks this directory as containing a CBMC proof.

View File

@@ -0,0 +1,7 @@
{ "expected-missing-functions":
[
],
"proof-name": "MQTTAgentCommand_Disconnect",
"proof-root": "test/cbmc/proofs"
}

View File

@@ -0,0 +1,42 @@
/*
* coreMQTT Agent <v1.3.1>
* 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
* 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 MQTTAgentCommand_Ping_harness.c
* @brief Implements the proof harness for MQTTAgentCommand_Ping function.
*/
/* MQTT agent include. */
#include "core_mqtt_agent_command_functions.h"
void harness()
{
MQTTAgentContext_t * pMqttAgentContext;
MQTTAgentCommandFuncReturns_t * pReturnFlags;
pMqttAgentContext = malloc( sizeof( MQTTAgentContext_t ) );
__CPROVER_assume( pMqttAgentContext != NULL );
pReturnFlags = malloc( sizeof( MQTTAgentCommandFuncReturns_t ) );
__CPROVER_assume( pReturnFlags != NULL );
MQTTAgentCommand_Ping( pMqttAgentContext, NULL, pReturnFlags );
}

View File

@@ -0,0 +1,20 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
HARNESS_ENTRY = harness
HARNESS_FILE = MQTTAgentCommand_Ping_harness
# 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 = MQTTAgentCommand_Ping
DEFINES +=
INCLUDES +=
REMOVE_FUNCTION_BODY +=
UNWINDSET +=
PROOF_SOURCES += $(PROOFDIR)/$(HARNESS_FILE).c
PROJECT_SOURCES += $(SRCDIR)/source/core_mqtt_agent_command_functions.c
include ../Makefile.common

View File

@@ -0,0 +1,23 @@
MQTTAgentCommand_Ping proof
==============
This directory contains a memory safety proof for MQTTAgentCommand_Ping.
The proof runs within 10 seconds on a t2.2xlarge. It provides complete coverage of:
* MQTTAgentCommand_Ping()
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://awslabs.github.io/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`).

View File

@@ -0,0 +1 @@
# This file marks this directory as containing a CBMC proof.

View File

@@ -0,0 +1,7 @@
{ "expected-missing-functions":
[
],
"proof-name": "MQTTAgentCommand_Ping",
"proof-root": "test/cbmc/proofs"
}

View File

@@ -0,0 +1,42 @@
/*
* coreMQTT Agent <v1.3.1>
* 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
* 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 MQTTAgentCommand_ProcessLoop_harness.c
* @brief Implements the proof harness for MQTTAgentCommand_ProcessLoop function.
*/
/* MQTT agent include. */
#include "core_mqtt_agent_command_functions.h"
void harness()
{
MQTTAgentContext_t * pMqttAgentContext;
MQTTAgentCommandFuncReturns_t * pReturnFlags;
pMqttAgentContext = malloc( sizeof( MQTTAgentContext_t ) );
__CPROVER_assume( pMqttAgentContext != NULL );
pReturnFlags = malloc( sizeof( MQTTAgentCommandFuncReturns_t ) );
__CPROVER_assume( pReturnFlags != NULL );
MQTTAgentCommand_ProcessLoop( pMqttAgentContext, NULL, pReturnFlags );
}

View File

@@ -0,0 +1,20 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
HARNESS_ENTRY = harness
HARNESS_FILE = MQTTAgentCommand_ProcessLoop_harness
# 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 = MQTTAgentCommand_ProcessLoop
DEFINES +=
INCLUDES +=
REMOVE_FUNCTION_BODY +=
UNWINDSET +=
PROOF_SOURCES += $(PROOFDIR)/$(HARNESS_FILE).c
PROJECT_SOURCES += $(SRCDIR)/source/core_mqtt_agent_command_functions.c
include ../Makefile.common

View File

@@ -0,0 +1,23 @@
MQTTAgentCommand_ProcessLoop proof
==============
This directory contains a memory safety proof for MQTTAgentCommand_ProcessLoop.
The proof runs within 10 seconds on a t2.2xlarge. It provides complete coverage of:
* MQTTAgentCommand_ProcessLoop()
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://awslabs.github.io/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`).

View File

@@ -0,0 +1 @@
# This file marks this directory as containing a CBMC proof.

View File

@@ -0,0 +1,7 @@
{ "expected-missing-functions":
[
],
"proof-name": "MQTTAgentCommand_ProcessLoop",
"proof-root": "test/cbmc/proofs"
}

View File

@@ -0,0 +1,45 @@
/*
* coreMQTT Agent <v1.3.1>
* 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
* 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 MQTTAgentCommand_Publish_harness.c
* @brief Implements the proof harness for MQTTAgentCommand_Publish function.
*/
/* MQTT agent include. */
#include "core_mqtt_agent_command_functions.h"
void harness()
{
MQTTAgentContext_t * pMqttAgentContext;
MQTTAgentCommandFuncReturns_t * pReturnFlags;
MQTTPublishInfo_t * pPublishArg;
pMqttAgentContext = malloc( sizeof( MQTTAgentContext_t ) );
__CPROVER_assume( pMqttAgentContext != NULL );
pReturnFlags = malloc( sizeof( MQTTAgentCommandFuncReturns_t ) );
__CPROVER_assume( pReturnFlags != NULL );
pPublishArg = malloc( sizeof( MQTTPublishInfo_t ) );
__CPROVER_assume( pPublishArg != NULL );
MQTTAgentCommand_Publish( pMqttAgentContext, pPublishArg, pReturnFlags );
}

View File

@@ -0,0 +1,20 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
HARNESS_ENTRY = harness
HARNESS_FILE = MQTTAgentCommand_Publish_harness
# 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 = MQTTAgentCommand_Publish
DEFINES +=
INCLUDES +=
REMOVE_FUNCTION_BODY +=
UNWINDSET +=
PROOF_SOURCES += $(PROOFDIR)/$(HARNESS_FILE).c
PROJECT_SOURCES += $(SRCDIR)/source/core_mqtt_agent_command_functions.c
include ../Makefile.common

View File

@@ -0,0 +1,23 @@
MQTTAgentCommand_Publish proof
==============
This directory contains a memory safety proof for MQTTAgentCommand_Publish.
The proof runs within 10 seconds on a t2.2xlarge. It provides complete coverage of:
* MQTTAgentCommand_Publish()
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://awslabs.github.io/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`).

View File

@@ -0,0 +1 @@
# This file marks this directory as containing a CBMC proof.

View File

@@ -0,0 +1,7 @@
{ "expected-missing-functions":
[
],
"proof-name": "MQTTAgentCommand_Publish",
"proof-root": "test/cbmc/proofs"
}

View File

@@ -0,0 +1,45 @@
/*
* coreMQTT Agent <v1.3.1>
* 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
* 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 MQTTAgentCommand_Subscribe_harness.c
* @brief Implements the proof harness for MQTTAgentCommand_Subscribe function.
*/
/* MQTT agent include. */
#include "core_mqtt_agent_command_functions.h"
#include "mqtt_agent_cbmc_state.h"
void harness()
{
MQTTAgentContext_t * pMqttAgentContext;
MQTTAgentCommandFuncReturns_t * pReturnFlags;
MQTTAgentSubscribeArgs_t * pSubscribeArgs;
pMqttAgentContext = malloc( sizeof( MQTTAgentContext_t ) );
__CPROVER_assume( pMqttAgentContext != NULL );
pReturnFlags = malloc( sizeof( MQTTAgentCommandFuncReturns_t ) );
__CPROVER_assume( pReturnFlags != NULL );
pSubscribeArgs = allocateSubscribeArgs( NULL );
MQTTAgentCommand_Subscribe( pMqttAgentContext, pSubscribeArgs, pReturnFlags );
}

View File

@@ -0,0 +1,21 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
HARNESS_ENTRY = harness
HARNESS_FILE = MQTTAgentCommand_Subscribe_harness
# 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 = MQTTAgentCommand_Subscribe
DEFINES +=
INCLUDES +=
REMOVE_FUNCTION_BODY +=
UNWINDSET +=
PROOF_SOURCES += $(PROOFDIR)/$(HARNESS_FILE).c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/sources/mqtt_agent_cbmc_state.c
PROJECT_SOURCES += $(SRCDIR)/source/core_mqtt_agent_command_functions.c
include ../Makefile.common

View File

@@ -0,0 +1,23 @@
MQTTAgentCommand_Subscribe proof
==============
This directory contains a memory safety proof for MQTTAgentCommand_Subscribe.
The proof runs within 10 seconds on a t2.2xlarge. It provides complete coverage of:
* MQTTAgentCommand_Subscribe()
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://awslabs.github.io/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`).

View File

@@ -0,0 +1 @@
# This file marks this directory as containing a CBMC proof.

View File

@@ -0,0 +1,7 @@
{ "expected-missing-functions":
[
],
"proof-name": "MQTTAgentCommand_Subscribe",
"proof-root": "test/cbmc/proofs"
}

View File

@@ -0,0 +1,49 @@
/*
* coreMQTT Agent <v1.3.1>
* 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
* 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 MQTTAgentCommand_Terminate_harness.c
* @brief Implements the proof harness for MQTTAgentCommand_Terminate function.
*/
/* MQTT agent include. */
#include "core_mqtt_agent_command_functions.h"
#include "mqtt_agent_cbmc_state.h"
void harness()
{
MQTTAgentContext_t * pMqttAgentContext;
MQTTAgentCommandFuncReturns_t * pReturnFlags;
pMqttAgentContext = allocateMqttAgentContext( NULL );
__CPROVER_assume( pMqttAgentContext != NULL );
__CPROVER_assume( pMqttAgentContext->agentInterface.releaseCommand != NULL );
pReturnFlags = malloc( sizeof( MQTTAgentCommandFuncReturns_t ) );
__CPROVER_assume( pReturnFlags != NULL );
if( pMqttAgentContext != NULL )
{
addPendingAcks( pMqttAgentContext );
}
MQTTAgentCommand_Terminate( pMqttAgentContext, NULL, pReturnFlags );
}

View File

@@ -0,0 +1,42 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
HARNESS_ENTRY = harness
HARNESS_FILE = MQTTAgentCommand_Terminate_harness
# 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 = MQTTAgentCommand_Terminate
# MQTT_AGENT_MAX_OUTSTANDING_ACKS set the maximum number of acknowledgments
# that can be outstanding at any one time. A small number 2 will be enough
# for proving the memory safety and making the proofs run faster.
MQTT_AGENT_MAX_OUTSTANDING_ACKS=2
MAX_BOUND_FOR_RECEIVE_COMMAND_LOOP=2
# Bound for loop unwinding for the loops trying to read and write into the
# outstanding acks array. The size of the array is determined by
# MQTT_AGENT_MAX_OUTSTANDING_ACKS. The max bound will be one more than
# array size for the proofs.
MAX_BOUND_FOR_PENDING_ACK_LOOPS=$(shell expr $(MQTT_AGENT_MAX_OUTSTANDING_ACKS) + 1 )
DEFINES += -DMQTT_AGENT_MAX_OUTSTANDING_ACKS=$(MQTT_AGENT_MAX_OUTSTANDING_ACKS)
DEFINES +=
INCLUDES +=
REMOVE_FUNCTION_BODY += MQTTAgent_CancelAll
UNWINDSET += addPendingAcks.0:$(MAX_BOUND_FOR_PENDING_ACK_LOOPS)
PROOF_SOURCES += $(PROOFDIR)/$(HARNESS_FILE).c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/sources/mqtt_agent_cbmc_state.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/network_interface_stubs.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/incoming_publish_callback_stub.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/get_time_stub.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/agent_command_pool_stubs.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/agent_message_stubs.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/core_mqtt_stubs.c
PROJECT_SOURCES += $(SRCDIR)/source/core_mqtt_agent_command_functions.c
PROJECT_SOURCES += $(SRCDIR)/source/core_mqtt_agent.c
include ../Makefile.common

View File

@@ -0,0 +1,23 @@
MQTTAgentCommand_Terminate proof
==============
This directory contains a memory safety proof for MQTTAgentCommand_Terminate.
The proof runs within 10 seconds on a t2.2xlarge. It provides complete coverage of:
* MQTTAgentCommand_Terminate()
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://awslabs.github.io/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`).

View File

@@ -0,0 +1 @@
# This file marks this directory as containing a CBMC proof.

View File

@@ -0,0 +1,7 @@
{ "expected-missing-functions":
[
],
"proof-name": "MQTTAgentCommand_Terminate",
"proof-root": "test/cbmc/proofs"
}

View File

@@ -0,0 +1,45 @@
/*
* coreMQTT Agent <v1.3.1>
* 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
* 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 MQTTAgentCommand_Unsubscribe_harness.c
* @brief Implements the proof harness for MQTTAgentCommand_Unsubscribe function.
*/
/* MQTT agent include. */
#include "core_mqtt_agent_command_functions.h"
#include "mqtt_agent_cbmc_state.h"
void harness()
{
MQTTAgentContext_t * pMqttAgentContext;
MQTTAgentCommandFuncReturns_t * pReturnFlags;
MQTTAgentSubscribeArgs_t * pSubscribeArgs;
pMqttAgentContext = malloc( sizeof( MQTTAgentContext_t ) );
__CPROVER_assume( pMqttAgentContext != NULL );
pReturnFlags = malloc( sizeof( MQTTAgentCommandFuncReturns_t ) );
__CPROVER_assume( pReturnFlags != NULL );
pSubscribeArgs = allocateSubscribeArgs( NULL );
MQTTAgentCommand_Unsubscribe( pMqttAgentContext, pSubscribeArgs, pReturnFlags );
}

View File

@@ -0,0 +1,21 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
HARNESS_ENTRY = harness
HARNESS_FILE = MQTTAgentCommand_Unsubscribe_harness
# 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 = MQTTAgentCommand_Unsubscribe
DEFINES +=
INCLUDES +=
REMOVE_FUNCTION_BODY +=
UNWINDSET +=
PROOF_SOURCES += $(PROOFDIR)/$(HARNESS_FILE).c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/sources/mqtt_agent_cbmc_state.c
PROJECT_SOURCES += $(SRCDIR)/source/core_mqtt_agent_command_functions.c
include ../Makefile.common

View File

@@ -0,0 +1,23 @@
MQTTAgentCommand_Unsubscribe proof
==============
This directory contains a memory safety proof for MQTTAgentCommand_Unsubscribe.
The proof runs within 10 seconds on a t2.2xlarge. It provides complete coverage of:
* MQTTAgentCommand_Unsubscribe()
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://awslabs.github.io/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`).

View File

@@ -0,0 +1 @@
# This file marks this directory as containing a CBMC proof.

View File

@@ -0,0 +1,7 @@
{ "expected-missing-functions":
[
],
"proof-name": "MQTTAgentCommand_Unsubscribe",
"proof-root": "test/cbmc/proofs"
}

View File

@@ -0,0 +1,44 @@
/*
* coreMQTT Agent <v1.3.1>
* 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
* 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 MQTTAgent_CancelAll_harness.c
* @brief Implements the proof harness for MQTTAgent_CancelAll function.
*/
/* MQTT agent include. */
#include "core_mqtt_agent.h"
#include "mqtt_agent_cbmc_state.h"
void harness()
{
MQTTAgentContext_t * pMqttAgentContext;
pMqttAgentContext = allocateMqttAgentContext( NULL );
if( pMqttAgentContext != NULL )
{
addPendingAcks( pMqttAgentContext );
}
MQTTAgent_CancelAll( pMqttAgentContext );
}

View File

@@ -0,0 +1,43 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
HARNESS_ENTRY = harness
HARNESS_FILE = MQTTAgent_CancelAll_harness
# 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 = MQTTAgent_CancelAll
# MQTT_AGENT_MAX_OUTSTANDING_ACKS set the maximum number of acknowledgments
# that can be outstanding at any one time. A small number 2 will be enough
# for proving the memory safety and making the proofs run faster.
MQTT_AGENT_MAX_OUTSTANDING_ACKS=2
MAX_BOUND_FOR_RECEIVE_COMMAND_LOOP=2
# Bound for loop unwinding for the loops trying to read and write into the
# outstanding acks array. The size of the array is determined by
# MQTT_AGENT_MAX_OUTSTANDING_ACKS. The max bound will be one more than
# array size for the proofs.
MAX_BOUND_FOR_PENDING_ACK_LOOPS=$(shell expr $(MQTT_AGENT_MAX_OUTSTANDING_ACKS) + 1 )
DEFINES += -DMQTT_AGENT_MAX_OUTSTANDING_ACKS=$(MQTT_AGENT_MAX_OUTSTANDING_ACKS)
DEFINES +=
INCLUDES +=
REMOVE_FUNCTION_BODY +=
UNWINDSET += addPendingAcks.0:$(MAX_BOUND_FOR_PENDING_ACK_LOOPS)
UNWINDSET += MQTTAgent_CancelAll.0:$(MAX_BOUND_FOR_RECEIVE_COMMAND_LOOP)
UNWINDSET += MQTTAgent_CancelAll.1:$(MAX_BOUND_FOR_PENDING_ACK_LOOPS)
PROOF_SOURCES += $(PROOFDIR)/$(HARNESS_FILE).c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/sources/mqtt_agent_cbmc_state.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/network_interface_stubs.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/incoming_publish_callback_stub.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/get_time_stub.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/agent_command_pool_stubs.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/agent_message_stubs.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/core_mqtt_stubs.c
PROJECT_SOURCES += $(SRCDIR)/source/core_mqtt_agent.c
include ../Makefile.common

View File

@@ -0,0 +1,23 @@
MQTTAgent_CancelAll proof
==============
This directory contains a memory safety proof for MQTTAgent_CancelAll.
The proof runs within 3 minutes on a t2.2xlarge. It provides complete coverage of:
* MQTTAgent_CancelAll()
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://awslabs.github.io/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`).

View File

@@ -0,0 +1 @@
# This file marks this directory as containing a CBMC proof.

View File

@@ -0,0 +1,7 @@
{ "expected-missing-functions":
[
],
"proof-name": "MQTTAgent_CancelAll",
"proof-root": "test/cbmc/proofs"
}

View File

@@ -0,0 +1,40 @@
/*
* coreMQTT Agent <v1.3.1>
* 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
* 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.
*/
/* MQTT agent include. */
#include "core_mqtt_agent.h"
#include "mqtt_agent_cbmc_state.h"
void harness()
{
MQTTAgentContext_t * pMqttAgentContext = NULL;
pMqttAgentContext = allocateMqttAgentContext( pMqttAgentContext );
if( pMqttAgentContext != NULL )
{
pMqttAgentContext->mqttContext.connectStatus = MQTTConnected;
}
MQTTAgent_CommandLoop( pMqttAgentContext );
}

View File

@@ -0,0 +1,57 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
HARNESS_ENTRY = harness
HARNESS_FILE = MQTTAgent_CommandLoop_harness
# 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 = MQTTAgent_CommandLoop
# MQTT_AGENT_MAX_OUTSTANDING_ACKS set the maximum number of acknowledgments
# that can be outstanding at any one time. A small number 2 will be enough
# for proving the memory safety and making the proofs run faster.
MQTT_AGENT_MAX_OUTSTANDING_ACKS=2
# Bound for loop unwinding for the loops trying to read and write into the
# outstanding acks array. The size of the array is determined by
# MQTT_AGENT_MAX_OUTSTANDING_ACKS. The max bound will be one more than
# array size for the proofs.
MAX_BOUND_FOR_PENDING_ACK_LOOPS=$(shell expr $(MQTT_AGENT_MAX_OUTSTANDING_ACKS) + 1 )
# Bound for loop unwinding for the main loop in MQTTAgent_CommandLoop. Unwinding
# the loop 3 times will be enough for proving memory safety.
MAX_BOUND_FOR_COMMAND_LOOP=3
# Bound for loop unwinding for loop in processCommand function. Unwinding
# the loop 2 times will be enough for proving memory safety.
MAX_BOUND_FOR_PROCESS_COMMAND_LOOP=2
# Force CBMC to only use the AgentMessageRecvStub function as the pointee of
# the recv function.
RESTRICT_FUNCTION_POINTER += MQTTAgent_CommandLoop.function_pointer_call.1/AgentMessageRecvStub
DEFINES += -DMQTT_AGENT_MAX_OUTSTANDING_ACKS=$(MQTT_AGENT_MAX_OUTSTANDING_ACKS)
INCLUDES +=
REMOVE_FUNCTION_BODY +=
UNWINDSET += MQTTAgent_CommandLoop.0:$(MAX_BOUND_FOR_COMMAND_LOOP)
UNWINDSET += __CPROVER_file_local_core_mqtt_agent_c_addAwaitingOperation.0:$(MAX_BOUND_FOR_PENDING_ACK_LOOPS)
UNWINDSET += __CPROVER_file_local_core_mqtt_agent_c_getAwaitingOperation.0:$(MAX_BOUND_FOR_PENDING_ACK_LOOPS)
UNWINDSET += __CPROVER_file_local_core_mqtt_agent_c_processCommand.0:$(MAX_BOUND_FOR_PROCESS_COMMAND_LOOP)
PROOF_SOURCES += $(PROOFDIR)/$(HARNESS_FILE).c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/sources/mqtt_agent_cbmc_state.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/network_interface_stubs.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/incoming_publish_callback_stub.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/get_time_stub.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/agent_command_pool_stubs.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/agent_message_stubs.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/agent_command_functions_stub.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/core_mqtt_stubs.c
PROJECT_SOURCES += $(SRCDIR)/source/core_mqtt_agent.c
include ../Makefile.common

View File

@@ -0,0 +1,51 @@
MQTTAgent_CommandLoop proof
==============
This directory contains a memory safety proof for MQTTAgent_CommandLoop.
The proof runs within 3 minutes on a t2.2xlarge. It provides complete coverage of:
* MQTTAgent_CommandLoop()
* MQTTAgent_Init()
* addAwaitingOperation()
* getAgentFromMQTTContext()
* getAwaitingOperation()
* handleAcks()
* mqttEventCallback()
For this proof, stubs are used for the implementation of functions in the following interfaces and
function types. Since the implementation for these functions will be provided by the applications,
the proof only will require stubs.
* MQTTAgentMessageInterface_t
* TransportInterface_t
* MQTTGetCurrentTimeFunc_t
* MQTTAgentIncomingPublishCallback_t
* MQTTAgentCommandCallback_t
In addition to the interfaces and the function types, stubs are used for the below listed functions.
CBMC proofs are written for these functions separately.
* MQTTAgentCommand_ProcessLoop()
* MQTTAgentCommand_Publish()
* MQTTAgentCommand_Subscribe()
* MQTTAgentCommand_Unsubscribe()
* MQTTAgentCommand_Connect()
* MQTTAgentCommand_Disconnect()
* MQTTAgentCommand_Ping()
* MQTTAgentCommand_Terminate()
* MQTT_ProcessLoop()
* MQTT_Init()
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://awslabs.github.io/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`).

View File

@@ -0,0 +1 @@
# This file marks this directory as containing a CBMC proof.

View File

@@ -0,0 +1,7 @@
{ "expected-missing-functions":
[
],
"proof-name": "MQTTAgent_CommandLoop",
"proof-root": "test/cbmc/proofs"
}

View File

@@ -0,0 +1,47 @@
/*
* coreMQTT Agent <v1.3.1>
* 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
* 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.
*/
/* MQTT agent include. */
#include "core_mqtt_agent.h"
#include "mqtt_agent_cbmc_state.h"
void harness()
{
MQTTAgentContext_t * pMqttAgentContext;
MQTTAgentConnectArgs_t * pConnectArgs;
MQTTAgentCommandInfo_t * pCommandInfo;
MQTTStatus_t mqttStatus;
pMqttAgentContext = allocateMqttAgentContext( NULL );
__CPROVER_assume( isValidMqttAgentContext( pMqttAgentContext ) );
pConnectArgs = malloc( sizeof( MQTTAgentConnectArgs_t ) );
pCommandInfo = malloc( sizeof( MQTTAgentCommandInfo_t ) );
mqttStatus = MQTTAgent_Connect( pMqttAgentContext,
pConnectArgs,
pCommandInfo );
__CPROVER_assert( isAgentSendCommandFunctionStatus( mqttStatus ), "The return value is a MQTTStatus_t." );
}

View File

@@ -0,0 +1,29 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
HARNESS_ENTRY = harness
HARNESS_FILE = MQTTAgent_Connect_harness
# 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 = MQTTAgent_Connect
DEFINES +=
INCLUDES +=
REMOVE_FUNCTION_BODY +=
UNWINDSET +=
PROOF_SOURCES += $(PROOFDIR)/$(HARNESS_FILE).c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/sources/mqtt_agent_cbmc_state.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/network_interface_stubs.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/incoming_publish_callback_stub.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/get_time_stub.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/agent_command_pool_stubs.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/agent_message_stubs.c
PROJECT_SOURCES += $(SRCDIR)/source/core_mqtt_agent.c
PROJECT_SOURCES += $(SRCDIR)/source/dependency/coreMQTT/source/core_mqtt.c
PROJECT_SOURCES += $(SRCDIR)/source/dependency/coreMQTT/source/core_mqtt_serializer.c
include ../Makefile.common

View File

@@ -0,0 +1,35 @@
MQTTAgent_Connect proof
==============
This directory contains a memory safety proof for MQTTAgent_Connect.
The proof runs within 10 seconds on a t2.2xlarge. It provides complete coverage of:
* MQTTAgent_Connect()
* MQTTAgent_Init()
* addCommandToQueue()
* createAndAddCommand()
* validateStruct()
For this proof, stubs are used for the implementation of functions in the following interfaces and
function types. Since the implementation for these functions will be provided by the applications,
the proof only will require stubs.
* MQTTAgentMessageInterface_t
* TransportInterface_t
* MQTTGetCurrentTimeFunc_t
* MQTTAgentIncomingPublishCallback_t
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://awslabs.github.io/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`).

View File

@@ -0,0 +1 @@
# This file marks this directory as containing a CBMC proof.

View File

@@ -0,0 +1,7 @@
{ "expected-missing-functions":
[
],
"proof-name": "MQTTAgent_Connect",
"proof-root": "test/cbmc/proofs"
}

View File

@@ -0,0 +1,40 @@
/*
* coreMQTT Agent <v1.3.1>
* 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
* 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.
*/
/* MQTT agent include. */
#include "core_mqtt_agent.h"
#include "mqtt_agent_cbmc_state.h"
void harness()
{
MQTTAgentContext_t * pMqttAgentContext;
MQTTAgentCommandInfo_t * pCommandInfo;
pMqttAgentContext = allocateMqttAgentContext( NULL );
__CPROVER_assume( isValidMqttAgentContext( pMqttAgentContext ) );
pCommandInfo = malloc( sizeof( MQTTAgentCommandInfo_t ) );
MQTTAgent_Disconnect( pMqttAgentContext,
pCommandInfo );
}

View File

@@ -0,0 +1,29 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
HARNESS_ENTRY = harness
HARNESS_FILE = MQTTAgent_Disconnect_harness
# 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 = MQTTAgent_Disconnect
DEFINES +=
INCLUDES +=
REMOVE_FUNCTION_BODY +=
UNWINDSET +=
PROOF_SOURCES += $(PROOFDIR)/$(HARNESS_FILE).c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/sources/mqtt_agent_cbmc_state.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/network_interface_stubs.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/incoming_publish_callback_stub.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/get_time_stub.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/agent_command_pool_stubs.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/agent_message_stubs.c
PROJECT_SOURCES += $(SRCDIR)/source/core_mqtt_agent.c
PROJECT_SOURCES += $(SRCDIR)/source/dependency/coreMQTT/source/core_mqtt.c
PROJECT_SOURCES += $(SRCDIR)/source/dependency/coreMQTT/source/core_mqtt_serializer.c
include ../Makefile.common

View File

@@ -0,0 +1,20 @@
MQTTAgent_Disconnect proof
==============
This directory contains a memory safety proof for MQTTAgent_Disconnect.
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://awslabs.github.io/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`).

View File

@@ -0,0 +1 @@
# This file marks this directory as containing a CBMC proof.

View File

@@ -0,0 +1,7 @@
{ "expected-missing-functions":
[
],
"proof-name": "MQTTAgent_Disconnect",
"proof-root": "test/cbmc/proofs"
}

View File

@@ -0,0 +1,48 @@
/*
* coreMQTT Agent <v1.3.1>
* 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
* 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.
*/
/* MQTT agent include. */
#include "core_mqtt_agent.h"
void harness()
{
MQTTAgentContext_t * pMqttAgentContext;
MQTTAgentMessageInterface_t * pMsgInterface;
MQTTFixedBuffer_t * pNetworkBuffer;
TransportInterface_t * pTransportInterface;
MQTTGetCurrentTimeFunc_t getCurrentTimeMs;
MQTTAgentIncomingPublishCallback_t incomingCallback;
void * pIncomingPacketContext;
pMqttAgentContext = malloc( sizeof( MQTTAgentContext_t ) );
pMsgInterface = malloc( sizeof( MQTTAgentMessageInterface_t ) );
pNetworkBuffer = malloc( sizeof( MQTTFixedBuffer_t ) );
pTransportInterface = malloc( sizeof( TransportInterface_t ) );
MQTTAgent_Init( pMqttAgentContext,
pMsgInterface,
pNetworkBuffer,
pTransportInterface,
getCurrentTimeMs,
incomingCallback,
pIncomingPacketContext );
}

View File

@@ -0,0 +1,21 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
HARNESS_ENTRY = harness
HARNESS_FILE = MQTTAgent_Init_harness
# 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 = MQTTAgent_Init
DEFINES +=
INCLUDES +=
REMOVE_FUNCTION_BODY +=
UNWINDSET +=
PROOF_SOURCES += $(PROOFDIR)/$(HARNESS_FILE).c
PROJECT_SOURCES += $(SRCDIR)/source/core_mqtt_agent.c
include ../Makefile.common

View File

@@ -0,0 +1,20 @@
MQTTAgent_Init proof
==============
This directory contains a memory safety proof for MQTTAgent_Init.
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://awslabs.github.io/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`).

View File

@@ -0,0 +1 @@
# This file marks this directory as containing a CBMC proof.

View File

@@ -0,0 +1,7 @@
{ "expected-missing-functions":
[
],
"proof-name": "MQTTAgent_Init",
"proof-root": "test/cbmc/proofs"
}

View File

@@ -0,0 +1,45 @@
/*
* coreMQTT Agent <v1.3.1>
* 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
* 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.
*/
/* MQTT agent include. */
#include "core_mqtt_agent.h"
#include "mqtt_agent_cbmc_state.h"
void harness()
{
MQTTAgentContext_t * pMqttAgentContext;
MQTTAgentCommandInfo_t * pCommandInfo;
MQTTStatus_t mqttStatus;
pMqttAgentContext = allocateMqttAgentContext( NULL );
__CPROVER_assume( isValidMqttAgentContext( pMqttAgentContext ) );
/* MQTTAgentCommandInfo is only added to Queue in MQTTAgent_Ping and
* non deterministic values for the members of MQTTAgentCommandInfo_t
* type will be sufficient for this proof. */
pCommandInfo = malloc( sizeof( MQTTAgentCommandInfo_t ) );
mqttStatus = MQTTAgent_Ping( pMqttAgentContext,
pCommandInfo );
__CPROVER_assert( isAgentSendCommandFunctionStatus( mqttStatus ), "The return value is a MQTTStatus_t." );
}

View File

@@ -0,0 +1,29 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
HARNESS_ENTRY = harness
HARNESS_FILE = MQTTAgent_Ping_harness
# 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 = MQTTAgent_Ping
DEFINES +=
INCLUDES +=
REMOVE_FUNCTION_BODY +=
UNWINDSET +=
PROOF_SOURCES += $(PROOFDIR)/$(HARNESS_FILE).c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/sources/mqtt_agent_cbmc_state.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/network_interface_stubs.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/incoming_publish_callback_stub.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/get_time_stub.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/agent_command_pool_stubs.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/agent_message_stubs.c
PROJECT_SOURCES += $(SRCDIR)/source/core_mqtt_agent.c
PROJECT_SOURCES += $(SRCDIR)/source/dependency/coreMQTT/source/core_mqtt.c
PROJECT_SOURCES += $(SRCDIR)/source/dependency/coreMQTT/source/core_mqtt_serializer.c
include ../Makefile.common

View File

@@ -0,0 +1,36 @@
MQTTAgent_Ping proof
==============
This directory contains a memory safety proof for MQTTAgent_Ping.
The proof runs within 10 seconds on a t2.2xlarge. It provides complete coverage of:
* MQTTAgent_Ping()
* MQTTAgent_Init()
* addCommandToQueue()
* createAndAddCommand()
* validateStruct()
* isSpaceInPendingAckList()
For this proof, stubs are used for the implementation of functions in the following interfaces and
function types. Since the implementation for these functions will be provided by the applications,
the proof only will require stubs.
* MQTTAgentMessageInterface_t
* TransportInterface_t
* MQTTGetCurrentTimeFunc_t
* MQTTAgentIncomingPublishCallback_t
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://awslabs.github.io/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`).

View File

@@ -0,0 +1 @@
# This file marks this directory as containing a CBMC proof.

View File

@@ -0,0 +1,7 @@
{ "expected-missing-functions":
[
],
"proof-name": "MQTTAgent_Ping",
"proof-root": "test/cbmc/proofs"
}

View File

@@ -0,0 +1,46 @@
/*
* coreMQTT Agent <v1.3.1>
* 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
* 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.
*/
/* MQTT agent include. */
#include "core_mqtt_agent.h"
#include "mqtt_agent_cbmc_state.h"
void harness()
{
MQTTAgentContext_t * pMqttAgentContext;
MQTTAgentCommandInfo_t * pCommandInfo;
MQTTStatus_t mqttStatus;
pMqttAgentContext = allocateMqttAgentContext( NULL );
__CPROVER_assume( isValidMqttAgentContext( pMqttAgentContext ) );
/* MQTTAgentCommandInfo is only added to Queue in MQTTAgent_ProcessLoop and
* non deterministic values for the members of MQTTAgentCommandInfo_t type
* will be sufficient for this proof. */
pCommandInfo = malloc( sizeof( MQTTAgentCommandInfo_t ) );
mqttStatus = MQTTAgent_ProcessLoop( pMqttAgentContext,
pCommandInfo );
__CPROVER_assert( isAgentSendCommandFunctionStatus( mqttStatus ), "The return value is a MQTTStatus_t." );
}

View File

@@ -0,0 +1,30 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
HARNESS_ENTRY = harness
HARNESS_FILE = MQTTAgent_ProcessLoop_harness
# 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 = MQTTAgent_ProcessLoop
DEFINES +=
INCLUDES +=
REMOVE_FUNCTION_BODY +=
UNWINDSET +=
PROOF_SOURCES += $(PROOFDIR)/$(HARNESS_FILE).c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/sources/mqtt_agent_cbmc_state.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/network_interface_stubs.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/incoming_publish_callback_stub.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/get_time_stub.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/agent_command_pool_stubs.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/agent_message_stubs.c
PROJECT_SOURCES += $(SRCDIR)/source/core_mqtt_agent.c
PROJECT_SOURCES += $(SRCDIR)/source/dependency/coreMQTT/source/core_mqtt.c
PROJECT_SOURCES += $(SRCDIR)/source/dependency/coreMQTT/source/core_mqtt_serializer.c
include ../Makefile.common

View File

@@ -0,0 +1,36 @@
MQTTAgent_ProcessLoop proof
==============
This directory contains a memory safety proof for MQTTAgent_ProcessLoop.
The proof runs within 10 seconds on a t2.2xlarge. It provides complete coverage of:
* MQTTAgent_ProcessLoop()
* MQTTAgent_Init()
* addCommandToQueue()
* createAndAddCommand()
* validateStruct()
* isSpaceInPendingAckList()
For this proof, stubs are used for the implementation of functions in the following interfaces and
function types. Since the implementation for these functions will be provided by the applications,
the proof only will require stubs.
* MQTTAgentMessageInterface_t
* TransportInterface_t
* MQTTGetCurrentTimeFunc_t
* MQTTAgentIncomingPublishCallback_t
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://awslabs.github.io/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`).

View File

@@ -0,0 +1 @@
# This file marks this directory as containing a CBMC proof.

View File

@@ -0,0 +1,7 @@
{ "expected-missing-functions":
[
],
"proof-name": "MQTTAgent_ProcessLoop",
"proof-root": "test/cbmc/proofs"
}

View File

@@ -0,0 +1,50 @@
/*
* coreMQTT Agent <v1.3.1>
* 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
* 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.
*/
/* MQTT agent include. */
#include "core_mqtt_agent.h"
#include "mqtt_agent_cbmc_state.h"
void harness()
{
MQTTAgentContext_t * pMqttAgentContext;
MQTTPublishInfo_t * pPublishInfo;
MQTTAgentCommandInfo_t * pCommandInfo;
MQTTStatus_t mqttStatus;
pMqttAgentContext = allocateMqttAgentContext( NULL );
__CPROVER_assume( isValidMqttAgentContext( pMqttAgentContext ) );
/* MQTTAgentCommandInfo and MQTTPublishInfo_t are only added to Queue
* in MQTTAgent_Publish and non deterministic values for the
* members of MQTTAgentCommandInfo_t and MQTTPublishInfo_t type will be
* sufficient for this proof.*/
pPublishInfo = malloc( sizeof( MQTTPublishInfo_t ) );
pCommandInfo = malloc( sizeof( MQTTAgentCommandInfo_t ) );
mqttStatus = MQTTAgent_Publish( pMqttAgentContext,
pPublishInfo,
pCommandInfo );
__CPROVER_assert( isAgentSendCommandFunctionStatus( mqttStatus ), "The return value is a MQTTStatus_t." );
}

View File

@@ -0,0 +1,29 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
HARNESS_ENTRY = harness
HARNESS_FILE = MQTTAgent_Publish_harness
# 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 = MQTTAgent_Publish
DEFINES +=
INCLUDES +=
REMOVE_FUNCTION_BODY +=
UNWINDSET +=
PROOF_SOURCES += $(PROOFDIR)/$(HARNESS_FILE).c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/sources/mqtt_agent_cbmc_state.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/network_interface_stubs.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/incoming_publish_callback_stub.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/get_time_stub.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/agent_command_pool_stubs.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/agent_message_stubs.c
PROJECT_SOURCES += $(SRCDIR)/source/core_mqtt_agent.c
PROJECT_SOURCES += $(SRCDIR)/source/dependency/coreMQTT/source/core_mqtt.c
PROJECT_SOURCES += $(SRCDIR)/source/dependency/coreMQTT/source/core_mqtt_serializer.c
include ../Makefile.common

View File

@@ -0,0 +1,36 @@
MQTTAgent_Publish proof
==============
This directory contains a memory safety proof for MQTTAgent_Publish.
The proof runs within 10 seconds on a t2.2xlarge. It provides complete coverage of:
* MQTTAgent_Publish()
* MQTTAgent_Init()
* addCommandToQueue()
* createAndAddCommand()
* validateStruct()
* isSpaceInPendingAckList()
For this proof, stubs are used for the implementation of functions in the following interfaces and
function types. Since the implementation for these functions will be provided by the applications,
the proof only will require stubs.
* MQTTAgentMessageInterface_t
* TransportInterface_t
* MQTTGetCurrentTimeFunc_t
* MQTTAgentIncomingPublishCallback_t
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://awslabs.github.io/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`).

View File

@@ -0,0 +1 @@
# This file marks this directory as containing a CBMC proof.

View File

@@ -0,0 +1,7 @@
{ "expected-missing-functions":
[
],
"proof-name": "MQTTAgent_Publish",
"proof-root": "test/cbmc/proofs"
}

View File

@@ -0,0 +1,46 @@
/*
* coreMQTT Agent <v1.3.1>
* 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
* 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.
*/
/* MQTT agent include. */
#include "core_mqtt_agent.h"
#include "mqtt_agent_cbmc_state.h"
void harness()
{
MQTTAgentContext_t * pMqttAgentContext;
bool sessionPresent;
MQTTStatus_t mqttStatus;
pMqttAgentContext = allocateMqttAgentContext( NULL );
if( pMqttAgentContext != NULL )
{
addPendingAcks( pMqttAgentContext );
}
mqttStatus = MQTTAgent_ResumeSession( pMqttAgentContext,
sessionPresent );
__CPROVER_assert( ( mqttStatus >= MQTTSuccess && mqttStatus <= MQTTKeepAliveTimeout ),
"Return status from MQTTAgent_ResumeSession is a MQTT status." );
}

View File

@@ -0,0 +1,50 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
HARNESS_ENTRY = harness
HARNESS_FILE = MQTTAgent_ResumeSession_harness
# 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 = MQTTAgent_ResumeSession
# MQTT_AGENT_MAX_OUTSTANDING_ACKS set the maximum number of acknowledgments
# that can be outstanding at any one time. A small number 2 will be enough
# for proving the memory safety and making the proofs run faster.
MQTT_AGENT_MAX_OUTSTANDING_ACKS=2
# Bound for loop unwinding for the loops trying to read and write into the
# outstanding acks array. The size of the array is determined by
# MQTT_AGENT_MAX_OUTSTANDING_ACKS. The max bound will be one more than
# array size for the proofs.
MAX_BOUND_FOR_PENDING_ACK_LOOPS=$(shell expr $(MQTT_AGENT_MAX_OUTSTANDING_ACKS) + 1 )
# The maximum value for packet identifier for the packets to be filled in the
# pending acks array. Chosen a small value 5 to increase the probability of
# finding a matching packet for query from MQTT_PublishToResend API.
MAX_PACKET_ID=5
DEFINES += -DMQTT_AGENT_MAX_OUTSTANDING_ACKS=$(MQTT_AGENT_MAX_OUTSTANDING_ACKS)
DEFINES += -DMAX_PACKET_ID=$(MAX_PACKET_ID)
INCLUDES +=
REMOVE_FUNCTION_BODY +=
UNWINDSET += __CPROVER_file_local_core_mqtt_agent_c_getAwaitingOperation.0:$(MAX_BOUND_FOR_PENDING_ACK_LOOPS)
UNWINDSET += __CPROVER_file_local_core_mqtt_agent_c_clearPendingAcknowledgments.0:$(MAX_BOUND_FOR_PENDING_ACK_LOOPS)
UNWINDSET += __CPROVER_file_local_core_mqtt_agent_c_resendPublishes.0:$(MAX_BOUND_FOR_PENDING_ACK_LOOPS)
UNWINDSET += addPendingAcks.0:$(MAX_BOUND_FOR_PENDING_ACK_LOOPS)
PROOF_SOURCES += $(PROOFDIR)/$(HARNESS_FILE).c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/sources/mqtt_agent_cbmc_state.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/network_interface_stubs.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/incoming_publish_callback_stub.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/get_time_stub.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/agent_command_pool_stubs.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/agent_message_stubs.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/core_mqtt_stubs.c
PROJECT_SOURCES += $(SRCDIR)/source/core_mqtt_agent.c
include ../Makefile.common

View File

@@ -0,0 +1,45 @@
MQTTAgent_ResumeSession proof
==============
This directory contains a memory safety proof for MQTTAgent_ResumeSession.
The proof runs within 10 seconds on a t2.2xlarge. It provides complete coverage of:
* MQTTAgent_ResumeSession()
* MQTTAgent_Init()
* clearPendingAcknowledgments()
* resendPublishes()
* concludeCommand()
* addPendingAcks()
* isSpaceInPendingAckList()
For this proof, stubs are used for the implementation of functions in the following interfaces and
function types. Since the implementation for these functions will be provided by the applications,
the proof only will require stubs.
* MQTTAgentMessageInterface_t
* TransportInterface_t
* MQTTGetCurrentTimeFunc_t
* MQTTAgentIncomingPublishCallback_t
* MQTTAgentCommandCallback_t
In addition to the interfaces and the function types, stubs are used for the below listed functions.
CBMC proofs are written for these functions separately.
* MQTT_ProcessLoop()
* MQTT_Init()
* MQTT_Publish()
* MQTT_PublishToResend()
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://awslabs.github.io/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`).

View File

@@ -0,0 +1 @@
# This file marks this directory as containing a CBMC proof.

View File

@@ -0,0 +1,7 @@
{ "expected-missing-functions":
[
],
"proof-name": "MQTTAgent_ResumeSession",
"proof-root": "test/cbmc/proofs"
}

View File

@@ -0,0 +1,50 @@
/*
* coreMQTT Agent <v1.3.1>
* 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
* 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.
*/
/* MQTT agent include. */
#include "core_mqtt_agent.h"
#include "mqtt_agent_cbmc_state.h"
void harness()
{
MQTTAgentContext_t * pMqttAgentContext;
MQTTAgentSubscribeArgs_t * pSubscriptionArgs;
MQTTAgentCommandInfo_t * pCommandInfo;
MQTTStatus_t mqttStatus;
pMqttAgentContext = allocateMqttAgentContext( NULL );
__CPROVER_assume( isValidMqttAgentContext( pMqttAgentContext ) );
/* MQTTAgentCommandInfo and MQTTAgentSubscribeArgs_t are only added to Queue
* in MQTTAgent_Subscribe and non deterministic values for the members
* of MQTTAgentCommandInfo_t and MQTTAgentSubscribeArgs_t type will be sufficient
* for this proof.*/
pSubscriptionArgs = malloc( sizeof( MQTTAgentSubscribeArgs_t ) );
pCommandInfo = malloc( sizeof( MQTTAgentCommandInfo_t ) );
mqttStatus = MQTTAgent_Subscribe( pMqttAgentContext,
pSubscriptionArgs,
pCommandInfo );
__CPROVER_assert( isAgentSendCommandFunctionStatus( mqttStatus ), "The return value is a MQTTStatus_t." );
}

View File

@@ -0,0 +1,29 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
HARNESS_ENTRY = harness
HARNESS_FILE = MQTTAgent_Subscribe_harness
# 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 = MQTTAgent_Subscribe
DEFINES +=
INCLUDES +=
REMOVE_FUNCTION_BODY +=
UNWINDSET +=
PROOF_SOURCES += $(PROOFDIR)/$(HARNESS_FILE).c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/sources/mqtt_agent_cbmc_state.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/network_interface_stubs.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/incoming_publish_callback_stub.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/get_time_stub.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/agent_command_pool_stubs.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/agent_message_stubs.c
PROJECT_SOURCES += $(SRCDIR)/source/core_mqtt_agent.c
PROJECT_SOURCES += $(SRCDIR)/source/dependency/coreMQTT/source/core_mqtt.c
PROJECT_SOURCES += $(SRCDIR)/source/dependency/coreMQTT/source/core_mqtt_serializer.c
include ../Makefile.common

View File

@@ -0,0 +1,36 @@
MQTTAgent_Subscribe proof
==============
This directory contains a memory safety proof for MQTTAgent_Subscribe.
The proof runs within 10 seconds on a t2.2xlarge. It provides complete coverage of:
* MQTTAgent_Subscribe()
* MQTTAgent_Init()
* addCommandToQueue()
* createAndAddCommand()
* validateStruct()
* isSpaceInPendingAckList()
For this proof, stubs are used for the implementation of functions in the following interfaces and
function types. Since the implementation for these functions will be provided by the applications,
the proof only will require stubs.
* MQTTAgentMessageInterface_t
* TransportInterface_t
* MQTTGetCurrentTimeFunc_t
* MQTTAgentIncomingPublishCallback_t
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://awslabs.github.io/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`).

View File

@@ -0,0 +1 @@
# This file marks this directory as containing a CBMC proof.

View File

@@ -0,0 +1,7 @@
{ "expected-missing-functions":
[
],
"proof-name": "MQTTAgent_Subscribe",
"proof-root": "test/cbmc/proofs"
}

View File

@@ -0,0 +1,47 @@
/*
* coreMQTT Agent <v1.3.1>
* 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
* 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.
*/
/* MQTT agent include. */
#include "core_mqtt_agent.h"
#include "mqtt_agent_cbmc_state.h"
/* Test harness entry function. */
void harness()
{
MQTTAgentContext_t * pMqttAgentContext;
MQTTAgentCommandInfo_t * pCommandInfo;
MQTTStatus_t mqttStatus;
pMqttAgentContext = allocateMqttAgentContext( NULL );
__CPROVER_assume( isValidMqttAgentContext( pMqttAgentContext ) );
/* MQTTAgentCommandInfo is only added to Queue in MQTTAgent_Terminate and
* non deterministic values for the members of MQTTAgentCommandInfo_t type
* will be sufficient for this proof.*/
pCommandInfo = malloc( sizeof( MQTTAgentCommandInfo_t ) );
mqttStatus = MQTTAgent_Terminate( pMqttAgentContext,
pCommandInfo );
__CPROVER_assert( isAgentSendCommandFunctionStatus( mqttStatus ), "The return value is a MQTTStatus_t." );
}

View File

@@ -0,0 +1,29 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
HARNESS_ENTRY = harness
HARNESS_FILE = MQTTAgent_Terminate_harness
# 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 = MQTTAgent_Terminate
DEFINES +=
INCLUDES +=
REMOVE_FUNCTION_BODY +=
UNWINDSET +=
PROOF_SOURCES += $(PROOFDIR)/$(HARNESS_FILE).c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/sources/mqtt_agent_cbmc_state.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/network_interface_stubs.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/incoming_publish_callback_stub.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/get_time_stub.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/agent_command_pool_stubs.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/agent_message_stubs.c
PROJECT_SOURCES += $(SRCDIR)/source/core_mqtt_agent.c
PROJECT_SOURCES += $(SRCDIR)/source/dependency/coreMQTT/source/core_mqtt.c
PROJECT_SOURCES += $(SRCDIR)/source/dependency/coreMQTT/source/core_mqtt_serializer.c
include ../Makefile.common

View File

@@ -0,0 +1,35 @@
MQTTAgent_Terminate proof
==============
This directory contains a memory safety proof for MQTTAgent_Terminate.
The proof runs within 10 seconds on a t2.2xlarge. It provides complete coverage of:
* MQTTAgent_Terminate()
* MQTTAgent_Init()
* addCommandToQueue()
* createAndAddCommand()
* validateStruct()
For this proof, stubs are used for the implementation of functions in the following interfaces and
function types. Since the implementation for these functions will be provided by the applications,
the proof only will require stubs.
* MQTTAgentMessageInterface_t
* TransportInterface_t
* MQTTGetCurrentTimeFunc_t
* MQTTAgentIncomingPublishCallback_t
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://awslabs.github.io/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`).

View File

@@ -0,0 +1 @@
# This file marks this directory as containing a CBMC proof.

View File

@@ -0,0 +1,7 @@
{ "expected-missing-functions":
[
],
"proof-name": "MQTTAgent_Terminate",
"proof-root": "test/cbmc/proofs"
}

View File

@@ -0,0 +1,50 @@
/*
* coreMQTT Agent <v1.3.1>
* 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
* 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.
*/
/* MQTT agent include. */
#include "core_mqtt_agent.h"
#include "mqtt_agent_cbmc_state.h"
void harness()
{
MQTTAgentContext_t * pMqttAgentContext;
MQTTAgentSubscribeArgs_t * pSubscriptionArgs;
MQTTAgentCommandInfo_t * pCommandInfo;
MQTTStatus_t mqttStatus;
pMqttAgentContext = allocateMqttAgentContext( NULL );
__CPROVER_assume( isValidMqttAgentContext( pMqttAgentContext ) );
/* MQTTAgentCommandInfo and MQTTAgentSubscribeArgs_t are only added to Queue
* in MQTTAgent_Unsubscribe and non deterministic values for the members
* of MQTTAgentCommandInfo_t and MQTTAgentSubscribeArgs_t type will be sufficient
* for this proof. */
pSubscriptionArgs = malloc( sizeof( MQTTAgentSubscribeArgs_t ) );
pCommandInfo = malloc( sizeof( MQTTAgentCommandInfo_t ) );
mqttStatus = MQTTAgent_Unsubscribe( pMqttAgentContext,
pSubscriptionArgs,
pCommandInfo );
__CPROVER_assert( isAgentSendCommandFunctionStatus( mqttStatus ), "The return value is a MQTTStatus_t." );
}

View File

@@ -0,0 +1,29 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
HARNESS_ENTRY = harness
HARNESS_FILE = MQTTAgent_Unsubscribe_harness
# 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 = MQTTAgent_Unsubscribe
DEFINES +=
INCLUDES +=
REMOVE_FUNCTION_BODY +=
UNWINDSET +=
PROOF_SOURCES += $(PROOFDIR)/$(HARNESS_FILE).c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/sources/mqtt_agent_cbmc_state.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/network_interface_stubs.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/incoming_publish_callback_stub.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/get_time_stub.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/agent_command_pool_stubs.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/agent_message_stubs.c
PROJECT_SOURCES += $(SRCDIR)/source/core_mqtt_agent.c
PROJECT_SOURCES += $(SRCDIR)/source/dependency/coreMQTT/source/core_mqtt.c
PROJECT_SOURCES += $(SRCDIR)/source/dependency/coreMQTT/source/core_mqtt_serializer.c
include ../Makefile.common

View File

@@ -0,0 +1,36 @@
MQTTAgent_Unsubscribe proof
==============
This directory contains a memory safety proof for MQTTAgent_Unsubscribe.
The proof runs within 10 seconds on a t2.2xlarge. It provides complete coverage of:
* MQTTAgent_Unsubscribe()
* MQTTAgent_Init()
* addCommandToQueue()
* createAndAddCommand()
* validateStruct()
* isSpaceInPendingAckList()
For this proof, stubs are used for the implementation of functions in the following interfaces and
function types. Since the implementation for these functions will be provided by the applications,
the proof only will require stubs.
* MQTTAgentMessageInterface_t
* TransportInterface_t
* MQTTGetCurrentTimeFunc_t
* MQTTAgentIncomingPublishCallback_t
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://awslabs.github.io/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`).

View File

@@ -0,0 +1 @@
# This file marks this directory as containing a CBMC proof.

View File

@@ -0,0 +1,7 @@
{ "expected-missing-functions":
[
],
"proof-name": "MQTTAgent_Unsubscribe",
"proof-root": "test/cbmc/proofs"
}

Some files were not shown because too many files have changed in this diff Show More