mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-10-26 23:36:32 -04:00
Adding FreeRTOS+TCP CBMC proofs to FreeRTOS/FreeRTOS (#56)
ParseDNSReply is to be added in the next PR.
This commit is contained in:
parent
40a31b6d35
commit
4db195c916
100 changed files with 3448 additions and 30 deletions
|
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
"ENTRY": "ProcessReceivedUDPPacket",
|
||||
"MAX_RX_PACKETS":1,
|
||||
"USE_LLMNR":1,
|
||||
"USE_NBNS":1,
|
||||
"CBMCFLAGS":
|
||||
[
|
||||
"--unwind 1",
|
||||
"--nondet-static"
|
||||
],
|
||||
"OBJS":
|
||||
[
|
||||
"$(ENTRY)_harness.goto",
|
||||
"$(FREERTOS)/../FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/FreeRTOS_UDP_IP.goto",
|
||||
"$(FREERTOS)/../FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/FreeRTOS_IP.goto"
|
||||
],
|
||||
"DEF":
|
||||
[
|
||||
"ipconfigUDP_MAX_RX_PACKETS={MAX_RX_PACKETS}",
|
||||
"ipconfigUSE_LLMNR={USE_LLMNR}",
|
||||
"ipconfigUSE_NBNS={USE_NBNS}"
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
/* FreeRTOS includes. */
|
||||
#include "FreeRTOS.h"
|
||||
#include "queue.h"
|
||||
|
||||
/* FreeRTOS+TCP includes. */
|
||||
#include "FreeRTOS_IP.h"
|
||||
#include "FreeRTOS_IP_Private.h"
|
||||
#include "FreeRTOS_ARP.h"
|
||||
#include "FreeRTOS_UDP_IP.h"
|
||||
#include "FreeRTOS_TCP_IP.h"
|
||||
|
||||
/*This proof assumes that pxUDPSocketLookup is implemented correctly. */
|
||||
|
||||
/* This proof was done before. Hence we assume it to be correct here. */
|
||||
void vARPRefreshCacheEntry(const MACAddress_t * pxMACAddress, const uint32_t ulIPAddress) { }
|
||||
|
||||
/* This proof was done before. Hence we assume it to be correct here. */
|
||||
BaseType_t xIsDHCPSocket(Socket_t xSocket) { }
|
||||
|
||||
/* This proof was done before. Hence we assume it to be correct here. */
|
||||
uint32_t ulDNSHandlePacket(NetworkBufferDescriptor_t *pxNetworkBuffer) { }
|
||||
|
||||
/* Implementation of safe malloc */
|
||||
void *safeMalloc(size_t xWantedSize) {
|
||||
if(xWantedSize == 0) {
|
||||
return NULL;
|
||||
}
|
||||
uint8_t byte;
|
||||
return byte ? malloc(xWantedSize) : NULL;
|
||||
}
|
||||
|
||||
/* Abstraction of pxUDPSocketLookup */
|
||||
FreeRTOS_Socket_t *pxUDPSocketLookup( UBaseType_t uxLocalPort ) {
|
||||
return safeMalloc(sizeof(FreeRTOS_Socket_t));
|
||||
}
|
||||
|
||||
void harness() {
|
||||
NetworkBufferDescriptor_t *pxNetworkBuffer = safeMalloc(sizeof(NetworkBufferDescriptor_t));
|
||||
if(pxNetworkBuffer) {
|
||||
pxNetworkBuffer->pucEthernetBuffer = safeMalloc(sizeof(UDPPacket_t));
|
||||
}
|
||||
uint16_t usPort;
|
||||
if (pxNetworkBuffer && pxNetworkBuffer->pucEthernetBuffer) {
|
||||
xProcessReceivedUDPPacket(pxNetworkBuffer, usPort);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue