[修改] 增加freeRTOS

1. 版本FreeRTOSv202212.01,命名为kernel;
This commit is contained in:
2023-05-06 16:43:01 +00:00
commit a345df017b
20944 changed files with 11094377 additions and 0 deletions

View File

@ -0,0 +1,62 @@
/*
* FreeRTOS-Cellular-Interface v1.3.0
* 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.
*
* https://www.FreeRTOS.org
* https://github.com/FreeRTOS
*/
/* Standard includes. */
#include <stdint.h>
/* Cellular default config includes. */
#include "cellular_config.h"
#include "cellular_config_defaults.h"
/* Cellular APIs includes. */
#include "cellular_platform.h"
#include "cellular_types.h"
#include "cellular_common_internal.h"
#include "cellular_common_api.h"
#define ensure_memory_is_valid( px, length ) ( px != NULL ) && ( length > 0 ) && __CPROVER_w_ok( ( px ), length ) && __CPROVER_r_ok( ( px ), length )
/* Extern the com interface in comm_if_windows.c */
extern CellularCommInterface_t CellularCommInterface;
/****************************************************************
* The signature of the function under test.
****************************************************************/
CellularATError_t Cellular_ATGetNextTok( char ** ppString,
char ** ppTokOutput );
/****************************************************************
* The proof of Cellular_ATGetNextTok
****************************************************************/
void harness()
{
const char ** ppString;
const char ** ppTokOutput;
ppString = ( char * ) safeMalloc( sizeof( *ppString ) );
ppTokOutput = ( char * ) safeMalloc( sizeof( *ppTokOutput ) );
Cellular_ATGetNextTok( ppString, ppTokOutput );
}

View File

@ -0,0 +1,39 @@
#
# Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
# the Software, and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
HARNESS_ENTRY=harness
HARNESS_FILE=Cellular_ATGetNextTok_harness
PROOF_UID = Cellular_ATGetNextTok
DEFINES +=
INCLUDES +=
# Remove this function because it will has its own harness.
REMOVE_FUNCTION_BODY += Cellular_ATGetSpecificNextTok
PROOF_SOURCES += $(PROOFDIR)/$(HARNESS_FILE).c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/sources/cellular_cbmc_state.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/sources/global_state_cellular.c
PROJECT_SOURCES += $(SRCDIR)/source/cellular_at_core.c
include ../Makefile.common

View File

@ -0,0 +1,10 @@
Cellular_ATGetNextTok proof
==============
This directory contains a memory safety proof for Cellular_ATGetNextTok.
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.

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": "Cellular_ATGetNextTok",
"proof-root": "tools/cbmc/proofs"
}

View File

@ -0,0 +1,81 @@
/*
* FreeRTOS-Cellular-Interface v1.3.0
* 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.
*
* https://www.FreeRTOS.org
* https://github.com/FreeRTOS
*/
/* Standard includes. */
#include <stdint.h>
/* Cellular default config includes. */
#include "cellular_config.h"
#include "cellular_config_defaults.h"
/* Cellular APIs includes. */
#include "cellular_platform.h"
#include "cellular_types.h"
#include "cellular_common_internal.h"
#include "cellular_common_api.h"
#define ensure_memory_is_valid( px, length ) ( px != NULL ) && ( length > 0 ) && __CPROVER_w_ok( ( px ), length ) && __CPROVER_r_ok( ( px ), length )
/* Extern the com interface in comm_if_windows.c */
extern CellularCommInterface_t CellularCommInterface;
/****************************************************************
* The signature of the function under test.
****************************************************************/
CellularATError_t Cellular_ATGetSpecificNextTok( char ** ppString,
const char * pDelimiter,
char ** ppTokOutput );
/****************************************************************
* The proof of Cellular_ATGetSpecificNextTok
****************************************************************/
void harness()
{
const char ** ppString;
const char ** ppTokOutput;
const char * pDelimiter;
uint16_t stringLength;
uint16_t delLength;
__CPROVER_assume( stringLength > 0 && stringLength < CBMC_MAX_BUFSIZE );
__CPROVER_assume( delLength > 0 && delLength < CBMC_MAX_BUFSIZE );
char * pString = ( char * ) safeMalloc( stringLength );
ppString = nondet_bool() ? NULL : &pString;
ppTokOutput = ( char * ) safeMalloc( sizeof( *ppTokOutput ) );
pDelimiter = ( char * ) safeMalloc( delLength );
if( ( pString == NULL ) || ( ( pString != NULL ) && ensure_memory_is_valid( pString, stringLength ) ) )
{
if( pString != NULL )
{
pString[ stringLength - 1 ] = '\0';
}
Cellular_ATGetSpecificNextTok( ppString, pDelimiter, ppTokOutput );
}
}

View File

@ -0,0 +1,47 @@
#
# Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
# the Software, and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
HARNESS_ENTRY=harness
HARNESS_FILE=Cellular_ATGetSpecificNextTok_harness
PROOF_UID = Cellular_ATGetSpecificNextTok
DEFINES +=
INCLUDES +=
# This value was experimentally chosen to provide 100% coverage
# without tripping unwinding assertions and without exhausting memory.
CBMC_MAX_BUFSIZE=128
DEFINES += -DCBMC_MAX_BUFSIZE=$(CBMC_MAX_BUFSIZE)
UNWINDSET += Cellular_ATGetSpecificNextTok.0:$(CBMC_MAX_BUFSIZE)
UNWINDSET += strlen.0:$(CBMC_MAX_BUFSIZE)
UNWINDSET += memchr.0:$(CBMC_MAX_BUFSIZE)
PROOF_SOURCES += $(PROOFDIR)/$(HARNESS_FILE).c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/sources/cellular_cbmc_state.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/sources/global_state_cellular.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/strtok.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/memchr.c
PROJECT_SOURCES += $(SRCDIR)/source/cellular_at_core.c
include ../Makefile.common

View File

@ -0,0 +1,10 @@
Cellular_ATGetSpecificNextTok proof
==============
This directory contains a memory safety proof for Cellular_ATGetSpecificNextTok.
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.

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": "Cellular_ATGetSpecificNextTok",
"proof-root": "tools/cbmc/proofs"
}

View File

@ -0,0 +1,76 @@
/*
* FreeRTOS-Cellular-Interface v1.3.0
* 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.
*
* https://www.FreeRTOS.org
* https://github.com/FreeRTOS
*/
/* Standard includes. */
#include <stdint.h>
/* Cellular default config includes. */
#include "cellular_config.h"
#include "cellular_config_defaults.h"
/* Cellular APIs includes. */
#include "cellular_platform.h"
#include "cellular_types.h"
#include "cellular_common_internal.h"
#include "cellular_common_api.h"
#define ensure_memory_is_valid( px, length ) ( px != NULL ) && ( length > 0 ) && __CPROVER_w_ok( ( px ), length ) && __CPROVER_r_ok( ( px ), length )
/* Extern the com interface in comm_if_windows.c */
extern CellularCommInterface_t CellularCommInterface;
/****************************************************************
* The signature of the function under test.
****************************************************************/
CellularATError_t Cellular_ATHexStrToHex( const char * pString,
uint8_t * pHexData,
uint16_t hexDataLen );
/****************************************************************
* The proof of Cellular_ATHexStrToHex
****************************************************************/
void harness()
{
uint16_t hexDataLen;
uint16_t stringLen;
__CPROVER_assume( stringLen < CBMC_MAX_BUFSIZE );
__CPROVER_assume( stringLen > 0 );
char * pString = ( char * ) safeMalloc( stringLen );
uint8_t * pHexData = ( uint8_t * ) safeMalloc( hexDataLen );
if( ( pString == NULL ) || ( ( pString != NULL ) && ensure_memory_is_valid( pString, stringLen ) ) )
{
if( pString != NULL )
{
pString[ stringLen - 1 ] = '\0';
}
Cellular_ATHexStrToHex( pString,
pHexData,
hexDataLen );
}
}

View File

@ -0,0 +1,46 @@
#
# Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
# the Software, and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
HARNESS_ENTRY=harness
HARNESS_FILE=Cellular_ATHexStrToHex_harness
PROOF_UID = Cellular_ATHexStrToHex
DEFINES +=
INCLUDES +=
# This value was experimentally chosen to provide 100% coverage
# without tripping unwinding assertions and without exhausting memory.
CBMC_MAX_BUFSIZE=128
DEFINES += -DCBMC_MAX_BUFSIZE=$(CBMC_MAX_BUFSIZE)
UNWINDSET += Cellular_ATHexStrToHex.0:$(CBMC_MAX_BUFSIZE)
UNWINDSET += strlen.0:$(CBMC_MAX_BUFSIZE)
UNWINDSET += memchr.0:$(CBMC_MAX_BUFSIZE)
PROOF_SOURCES += $(PROOFDIR)/$(HARNESS_FILE).c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/sources/cellular_cbmc_state.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/sources/global_state_cellular.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/memchr.c
PROJECT_SOURCES += $(SRCDIR)/source/cellular_at_core.c
include ../Makefile.common

View File

@ -0,0 +1,10 @@
Cellular_ATHexStrToHex proof
==============
This directory contains a memory safety proof for Cellular_ATHexStrToHex.
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.

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": "Cellular_ATHexStrToHex",
"proof-root": "tools/cbmc/proofs"
}

View File

