SE RT Services Utilities library
CRC32 operations

General Description

CRC32 operations definitions.

Macros

#define IFX_CRC32_CRC_WIDTH   32u
 Size of CRC32 data value in bits.
 
#define IFX_CRC32_CRC_SIZE   (IFX_CRC32_CRC_WIDTH / 8u)
 Size of CRC32 data value in bytes.
 
#define IFX_CRC32_INIT   (0xFFFFFFFFuL)
 Default initial value to calculate CRC32.
 
#define IFX_CRC32_CALC(Q, n)   ifx_se_crc32d6a(n, Q, IFX_CRC32_INIT)
 Calculates CRC32 value of the data block. More...
 
#define IFX_CRC32_CALC_APPEND(data, data_size)
 Calculates and appends CRC32 value to the and of the data block. More...
 

Functions

void ifx_se_crc32d6_open (uint32_t *P, uint32_t init)
 Used to initialize CRC state P. More...
 
uint32_t ifx_se_crc32d6_close (uint32_t const *P)
 Used to finalize CRC state P and return 32 bit digest. More...
 
void ifx_se_crc32d6a_update (uint32_t *P, uint8_t Q)
 Used to update CRC state P with next message symbol Q. More...
 
uint32_t ifx_se_crc32d6a (size_t n, uint8_t const *Q, uint32_t init)
 Used to calculate 32 bit digest from the message. More...
 
void ifx_se_crc32d6b_update (uint32_t *P, uint16_t Q)
 Used to update CRC state P with next 16-bit message symbol Q. More...
 
uint32_t ifx_se_crc32d6b (size_t n, uint16_t const *Q, uint32_t init)
 Used to calculate 32 bit digest from the 16-bit symbol message. More...
 

Macro Definition Documentation

◆ IFX_CRC32_CALC

#define IFX_CRC32_CALC (   Q,
 
)    ifx_se_crc32d6a(n, Q, IFX_CRC32_INIT)

Calculates CRC32 value of the data block.

Parameters
[in]QThe pointer to the input data block
[in]nThe size of data block to calculate CRC32
Returns
CRC32 value

◆ IFX_CRC32_CALC_APPEND

#define IFX_CRC32_CALC_APPEND (   data,
  data_size 
)
Value:
do { \
uint32_t data_crc = IFX_CRC32_CALC((const uint8_t*)(data), (data_size)); \
memcpy((uint8_t *)(data) + (data_size), &data_crc, sizeof(data_crc)); \
} while(0)
#define IFX_CRC32_CALC(Q, n)
Calculates CRC32 value of the data block.
Definition: ifx_se_crc32.h:71

Calculates and appends CRC32 value to the and of the data block.

Parameters
[in]dataThe pointer to the input data block
[in]data_sizeThe size of actual data to calculate CRC32
Note
The data buffer MUST be larger than data_size by at least IFX_CRC32_CRC_SIZE (4 bytes) to save the CRC32 value at the end of the data block

Function Documentation

◆ ifx_se_crc32d6_open()

void ifx_se_crc32d6_open ( uint32_t *  P,
uint32_t  init 
)

Used to initialize CRC state P.

Parameters
[out]PThe pointer to the CRC32 state variable.
[in]initInitial value for CRC32 calculation

◆ ifx_se_crc32d6_close()

uint32_t ifx_se_crc32d6_close ( uint32_t const *  P)

Used to finalize CRC state P and return 32 bit digest.

Parameters
[in]PThe pointer to the CRC32 state variable.
Returns
32 bit digest

◆ ifx_se_crc32d6a_update()

void ifx_se_crc32d6a_update ( uint32_t *  P,
uint8_t  Q 
)

Used to update CRC state P with next message symbol Q.

Parameters
[in,out]PThe pointer to the CRC32 state variable.
[in]Qmessage symbol Q

◆ ifx_se_crc32d6a()

uint32_t ifx_se_crc32d6a ( size_t  n,
uint8_t const *  Q,
uint32_t  init 
)

Used to calculate 32 bit digest from the message.

Parameters
[in]nThe length of the message.
[in]QThe pointer to the message.
[in]initInitial value for CRC32 calculation.
Returns
32 bit digest

◆ ifx_se_crc32d6b_update()

void ifx_se_crc32d6b_update ( uint32_t *  P,
uint16_t  Q 
)

Used to update CRC state P with next 16-bit message symbol Q.

Parameters
[in,out]PThe pointer to the CRC32 state variable.
[in]Qmessage symbol Q (16-bit)

◆ ifx_se_crc32d6b()

uint32_t ifx_se_crc32d6b ( size_t  n,
uint16_t const *  Q,
uint32_t  init 
)

Used to calculate 32 bit digest from the 16-bit symbol message.

Parameters
[in]nThe length of the message.
[in]QThe pointer to the message.
[in]initInitial value for CRC32 calculation.
Returns
32 bit digest