[修改] 增加freeRTOS
1. 版本FreeRTOSv202212.01,命名为kernel;
This commit is contained in:
@ -0,0 +1,105 @@
|
||||
cmake_minimum_required ( VERSION 3.13.0 )
|
||||
project ( "cellular_library unit test"
|
||||
VERSION 1.0.0
|
||||
LANGUAGES C )
|
||||
|
||||
# Allow the project to be organized into folders.
|
||||
set_property( GLOBAL PROPERTY USE_FOLDERS ON )
|
||||
|
||||
# Use C90.
|
||||
set( CMAKE_C_STANDARD 90 )
|
||||
set( CMAKE_C_STANDARD_REQUIRED ON )
|
||||
|
||||
# Do not allow in-source build.
|
||||
if( ${PROJECT_SOURCE_DIR} STREQUAL ${PROJECT_BINARY_DIR} )
|
||||
message( FATAL_ERROR "In-source build is not allowed. Please build in a separate directory, such as ${PROJECT_SOURCE_DIR}/build." )
|
||||
endif()
|
||||
|
||||
# Set global path variables.
|
||||
get_filename_component(__MODULE_ROOT_DIR "${CMAKE_CURRENT_LIST_DIR}/.." ABSOLUTE)
|
||||
set(MODULE_ROOT_DIR ${__MODULE_ROOT_DIR} CACHE INTERNAL "cellular_library repository root.")
|
||||
|
||||
# Configure options to always show in CMake GUI.
|
||||
option( BUILD_CLONE_SUBMODULES
|
||||
"Set this to ON to automatically clone any required Git submodules. When OFF, submodules must be manually cloned."
|
||||
OFF )
|
||||
|
||||
# Set output directories.
|
||||
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin )
|
||||
set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib )
|
||||
set( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib )
|
||||
|
||||
# ===================================== Coverity Analysis Configuration =================================================
|
||||
|
||||
# Set the source path and include path
|
||||
set( CELLULAR_COMMON_SOURCE ${MODULE_ROOT_DIR}/source )
|
||||
set( CELLULAR_INCLUDE_DIRS ${CELLULAR_COMMON_SOURCE}/include )
|
||||
set( CELLULAR_COMMON_INCLUDE_DIRS ${CELLULAR_INCLUDE_DIRS}/common )
|
||||
set( CELLULAR_COMMON_INCLUDE_PRIVATE_DIRS ${CELLULAR_INCLUDE_DIRS}/private )
|
||||
set( CELLULAR_INTERFACE_INCLUDE_DIRS ${CELLULAR_COMMON_SOURCE}/interface )
|
||||
set( CELLULAR_TEST_DIRS ${MODULE_ROOT_DIR}/test/unit-test )
|
||||
|
||||
# Target for Coverity analysis that builds the library.
|
||||
add_library( coverity_analysis
|
||||
${CELLULAR_COMMON_SOURCE}/cellular_at_core.c
|
||||
${CELLULAR_COMMON_SOURCE}/cellular_common.c
|
||||
${CELLULAR_COMMON_SOURCE}/cellular_common_api.c
|
||||
${CELLULAR_COMMON_SOURCE}/cellular_3gpp_urc_handler.c
|
||||
${CELLULAR_COMMON_SOURCE}/cellular_3gpp_api.c
|
||||
${CELLULAR_COMMON_SOURCE}/cellular_pkthandler.c
|
||||
${CELLULAR_COMMON_SOURCE}/cellular_pktio.c )
|
||||
|
||||
# Build Cellular library target without custom config dependency.
|
||||
target_compile_definitions( coverity_analysis PUBLIC CELLULAR_DO_NOT_USE_CUSTOM_CONFIG=1 )
|
||||
|
||||
# Cellular include path.
|
||||
target_include_directories( coverity_analysis PUBLIC ${CELLULAR_COMMON_INCLUDE_DIRS} ${CELLULAR_INCLUDE_DIRS} ${CELLULAR_INTERFACE_INCLUDE_DIRS} ${CELLULAR_TEST_DIRS})
|
||||
|
||||
# Cellular private include path.
|
||||
target_include_directories( coverity_analysis PRIVATE ${CELLULAR_COMMON_INCLUDE_PRIVATE_DIRS} )
|
||||
|
||||
# Build without debug enabled when performing static analysis
|
||||
target_compile_options(coverity_analysis PUBLIC -DNDEBUG )
|
||||
|
||||
# ==================================== Test Configuration ========================================
|
||||
|
||||
# Define a CMock resource path.
|
||||
set( CMOCK_DIR ${MODULE_ROOT_DIR}/test/unit-test/CMock CACHE INTERNAL "CMock library source directory." )
|
||||
|
||||
# Include CMock build configuration.
|
||||
include( unit-test/cmock_build.cmake )
|
||||
|
||||
# Check if the CMock source directory exists, and if not present, clone the submodule
|
||||
# if BUILD_CLONE_SUBMODULES configuration is enabled.
|
||||
if( NOT EXISTS ${CMOCK_DIR}/src )
|
||||
# Attempt to clone CMock.
|
||||
if( ${BUILD_CLONE_SUBMODULES} )
|
||||
clone_cmock()
|
||||
else()
|
||||
message( FATAL_ERROR "The required submodule CMock does not exist. Either clone it manually, or set BUILD_CLONE_SUBMODULES to 1 to automatically clone it during build." )
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Add unit test and coverage configuration.
|
||||
|
||||
# Use CTest utility for managing test runs. This has to be added BEFORE
|
||||
# defining test targets with add_test()
|
||||
enable_testing()
|
||||
|
||||
# Add build targets for CMock and Unit, required for unit testing.
|
||||
add_cmock_targets()
|
||||
|
||||
# Add function to enable CMock based tests and coverage.
|
||||
include( ${MODULE_ROOT_DIR}/tools/cmock/create_test.cmake )
|
||||
|
||||
# Include build configuration for unit tests.
|
||||
add_subdirectory( unit-test )
|
||||
|
||||
# ==================================== Coverage Analysis configuration ========================================
|
||||
|
||||
# Add a target for running coverage on tests.
|
||||
add_custom_target( coverage
|
||||
COMMAND ${CMAKE_COMMAND} -P ${MODULE_ROOT_DIR}/tools/cmock/coverage.cmake
|
||||
DEPENDS cmock unity cellular_at_core_utest cellular_pktio_utest cellular_pkthandler_utest cellular_common_api_utest cellular_common_utest cellular_3gpp_api_utest cellular_3gpp_urc_handler_utest
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
)
|
||||
20
kernel/FreeRTOS-Plus/Source/FreeRTOS-Cellular-Interface/test/cbmc/.gitignore
vendored
Normal file
20
kernel/FreeRTOS-Plus/Source/FreeRTOS-Cellular-Interface/test/cbmc/.gitignore
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
# Emitted when running CBMC proofs
|
||||
proofs/**/logs
|
||||
proofs/**/gotos
|
||||
proofs/**/report
|
||||
proofs/**/html
|
||||
|
||||
# Emitted by CBMC Viewer
|
||||
TAGS-*
|
||||
|
||||
# Emitted by Arpa
|
||||
arpa_cmake/
|
||||
arpa-validation-logs/
|
||||
Makefile.arpa
|
||||
|
||||
# Emitted by litani
|
||||
.ninja_deps
|
||||
.ninja_log
|
||||
.litani_cache_dir
|
||||
|
||||
__pycache__/
|
||||
@ -0,0 +1,6 @@
|
||||
CBMC proof include files
|
||||
========================
|
||||
|
||||
This directory contains include files written for CBMC proof. It is
|
||||
common to write some code to model aspects of the system under test,
|
||||
and the header files for this code go here.
|
||||
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file cellular_cbmc_state.h
|
||||
* @brief Allocation and assumption utilities for the Shadow library CBMC proofs.
|
||||
*/
|
||||
#ifndef CELLULAR_CBMC_STATE_H_
|
||||
#define CELLULAR_CBMC_STATE_H_
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
/**
|
||||
* @brief Proof model for malloc that can fail and return NULL.
|
||||
*
|
||||
* @param[in] size The size in bytes of memory to allocate.
|
||||
*
|
||||
* @return NULL or requested memory.
|
||||
*/
|
||||
void * mallocCanFail( size_t size );
|
||||
|
||||
#endif /* ifndef CELLULAR_CBMC_STATE_H_ */
|
||||
@ -0,0 +1,58 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file cellular_config.h
|
||||
* @brief cellular config options.
|
||||
*/
|
||||
|
||||
#ifndef CELLULAR_CONFIG_H_
|
||||
#define CELLULAR_CONFIG_H_
|
||||
|
||||
/* This is a project specific file and is used to override config values defined
|
||||
* in cellular_config_defaults.h. */
|
||||
|
||||
|
||||
/*
|
||||
* PDN context id for cellular network.
|
||||
*/
|
||||
#define CELLULAR_PDN_CONTEXT_ID ( CELLULAR_PDN_CONTEXT_ID_MIN )
|
||||
|
||||
/*
|
||||
* PDN connect timeout for network registration.
|
||||
*/
|
||||
#define CELLULAR_PDN_CONNECT_TIMEOUT ( 100000UL )
|
||||
|
||||
/*
|
||||
* Overwrite default config for different cellular modules.
|
||||
*/
|
||||
|
||||
/*
|
||||
* GetHostByName API is not used in the demo. IP address is used to store the hostname.
|
||||
* The value should be longer than the length of democonfigMQTT_BROKER_ENDPOINT in demo_config.h.
|
||||
*/
|
||||
#define CELLULAR_IP_ADDRESS_MAX_SIZE ( 64U )
|
||||
|
||||
#endif /* __CELLULAR_CONFIG_H__ */
|
||||
@ -0,0 +1,240 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#ifndef __CELLULAR_PLATFORM_H__
|
||||
#define __CELLULAR_PLATFORM_H__
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
||||
/**
|
||||
* @brief Cellular library platform event group APIs.
|
||||
*
|
||||
* Cellular library use platform event group for process synchronization.
|
||||
*
|
||||
* The EventGroup functions in the following link can be referenced as function prototype.
|
||||
* https://www.freertos.org/event-groups-API.html
|
||||
*
|
||||
*/
|
||||
|
||||
#define LogError
|
||||
#define LogDebug
|
||||
#define LogWarn
|
||||
#define LogInfo
|
||||
|
||||
#define configASSERT
|
||||
|
||||
#define Platform_Delay
|
||||
|
||||
typedef void * PVOID;
|
||||
|
||||
#define PlatformEventGroupHandle_t uint16_t
|
||||
#define PlatformEventGroup_Delete MockPlatformEventGroup_Delete
|
||||
#define PlatformEventGroup_ClearBits MockPlatformEventGroup_ClearBits
|
||||
#define PlatformEventGroup_Create MockPlatformEventGroup_Create
|
||||
#define PlatformEventGroup_GetBits MockPlatformEventGroup_GetBits
|
||||
#define PlatformEventGroup_SetBits
|
||||
#define PlatformEventGroup_SetBitsFromISR MockPlatformEventGroup_SetBitsFromISR
|
||||
#define PlatformEventGroup_WaitBits MockPlatformEventGroup_WaitBits
|
||||
#define PlatformEventGroup_EventBits uint32_t
|
||||
|
||||
#define vQueueDelete MockvQueueDelete
|
||||
#define xQueueSend MockxQueueSend
|
||||
#define xQueueReceive MockxQueueReceive
|
||||
#define xQueueCreate MockxQueueCreate
|
||||
|
||||
#define PlatformMutex_Create MockPlatformMutex_Create
|
||||
#define PlatformMutex_Destroy MockPlatformMutex_Destroy
|
||||
#define PlatformMutex_Lock MockPlatformMutex_Lock
|
||||
#define PlatformMutex_TryLock MockPlatformMutex_TryLock
|
||||
#define PlatformMutex_Unlock MockPlatformMutex_Unlock
|
||||
|
||||
#define Platform_CreateDetachedThread MockPlatform_CreateDetachedThread
|
||||
|
||||
#define taskENTER_CRITICAL() PVOID
|
||||
#define taskEXIT_CRITICAL() PVOID
|
||||
|
||||
#define pdFALSE ( 0x0 )
|
||||
#define pdTRUE ( 0x1 )
|
||||
#define pdPASS ( 0x1 )
|
||||
|
||||
#define PlatformTickType uint64_t
|
||||
|
||||
/* Converts a time in milliseconds to a time in ticks. This macro can be
|
||||
* overridden by a macro of the same name defined in FreeRTOSConfig.h in case the
|
||||
* definition here is not suitable for your application. */
|
||||
#ifndef pdMS_TO_TICKS
|
||||
#define pdMS_TO_TICKS( xTimeInMs ) ( ( TickType_t ) ( ( ( TickType_t ) ( xTimeInMs ) * ( TickType_t ) 1000 ) / ( TickType_t ) 1000U ) )
|
||||
#endif
|
||||
|
||||
#define CELLULAR_URC_HANDLER_TABLE_SIZE ( sizeof( CellularUrcHandlerTable ) / sizeof( CellularAtParseTokenMap_t ) )
|
||||
#define CELLULAR_SRC_TOKEN_ERROR_TABLE_SIZE ( sizeof( CellularSrcTokenErrorTable ) / sizeof( char * ) )
|
||||
#define CELLULAR_SRC_TOKEN_SUCCESS_TABLE_SIZE ( sizeof( CellularSrcTokenSuccessTable ) / sizeof( char * ) )
|
||||
#define CELLULAR_URC_TOKEN_WO_PREFIX_TABLE_SIZE ( sizeof( CellularUrcTokenWoPrefixTable ) / sizeof( char * ) )
|
||||
#define CELLULAR_SRC_EXTRA_TOKEN_SUCCESS_TABLE_SIZE ( sizeof( CellularSrcExtraTokenSuccessTable ) / sizeof( char * ) )
|
||||
|
||||
#if ( configUSE_16_BIT_TICKS == 1 )
|
||||
typedef uint16_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffff
|
||||
#else
|
||||
typedef uint64_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffffffffUL
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The type that holds event bits always matches TickType_t - therefore the
|
||||
* number of bits it holds is set by configUSE_16_BIT_TICKS (16 bits if set to 1,
|
||||
* 32 bits if set to 0.
|
||||
*
|
||||
* \defgroup EventBits_t EventBits_t
|
||||
* \ingroup EventGroup
|
||||
*/
|
||||
typedef TickType_t EventBits_t;
|
||||
|
||||
/**
|
||||
* @brief Cellular library platform thread API and configuration.
|
||||
*
|
||||
* Cellular library create a detached thread by this API.
|
||||
* The threadRoutine should be called with pArgument in the created thread.
|
||||
*
|
||||
* PLATFORM_THREAD_DEFAULT_STACK_SIZE and PLATFORM_THREAD_DEFAULT_PRIORITY defines
|
||||
* the platform related stack size and priority.
|
||||
*/
|
||||
|
||||
bool Platform_CreateDetachedThread( void ( * threadRoutine )( void * pArgument ),
|
||||
void * pArgument,
|
||||
size_t priority,
|
||||
size_t stackSize );
|
||||
|
||||
#define PLATFORM_THREAD_DEFAULT_STACK_SIZE ( 2048U )
|
||||
#define PLATFORM_THREAD_DEFAULT_PRIORITY ( 5U )
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* Definition of the queue used by the scheduler.
|
||||
* Items are queued by copy, not reference. See the following link for the
|
||||
* rationale: https://www.FreeRTOS.org/Embedded-RTOS-Queues.html
|
||||
*/
|
||||
struct QueueDefinition /* The old naming convention is used to prevent breaking kernel aware debuggers. */
|
||||
{
|
||||
int8_t * pcHead; /*< Points to the beginning of the queue storage area. */
|
||||
int8_t * pcWriteTo; /*< Points to the free next place in the storage area. */
|
||||
};
|
||||
|
||||
/**
|
||||
* Type by which queues are referenced. For example, a call to xQueueCreate()
|
||||
* returns an QueueHandle_t variable that can then be used as a parameter to
|
||||
* xQueueSend(), xQueueReceive(), etc.
|
||||
*/
|
||||
struct QueueDefinition; /* Using old naming convention so as not to break kernel aware debuggers. */
|
||||
typedef struct QueueDefinition * QueueHandle_t;
|
||||
|
||||
/*
|
||||
* In line with software engineering best practice, especially when supplying a
|
||||
* library that is likely to change in future versions, FreeRTOS implements a
|
||||
* strict data hiding policy. This means the Queue structure used internally by
|
||||
* FreeRTOS is not accessible to application code. However, if the application
|
||||
* writer wants to statically allocate the memory required to create a queue
|
||||
* then the size of the queue object needs to be know. The StaticQueue_t
|
||||
* structure below is provided for this purpose. Its sizes and alignment
|
||||
* requirements are guaranteed to match those of the genuine structure, no
|
||||
* matter which architecture is being used, and no matter how the values in
|
||||
* FreeRTOSConfig.h are set. Its contents are somewhat obfuscated in the hope
|
||||
* users will recognise that it would be unwise to make direct use of the
|
||||
* structure members.
|
||||
*/
|
||||
typedef struct xSTATIC_QUEUE
|
||||
{
|
||||
void * pvDummy1[ 3 ];
|
||||
} StaticQueue_t;
|
||||
typedef StaticQueue_t StaticSemaphore_t;
|
||||
|
||||
/**
|
||||
* @brief Cellular library platform mutex APIs.
|
||||
*
|
||||
* Cellular library use platform mutex to protect resource.
|
||||
*
|
||||
* The IotMutex_ functions can be referenced as function prototype for
|
||||
* PlatfromMutex_ prefix function in the following link.
|
||||
* https://docs.aws.amazon.com/freertos/latest/lib-ref/c-sdk/platform/platform_threads_functions.html
|
||||
*
|
||||
*/
|
||||
typedef long BaseType_t;
|
||||
typedef struct PlatformMutex
|
||||
{
|
||||
StaticSemaphore_t xMutex; /**< FreeRTOS mutex. */
|
||||
BaseType_t recursive; /**< Type; used for indicating if this is reentrant or normal. */
|
||||
bool created;
|
||||
} PlatformMutex_t;
|
||||
|
||||
bool PlatformMutex_Create( PlatformMutex_t * pNewMutex,
|
||||
bool recursive );
|
||||
void PlatformMutex_Destroy( PlatformMutex_t * pMutex );
|
||||
void PlatformMutex_Lock( PlatformMutex_t * pMutex );
|
||||
bool PlatformMutex_TryLock( PlatformMutex_t * pMutex );
|
||||
void PlatformMutex_Unlock( PlatformMutex_t * pMutex );
|
||||
int32_t PlatformEventGroup_SetBitsFromISR( PlatformEventGroupHandle_t groupEvent,
|
||||
EventBits_t event,
|
||||
BaseType_t * pHigherPriorityTaskWoken );
|
||||
void * safeMalloc( size_t xWantedSize );
|
||||
void allocateSocket( void * pCellularHandle );
|
||||
bool MockxQueueReceive( int32_t * queue,
|
||||
void * data,
|
||||
uint32_t time );
|
||||
uint16_t MockPlatformEventGroup_Create();
|
||||
uint16_t MockPlatformEventGroup_WaitBits();
|
||||
|
||||
QueueHandle_t xQueueCreate( int32_t uxQueueLength,
|
||||
uint32_t uxItemSize );
|
||||
uint16_t vQueueDelete( QueueHandle_t queue );
|
||||
BaseType_t xQueueSend( QueueHandle_t queue,
|
||||
void * data,
|
||||
uint32_t time );
|
||||
|
||||
uint16_t PlatformEventGroup_ClearBits( PlatformEventGroupHandle_t xEventGroup,
|
||||
TickType_t uxBitsToClear );
|
||||
uint16_t PlatformEventGroup_Delete( PlatformEventGroupHandle_t groupEvent );
|
||||
uint16_t PlatformEventGroup_GetBits( PlatformEventGroupHandle_t groupEvent );
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* @brief Cellular library platform memory allocation APIs.
|
||||
*
|
||||
* Cellular library use platform memory allocation APIs to allocate memory dynamically.
|
||||
* The FreeRTOS memory management document can be referenced for these APIs.
|
||||
* https://www.freertos.org/a00111.html
|
||||
*
|
||||
*/
|
||||
|
||||
#define Platform_Malloc safeMalloc
|
||||
#define Platform_Free free
|
||||
|
||||
#endif /* __CELLULAR_PLATFORM_H__ */
|
||||
@ -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 );
|
||||
}
|
||||
@ -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
|
||||
@ -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.
|
||||
@ -0,0 +1 @@
|
||||
# This file marks this directory as containing a CBMC proof.
|
||||
@ -0,0 +1,7 @@
|
||||
{ "expected-missing-functions":
|
||||
[
|
||||
|
||||
],
|
||||
"proof-name": "Cellular_ATGetNextTok",
|
||||
"proof-root": "tools/cbmc/proofs"
|
||||
}
|
||||
@ -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 );
|
||||
}
|
||||
}
|
||||
@ -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
|
||||
@ -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.
|
||||
@ -0,0 +1 @@
|
||||
# This file marks this directory as containing a CBMC proof.
|
||||
@ -0,0 +1,7 @@
|
||||
{ "expected-missing-functions":
|
||||
[
|
||||
|
||||
],
|
||||
"proof-name": "Cellular_ATGetSpecificNextTok",
|
||||
"proof-root": "tools/cbmc/proofs"
|
||||
}
|
||||
@ -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 );
|
||||
}
|
||||
}
|
||||
@ -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
|
||||
@ -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.
|
||||
@ -0,0 +1 @@
|
||||
# This file marks this directory as containing a CBMC proof.
|
||||
@ -0,0 +1,7 @@
|
||||
{ "expected-missing-functions":
|
||||
[
|
||||
|
||||
],
|
||||
"proof-name": "Cellular_ATHexStrToHex",
|
||||
"proof-root": "tools/cbmc/proofs"
|
||||
}
|
||||
@ -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 );
|
||||
}
|
||||
}
|
||||
@ -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
|
||||
@ -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.
|
||||
@ -0,0 +1 @@
|
||||
# This file marks this directory as containing a CBMC proof.
|
||||
@ -0,0 +1,7 @@
|
||||
{ "expected-missing-functions":
|
||||
[
|
||||
|
||||
],
|
||||
"proof-name": "Cellular_ATIsPrefixPresent",
|
||||
"proof-root": "tools/cbmc/proofs"
|
||||
}
|
||||
@ -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 );
|
||||
}
|
||||
}
|
||||
@ -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
|
||||
@ -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.
|
||||
@ -0,0 +1 @@
|
||||
# This file marks this directory as containing a CBMC proof.
|
||||
@ -0,0 +1,7 @@
|
||||
{ "expected-missing-functions":
|
||||
[
|
||||
|
||||
],
|
||||
"proof-name": "Cellular_ATIsStrDigit",
|
||||
"proof-root": "tools/cbmc/proofs"
|
||||
}
|
||||
@ -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 );
|
||||
}
|
||||
}
|
||||
@ -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
|
||||
@ -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.
|
||||
@ -0,0 +1 @@
|
||||
# This file marks this directory as containing a CBMC proof.
|
||||
@ -0,0 +1,7 @@
|
||||
{ "expected-missing-functions":
|
||||
[
|
||||
|
||||
],
|
||||
"proof-name": "Cellular_ATRemoveAllDoubleQuote",
|
||||
"proof-root": "tools/cbmc/proofs"
|
||||
}
|
||||
@ -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 );
|
||||
}
|
||||
}
|
||||
@ -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
|
||||
@ -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.
|
||||
@ -0,0 +1 @@
|
||||
# This file marks this directory as containing a CBMC proof.
|
||||
@ -0,0 +1,7 @@
|
||||
{ "expected-missing-functions":
|
||||
[
|
||||
|
||||
],
|
||||
"proof-name": "Cellular_ATRemoveAllWhiteSpaces",
|
||||
"proof-root": "tools/cbmc/proofs"
|
||||
}
|
||||
@ -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 );
|
||||
}
|
||||
}
|
||||
@ -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
|
||||
@ -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.
|
||||
@ -0,0 +1 @@
|
||||
# This file marks this directory as containing a CBMC proof.
|
||||
@ -0,0 +1,7 @@
|
||||
{ "expected-missing-functions":
|
||||
[
|
||||
|
||||
],
|
||||
"proof-name": "Cellular_ATRemoveLeadingWhiteSpaces",
|
||||
"proof-root": "tools/cbmc/proofs"
|
||||
}
|
||||
@ -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 );
|
||||
}
|
||||
}
|
||||
@ -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
|
||||
@ -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.
|
||||
@ -0,0 +1 @@
|
||||
# This file marks this directory as containing a CBMC proof.
|
||||
@ -0,0 +1,7 @@
|
||||
{ "expected-missing-functions":
|
||||
[
|
||||
|
||||
],
|
||||
"proof-name": "Cellular_ATRemoveOutermostDoubleQuote",
|
||||
"proof-root": "tools/cbmc/proofs"
|
||||
}
|
||||
Binary file not shown.
@ -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 );
|
||||
}
|
||||
}
|
||||
@ -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
|
||||
@ -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.
|
||||
@ -0,0 +1 @@
|
||||
# This file marks this directory as containing a CBMC proof.
|
||||
@ -0,0 +1,7 @@
|
||||
{ "expected-missing-functions":
|
||||
[
|
||||
|
||||
],
|
||||
"proof-name": "Cellular_ATRemovePrefix",
|
||||
"proof-root": "tools/cbmc/proofs"
|
||||
}
|
||||
@ -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 );
|
||||
}
|
||||
}
|
||||
@ -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
|
||||
@ -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.
|
||||
@ -0,0 +1 @@
|
||||
# This file marks this directory as containing a CBMC proof.
|
||||
@ -0,0 +1,7 @@
|
||||
{ "expected-missing-functions":
|
||||
[
|
||||
|
||||
],
|
||||
"proof-name": "Cellular_ATRemoveTrailingWhiteSpaces",
|
||||
"proof-root": "tools/cbmc/proofs"
|
||||
}
|
||||
@ -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 );
|
||||
}
|
||||
}
|
||||
@ -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
|
||||
@ -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.
|
||||
@ -0,0 +1 @@
|
||||
# This file marks this directory as containing a CBMC proof.
|
||||
@ -0,0 +1,7 @@
|
||||
{ "expected-missing-functions":
|
||||
[
|
||||
|
||||
],
|
||||
"proof-name": "Cellular_ATStrDup",
|
||||
"proof-root": "tools/cbmc/proofs"
|
||||
}
|
||||
@ -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 );
|
||||
}
|
||||
}
|
||||
@ -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
|
||||
@ -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.
|
||||
@ -0,0 +1 @@
|
||||
# This file marks this directory as containing a CBMC proof.
|
||||
@ -0,0 +1,7 @@
|
||||
{ "expected-missing-functions":
|
||||
[
|
||||
|
||||
],
|
||||
"proof-name": "Cellular_ATStrStartWith",
|
||||
"proof-root": "tools/cbmc/proofs"
|
||||
}
|
||||
@ -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 );
|
||||
}
|
||||
}
|
||||
@ -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
|
||||
@ -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.
|
||||
@ -0,0 +1 @@
|
||||
# This file marks this directory as containing a CBMC proof.
|
||||
@ -0,0 +1,7 @@
|
||||
{ "expected-missing-functions":
|
||||
[
|
||||
|
||||
],
|
||||
"proof-name": "Cellular_ATStrtoi",
|
||||
"proof-root": "tools/cbmc/proofs"
|
||||
}
|
||||
@ -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 );
|
||||
}
|
||||
}
|
||||
@ -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
|
||||
@ -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.
|
||||
@ -0,0 +1 @@
|
||||
# This file marks this directory as containing a CBMC proof.
|
||||
@ -0,0 +1,7 @@
|
||||
{ "expected-missing-functions":
|
||||
[
|
||||
|
||||
],
|
||||
"proof-name": "Cellular_ATcheckErrorCode",
|
||||
"proof-root": "tools/cbmc/proofs"
|
||||
}
|
||||
@ -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 );
|
||||
}
|
||||
}
|
||||
@ -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
|
||||
@ -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.
|
||||
@ -0,0 +1 @@
|
||||
# This file marks this directory as containing a CBMC proof.
|
||||
@ -0,0 +1,7 @@
|
||||
{ "expected-missing-functions":
|
||||
[
|
||||
|
||||
],
|
||||
"proof-name": "Cellular_CommonATCommandRaw",
|
||||
"proof-root": "tools/cbmc/proofs"
|
||||
}
|
||||
@ -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 );
|
||||
}
|
||||
@ -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
|
||||
@ -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.
|
||||
@ -0,0 +1 @@
|
||||
# This file marks this directory as containing a CBMC proof.
|
||||
@ -0,0 +1,7 @@
|
||||
{ "expected-missing-functions":
|
||||
[
|
||||
|
||||
],
|
||||
"proof-name": "Cellular_CommonCleanup",
|
||||
"proof-root": "tools/cbmc/proofs"
|
||||
}
|
||||
@ -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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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
|
||||
@ -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.
|
||||
@ -0,0 +1 @@
|
||||
# This file marks this directory as containing a CBMC proof.
|
||||
@ -0,0 +1,7 @@
|
||||
{ "expected-missing-functions":
|
||||
[
|
||||
|
||||
],
|
||||
"proof-name": "Cellular_CommonCreateSocket",
|
||||
"proof-root": "tools/cbmc/proofs"
|
||||
}
|
||||
@ -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 );
|
||||
}
|
||||
@ -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
|
||||
@ -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.
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user