@ -0,0 +1,78 @@
/*
* FreeRTOS-Cellular-Interface v1.3.0
* 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.
*
* https://www.FreeRTOS.org
* https://github.com/FreeRTOS
*/
/* Standard includes. */
#include <stdint.h>
/* Cellular default config includes. */
#include "cellular_config.h"
#include "cellular_config_defaults.h"
/* Cellular APIs includes. */
#include "cellular_platform.h"
#include "cellular_types.h"
#include "cellular_common_internal.h"
#include "cellular_common_api.h"
#define ensure_memory_is_valid( px, length ) ( px != NULL ) && ( length > 0 ) && __CPROVER_w_ok( ( px ), length ) && __CPROVER_r_ok( ( px ), length )
/* Extern the com interface in comm_if_windows.c */
extern CellularCommInterface_t CellularCommInterface;
/****************************************************************
* The signature of the function under test.
****************************************************************/
CellularATError_t Cellular_ATIsPrefixPresent( const char * pString,
bool * pResult );
/****************************************************************
* The proof of Cellular_ATIsPrefixPresent
****************************************************************/
void harness()
{
uint16_t stringLen;
__CPROVER_assume( stringLen < CBMC_MAX_BUFSIZE );
__CPROVER_assume( stringLen > 0 );
char * pString = ( char * ) safeMalloc( stringLen );
bool * pResult = ( uint8_t * ) safeMalloc( sizeof( bool * ) );
if( ( pString == NULL ) || ( ( pString != NULL ) && ensure_memory_is_valid( pString, stringLen ) ) )
{
if( pString != NULL )
{
pString[ stringLen - 1 ] = '\0';
if( nondet_bool() && ( stringLen > 2 ) )
{
pString[ 0 ] = '+';
}
}
Cellular_ATIsPrefixPresent( pString,
pResult );
}
}

View File

@ -0,0 +1,48 @@
#
# Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
# the Software, and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
HARNESS_ENTRY=harness
HARNESS_FILE=Cellular_ATIsPrefixPresent_harness
PROOF_UID = Cellular_ATIsPrefixPresent
DEFINES += -D__NO_CTYPE
INCLUDES +=
# This value was experimentally chosen to provide 100% coverage
# without tripping unwinding assertions and without exhausting memory.
CBMC_MAX_BUFSIZE=32
DEFINES += -DCBMC_MAX_BUFSIZE=$(CBMC_MAX_BUFSIZE)
UNWINDSET += Cellular_ATIsPrefixPresent.0:$(CBMC_MAX_BUFSIZE)
UNWINDSET += strlen.0:$(CBMC_MAX_BUFSIZE)
UNWINDSET += strchr.0:$(CBMC_MAX_BUFSIZE)
UNWINDSET += strnlen.0:$(CBMC_MAX_BUFSIZE)
PROOF_SOURCES += $(PROOFDIR)/$(HARNESS_FILE).c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/sources/cellular_cbmc_state.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/sources/global_state_cellular.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/strchr.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/strnlen.c
PROJECT_SOURCES += $(SRCDIR)/source/cellular_at_core.c
include ../Makefile.common

View File

@ -0,0 +1,10 @@
Cellular_ATIsPrefixPresent proof
==============
This directory contains a memory safety proof for Cellular_ATIsPrefixPresent.
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.

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": "Cellular_ATIsPrefixPresent",
"proof-root": "tools/cbmc/proofs"
}

View File

@ -0,0 +1,73 @@
/*
* FreeRTOS-Cellular-Interface v1.3.0
* 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.
*
* https://www.FreeRTOS.org
* https://github.com/FreeRTOS
*/
/* Standard includes. */
#include <stdint.h>
/* Cellular default config includes. */
#include "cellular_config.h"
#include "cellular_config_defaults.h"
/* Cellular APIs includes. */
#include "cellular_platform.h"
#include "cellular_types.h"
#include "cellular_common_internal.h"
#include "cellular_common_api.h"
#define ensure_memory_is_valid( px, length ) ( px != NULL ) && ( length > 0 ) && __CPROVER_w_ok( ( px ), length ) && __CPROVER_r_ok( ( px ), length )
/* Extern the com interface in comm_if_windows.c */
extern CellularCommInterface_t CellularCommInterface;
/****************************************************************
* The signature of the function under test.
****************************************************************/
CellularATError_t Cellular_ATIsStrDigit( const char * pString,
bool * pResult );
/****************************************************************
* The proof of Cellular_ATIsStrDigit
****************************************************************/
void harness()
{
uint16_t stringLen;
__CPROVER_assume( stringLen < CBMC_MAX_BUFSIZE );
__CPROVER_assume( stringLen > 0 );
char * pString = ( char * ) safeMalloc( stringLen );
bool * pResult = ( uint8_t * ) safeMalloc( sizeof( bool * ) );
if( ( pString == NULL ) || ( ( pString != NULL ) && ensure_memory_is_valid( pString, stringLen ) ) )
{
if( pString != NULL )
{
pString[ stringLen - 1 ] = '\0';
}
Cellular_ATIsStrDigit( pString,
pResult );
}
}

View File

@ -0,0 +1,46 @@
#
# Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
# the Software, and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
HARNESS_ENTRY=harness
HARNESS_FILE=Cellular_ATIsStrDigit_harness
PROOF_UID = Cellular_ATIsStrDigit
DEFINES += -D__NO_CTYPE
INCLUDES +=
# This value was experimentally chosen to provide 100% coverage
# without tripping unwinding assertions and without exhausting memory.
CBMC_MAX_BUFSIZE=128
DEFINES += -DCBMC_MAX_BUFSIZE=$(CBMC_MAX_BUFSIZE)
UNWINDSET += Cellular_ATIsStrDigit.0:$(CBMC_MAX_BUFSIZE)
UNWINDSET += strlen.0:$(CBMC_MAX_BUFSIZE)
UNWINDSET += memchr.0:$(CBMC_MAX_BUFSIZE)
PROOF_SOURCES += $(PROOFDIR)/$(HARNESS_FILE).c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/sources/cellular_cbmc_state.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/sources/global_state_cellular.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/memchr.c
PROJECT_SOURCES += $(SRCDIR)/source/cellular_at_core.c
include ../Makefile.common

View File

@ -0,0 +1,10 @@
Cellular_ATIsStrDigit proof
==============
This directory contains a memory safety proof for Cellular_ATIsStrDigit.
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.

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": "Cellular_ATIsStrDigit",
"proof-root": "tools/cbmc/proofs"
}

View File

@ -0,0 +1,70 @@
/*
* FreeRTOS-Cellular-Interface v1.3.0
* 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.
*
* https://www.FreeRTOS.org
* https://github.com/FreeRTOS
*/
/* Standard includes. */
#include <stdint.h>
/* Cellular default config includes. */
#include "cellular_config.h"
#include "cellular_config_defaults.h"
/* Cellular APIs includes. */
#include "cellular_platform.h"
#include "cellular_types.h"
#include "cellular_common_internal.h"
#include "cellular_common_api.h"
#define ensure_memory_is_valid( px, length ) ( px != NULL ) && ( length > 0 ) && __CPROVER_w_ok( ( px ), length ) && __CPROVER_r_ok( ( px ), length )
/* Extern the com interface in comm_if_windows.c */
extern CellularCommInterface_t CellularCommInterface;
/****************************************************************
* The signature of the function under test.
****************************************************************/
CellularATError_t Cellular_ATRemoveAllDoubleQuote( char * pString );
/****************************************************************
* The proof of Cellular_ATRemoveAllDoubleQuote
****************************************************************/
void harness()
{
uint16_t stringLength;
__CPROVER_assume( stringLength < CBMC_MAX_BUFSIZE );
__CPROVER_assume( stringLength > 0 );
char * pString = ( char * ) safeMalloc( stringLength );
if( ( pString == NULL ) || ( ( pString != NULL ) && ensure_memory_is_valid( pString, stringLength ) ) )
{
if( pString != NULL )
{
pString[ stringLength - 1 ] = '\0';
}
Cellular_ATRemoveAllDoubleQuote( pString );
}
}

View File

@ -0,0 +1,46 @@
#
# Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
# the Software, and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
HARNESS_ENTRY=harness
HARNESS_FILE=Cellular_ATRemoveAllDoubleQuote_harness
PROOF_UID = Cellular_ATRemoveAllDoubleQuote
DEFINES +=
INCLUDES +=
# This value was experimentally chosen to provide 100% coverage
# without tripping unwinding assertions and without exhausting memory.
CBMC_MAX_BUFSIZE=32
DEFINES += -DCBMC_MAX_BUFSIZE=$(CBMC_MAX_BUFSIZE)
UNWINDSET += Cellular_ATRemoveAllDoubleQuote.0:$(CBMC_MAX_BUFSIZE)
UNWINDSET += strlen.0:$(CBMC_MAX_BUFSIZE)
UNWINDSET += memchr.0:$(CBMC_MAX_BUFSIZE)
PROOF_SOURCES += $(PROOFDIR)/$(HARNESS_FILE).c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/sources/cellular_cbmc_state.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/sources/global_state_cellular.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/memchr.c
PROJECT_SOURCES += $(SRCDIR)/source/cellular_at_core.c
include ../Makefile.common

View File

@ -0,0 +1,10 @@
Cellular_ATRemoveAllDoubleQuote proof
==============
This directory contains a memory safety proof for Cellular_ATRemoveAllDoubleQuote.
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.

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": "Cellular_ATRemoveAllDoubleQuote",
"proof-root": "tools/cbmc/proofs"
}

