Functions#

This section provides a reference to the Crypto utility API functions used for AES.

Functions#

uint8_t *
pkcs7_padding(uint8_t *data, size_t data_length, size_t block_size, size_t *padded_data_length)

To perform PKCS #7 padding on the given data.

int
pkcs7_unpad(unsigned char *data, size_t data_length)

To unpad a PKCS #7 padded data array in-place, and return the length of the unpadded data.

Function Documentation#

pkcs7_padding#

uint8_t * pkcs7_padding (uint8_t * data, size_t data_length, size_t block_size, size_t * padded_data_length)

To perform PKCS #7 padding on the given data.

Parameters
[in]data

Pointer to the data to be padded.

[in]data_length

Length of the data in bytes.

[in]block_size

Size of the block in bytes (typically 16 for AES).

[out]padded_data_length


Pointer to store the length of the padded data.

Returns

  • Returns a pointer to the padded data.


Definition at line 59 of file components/device/silabs/si91x/wireless/crypto/crypto_utility/inc/sl_si91x_crypto_utility.h

pkcs7_unpad#

int pkcs7_unpad (unsigned char * data, size_t data_length)

To unpad a PKCS #7 padded data array in-place, and return the length of the unpadded data.

Parameters
[in]data

Pointer to the data array containing PKCS #7 padded data.

[in]data_length

Length of the data array.

This function performs PKCS #7 unpadding on the input data array. It checks the padding bytes at the end of the array, removes them if they are valid, and returns the length of the unpadded data.
Returns

  • The length of the unpadded data, or -1, if the padding is invalid or data is empty.


Definition at line 72 of file components/device/silabs/si91x/wireless/crypto/crypto_utility/inc/sl_si91x_crypto_utility.h