SE RT Services Utilities library

| SE RT Services Utilities library

Macros | Functions
CRC32 operations
IFX SE PSA crypto API

## 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,
|  |  | n
| ) |  | ifx_se_crc32d6a(n, Q, IFX_CRC32_INIT)

Calculates CRC32 value of the data block.

Parameters

  [in] | Q | The pointer to the input data block
  [in] | n | The 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)
IFX_CRC32_CALC
#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] | data | The pointer to the input data block
  [in] | data_size | The 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] | P | The pointer to the CRC32 state variable.
  [in] | init | Initial 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] | P | The 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] | P | The pointer to the CRC32 state variable.
  [in] | Q | message 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] | n | The length of the message.
  [in] | Q | The pointer to the message.
  [in] | init | Initial 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] | P | The pointer to the CRC32 state variable.
  [in] | Q | message 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] | n | The length of the message.
  [in] | Q | The pointer to the message.
  [in] | init | Initial value for CRC32 calculation.

Returns
  32 bit digest