View File

@ -0,0 +1,70 @@
/*
* FreeRTOS-Cellular-Interface v1.3.0
* 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.
*
* https://www.FreeRTOS.org
* https://github.com/FreeRTOS
*/
/* Standard includes. */
#include <stdint.h>
/* Cellular default config includes. */
#include "cellular_config.h"
#include "cellular_config_defaults.h"
/* Cellular APIs includes. */
#include "cellular_platform.h"
#include "cellular_types.h"
#include "cellular_common_internal.h"
#include "cellular_common_api.h"
#define ensure_memory_is_valid( px, length ) ( px != NULL ) && ( length > 0 ) && __CPROVER_w_ok( ( px ), length ) && __CPROVER_r_ok( ( px ), length )
/* Extern the com interface in comm_if_windows.c */
extern CellularCommInterface_t CellularCommInterface;
/****************************************************************
* The signature of the function under test.
****************************************************************/
CellularATError_t Cellular_ATRemoveAllWhiteSpaces( char * pString );
/****************************************************************
* The proof of Cellular_ATRemoveAllWhiteSpaces
****************************************************************/
void harness()
{
uint16_t stringLength;
__CPROVER_assume( stringLength < CBMC_MAX_BUFSIZE );
__CPROVER_assume( stringLength > 0 );
char * pString = ( char * ) safeMalloc( stringLength );
if( ( pString == NULL ) || ( ( pString != NULL ) && ensure_memory_is_valid( pString, stringLength ) ) )
{
if( pString != NULL )
{
pString[ stringLength - 1 ] = '\0';
}
Cellular_ATRemoveAllWhiteSpaces( pString );
}
}

View File

@ -0,0 +1,46 @@
#
# Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
# the Software, and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
HARNESS_ENTRY=harness
HARNESS_FILE=Cellular_ATRemoveAllWhiteSpaces_harness
PROOF_UID = Cellular_ATRemoveAllWhiteSpaces
DEFINES += -D__NO_CTYPE
INCLUDES +=
# This value was experimentally chosen to provide 100% coverage
# without tripping unwinding assertions and without exhausting memory.
CBMC_MAX_BUFSIZE=32
DEFINES += -DCBMC_MAX_BUFSIZE=$(CBMC_MAX_BUFSIZE)
UNWINDSET += Cellular_ATRemoveAllWhiteSpaces.0:$(CBMC_MAX_BUFSIZE)
UNWINDSET += strlen.0:$(CBMC_MAX_BUFSIZE)
UNWINDSET += memchr.0:$(CBMC_MAX_BUFSIZE)
PROOF_SOURCES += $(PROOFDIR)/$(HARNESS_FILE).c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/sources/cellular_cbmc_state.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/sources/global_state_cellular.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/memchr.c
PROJECT_SOURCES += $(SRCDIR)/source/cellular_at_core.c
include ../Makefile.common

View File

@ -0,0 +1,10 @@
Cellular_ATRemoveAllWhiteSpaces proof
==============
This directory contains a memory safety proof for Cellular_ATRemoveAllWhiteSpaces.
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.

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": "Cellular_ATRemoveAllWhiteSpaces",
"proof-root": "tools/cbmc/proofs"
}

View File

@ -0,0 +1,71 @@
/*
* FreeRTOS-Cellular-Interface v1.3.0
* 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.
*
* https://www.FreeRTOS.org
* https://github.com/FreeRTOS
*/
/* Standard includes. */
#include <stdint.h>
/* Cellular default config includes. */
#include "cellular_config.h"
#include "cellular_config_defaults.h"
/* Cellular APIs includes. */
#include "cellular_platform.h"
#include "cellular_types.h"
#include "cellular_common_internal.h"
#include "cellular_common_api.h"
#define ensure_memory_is_valid( px, length ) ( px != NULL ) && ( length > 0 ) && __CPROVER_w_ok( ( px ), length ) && __CPROVER_r_ok( ( px ), length )
/* Extern the com interface in comm_if_windows.c */
extern CellularCommInterface_t CellularCommInterface;
/****************************************************************
* The signature of the function under test.
****************************************************************/
CellularATError_t Cellular_ATRemoveLeadingWhiteSpaces( char ** ppString );
/****************************************************************
* The proof of Cellular_ATRemoveLeadingWhiteSpaces
****************************************************************/
void harness()
{
uint16_t stringLength;
__CPROVER_assume( stringLength < CBMC_MAX_BUFSIZE );
__CPROVER_assume( stringLength > 0 );
char * pString = ( char * ) safeMalloc( stringLength );
char ** ppString = nondet_bool() ? NULL : &pString;
if( ( pString == NULL ) || ( ( pString != NULL ) && ensure_memory_is_valid( pString, stringLength ) ) )
{
if( pString != NULL )
{
pString[ stringLength - 1 ] = '\0';
}
Cellular_ATRemoveLeadingWhiteSpaces( ppString );
}
}

View File

@ -0,0 +1,45 @@
#
# Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
# the Software, and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
HARNESS_ENTRY=harness
HARNESS_FILE=Cellular_ATRemoveLeadingWhiteSpaces_harness
PROOF_UID = Cellular_ATRemoveLeadingWhiteSpaces
DEFINES += -D__NO_CTYPE
INCLUDES +=
# This value was experimentally chosen to provide 100% coverage
# without tripping unwinding assertions and without exhausting memory.
CBMC_MAX_BUFSIZE=128
DEFINES += -DCBMC_MAX_BUFSIZE=$(CBMC_MAX_BUFSIZE)
UNWINDSET += Cellular_ATRemoveLeadingWhiteSpaces.0:$(CBMC_MAX_BUFSIZE)
UNWINDSET += memchr.0:$(CBMC_MAX_BUFSIZE)
PROOF_SOURCES += $(PROOFDIR)/$(HARNESS_FILE).c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/sources/cellular_cbmc_state.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/sources/global_state_cellular.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/memchr.c
PROJECT_SOURCES += $(SRCDIR)/source/cellular_at_core.c
include ../Makefile.common

View File

@ -0,0 +1,10 @@
Cellular_ATRemoveLeadingWhiteSpaces proof
==============
This directory contains a memory safety proof for Cellular_ATRemoveLeadingWhiteSpaces.
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.

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": "Cellular_ATRemoveLeadingWhiteSpaces",
"proof-root": "tools/cbmc/proofs"
}

View File

@ -0,0 +1,71 @@
/*
* FreeRTOS-Cellular-Interface v1.3.0
* 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.
*
* https://www.FreeRTOS.org
* https://github.com/FreeRTOS
*/
/* Standard includes. */
#include <stdint.h>
/* Cellular default config includes. */
#include "cellular_config.h"
#include "cellular_config_defaults.h"
/* Cellular APIs includes. */
#include "cellular_platform.h"
#include "cellular_types.h"
#include "cellular_common_internal.h"
#include "cellular_common_api.h"
#define ensure_memory_is_valid( px, length ) ( px != NULL ) && ( length > 0 ) && __CPROVER_w_ok( ( px ), length ) && __CPROVER_r_ok( ( px ), length )
/* Extern the com interface in comm_if_windows.c */
extern CellularCommInterface_t CellularCommInterface;
/****************************************************************
* The signature of the function under test.
****************************************************************/
CellularATError_t Cellular_ATRemoveOutermostDoubleQuote( char ** ppString );
/****************************************************************
* The proof of Cellular_ATRemoveOutermostDoubleQuote
****************************************************************/
void harness()
{
uint16_t stringLength;
__CPROVER_assume( stringLength < CBMC_MAX_BUFSIZE );
__CPROVER_assume( stringLength > 0 );
char * pString = ( char * ) safeMalloc( stringLength );
char ** ppString = nondet_bool() ? NULL : &pString;
if( ( pString == NULL ) || ( ( pString != NULL ) && ensure_memory_is_valid( pString, stringLength ) ) )
{
if( pString != NULL )
{
pString[ stringLength - 1 ] = '\0';
}
Cellular_ATRemoveOutermostDoubleQuote( ppString );
}
}

View File

@ -0,0 +1,46 @@
#
# Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
# the Software, and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
HARNESS_ENTRY=harness
HARNESS_FILE=Cellular_ATRemoveOutermostDoubleQuote_harness
PROOF_UID = Cellular_ATRemoveOutermostDoubleQuote
DEFINES +=
INCLUDES +=
# This value was experimentally chosen to provide 100% coverage
# without tripping unwinding assertions and without exhausting memory.
CBMC_MAX_BUFSIZE=128
DEFINES += -DCBMC_MAX_BUFSIZE=$(CBMC_MAX_BUFSIZE)
UNWINDSET += Cellular_ATRemoveOutermostDoubleQuote.0:$(CBMC_MAX_BUFSIZE)
UNWINDSET += strlen.0:$(CBMC_MAX_BUFSIZE)
UNWINDSET += memchr.0:$(CBMC_MAX_BUFSIZE)
PROOF_SOURCES += $(PROOFDIR)/$(HARNESS_FILE).c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/sources/cellular_cbmc_state.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/sources/global_state_cellular.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/memchr.c
PROJECT_SOURCES += $(SRCDIR)/source/cellular_at_core.c
include ../Makefile.common

View File

@ -0,0 +1,10 @@
Cellular_ATRemoveOutermostDoubleQuote proof
==============
This directory contains a memory safety proof for Cellular_ATRemoveOutermostDoubleQuote.
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.

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": "Cellular_ATRemoveOutermostDoubleQuote",
"proof-root": "tools/cbmc/proofs"
}

View File

@ -0,0 +1,70 @@
/*
* FreeRTOS-Cellular-Interface v1.3.0
* 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.
*
* https://www.FreeRTOS.org
* https://github.com/FreeRTOS
*/
/* Standard includes. */
#include <stdint.h>
/* Cellular default config includes. */
#include "cellular_config.h"
#include "cellular_config_defaults.h"
/* Cellular APIs includes. */
#include "cellular_platform.h"
#include "cellular_types.h"
#include "cellular_common_internal.h"
#include "cellular_common_api.h"
#define ensure_memory_is_valid( px, length ) ( px != NULL ) && ( length > 0 ) && __CPROVER_w_ok( ( px ), length ) && __CPROVER_r_ok( ( px ), length )
/* Extern the com interface in comm_if_windows.c */
extern CellularCommInterface_t CellularCommInterface;
/****************************************************************
* The signature of the function under test.
****************************************************************/
CellularATError_t Cellular_ATRemovePrefix( char ** ppString );
/****************************************************************
* The proof of Cellular_ATRemovePrefix
****************************************************************/
void harness()
{
uint32_t stringLength;
__CPROVER_assume( stringLength < CELLULAR_AT_MAX_STRING_SIZE + 1 );
char * pString = ( char * ) safeMalloc( stringLength );
char ** ppString = nondet_bool() ? NULL : &pString;
if( ( pString == NULL ) || ( ( pString != NULL ) && ensure_memory_is_valid( pString, stringLength ) ) )
{
if( pString != NULL )
{
pString[ stringLength - 1 ] = '\0';
}
Cellular_ATRemovePrefix( ppString );
}
}

View File

@ -0,0 +1,46 @@
#
# Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
# the Software, and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
HARNESS_ENTRY=harness
HARNESS_FILE=Cellular_ATRemovePrefix_harness
PROOF_UID = Cellular_ATRemovePrefix
DEFINES +=
INCLUDES +=
# This value was experimentally chosen to provide 100% coverage
# without tripping unwinding assertions and without exhausting memory.
CBMC_MAX_BUFSIZE=256
DEFINES += -DCBMC_MAX_BUFSIZE=$(CBMC_MAX_BUFSIZE)
UNWINDSET += strchr.0:$(CBMC_MAX_BUFSIZE)
UNWINDSET += memchr.0:$(CBMC_MAX_BUFSIZE)
PROOF_SOURCES += $(PROOFDIR)/$(HARNESS_FILE).c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/sources/cellular_cbmc_state.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/sources/global_state_cellular.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/strchr.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/memchr.c
PROJECT_SOURCES += $(SRCDIR)/source/cellular_at_core.c
include ../Makefile.common

View File

@ -0,0 +1,10 @@
Cellular_ATRemovePrefix proof
==============
This directory contains a memory safety proof for Cellular_ATRemovePrefix.
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.

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": "Cellular_ATRemovePrefix",
"proof-root": "tools/cbmc/proofs"
}

View File

@ -0,0 +1,70 @@
/*
* FreeRTOS-Cellular-Interface v1.3.0
* 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.
*
* https://www.FreeRTOS.org
* https://github.com/FreeRTOS
*/
/* Standard includes. */
#include <stdint.h>
/* Cellular default config includes. */
#include "cellular_config.h"
#include "cellular_config_defaults.h"
/* Cellular APIs includes. */
#include "cellular_platform.h"
#include "cellular_types.h"
#include "cellular_common_internal.h"
#include "cellular_common_api.h"
#define ensure_memory_is_valid( px, length ) ( px != NULL ) && ( length > 0 ) && __CPROVER_w_ok( ( px ), length ) && __CPROVER_r_ok( ( px ), length )
/* Extern the com interface in comm_if_windows.c */
extern CellularCommInterface_t CellularCommInterface;
/****************************************************************
* The signature of the function under test.
****************************************************************/
CellularATError_t Cellular_ATRemoveTrailingWhiteSpaces( char * pString );
/****************************************************************
* The proof of Cellular_ATRemoveTrailingWhiteSpaces
****************************************************************/
void harness()
{
uint16_t stringLength;
__CPROVER_assume( stringLength < CBMC_MAX_BUFSIZE );
__CPROVER_assume( stringLength > 0 );
char * pString = ( char * ) safeMalloc( stringLength );
if( ( pString == NULL ) || ( ( pString != NULL ) && ensure_memory_is_valid( pString, stringLength ) ) )
{
if( pString != NULL )
{
pString[ stringLength - 1 ] = '\0';
}
Cellular_ATRemoveTrailingWhiteSpaces( pString );
}
}

View File

@ -0,0 +1,46 @@
#
# Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
# the Software, and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
HARNESS_ENTRY=harness
HARNESS_FILE=Cellular_ATRemoveTrailingWhiteSpaces_harness
PROOF_UID = Cellular_ATRemoveTrailingWhiteSpaces
DEFINES += -D__NO_CTYPE
INCLUDES +=
# This value was experimentally chosen to provide 100% coverage
# without tripping unwinding assertions and without exhausting memory.
CBMC_MAX_BUFSIZE=128
DEFINES += -DCBMC_MAX_BUFSIZE=$(CBMC_MAX_BUFSIZE)
UNWINDSET += Cellular_ATRemoveTrailingWhiteSpaces.0:$(CBMC_MAX_BUFSIZE)
UNWINDSET += strlen.0:$(CBMC_MAX_BUFSIZE)
UNWINDSET += memchr.0:$(CBMC_MAX_BUFSIZE)
PROOF_SOURCES += $(PROOFDIR)/$(HARNESS_FILE).c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/sources/cellular_cbmc_state.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/sources/global_state_cellular.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/memchr.c
PROJECT_SOURCES += $(SRCDIR)/source/cellular_at_core.c
include ../Makefile.common

View File

@ -0,0 +1,10 @@
Cellular_ATRemoveTrailingWhiteSpaces proof
==============
This directory contains a memory safety proof for Cellular_ATRemoveTrailingWhiteSpaces.
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.

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": "Cellular_ATRemoveTrailingWhiteSpaces",
"proof-root": "tools/cbmc/proofs"
}

View File

@ -0,0 +1,71 @@
/*
* FreeRTOS-Cellular-Interface v1.3.0
* 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.
*
* https://www.FreeRTOS.org
* https://github.com/FreeRTOS
*/
/* Standard includes. */
#include <stdint.h>
/* Cellular default config includes. */
#include "cellular_config.h"
#include "cellular_config_defaults.h"
/* Cellular APIs includes. */
#include "cellular_platform.h"
#include "cellular_types.h"
#include "cellular_common_internal.h"
#include "cellular_common_api.h"
#define ensure_memory_is_valid( px, length ) ( px != NULL ) && ( length > 0 ) && __CPROVER_w_ok( ( px ), length ) && __CPROVER_r_ok( ( px ), length )
/* Extern the com interface in comm_if_windows.c */
extern CellularCommInterface_t CellularCommInterface;
/****************************************************************
* The signature of the function under test.
****************************************************************/
CellularATError_t Cellular_ATStrDup( char ** ppDst,
const char * pSrc );
/****************************************************************
* The proof of Cellular_ATStrDup
****************************************************************/
void harness()
{
char * pDst;
uint16_t stringLength;
__CPROVER_assume( stringLength > 0 && stringLength < CBMC_MAX_BUFSIZE );
char * pString = ( char * ) safeMalloc( stringLength );
if( ( pString == NULL ) || ( ( pString != NULL ) && ensure_memory_is_valid( pString, stringLength ) ) )
{
if( pString != NULL )
{
pString[ stringLength - 1 ] = '\0';
}
Cellular_ATStrDup( &pDst, pString );
}
}

View File

@ -0,0 +1,47 @@
#
# Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
# the Software, and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
HARNESS_ENTRY=harness
HARNESS_FILE=Cellular_ATStrDup_harness
PROOF_UID = Cellular_ATStrDup
DEFINES +=
INCLUDES +=
# This value was experimentally chosen to provide 100% coverage
# without tripping unwinding assertions and without exhausting memory.
CBMC_MAX_BUFSIZE=128
DEFINES += -DCBMC_MAX_BUFSIZE=$(CBMC_MAX_BUFSIZE)
UNWINDSET += Cellular_ATStrDup.0:$(CBMC_MAX_BUFSIZE)
UNWINDSET += strlen.0:$(CBMC_MAX_BUFSIZE)
UNWINDSET += memchr.0:$(CBMC_MAX_BUFSIZE)
PROOF_SOURCES += $(PROOFDIR)/$(HARNESS_FILE).c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/sources/cellular_cbmc_state.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/sources/global_state_cellular.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/strtok.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/memchr.c
PROJECT_SOURCES += $(SRCDIR)/source/cellular_at_core.c
include ../Makefile.common

View File

@ -0,0 +1,10 @@
Cellular_ATStrDup proof
==============
This directory contains a memory safety proof for Cellular_ATStrDup.
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.

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": "Cellular_ATStrDup",
"proof-root": "tools/cbmc/proofs"
}

View File

