first commit
This commit is contained in:
commit
92cbe97616
1978 files changed
+1688498
No files matched your search
+31
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"ENTRY": "vProcessGeneratedUDPPacket",
|
||||
"CBMCFLAGS":
|
||||
[
|
||||
"--unwind 1",
|
||||
"--unwindset FreeRTOS_InterfaceEndPointOnNetMask.0:3",
|
||||
"--nondet-static"
|
||||
],
|
||||
"OBJS":
|
||||
[
|
||||
"$(ENTRY)_harness.goto",
|
||||
"$(FREERTOS_PLUS_TCP)/source/FreeRTOS_IP.goto",
|
||||
"$(FREERTOS_PLUS_TCP)/source/FreeRTOS_Routing.goto",
|
||||
"$(FREERTOS_PLUS_TCP)/source/FreeRTOS_UDP_IP.goto",
|
||||
"$(FREERTOS_PLUS_TCP)/source/FreeRTOS_UDP_IPv4.goto"
|
||||
],
|
||||
"INSTFLAGS":
|
||||
[
|
||||
],
|
||||
"DEF":
|
||||
[
|
||||
"ipconfigSUPPORT_OUTGOING_PINGS=1",
|
||||
"ipconfigBYTE_ORDER=pdFREERTOS_BIG_ENDIAN"
|
||||
],
|
||||
"INC":
|
||||
[
|
||||
"$(FREERTOS_PLUS_TCP)/test/cbmc/include",
|
||||
"$(FREERTOS_PLUS_TCP)/test/cbmc/proofs/utility",
|
||||
"$(FREERTOS_PLUS_TCP)/test/cbmc/stubs"
|
||||
]
|
||||
}
|
||||
+142
@@ -0,0 +1,142 @@
|
||||
/* Standard includes. */
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
/* FreeRTOS includes. */
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
#include "queue.h"
|
||||
#include "list.h"
|
||||
#include "semphr.h"
|
||||
|
||||
/* FreeRTOS+TCP includes. */
|
||||
#include "FreeRTOS_IP.h"
|
||||
#include "FreeRTOS_ARP.h"
|
||||
#include "FreeRTOS_UDP_IP.h"
|
||||
#include "FreeRTOS_IP_Private.h"
|
||||
|
||||
/* Include the stubs for APIs. */
|
||||
#include "memory_assignments.c"
|
||||
#include "freertos_api.c"
|
||||
|
||||
/* vProcessGeneratedUDPPacket_IPv6 is proven separately. */
|
||||
void vProcessGeneratedUDPPacket_IPv6( NetworkBufferDescriptor_t * const pxNetworkBuffer )
|
||||
{
|
||||
__CPROVER_assert( pxNetworkBuffer != NULL, "pxNetworkBuffer cannot be NULL" );
|
||||
}
|
||||
|
||||
/* We do not need to calculate the actual checksum for the proof to be complete.
|
||||
* Neither does the checksum matter for completeness. */
|
||||
uint16_t usGenerateChecksum( uint16_t usSum,
|
||||
const uint8_t * pucNextData,
|
||||
size_t uxByteCount )
|
||||
{
|
||||
__CPROVER_assert( pucNextData != NULL, "Next data in GenerateChecksum cannot be NULL" );
|
||||
|
||||
uint16_t usChecksum;
|
||||
|
||||
/* Return any random value of checksum since it does not matter for CBMC checks. */
|
||||
return usChecksum;
|
||||
}
|
||||
|
||||
/* We do not need to calculate the actual checksum for the proof to be complete.
|
||||
* Neither does the checksum matter for completeness. */
|
||||
uint16_t usGenerateProtocolChecksum( const uint8_t * const pucEthernetBuffer,
|
||||
size_t uxBufferLength,
|
||||
BaseType_t xOutgoingPacket )
|
||||
{
|
||||
__CPROVER_assert( pucEthernetBuffer != NULL, "The Ethernet buffer cannot be NULL while generating Protocol Checksum" );
|
||||
uint16_t usProtocolChecksum;
|
||||
|
||||
/* Return random value of checksum since it does not matter for CBMC checks. */
|
||||
return usProtocolChecksum;
|
||||
}
|
||||
|
||||
|
||||
/* This function has been tested separately. Therefore, we assume that the implementation is correct. */
|
||||
void vARPRefreshCacheEntry( const MACAddress_t * pxMACAddress,
|
||||
const uint32_t ulIPAddress )
|
||||
{
|
||||
/* pxMACAddress can be NULL or Non-NULL, no need to assert. */
|
||||
}
|
||||
|
||||
|
||||
/* This function has been tested separately. Therefore, we assume that the implementation is correct. */
|
||||
void vARPGenerateRequestPacket( NetworkBufferDescriptor_t * const pxNetworkBuffer )
|
||||
{
|
||||
__CPROVER_assert( pxNetworkBuffer != NULL, "The network buffer cannot be NULL." );
|
||||
}
|
||||
|
||||
|
||||
/* This function has been tested separately. Therefore, we assume that the implementation is correct. */
|
||||
eResolutionLookupResult_t eARPGetCacheEntry( uint32_t * pulIPAddress,
|
||||
MACAddress_t * const pxMACAddress )
|
||||
{
|
||||
__CPROVER_assert( pulIPAddress != NULL, "pulIPAddress cannot be NULL" );
|
||||
__CPROVER_assert( pxMACAddress != NULL, "pxMACAddress cannot be NULL" );
|
||||
|
||||
eResolutionLookupResult_t eResult;
|
||||
|
||||
return eResult;
|
||||
}
|
||||
|
||||
BaseType_t NetworkInterfaceOutputFunction_Stub( struct xNetworkInterface * pxDescriptor,
|
||||
NetworkBufferDescriptor_t * const pxNetworkBuffer,
|
||||
BaseType_t xReleaseAfterSend )
|
||||
{
|
||||
__CPROVER_assert( pxDescriptor != NULL, "The network interface cannot be NULL." );
|
||||
__CPROVER_assert( pxNetworkBuffer != NULL, "The network buffer descriptor cannot be NULL." );
|
||||
__CPROVER_assert( pxNetworkBuffer->pucEthernetBuffer != NULL, "The Ethernet buffer cannot be NULL." );
|
||||
BaseType_t ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void harness()
|
||||
{
|
||||
size_t xRequestedSizeBytes;
|
||||
|
||||
/* Assume that the size of packet must be greater than that of UDP-Packet and less than
|
||||
* that of the Ethernet Frame Size. */
|
||||
__CPROVER_assume( xRequestedSizeBytes >= sizeof( UDPPacket_t ) && xRequestedSizeBytes <= ipTOTAL_ETHERNET_FRAME_SIZE );
|
||||
|
||||
/* Second parameter is not used from CBMC's perspective. */
|
||||
NetworkBufferDescriptor_t * const pxNetworkBuffer = pxGetNetworkBufferWithDescriptor( xRequestedSizeBytes, 0 );
|
||||
|
||||
/* The buffer cannot be NULL for the function call. */
|
||||
__CPROVER_assume( pxNetworkBuffer != NULL );
|
||||
__CPROVER_assume( pxNetworkBuffer->pucEthernetBuffer != NULL );
|
||||
|
||||
/*
|
||||
* Add an end point to the network buffer present. Its assumed that the
|
||||
* network interface layer correctly assigns the end point to the generated buffer.
|
||||
*/
|
||||
pxNetworkBuffer->pxEndPoint = ( NetworkEndPoint_t * ) malloc( sizeof( NetworkEndPoint_t ) );
|
||||
__CPROVER_assume( pxNetworkBuffer->pxEndPoint != NULL );
|
||||
pxNetworkBuffer->pxEndPoint->pxNext = NULL;
|
||||
|
||||
/* Add an interface */
|
||||
pxNetworkBuffer->pxEndPoint->pxNetworkInterface = ( NetworkInterface_t * ) malloc( sizeof( NetworkInterface_t ) );
|
||||
__CPROVER_assume( pxNetworkBuffer->pxEndPoint->pxNetworkInterface != NULL );
|
||||
|
||||
/* Add few endpoints to global pxNetworkEndPoints */
|
||||
pxNetworkEndPoints = ( NetworkEndPoint_t * ) malloc( sizeof( NetworkEndPoint_t ) );
|
||||
__CPROVER_assume( pxNetworkEndPoints != NULL );
|
||||
pxNetworkEndPoints->pxNetworkInterface = pxNetworkBuffer->pxEndPoint->pxNetworkInterface;
|
||||
|
||||
if( nondet_bool() )
|
||||
{
|
||||
pxNetworkEndPoints->pxNext = ( NetworkEndPoint_t * ) malloc( sizeof( NetworkEndPoint_t ) );
|
||||
__CPROVER_assume( pxNetworkEndPoints->pxNext != NULL );
|
||||
pxNetworkEndPoints->pxNext->pxNetworkInterface = pxNetworkBuffer->pxEndPoint->pxNetworkInterface;
|
||||
pxNetworkEndPoints->pxNext->pxNext = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
pxNetworkEndPoints->pxNext = NULL;
|
||||
}
|
||||
|
||||
pxNetworkBuffer->pxEndPoint->pxNetworkInterface->pfOutput = &NetworkInterfaceOutputFunction_Stub;
|
||||
|
||||
vProcessGeneratedUDPPacket( pxNetworkBuffer );
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"ENTRY": "vProcessGeneratedUDPPacket_IPv6",
|
||||
"CBMCFLAGS":
|
||||
[
|
||||
"--unwind 1",
|
||||
"--unwindset FreeRTOS_InterfaceEndPointOnNetMask.0:3",
|
||||
"--nondet-static"
|
||||
],
|
||||
"OBJS":
|
||||
[
|
||||
"$(ENTRY)_harness.goto",
|
||||
"$(FREERTOS_PLUS_TCP)/source/FreeRTOS_IP.goto",
|
||||
"$(FREERTOS_PLUS_TCP)/source/FreeRTOS_Routing.goto",
|
||||
"$(FREERTOS_PLUS_TCP)/source/FreeRTOS_ND.goto",
|
||||
"$(FREERTOS_PLUS_TCP)/source/FreeRTOS_UDP_IPv6.goto"
|
||||
],
|
||||
"INSTFLAGS":
|
||||
[
|
||||
],
|
||||
"DEF":
|
||||
[
|
||||
"ipconfigSUPPORT_OUTGOING_PINGS=1",
|
||||
"ipconfigBYTE_ORDER=pdFREERTOS_BIG_ENDIAN"
|
||||
],
|
||||
"INC":
|
||||
[
|
||||
"$(FREERTOS_PLUS_TCP)/test/cbmc/include",
|
||||
"$(FREERTOS_PLUS_TCP)/test/cbmc/proofs/utility",
|
||||
"$(FREERTOS_PLUS_TCP)/test/cbmc/stubs"
|
||||
]
|
||||
}
|
||||
+134
@@ -0,0 +1,134 @@
|
||||
/* Standard includes. */
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
/* FreeRTOS includes. */
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
#include "queue.h"
|
||||
#include "list.h"
|
||||
#include "semphr.h"
|
||||
|
||||
/* FreeRTOS+TCP includes. */
|
||||
#include "FreeRTOS_IP.h"
|
||||
#include "FreeRTOS_ND.h"
|
||||
#include "FreeRTOS_UDP_IP.h"
|
||||
#include "FreeRTOS_IP_Private.h"
|
||||
|
||||
/* Include the stubs for APIs. */
|
||||
#include "memory_assignments.c"
|
||||
#include "freertos_api.c"
|
||||
|
||||
/* We do not need to calculate the actual checksum for the proof to be complete.
|
||||
* Neither does the checksum matter for completeness. */
|
||||
uint16_t usGenerateChecksum( uint16_t usSum,
|
||||
const uint8_t * pucNextData,
|
||||
size_t uxByteCount )
|
||||
{
|
||||
uint16_t usChecksum;
|
||||
|
||||
__CPROVER_assert( pucNextData != NULL, "Next data in GenerateChecksum cannot be NULL" );
|
||||
/* Return any random value of checksum since it does not matter for CBMC checks. */
|
||||
return usChecksum;
|
||||
}
|
||||
|
||||
|
||||
/* We do not need to calculate the actual checksum for the proof to be complete.
|
||||
* Neither does the checksum matter for completeness. */
|
||||
uint16_t usGenerateProtocolChecksum( const uint8_t * const pucEthernetBuffer,
|
||||
size_t uxBufferLength,
|
||||
BaseType_t xOutgoingPacket )
|
||||
{
|
||||
uint16_t usProtocolChecksum;
|
||||
|
||||
__CPROVER_assert( pucEthernetBuffer != NULL, "The Ethernet buffer cannot be NULL while generating Protocol Checksum" );
|
||||
|
||||
/* Return random value of checksum since it does not matter for CBMC checks. */
|
||||
return usProtocolChecksum;
|
||||
}
|
||||
|
||||
/* This function has been tested separately. Therefore, we assume that the implementation is correct. */
|
||||
eResolutionLookupResult_t eNDGetCacheEntry( IPv6_Address_t * pxIPAddress,
|
||||
MACAddress_t * const pxMACAddress,
|
||||
struct xNetworkEndPoint ** ppxEndPoint )
|
||||
{
|
||||
eResolutionLookupResult_t eResult;
|
||||
|
||||
__CPROVER_assert( pxIPAddress != NULL, "pxIPAddress cannot be NULL" );
|
||||
__CPROVER_assert( pxMACAddress != NULL, "pxMACAddress cannot be NULL" );
|
||||
|
||||
return eResult;
|
||||
}
|
||||
|
||||
/* This function has been tested separately. Therefore, we assume that the implementation is correct. */
|
||||
void vNDSendNeighbourSolicitation( NetworkBufferDescriptor_t * pxNetworkBuffer,
|
||||
const IPv6_Address_t * pxIPAddress )
|
||||
{
|
||||
__CPROVER_assert( pxNetworkBuffer != NULL, "The network buffer descriptor cannot be NULL." );
|
||||
__CPROVER_assert( pxNetworkBuffer->pucEthernetBuffer != NULL, "The Ethernet buffer cannot be NULL." );
|
||||
__CPROVER_assert( pxIPAddress != NULL, "pxIPAddress cannot be NULL." );
|
||||
}
|
||||
|
||||
BaseType_t NetworkInterfaceOutputFunction_Stub( struct xNetworkInterface * pxDescriptor,
|
||||
NetworkBufferDescriptor_t * const pxNetworkBuffer,
|
||||
BaseType_t xReleaseAfterSend )
|
||||
{
|
||||
BaseType_t ret;
|
||||
|
||||
__CPROVER_assert( pxDescriptor != NULL, "The network interface cannot be NULL." );
|
||||
__CPROVER_assert( pxNetworkBuffer != NULL, "The network buffer descriptor cannot be NULL." );
|
||||
__CPROVER_assert( pxNetworkBuffer->pucEthernetBuffer != NULL, "The Ethernet buffer cannot be NULL." );
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void harness()
|
||||
{
|
||||
size_t xRequestedSizeBytes;
|
||||
|
||||
/* Assume that the size of packet must be greater than that of UDP-Packet and less than
|
||||
* that of the Ethernet Frame Size. */
|
||||
__CPROVER_assume( xRequestedSizeBytes >= sizeof( UDPPacket_IPv6_t ) && xRequestedSizeBytes <= ipTOTAL_ETHERNET_FRAME_SIZE );
|
||||
|
||||
/* Second parameter is not used from CBMC's perspective. */
|
||||
NetworkBufferDescriptor_t * const pxNetworkBuffer = pxGetNetworkBufferWithDescriptor( xRequestedSizeBytes, 0 );
|
||||
|
||||
/* The buffer cannot be NULL for the function call. */
|
||||
__CPROVER_assume( pxNetworkBuffer != NULL );
|
||||
__CPROVER_assume( pxNetworkBuffer->pucEthernetBuffer != NULL );
|
||||
|
||||
/*
|
||||
* Add an end point to the network buffer present. Its assumed that the
|
||||
* network interface layer correctly assigns the end point to the generated buffer.
|
||||
*/
|
||||
pxNetworkBuffer->pxEndPoint = ( NetworkEndPoint_t * ) safeMalloc( sizeof( NetworkEndPoint_t ) );
|
||||
__CPROVER_assume( pxNetworkBuffer->pxEndPoint != NULL );
|
||||
pxNetworkBuffer->pxEndPoint->pxNext = NULL;
|
||||
|
||||
/* Add an interface */
|
||||
pxNetworkBuffer->pxEndPoint->pxNetworkInterface = ( NetworkInterface_t * ) safeMalloc( sizeof( NetworkInterface_t ) );
|
||||
__CPROVER_assume( pxNetworkBuffer->pxEndPoint->pxNetworkInterface != NULL );
|
||||
|
||||
/* Add few endpoints to global pxNetworkEndPoints */
|
||||
pxNetworkEndPoints = ( NetworkEndPoint_t * ) safeMalloc( sizeof( NetworkEndPoint_t ) );
|
||||
__CPROVER_assume( pxNetworkEndPoints != NULL );
|
||||
|
||||
pxNetworkEndPoints->pxNetworkInterface = pxNetworkBuffer->pxEndPoint->pxNetworkInterface;
|
||||
|
||||
if( nondet_bool() )
|
||||
{
|
||||
pxNetworkEndPoints->pxNext = ( NetworkEndPoint_t * ) safeMalloc( sizeof( NetworkEndPoint_t ) );
|
||||
__CPROVER_assume( pxNetworkEndPoints->pxNext != NULL );
|
||||
pxNetworkEndPoints->pxNext->pxNetworkInterface = pxNetworkBuffer->pxEndPoint->pxNetworkInterface;
|
||||
pxNetworkEndPoints->pxNext->pxNext = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
pxNetworkEndPoints->pxNext = NULL;
|
||||
}
|
||||
|
||||
pxNetworkBuffer->pxEndPoint->pxNetworkInterface->pfOutput = &NetworkInterfaceOutputFunction_Stub;
|
||||
|
||||
vProcessGeneratedUDPPacket_IPv6( pxNetworkBuffer );
|
||||
}
|
||||
Reference in new issue
Block a user