CRC32 API

group CRC32

Functions

void csp_crc32_gentab(void)

Generate precomputed CRC32 table.

int csp_crc32_append(csp_packet_t *packet, bool include_header)

Append CRC32 checksum to packet.

Return
0 on success, -1 on error
Parameters
  • packet: Packet to append checksum
  • include_header: use header in calculation (this will not modify the flags field)

int csp_crc32_verify(csp_packet_t *packet, bool include_header)

Verify CRC32 checksum on packet.

Return
0 if checksum is valid, -1 otherwise
Parameters
  • packet: Packet to verify
  • include_header: use header in calculation (this will not modify the flags field)

uint32_t csp_crc32_memory(const uint8_t *data, uint32_t length)

Calculate checksum for a given memory area.

Return
return uint32_t checksum
Parameters
  • data: pointer to memory
  • length: length of memory to do checksum on