@ -0,0 +1,84 @@
/*
* FreeRTOS-Cellular-Interface v1.3.0
* 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.
*
* https://www.FreeRTOS.org
* https://github.com/FreeRTOS
*/
/* Standard includes. */
#include <stdint.h>
/* Cellular default config includes. */
#include "cellular_config.h"
#include "cellular_config_defaults.h"
/* Cellular APIs includes. */
#include "cellular_platform.h"
#include "cellular_types.h"
#include "cellular_common_internal.h"
#include "cellular_common_api.h"
#define ensure_memory_is_valid( px, length ) ( px != NULL ) && ( length > 0 ) && __CPROVER_w_ok( ( px ), length ) && __CPROVER_r_ok( ( px ), length )
/* Extern the com interface in comm_if_windows.c */
extern CellularCommInterface_t CellularCommInterface;
/****************************************************************
* The signature of the function under test.
****************************************************************/
CellularATError_t Cellular_ATStrStartWith( const char * pString,
const char * pPrefix,
bool * pResult );
/****************************************************************
* The proof of Cellular_ATStrStartWith
****************************************************************/
void harness()
{
uint16_t stringLen;
uint16_t prefixLen;
__CPROVER_assume( stringLen < CBMC_MAX_BUFSIZE );
__CPROVER_assume( stringLen > 0 );
__CPROVER_assume( prefixLen < CBMC_MAX_BUFSIZE );
__CPROVER_assume( prefixLen > 0 );
char * pString = ( char * ) safeMalloc( stringLen );
char * pPrefix = ( char * ) safeMalloc( prefixLen );
bool * pResult = ( uint8_t * ) safeMalloc( sizeof( bool * ) );
if( ( pString == NULL ) || ( ( pString != NULL ) && ensure_memory_is_valid( pString, stringLen ) ) )
{
if( pString != NULL )
{
pString[ stringLen - 1 ] = '\0';
}
if( pPrefix != NULL )
{
pPrefix[ prefixLen - 1 ] = '\0';
}
Cellular_ATStrStartWith( pString,
pPrefix,
pResult );
}
}

View File

@ -0,0 +1,46 @@
#
# Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
# the Software, and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
HARNESS_ENTRY=harness
HARNESS_FILE=Cellular_ATStrStartWith_harness
PROOF_UID = Cellular_ATStrStartWith
DEFINES +=
INCLUDES +=
# This value was experimentally chosen to provide 100% coverage
# without tripping unwinding assertions and without exhausting memory.
CBMC_MAX_BUFSIZE=256
DEFINES += -DCBMC_MAX_BUFSIZE=$(CBMC_MAX_BUFSIZE)
UNWINDSET += Cellular_ATStrStartWith.0:$(CBMC_MAX_BUFSIZE)
UNWINDSET += memchr.0:$(CBMC_MAX_BUFSIZE)
PROOF_SOURCES += $(PROOFDIR)/$(HARNESS_FILE).c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/sources/cellular_cbmc_state.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/sources/global_state_cellular.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/strchr.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/memchr.c
PROJECT_SOURCES += $(SRCDIR)/source/cellular_at_core.c
include ../Makefile.common

View File

@ -0,0 +1,10 @@
Cellular_ATStrStartWith proof
==============
This directory contains a memory safety proof for Cellular_ATStrStartWith.
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.

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": "Cellular_ATStrStartWith",
"proof-root": "tools/cbmc/proofs"
}

View File

@ -0,0 +1,76 @@
/*
* FreeRTOS-Cellular-Interface v1.3.0
* 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.
*
* https://www.FreeRTOS.org
* https://github.com/FreeRTOS
*/
/* Standard includes. */
#include <stdint.h>
/* Cellular default config includes. */
#include "cellular_config.h"
#include "cellular_config_defaults.h"
/* Cellular APIs includes. */
#include "cellular_platform.h"
#include "cellular_types.h"
#include "cellular_common_internal.h"
#include "cellular_common_api.h"
#define ensure_memory_is_valid( px, length ) ( px != NULL ) && ( length > 0 ) && __CPROVER_w_ok( ( px ), length ) && __CPROVER_r_ok( ( px ), length )
/* Extern the com interface in comm_if_windows.c */
extern CellularCommInterface_t CellularCommInterface;
/****************************************************************
* The signature of the function under test.
****************************************************************/
CellularATError_t Cellular_ATStrtoi( const char * pStr,
int32_t base,
long * pResult );
/****************************************************************
* The proof of Cellular_ATcheckErrorCode
****************************************************************/
void harness()
{
uint16_t stringLen;
int32_t base;
__CPROVER_assume( stringLen < CBMC_MAX_BUFSIZE );
__CPROVER_assume( stringLen > 0 );
char * pInputBuf = ( char * ) safeMalloc( stringLen );
long * pResult = ( long * ) safeMalloc( sizeof( long * ) );
if( ( pInputBuf == NULL ) || ( ( pInputBuf != NULL ) && ensure_memory_is_valid( pInputBuf, stringLen ) ) )
{
if( pInputBuf != NULL )
{
pInputBuf[ stringLen - 1 ] = '\0';
}
Cellular_ATStrtoi( pInputBuf,
base,
pResult );
}
}

View File

@ -0,0 +1,45 @@
#
# Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
# the Software, and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
HARNESS_ENTRY=harness
HARNESS_FILE=Cellular_ATStrtoi_harness
PROOF_UID = Cellular_ATStrtoi
DEFINES +=
INCLUDES +=
# This value was experimentally chosen to provide 100% coverage
# without tripping unwinding assertions and without exhausting memory.
CBMC_MAX_BUFSIZE=32
DEFINES += -DCBMC_MAX_BUFSIZE=$(CBMC_MAX_BUFSIZE)
UNWINDSET += strtol.0:$(CBMC_MAX_BUFSIZE)
UNWINDSET += memchr.0:$(CBMC_MAX_BUFSIZE)
PROOF_SOURCES += $(PROOFDIR)/$(HARNESS_FILE).c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/sources/cellular_cbmc_state.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/sources/global_state_cellular.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/memchr.c
PROJECT_SOURCES += $(SRCDIR)/source/cellular_at_core.c
PROJECT_SOURCES += $(SRCDIR)/test/cbmc/stubs/strtol.c
include ../Makefile.common

View File

@ -0,0 +1,10 @@
Cellular_ATStrtoi proof
==============
This directory contains a memory safety proof for Cellular_ATStrtoi.
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.

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": "Cellular_ATStrtoi",
"proof-root": "tools/cbmc/proofs"
}

View File

@ -0,0 +1,80 @@
/*
* FreeRTOS-Cellular-Interface v1.3.0
* 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.
*
* https://www.FreeRTOS.org
* https://github.com/FreeRTOS
*/
/* Standard includes. */
#include <stdint.h>
/* Cellular default config includes. */
#include "cellular_config.h"
#include "cellular_config_defaults.h"
/* Cellular APIs includes. */
#include "cellular_platform.h"
#include "cellular_types.h"
#include "cellular_common_internal.h"
#include "cellular_common_api.h"
#define ensure_memory_is_valid( px, length ) ( px != NULL ) && ( length > 0 ) && __CPROVER_w_ok( ( px ), length ) && __CPROVER_r_ok( ( px ), length )
/* Extern the com interface in comm_if_windows.c */
extern CellularCommInterface_t CellularCommInterface;
/****************************************************************
* The signature of the function under test.
****************************************************************/
CellularATError_t Cellular_ATcheckErrorCode( const char * pInputBuf,
const char * const * const ppKeyList,
size_t keyListLen,
bool * pResult );
/****************************************************************
* The proof of Cellular_ATcheckErrorCode
****************************************************************/
void harness()
{
uint16_t stringLen;
uint16_t keyListLen;
__CPROVER_assume( stringLen < CBMC_MAX_BUFSIZE );
__CPROVER_assume( stringLen > 0 );
__CPROVER_assume( keyListLen < KEY_LIST_SIZE );
char * pInputBuf = ( char * ) safeMalloc( stringLen );
bool * pResult = ( uint8_t * ) safeMalloc( sizeof( bool * ) );
char ** ppKeyList = ( char ** ) safeMalloc( sizeof( char ** ) * keyListLen );
if( ( pInputBuf == NULL ) || ( ( pInputBuf != NULL ) && ensure_memory_is_valid( pInputBuf, stringLen ) ) )
{
if( pInputBuf != NULL )
{
pInputBuf[ stringLen - 1 ] = '\0';
}
Cellular_ATcheckErrorCode( pInputBuf,
ppKeyList,
keyListLen,
pResult );
}
}

View File

@ -0,0 +1,50 @@
#
# Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
# the Software, and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
HARNESS_ENTRY=harness
HARNESS_FILE=Cellular_ATcheckErrorCode_harness
PROOF_UID = Cellular_ATcheckErrorCode
DEFINES +=
INCLUDES +=
# This value was experimentally chosen to provide 100% coverage
# without tripping unwinding assertions and without exhausting memory.
CBMC_MAX_BUFSIZE=256
KEY_LIST_SIZE=16
DEFINES += -DCBMC_MAX_BUFSIZE=$(CBMC_MAX_BUFSIZE) -DKEY_LIST_SIZE=$(KEY_LIST_SIZE)
UNWINDSET += Cellular_ATcheckErrorCode.0:$(CBMC_MAX_BUFSIZE)
UNWINDSET += memchr.0:$(CBMC_MAX_BUFSIZE)
# This API has its own CBMC test case.
REMOVE_FUNCTION_BODY += Cellular_ATStrStartWith
PROOF_SOURCES += $(PROOFDIR)/$(HARNESS_FILE).c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/sources/cellular_cbmc_state.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/sources/global_state_cellular.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/strchr.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/memchr.c
PROJECT_SOURCES += $(SRCDIR)/source/cellular_at_core.c
include ../Makefile.common

