CRC32

Functions

void csp_crc32_gentab (void)
 Generate precomputed CRC32 table. More...
 
int csp_crc32_append (csp_packet_t *packet, bool include_header)
 Append CRC32 checksum to packet. More...
 
int csp_crc32_verify (csp_packet_t *packet, bool include_header)
 Verify CRC32 checksum on packet. More...
 
uint32_t csp_crc32_memory (const uint8_t *data, uint32_t length)
 Calculate checksum for a given memory area. More...
 

Function Documentation

int csp_crc32_append ( csp_packet_t packet,
bool  include_header 
)

Append CRC32 checksum to packet.

Parameters
packetPacket to append checksum
include_headeruse header in calculation (this will not modify the flags field)
Returns
0 on success, -1 on error
void csp_crc32_gentab ( void  )

Generate precomputed CRC32 table.

uint32_t csp_crc32_memory ( const uint8_t *  data,
uint32_t  length 
)

Calculate checksum for a given memory area.

Parameters
datapointer to memory
lengthlength of memory to do checksum on
Returns
return uint32_t checksum
int csp_crc32_verify ( csp_packet_t packet,
bool  include_header 
)

Verify CRC32 checksum on packet.

Parameters
packetPacket to verify
include_headeruse header in calculation (this will not modify the flags field)
Returns
0 if checksum is valid, -1 otherwise