View File

@ -0,0 +1,10 @@
Cellular_ATcheckErrorCode proof
==============
This directory contains a memory safety proof for Cellular_ATcheckErrorCode.
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.

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": "Cellular_ATcheckErrorCode",
"proof-root": "tools/cbmc/proofs"
}

View File

@ -0,0 +1,126 @@
/*
* FreeRTOS-Cellular-Interface v1.3.0
* 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.
*
* https://www.FreeRTOS.org
* https://github.com/FreeRTOS
*/
/* Standard includes. */
#include <stdint.h>
/* Cellular APIs includes. */
#include "cellular_config_defaults.h"
#include "cellular_types.h"
#include "cellular_common_internal.h"
#include "cellular_common_api.h"
#define ensure_memory_is_valid( px, length ) ( px != NULL ) && __CPROVER_w_ok( ( px ), length )
/* Extern the com interface in comm_if_windows.c */
extern CellularCommInterface_t CellularCommInterface;
CellularAtParseTokenMap_t CellularUrcHandlerTable[] =
{
{ "CEREG", NULL },
{ "CGREG", NULL },
{ "CREG", NULL },
{ "NORMAL POWER DOWN", NULL },
{ "PSM POWER DOWN", NULL },
{ "QIND", NULL },
{ "QIOPEN", NULL },
{ "QIURC", NULL },
{ "QSIMSTAT", NULL },
{ "RDY", NULL }
};
const char * CellularSrcTokenErrorTable[] =
{ "ERROR", "BUSY", "NO CARRIER", "NO ANSWER", "NO DIALTONE", "ABORTED", "+CMS ERROR", "+CME ERROR", "SEND FAIL" };
const char * CellularSrcTokenSuccessTable[] =
{ "OK", "CONNECT", "SEND OK", ">" };
const char * CellularUrcTokenWoPrefixTable[] =
{ "NORMAL POWER DOWN", "PSM POWER DOWN", "RDY" };
const char * CellularSrcExtraTokenSuccessTable[] =
{ "EXTRA_TOKEN_1", "EXTRA_TOKEN_2", "EXTRA_TOKEN_3" };
static CellularTokenTable_t tokenTable =
{
.pCellularUrcHandlerTable = CellularUrcHandlerTable,
.cellularPrefixToParserMapSize = CELLULAR_URC_HANDLER_TABLE_SIZE,
.pCellularSrcTokenErrorTable = CellularSrcTokenErrorTable,
.cellularSrcTokenErrorTableSize = CELLULAR_SRC_TOKEN_ERROR_TABLE_SIZE,
.pCellularSrcTokenSuccessTable = CellularSrcTokenSuccessTable,
.cellularSrcTokenSuccessTableSize = CELLULAR_SRC_TOKEN_SUCCESS_TABLE_SIZE,
.pCellularUrcTokenWoPrefixTable = CellularUrcTokenWoPrefixTable,
.cellularUrcTokenWoPrefixTableSize = CELLULAR_URC_TOKEN_WO_PREFIX_TABLE_SIZE,
.pCellularSrcExtraTokenSuccessTable = CellularSrcExtraTokenSuccessTable,
.cellularSrcExtraTokenSuccessTableSize = CELLULAR_SRC_EXTRA_TOKEN_SUCCESS_TABLE_SIZE
};
/****************************************************************
* The signature of the function under test.
****************************************************************/
CellularError_t Cellular_CommonATCommandRaw( CellularHandle_t cellularHandle,
const char * pATCommandPrefix,
const char * pATCommandPayload,
CellularATCommandType_t atCommandType,
CellularATCommandResponseReceivedCallback_t responseReceivedCallback,
void * pData,
uint16_t dataLen );
/****************************************************************
* The proof of Cellular_CommonATCommandRaw
****************************************************************/
void harness()
{
CellularHandle_t pHandle = NULL;
char * pATCommandPrefix;
char * pATCommandPayload;
char * pData;
uint16_t lDataLen;
uint32_t lATCommandPrefixLen;
uint32_t lATCommandPayload;
CellularATCommandType_t atCommandType;
pATCommandPrefix = safeMalloc( lATCommandPrefixLen );
pATCommandPayload = safeMalloc( lATCommandPayload );
pData = safeMalloc( lDataLen );
/****************************************************************
* Initialize the member of Cellular_CommonInit.
****************************************************************/
Cellular_CommonInit( nondet_bool() ? NULL : &pHandle, &CellularCommInterface, &tokenTable );
if( ( pHandle == NULL ) ||
( ( pHandle != NULL ) && ensure_memory_is_valid( pHandle, sizeof( CellularContext_t ) ) ) )
{
Cellular_CommonATCommandRaw( pHandle,
pATCommandPrefix,
pATCommandPayload,
atCommandType,
NULL,
pData,
lDataLen );
}
}

View File

@ -0,0 +1,38 @@
#
# Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
# the Software, and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
HARNESS_ENTRY=harness
HARNESS_FILE=Cellular_CommonATCommandRaw_harness
PROOF_UID = Cellular_CommonATCommandRaw
DEFINES +=
INCLUDES +=
PROOF_SOURCES += $(PROOFDIR)/$(HARNESS_FILE).c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/sources/cellular_cbmc_state.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/sources/global_state_cellular.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/sources//cellular_platform.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/sources//cellular_modules.c
PROJECT_SOURCES += $(SRCDIR)/source/cellular_common_api.c
PROJECT_SOURCES += $(SRCDIR)/source/cellular_common.c
include ../Makefile.common

View File

@ -0,0 +1,10 @@
Cellular_CommonATCommandRaw proof
==============
This directory contains a memory safety proof for Cellular_CommonATCommandRaw.
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.

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": "Cellular_CommonATCommandRaw",
"proof-root": "tools/cbmc/proofs"
}

View File

@ -0,0 +1,104 @@
/*
* FreeRTOS-Cellular-Interface v1.3.0
* 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.
*
* https://www.FreeRTOS.org
* https://github.com/FreeRTOS
*/
/* Standard includes. */
#include <stdint.h>
/* Cellular APIs includes. */
#include "cellular_config_defaults.h"
#include "cellular_types.h"
#include "cellular_common_internal.h"
#include "cellular_common_api.h"
#define ensure_memory_is_valid( px, length ) ( px != NULL ) && __CPROVER_w_ok( ( px ), length )
/* Extern the com interface in comm_if_windows.c */
extern CellularCommInterface_t CellularCommInterface;
CellularAtParseTokenMap_t CellularUrcHandlerTable[] =
{
{ "CEREG", NULL },
{ "CGREG", NULL },
{ "CREG", NULL },
{ "NORMAL POWER DOWN", NULL },
{ "PSM POWER DOWN", NULL },
{ "QIND", NULL },
{ "QIOPEN", NULL },
{ "QIURC", NULL },
{ "QSIMSTAT", NULL },
{ "RDY", NULL }
};
const char * CellularSrcTokenErrorTable[] =
{ "ERROR", "BUSY", "NO CARRIER", "NO ANSWER", "NO DIALTONE", "ABORTED", "+CMS ERROR", "+CME ERROR", "SEND FAIL" };
const char * CellularSrcTokenSuccessTable[] =
{ "OK", "CONNECT", "SEND OK", ">" };
const char * CellularUrcTokenWoPrefixTable[] =
{ "NORMAL POWER DOWN", "PSM POWER DOWN", "RDY" };
const char * CellularSrcExtraTokenSuccessTable[] =
{ "EXTRA_TOKEN_1", "EXTRA_TOKEN_2", "EXTRA_TOKEN_3" };
static CellularTokenTable_t tokenTable =
{
.pCellularUrcHandlerTable = CellularUrcHandlerTable,
.cellularPrefixToParserMapSize = CELLULAR_URC_HANDLER_TABLE_SIZE,
.pCellularSrcTokenErrorTable = CellularSrcTokenErrorTable,
.cellularSrcTokenErrorTableSize = CELLULAR_SRC_TOKEN_ERROR_TABLE_SIZE,
.pCellularSrcTokenSuccessTable = CellularSrcTokenSuccessTable,
.cellularSrcTokenSuccessTableSize = CELLULAR_SRC_TOKEN_SUCCESS_TABLE_SIZE,
.pCellularUrcTokenWoPrefixTable = CellularUrcTokenWoPrefixTable,
.cellularUrcTokenWoPrefixTableSize = CELLULAR_URC_TOKEN_WO_PREFIX_TABLE_SIZE,
.pCellularSrcExtraTokenSuccessTable = CellularSrcExtraTokenSuccessTable,
.cellularSrcExtraTokenSuccessTableSize = CELLULAR_SRC_EXTRA_TOKEN_SUCCESS_TABLE_SIZE
};
/****************************************************************
* The signature of the function under test.
****************************************************************/
CellularError_t Cellular_CommonCleanup( CellularHandle_t cellularHandle );
/****************************************************************
* The proof of Cellular_CommonCleanup
****************************************************************/
void harness()
{
CellularHandle_t pHandle = NULL;
/****************************************************************
* Initialize the member of Cellular_CommonInit.
****************************************************************/
Cellular_CommonInit( nondet_bool() ? NULL : &pHandle, &CellularCommInterface, &tokenTable );
if( ( pHandle != NULL ) && ensure_memory_is_valid( pHandle, sizeof( CellularContext_t ) ) )
{
allocateSocket( ( void * ) pHandle );
}
Cellular_CommonCleanup( pHandle );
}

View File

@ -0,0 +1,46 @@
#
# Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
# the Software, and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
HARNESS_ENTRY=harness
HARNESS_FILE=Cellular_CommonCleanup_harness
PROOF_UID = Cellular_CommonCleanup
DEFINES +=
INCLUDES +=
# This value was experimentally chosen to provide 100% coverage
# without tripping unwinding assertions and without exhausting memory.
CBMC_MAX_BUFSIZE=13
UNWINDSET += allocateSocket.0:$(CBMC_MAX_BUFSIZE)
UNWINDSET += __CPROVER_file_local_cellular_common_c_libClose.0:$(CBMC_MAX_BUFSIZE)
UNWINDSET += __CPROVER_file_local_cellular_common_c__Cellular_FreeContext.0:$(CBMC_MAX_BUFSIZE)
PROOF_SOURCES += $(PROOFDIR)/$(HARNESS_FILE).c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/sources/cellular_cbmc_state.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/sources/global_state_cellular.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/sources/cellular_platform.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/sources/cellular_modules.c
PROJECT_SOURCES += $(SRCDIR)/source/cellular_common_api.c
PROJECT_SOURCES += $(SRCDIR)/source/cellular_common.c
include ../Makefile.common

View File

@ -0,0 +1,10 @@
Cellular_CommonCleanup proof
==============
This directory contains a memory safety proof for Cellular_CommonCleanup.
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.

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": "Cellular_CommonCleanup",
"proof-root": "tools/cbmc/proofs"
}

View File

@ -0,0 +1,127 @@
/*
* FreeRTOS-Cellular-Interface v1.3.0
* 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.
*
* https://www.FreeRTOS.org
* https://github.com/FreeRTOS
*/
/* Standard includes. */
#include <stdint.h>
/* Cellular APIs includes. */
#include "cellular_config_defaults.h"
#include "cellular_types.h"
#include "cellular_common_internal.h"
#include "cellular_common_api.h"
#define ensure_memory_is_valid( px, length ) ( px != NULL ) && __CPROVER_w_ok( ( px ), length )
/* Extern the com interface in comm_if_windows.c */
extern CellularCommInterface_t CellularCommInterface;
CellularAtParseTokenMap_t CellularUrcHandlerTable[] =
{
{ "CEREG", NULL },
{ "CGREG", NULL },
{ "CREG", NULL },
{ "NORMAL POWER DOWN", NULL },
{ "PSM POWER DOWN", NULL },
{ "QIND", NULL },
{ "QIOPEN", NULL },
{ "QIURC", NULL },
{ "QSIMSTAT", NULL },
{ "RDY", NULL }
};
const char * CellularSrcTokenErrorTable[] =
{ "ERROR", "BUSY", "NO CARRIER", "NO ANSWER", "NO DIALTONE", "ABORTED", "+CMS ERROR", "+CME ERROR", "SEND FAIL" };
const char * CellularSrcTokenSuccessTable[] =
{ "OK", "CONNECT", "SEND OK", ">" };
const char * CellularUrcTokenWoPrefixTable[] =
{ "NORMAL POWER DOWN", "PSM POWER DOWN", "RDY" };
const char * CellularSrcExtraTokenSuccessTable[] =
{ "EXTRA_TOKEN_1", "EXTRA_TOKEN_2", "EXTRA_TOKEN_3" };
static CellularTokenTable_t tokenTable =
{
.pCellularUrcHandlerTable = CellularUrcHandlerTable,
.cellularPrefixToParserMapSize = CELLULAR_URC_HANDLER_TABLE_SIZE,
.pCellularSrcTokenErrorTable = CellularSrcTokenErrorTable,
.cellularSrcTokenErrorTableSize = CELLULAR_SRC_TOKEN_ERROR_TABLE_SIZE,
.pCellularSrcTokenSuccessTable = CellularSrcTokenSuccessTable,
.cellularSrcTokenSuccessTableSize = CELLULAR_SRC_TOKEN_SUCCESS_TABLE_SIZE,
.pCellularUrcTokenWoPrefixTable = CellularUrcTokenWoPrefixTable,
.cellularUrcTokenWoPrefixTableSize = CELLULAR_URC_TOKEN_WO_PREFIX_TABLE_SIZE,
.pCellularSrcExtraTokenSuccessTable = CellularSrcExtraTokenSuccessTable,
.cellularSrcExtraTokenSuccessTableSize = CELLULAR_SRC_EXTRA_TOKEN_SUCCESS_TABLE_SIZE
};
/****************************************************************
* The signature of the function under test.
****************************************************************/
CellularError_t Cellular_CommonCreateSocket( CellularHandle_t cellularHandle,
uint8_t pdnContextId,
CellularSocketDomain_t socketDomain,
CellularSocketType_t socketType,
CellularSocketProtocol_t socketProtocol,
CellularSocketHandle_t * pSocketHandle );
/****************************************************************
* The proof of Cellular_CommonCreateSocket
****************************************************************/
void harness()
{
CellularHandle_t pHandle = NULL;
uint8_t CellularSocketPdnContextId;
CellularSocketDomain_t cellularSocketDomain;
CellularSocketType_t cellularSocketType;
CellularSocketProtocol_t cellularSocketProtocol;
CellularSocketHandle_t * pTcpSocket = safeMalloc( sizeof( CellularSocketHandle_t * ) );
CellularError_t socketStatus = CELLULAR_INVALID_HANDLE;
/****************************************************************
* Initialize the member of Cellular_CommonInit.
****************************************************************/
Cellular_CommonInit( nondet_bool() ? NULL : &pHandle, &CellularCommInterface, &tokenTable );
if( ( pHandle != NULL ) && ensure_memory_is_valid( pHandle, sizeof( CellularContext_t ) ) )
{
if( ( pTcpSocket == NULL ) ||
( ( pTcpSocket != NULL ) && ensure_memory_is_valid( pTcpSocket, sizeof( CellularSocketHandle_t * ) ) ) )
{
for( CellularSocketPdnContextId = 0; CellularSocketPdnContextId < CELLULAR_NUM_SOCKET_MAX + 2U; CellularSocketPdnContextId++ )
{
/* Create a new TCP socket. */
socketStatus = Cellular_CommonCreateSocket( pHandle,
CellularSocketPdnContextId,
cellularSocketDomain,
cellularSocketType,
cellularSocketProtocol,
pTcpSocket );
}
}
}
}

View File

@ -0,0 +1,50 @@
#
# Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
# the Software, and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
HARNESS_ENTRY=harness
HARNESS_FILE=Cellular_CommonCreateSocket_harness
PROOF_UID = Cellular_CommonCreateSocket
DEFINES +=
INCLUDES +=
REMOVE_FUNCTION_BODY += _Cellular_TranslatePktStatus
REMOVE_FUNCTION_BODY += _Cellular_CheckLibraryStatus
# This value was experimentally chosen to provide 100% coverage
# without tripping unwinding assertions and without exhausting memory.
CBMC_MAX_BUFSIZE=15
CBMC_OBJECT_BITS=9
UNWINDSET += __CPROVER_file_local_cellular_common_c__Cellular_FreeContext.0:$(CBMC_MAX_BUFSIZE)
UNWINDSET += _Cellular_CreateSocketData.0:$(CBMC_MAX_BUFSIZE)
UNWINDSET += harness.0:$(CBMC_MAX_BUFSIZE)
PROOF_SOURCES += $(PROOFDIR)/$(HARNESS_FILE).c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/sources/cellular_cbmc_state.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/sources/global_state_cellular.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/sources/cellular_platform.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/sources/cellular_modules.c
PROJECT_SOURCES += $(SRCDIR)/source/cellular_common_api.c
PROJECT_SOURCES += $(SRCDIR)/source/cellular_common.c
include ../Makefile.common

View File

@ -0,0 +1,10 @@
Cellular_CommonCreateSocket proof
==============
This directory contains a memory safety proof for Cellular_CommonCreateSocket.
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.

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": "Cellular_CommonCreateSocket",
"proof-root": "tools/cbmc/proofs"
}

View File

@ -0,0 +1,101 @@
/*
* FreeRTOS-Cellular-Interface v1.3.0
* 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.
*
* https://www.FreeRTOS.org
* https://github.com/FreeRTOS
*/
/* Standard includes. */
#include <stdint.h>
/* Cellular APIs includes. */
#include "cellular_config_defaults.h"
#include "cellular_types.h"
#include "cellular_common_internal.h"
#include "cellular_common_api.h"
#define ensure_memory_is_valid( px, length ) ( px != NULL ) && __CPROVER_w_ok( ( px ), length )
/* Extern the com interface in comm_if_windows.c */
extern CellularCommInterface_t CellularCommInterface;
CellularAtParseTokenMap_t CellularUrcHandlerTable[] =
{
{ "CEREG", NULL },
{ "CGREG", NULL },
{ "CREG", NULL },
{ "NORMAL POWER DOWN", NULL },
{ "PSM POWER DOWN", NULL },
{ "QIND", NULL },
{ "QIOPEN", NULL },
{ "QIURC", NULL },
{ "QSIMSTAT", NULL },
{ "RDY", NULL }
};
const char * CellularSrcTokenErrorTable[] =
{ "ERROR", "BUSY", "NO CARRIER", "NO ANSWER", "NO DIALTONE", "ABORTED", "+CMS ERROR", "+CME ERROR", "SEND FAIL" };
const char * CellularSrcTokenSuccessTable[] =
{ "OK", "CONNECT", "SEND OK", ">" };
const char * CellularUrcTokenWoPrefixTable[] =
{ "NORMAL POWER DOWN", "PSM POWER DOWN", "RDY" };
const char * CellularSrcExtraTokenSuccessTable[] =
{ "EXTRA_TOKEN_1", "EXTRA_TOKEN_2", "EXTRA_TOKEN_3" };
static CellularTokenTable_t tokenTable =
{
.pCellularUrcHandlerTable = CellularUrcHandlerTable,
.cellularPrefixToParserMapSize = CELLULAR_URC_HANDLER_TABLE_SIZE,
.pCellularSrcTokenErrorTable = CellularSrcTokenErrorTable,
.cellularSrcTokenErrorTableSize = CELLULAR_SRC_TOKEN_ERROR_TABLE_SIZE,
.pCellularSrcTokenSuccessTable = CellularSrcTokenSuccessTable,
.cellularSrcTokenSuccessTableSize = CELLULAR_SRC_TOKEN_SUCCESS_TABLE_SIZE,
.pCellularUrcTokenWoPrefixTable = CellularUrcTokenWoPrefixTable,
.cellularUrcTokenWoPrefixTableSize = CELLULAR_URC_TOKEN_WO_PREFIX_TABLE_SIZE,
.pCellularSrcExtraTokenSuccessTable = CellularSrcExtraTokenSuccessTable,
.cellularSrcExtraTokenSuccessTableSize = CELLULAR_SRC_EXTRA_TOKEN_SUCCESS_TABLE_SIZE
};
/****************************************************************
* The signature of the function under test.
****************************************************************/
CellularError_t Cellular_CommonGetEidrxSettings( CellularHandle_t cellularHandle,
CellularEidrxSettingsList_t * pEidrxSettingsList );
/****************************************************************
* The proof of Cellular_CommonGetEidrxSettings
****************************************************************/
void harness()
{
CellularHandle_t pHandle = NULL;
CellularEidrxSettingsList_t * pEidrxSettingsList = ( CellularEidrxSettingsList_t * ) safeMalloc( sizeof( CellularEidrxSettingsList_t ) );
/****************************************************************
* Initialize the member of Cellular_CommonInit.
****************************************************************/
Cellular_CommonInit( nondet_bool() ? NULL : &pHandle, &CellularCommInterface, &tokenTable );
Cellular_CommonGetEidrxSettings( pHandle, pEidrxSettingsList );
}

View File

@ -0,0 +1,39 @@
#
# Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
# the Software, and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
HARNESS_ENTRY=harness
HARNESS_FILE=Cellular_CommonGetEidrxSettings_harness
PROOF_UID = Cellular_CommonGetEidrxSettings
DEFINES +=
INCLUDES +=
PROOF_SOURCES += $(PROOFDIR)/$(HARNESS_FILE).c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/sources/cellular_cbmc_state.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/sources/global_state_cellular.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/sources/cellular_platform.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/sources/cellular_modules.c
PROJECT_SOURCES += $(SRCDIR)/source/cellular_common_api.c
PROJECT_SOURCES += $(SRCDIR)/source/cellular_common.c
PROJECT_SOURCES += $(SRCDIR)/source/cellular_3gpp_api.c
include ../Makefile.common

View File

@ -0,0 +1,10 @@
Cellular_CommonGetEidrxSettings proof
==============
This directory contains a memory safety proof for Cellular_CommonGetEidrxSettings.
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.

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": "Cellular_CommonGetEidrxSettings",
"proof-root": "tools/cbmc/proofs"
}

View File

@ -0,0 +1,108 @@
/*
* FreeRTOS-Cellular-Interface v1.3.0
* 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.
*
* https://www.FreeRTOS.org
* https://github.com/FreeRTOS
*/
/* Standard includes. */
#include <stdint.h>
/* Cellular APIs includes. */
#include "cellular_config_defaults.h"
#include "cellular_types.h"
#include "cellular_common_internal.h"
#include "cellular_common_api.h"
#define ensure_memory_is_valid( px, length ) ( px != NULL ) && __CPROVER_w_ok( ( px ), length )
/* Extern the com interface in comm_if_windows.c */
extern CellularCommInterface_t CellularCommInterface;
CellularAtParseTokenMap_t CellularUrcHandlerTable[] =
{
{ "CEREG", NULL },
{ "CGREG", NULL },
{ "CREG", NULL },
{ "NORMAL POWER DOWN", NULL },
{ "PSM POWER DOWN", NULL },
{ "QIND", NULL },
{ "QIOPEN", NULL },
{ "QIURC", NULL },
{ "QSIMSTAT", NULL },
{ "RDY", NULL }
};
const char * CellularSrcTokenErrorTable[] =
{ "ERROR", "BUSY", "NO CARRIER", "NO ANSWER", "NO DIALTONE", "ABORTED", "+CMS ERROR", "+CME ERROR", "SEND FAIL" };
const char * CellularSrcTokenSuccessTable[] =
{ "OK", "CONNECT", "SEND OK", ">" };
const char * CellularUrcTokenWoPrefixTable[] =
{ "NORMAL POWER DOWN", "PSM POWER DOWN", "RDY" };
const char * CellularSrcExtraTokenSuccessTable[] =
{ "EXTRA_TOKEN_1", "EXTRA_TOKEN_2", "EXTRA_TOKEN_3" };
static CellularTokenTable_t tokenTable =
{
.pCellularUrcHandlerTable = CellularUrcHandlerTable,
.cellularPrefixToParserMapSize = CELLULAR_URC_HANDLER_TABLE_SIZE,
.pCellularSrcTokenErrorTable = CellularSrcTokenErrorTable,
.cellularSrcTokenErrorTableSize = CELLULAR_SRC_TOKEN_ERROR_TABLE_SIZE,
.pCellularSrcTokenSuccessTable = CellularSrcTokenSuccessTable,
.cellularSrcTokenSuccessTableSize = CELLULAR_SRC_TOKEN_SUCCESS_TABLE_SIZE,
.pCellularUrcTokenWoPrefixTable = CellularUrcTokenWoPrefixTable,
.cellularUrcTokenWoPrefixTableSize = CELLULAR_URC_TOKEN_WO_PREFIX_TABLE_SIZE,
.pCellularSrcExtraTokenSuccessTable = CellularSrcExtraTokenSuccessTable,
.cellularSrcExtraTokenSuccessTableSize = CELLULAR_SRC_EXTRA_TOKEN_SUCCESS_TABLE_SIZE
};
/****************************************************************
* The signature of the function under test.
****************************************************************/
CellularError_t Cellular_CommonGetIPAddress( CellularHandle_t cellularHandle,
uint8_t contextId,
/* FreeRTOS Cellular Library prototype. pBuffer is passed to _Cellular_AtcmdRequestWithCallback. */
/* coverity[misra_c_2012_rule_8_13_violation] */
char * pBuffer,
uint32_t bufferLength );
/****************************************************************
* The proof of Cellular_CommonGetIPAddress
****************************************************************/
void harness()
{
CellularHandle_t pHandle = NULL;
uint8_t CellularSocketPdnContextId;
char * localIP; /*[ CELLULAR_IP_ADDRESS_MAX_SIZE ] = { '\0' }; */
localIP = ( char * ) safeMalloc( sizeof( char ) * CELLULAR_IP_ADDRESS_MAX_SIZE );
/****************************************************************
* Initialize the member of Cellular_CommonInit.
****************************************************************/
Cellular_CommonInit( nondet_bool() ? NULL : &pHandle, &CellularCommInterface, &tokenTable );
Cellular_CommonGetIPAddress( pHandle, CellularSocketPdnContextId, localIP, CELLULAR_IP_ADDRESS_MAX_SIZE );
}

View File

@ -0,0 +1,40 @@
#
# Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
# the Software, and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
HARNESS_ENTRY=harness
HARNESS_FILE=Cellular_CommonGetIPAddress_harness
PROOF_UID = Cellular_CommonGetIPAddress
DEFINES +=
INCLUDES +=
PROOF_SOURCES += $(PROOFDIR)/$(HARNESS_FILE).c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/sources/cellular_cbmc_state.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/sources/global_state_cellular.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/sources/cellular_platform.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/sources/cellular_modules.c
PROOF_SOURCES += $(SRCDIR)/test/cbmc/stubs/snprintf.c
PROJECT_SOURCES += $(SRCDIR)/source/cellular_common_api.c
PROJECT_SOURCES += $(SRCDIR)/source/cellular_common.c
PROJECT_SOURCES += $(SRCDIR)/source/cellular_3gpp_api.c
include ../Makefile.common

View File

@ -0,0 +1,10 @@
Cellular_CommonGetIPAddress proof
==============
This directory contains a memory safety proof for Cellular_CommonGetIPAddress.
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.

View File

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

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