Crypto APIs#
This section describes the Crypto APIs
Functions#
Compute the SHA digest. This is a blocking API.
Decide whether the SHA message can be sent once or requires multiple calls to send. This is a blocking API.
Hold computed digest from HMAC-SHA. This is a blocking API.
Decide whether the HMAC-SHA message can be sent once or requires multiple calls to send the message. This is a blocking API.
Decide whether the AES message can be sent once or requires multiple calls to send the message. This is a blocking API.
Encrypt/decrypt the data using AES.
Calculate the DH key. This is a blocking API.
Compute the ECDH point multiplication vector. This is a blocking API.
Compute the ECDH point addition vector. This is a blocking API.
Compute the ECDH point subtraction vector. This is a blocking API.
Compute the ECDH point double vector. This is a blocking API.
Compute the ECDH point affinity vector. This is a blocking API.
Decides whether the CCM message can be sent once or requires multiple calls to send.
Encrypt/Decrypt the data using CCM.
This API Initializes the TRNG hardware engine and Evaluate AES-CBC.
This API check the health of Trng.
This API Initializes key which needs to be programmed to TRNG hardware engine.
This API generated random number of desired length.
This API gets token.
Computes the sha3/shake digest.
Decides whether the sha message can be sent once or requires multiple calls to send.
Decides whether the sha message can be sent once or requires multiple calls to send.
Decides whether the CHACHAPOLY message can be sent once or requires multiple calls to send.
Encrypt/Decrypt the data using CHACHA_POLY.
Decides whether the GCM/CMAC message can be sent once or requires multiple calls to send.
Function Documentation#
rsi_sha_pen#
int32_t rsi_sha_pen (uint8_t sha_mode, uint8_t * msg, uint16_t msg_length, uint16_t chunk_len, uint8_t pending_flag, uint8_t * digest)
Compute the SHA digest. This is a blocking API.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint8_t | [in] | sha_mode | 1 – For SHA1 |
uint8_t * | [in] | msg | - Pointer to message |
uint16_t | [in] | msg_length | - Total message length |
uint16_t | [in] | chunk_len | - Current chunk length |
uint8_t | [in] | pending_flag | - BIT(0) - 1st chunk |
uint8_t * | [out] | digest | - Output parameter to hold computed digest from SHA |
Returns
0 - Success
Non-Zero Value - Failure
Note
Refer to Error Codes for the description of above error codes.
rsi_sha#
int32_t rsi_sha (uint8_t sha_mode, uint8_t * msg, uint16_t msg_length, uint8_t * digest)
Decide whether the SHA message can be sent once or requires multiple calls to send. This is a blocking API.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint8_t | [in] | sha_mode | 1 – For SHA1 |
uint8_t * | [in] | msg | - Pointer to message |
uint16_t | [in] | msg_length | - Total message length |
uint8_t * | [out] | digest | - Output parameter to hold computed digest from SHA |
Returns
0 - Success
Non-Zero Value - Failure
Note
Refer to Error Codes for the description of above error codes.
rsi_hmac_sha_pen#
int32_t rsi_hmac_sha_pen (uint8_t hmac_sha_mode, uint8_t * data, uint16_t total_length, uint16_t chunk_length, key_descriptor_t * key_info, uint8_t pending_flag, uint8_t * digest)
Hold computed digest from HMAC-SHA. This is a blocking API.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint8_t | [in] | hmac_sha_mode | - 1 – For HMAC-SHA1 |
uint8_t * | [in] | data | - Pointer to key along with message |
uint16_t | [in] | total_length | - Total message length |
uint16_t | [in] | chunk_length | - Current chunk length |
key_descriptor_t * | [in] | key_info | - Structure pointer for key_info |
uint8_t | [in] | pending_flag | - BIT(0) - 1st chunk |
uint8_t * | [out] | digest | - Output parameter to hold computed digest from HMAC-SHA |
Returns
0 - Success
Non-Zero Value - Failure
Note
Refer to Error Codes for the description of above error codes.
rsi_hmac_sha#
int32_t rsi_hmac_sha (uint8_t hmac_sha_mode, uint8_t * msg, uint32_t msg_length, uint8_t * key, key_descriptor_t * key_info, uint8_t * digest, uint8_t * hmac_buffer)
Decide whether the HMAC-SHA message can be sent once or requires multiple calls to send the message. This is a blocking API.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint8_t | [in] | hmac_sha_mode | - 1 – For HMAC-SHA1 |
uint8_t * | [in] | msg | - Pointer to message |
uint32_t | [in] | msg_length | - Total message length |
uint8_t * | [in] | key | - Pointer to HMAC key |
key_descriptor_t * | [in] | key_info | - Structure Pointer to key_info |
uint8_t * | [in] | digest | - HMAC key length in bytes |
uint8_t * | [out] | hmac_buffer | - Output parameter to hold computed digest from HMAC-SHA |
Returns
0 - Success
Non-Zero Value - Failure (Possible Error Codes - 0xfffffffe, 0xfffffffd, 0xfffffffc, 0xFF15, 0xCC9C, 0xCC9B)
Note
Refer to Error Codes for the description of above error codes.
rsi_aes#
int32_t rsi_aes (uint16_t aes_mode, uint16_t enc_dec, uint8_t * msg, uint16_t msg_length, key_descriptor_t * key_info, uint8_t * iv, uint8_t * output)
Decide whether the AES message can be sent once or requires multiple calls to send the message. This is a blocking API.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint16_t | [in] | aes_mode | - 1 – For AES CBC mode |
uint16_t | [in] | enc_dec | - 1 – For AES Encryption |
uint8_t * | [in] | msg | - Pointer to message |
uint16_t | [in] | msg_length | - Total message length (must be divisible by 16) |
key_descriptor_t * | [in] | key_info | - Structure pointer for key_info |
uint8_t * | [in] | iv | - Pointer to AES iv |
uint8_t * | [out] | output | - Output parameter to hold encrypted/decrypted from AES |
Returns
0 - Success
Non-Zero Value - Failure (Possible Error Codes - 0xfffffffe, 0xfffffffd, 0xfffffffc, 0xFF15, 0xCC9C, 0xCC9B)
Note
Refer to Error Codes for the description of above error codes.
rsi_aes_pen#
int32_t rsi_aes_pen (uint16_t aes_mode, uint16_t enc_dec, uint8_t * msg, uint16_t msg_length, uint16_t chunk_length, key_descriptor_t * key_info, uint8_t * iv, uint8_t aes_flags, uint8_t * output)
Encrypt/decrypt the data using AES.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint16_t | [in] | aes_mode | - 1 – For AES CBC mode |
uint16_t | [in] | enc_dec | - 1 – For AES Encryption |
uint8_t * | [in] | msg | - Pointer to message |
uint16_t | [in] | msg_length | - Total message length (must be divisible by 16) |
uint16_t | [in] | chunk_length | - Current chunk length |
key_descriptor_t * | [in] | key_info | - Structure pointer for key_info |
uint8_t * | [in] | iv | - Pointer to AES iv |
uint8_t | [in] | aes_flags | - BIT(0) - 1st chunk |
uint8_t * | [out] | output | - Output parameter to hold encrypted/decrypted from AES |
Returns
0 - Success
Non-Zero Value - Failure
Note
Refer to Error Codes for the description of above error codes.
rsi_exponentiation#
int32_t rsi_exponentiation (uint8_t * prime, uint32_t prime_length, uint8_t * base, uint32_t base_length, uint8_t * exponent, uint32_t exponent_length, uint8_t * exp_result)
Calculate the DH key. This is a blocking API.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint8_t * | [in] | prime | - Pointer to the prime |
uint32_t | [in] | prime_length | - Length of the prime |
uint8_t * | [in] | base | - Pointer to base |
uint32_t | [in] | base_length | - Length of the base |
uint8_t * | [in] | exponent | - Pointer to exponent |
uint32_t | [in] | exponent_length | - Length of the exponent |
uint8_t * | [out] | exp_result | - Output exponentiation result |
Returns
0 - Success
Non-Zero Value - Failure (Possible Error Codes - 0xfffffffe, 0xfffffffd, 0xfffffffc, 0xFF15, 0xCC9C, 0xCC9B)
Note
Refer to Error Codes for the description of above error codes.
rsi_ecdh_point_multiplication#
int32_t rsi_ecdh_point_multiplication (uint8_t ecdh_mode, uint8_t * d, uint8_t * sx, uint8_t * sy, uint8_t * sz, uint32_t affinity, uint8_t * rx, uint8_t * ry, uint8_t * rz, uint8_t reverse)
Compute the ECDH point multiplication vector. This is a blocking API.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint8_t | [in] | ecdh_mode | - 1 – For ECDH 192 |
uint8_t * | [in] | d | - Pointer to scalar value that needs to be multiplied |
uint8_t * | [in] | sx | Pointer to x coordinate of the point to be multiplied with scalar ‘d’ |
uint8_t * | [in] | sy | Pointer to y coordinate of the point to be multiplied with scalar ‘d’ |
uint8_t * | [in] | sz | Pointer to z coordinate of the point to be multiplied with scalar ‘d’ |
uint32_t | [in] | affinity | - 0 – no affinity |
uint8_t * | [out] | rx | Pointer to x coordinate of the result point |
uint8_t * | [out] | ry | Pointer to y coordinate of the result point |
uint8_t * | [out] | rz | Pointer to z coordinate of the result point |
uint8_t | [in] | reverse | - setting this will perform reverse_8 on the inputs and outputs. |
Returns
0 - Success
Non-Zero Value - Failure (Possible Error Codes - 0xfffffffe, 0xfffffffd, 0xfffffffc, 0xFF15, 0xCC9C, 0xCC9B)
Note
Refer to Error Codes for the description of above error codes.
rsi_ecdh_point_addition#
int32_t rsi_ecdh_point_addition (uint8_t ecdh_mode, uint8_t * sx, uint8_t * sy, uint8_t * sz, uint8_t * tx, uint8_t * ty, uint8_t * tz, uint8_t * rx, uint8_t * ry, uint8_t * rz)
Compute the ECDH point addition vector. This is a blocking API.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint8_t | [in] | ecdh_mode | - 1 – For ECDH 192 |
uint8_t * | [in] | sx | - Pointer to x coordinate of the point1 that needs to be added |
uint8_t * | [in] | sy | - Pointer to y coordinate of the point1 that needs to be added |
uint8_t * | [in] | sz | - Pointer to z coordinate of the point1 that needs to be added |
uint8_t * | [in] | tx | - Pointer to x coordinate of the point2 that needs to be added |
uint8_t * | [in] | ty | - Pointer to y coordinate of the point2 that needs to be added |
uint8_t * | [in] | tz | - Pointer to z coordinate of the point2 that needs to be added |
uint8_t * | [out] | rx | - Pointer to x coordinate of the result point |
uint8_t * | [out] | ry | - Pointer to y coordinate of the result point |
uint8_t * | [out] | rz | - Pointer to z coordinate of the result point |
Returns
0 - Success
Non-Zero Value - Failure (Possible Error Codes - 0xfffffffe, 0xfffffffd, 0xfffffffc, 0xFF15, 0xCC9C, 0xCC9B)
Note
Refer to Error Codes for the description of above error codes.
rsi_ecdh_point_subtraction#
int32_t rsi_ecdh_point_subtraction (uint8_t ecdh_mode, uint8_t * sx, uint8_t * sy, uint8_t * sz, uint8_t * tx, uint8_t * ty, uint8_t * tz, uint8_t * rx, uint8_t * ry, uint8_t * rz)
Compute the ECDH point subtraction vector. This is a blocking API.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint8_t | [in] | ecdh_mode | - 1 – For ECDH 192 |
uint8_t * | [in] | sx | - Pointers to x, y, z coordinates of the point1 that needs to be subtracted |
uint8_t * | [in] | sy | - Pointers to x, y, z coordinates of the point2 that needs to be subtracted |
uint8_t * | [out] | sz | - Pointers to x, y, z coordinates of the result point |
uint8_t * | N/A | tx | |
uint8_t * | N/A | ty | |
uint8_t * | N/A | tz | |
uint8_t * | N/A | rx | |
uint8_t * | N/A | ry | |
uint8_t * | N/A | rz |
Returns
0 - Success
Non-Zero Value - Failure (Possible Error Codes - 0xfffffffe, 0xfffffffd, 0xfffffffc, 0xFF15, 0xCC9C, 0xCC9B)
Note
Refer to Error Codes for the description of above error codes.
rsi_ecdh_point_double#
int32_t rsi_ecdh_point_double (uint8_t ecdh_mode, uint8_t * sx, uint8_t * sy, uint8_t * sz, uint8_t * rx, uint8_t * ry, uint8_t * rz)
Compute the ECDH point double vector. This is a blocking API.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint8_t | [in] | ecdh_mode | - 1 – For ECDH 192 |
uint8_t * | [in] | sx | - Pointers to x, y, z coordinates of the point1 that needs to be doubled |
uint8_t * | [out] | sy | - Pointers to x, y, z coordinates of the result point |
uint8_t * | N/A | sz | |
uint8_t * | N/A | rx | |
uint8_t * | N/A | ry | |
uint8_t * | N/A | rz |
Returns
0 - Success
Non-Zero Value - Failure (Possible Error Codes - 0xfffffffe, 0xfffffffd, 0xfffffffc, 0xFF15, 0xCC9C, 0xCC9B)
Note
Refer to Error Codes for the description of above error codes.
rsi_ecdh_point_affine#
int32_t rsi_ecdh_point_affine (uint8_t ecdh_mode, uint8_t * sx, uint8_t * sy, uint8_t * sz, uint8_t * rx, uint8_t * ry, uint8_t * rz)
Compute the ECDH point affinity vector. This is a blocking API.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint8_t | [in] | ecdh_mode | - 1 – For ECDH 192 |
uint8_t * | [in] | sx | - Pointers to x, y, z coordinates of the point1 that needs to be affinified |
uint8_t * | [out] | sy | - Pointers to x, y, z coordinates of the result point |
uint8_t * | N/A | sz | |
uint8_t * | N/A | rx | |
uint8_t * | N/A | ry | |
uint8_t * | N/A | rz |
Returns
0 - Success
Non-Zero Value - Failure (Possible Error Codes - 0xfffffffe, 0xfffffffd, 0xfffffffc, 0xFF15, 0xCC9C, 0xCC9B)
Note
Refer to Error Codes for the description of above error codes.
rsi_ccm#
int32_t rsi_ccm (uint8_t enc_dec, uint8_t * msg, uint16_t msg_length, key_descriptor_t * key_info, uint8_t * iv, uint16_t iv_sz, uint8_t * tag, uint16_t tag_len, uint8_t * ad, uint16_t ad_len, uint8_t * output)
Decides whether the CCM message can be sent once or requires multiple calls to send.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint8_t | [in] | enc_dec | 0 – For CCM Encryption 1 – For CCM Decryption |
uint8_t * | [in] | msg | Pointer to message |
uint16_t | [in] | msg_length | Total message length |
key_descriptor_t * | [in] | key_info | - Structure pointer for key_info |
uint8_t * | [in] | iv | Pointer to CCM iv |
uint16_t | [in] | iv_sz | of IV |
uint8_t * | [in] | tag | Pointer to CCM tag |
uint16_t | [in] | tag_len | size of tag |
uint8_t * | [in] | ad | to AD |
uint16_t | [in] | ad_len | Total length of AD |
uint8_t * | [out] | output | Output parameter to hold encrypted/decrypted from CCM |
Returns
Non zero - If fails 0 - If success
description#
This function decides whether the CCM message can be sent once or requires multiple calls to send the message
rsi_ccm_pen#
int32_t rsi_ccm_pen (uint8_t enc_dec, uint8_t * msg, uint16_t msg_length, uint16_t chunk_length, key_descriptor_t * key_info, uint8_t * iv, uint16_t iv_sz, uint8_t * tag, uint16_t tag_len, uint8_t * ad, uint16_t ad_len, uint8_t ccm_flags, uint8_t * output)
Encrypt/Decrypt the data using CCM.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint8_t | [in] | enc_dec | 0 – For CCM Encryption 1 – For CCM Decryption |
uint8_t * | [in] | msg | Pointer to message |
uint16_t | [in] | msg_length | Total message length |
uint16_t | [in] | chunk_length | current chunk length |
key_descriptor_t * | [in] | key_info | - Structure pointer for key_info |
uint8_t * | [in] | iv | Pointer to CCM iv |
uint16_t | [in] | iv_sz | size of IV |
uint8_t * | [in] | tag | Pointer to CCM tag |
uint16_t | [in] | tag_len | size of tag |
uint8_t * | [in] | ad | to AD |
uint16_t | [in] | ad_len | Total length of AD |
uint8_t | [in] | ccm_flags | BIT(0) - 1st chunk BIT(1) - Middle chunk BIT(2) - Last chunk |
uint8_t * | [out] | output | Output parameter to hold encrypted/decrypted from CCM |
Returns
Non zero - If fails 0 - If success
description#
This function encrypt/decrypt the data using CCM
trng_init#
int32_t trng_init (uint32_t * trng_key, uint32_t * trng_test_data, uint16_t input_length, uint32_t * output)
This API Initializes the TRNG hardware engine and Evaluate AES-CBC.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint32_t * | [in] | trng_key | - Pointer to trng_key |
uint32_t * | [in] | trng_test_data | - Pointer to test data for trng |
uint16_t | [in] | input_length | - Length of test data in dwords |
uint32_t * | [out] | output | - Pointer to output |
Returns
0 - Success
Non-Zero Value - Failure
Note
Refer Error Codes section for above error codes Error Codes.
description#
This API Initializes the TRNG hardware engine
trng_entropy#
int32_t trng_entropy (void )
This API check the health of Trng.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
Returns
0 - Success
Non-Zero Value - Failure
Note
Refer Error Codes section for above error codes Error Codes.
description#
This API checks the Entropy of TRNG
trng_program_key#
int32_t trng_program_key (uint32_t * trng_key, uint16_t key_length)
This API Initializes key which needs to be programmed to TRNG hardware engine.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint32_t * | [in] | trng_key | - Pointer to trng_key |
uint16_t | [in] | key_length | - key_length - key length in Dwords |
Returns
0 - Success
Non-Zero Value - Failure
Note
Refer Error Codes section for above error codes Error Codes.
description#
This API Initializes key which needs to be programmed to TRNG hardware engine
trng_get_random_num#
int32_t trng_get_random_num (uint32_t * random_number, uint16_t length)
This API generated random number of desired length.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint32_t * | [in] | random_number | - Address for Random number |
uint16_t | [in] | length | - Random number which needs to be generated in Dwords |
Returns
0 - Success
Non-Zero Value - Failure
Note
Refer Error Codes section for above error codes Error Codes.
description#
This API generated random number of desired length
sl_attestation_get_token#
int32_t sl_attestation_get_token (uint8_t * token, uint16_t length, uint32_t * nonce)
This API gets token.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint8_t * | [in] | token | - Address for token |
uint16_t | [in] | length | -Length of token request |
uint32_t * | [in] | nonce | - 32 byte nonce |
Returns
0 - Success
Non-Zero Value - Failure
Note
Refer Error Codes section for above error codes Error Codes.
description#
This API gets token
rsi_sha3_shake_pen#
int32_t rsi_sha3_shake_pen (uint8_t pad_char, uint8_t mode, uint8_t * msg, uint16_t msg_length, uint16_t chunk_len, uint8_t pending_flag, uint8_t * digest)
Computes the sha3/shake digest.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint8_t | [in] | pad_char | 0x1F SHAKE, 0x06 SHA3 |
uint8_t | [in] | mode | 21 - SHAKE_128 |
uint8_t * | [in] | msg | Pointer to message |
uint16_t | [in] | msg_length | Total message length |
uint16_t | [in] | chunk_len | current chunk length |
uint8_t | [in] | pending_flag | BIT(0) - 1st chunk BIT(1) - Middle chunk BIT(2) - Last chunk |
uint8_t * | [out] | digest | Output parameter to hold computed digest from SHA3/SHAKE |
Returns
0 - Success
Non-Zero Value - Failure
Note
Refer Error Codes section for above error codes Error Codes.
description#
This function computes the sha3/shake digest for the given input message
rsi_shake#
int32_t rsi_shake (uint8_t mode, uint8_t * msg, uint16_t msg_length, uint8_t * digest)
Decides whether the sha message can be sent once or requires multiple calls to send.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint8_t | [in] | mode | 21 - SHAKE_128 17 - SHAKE_256 |
uint8_t * | [in] | msg | Pointer to message |
uint16_t | [in] | msg_length | Total message length |
uint8_t * | [out] | digest | Output parameter to hold computed digest from SHAKE |
Returns
0 - Success
Non-Zero Value - Failure
Note
Refer Error Codes section for above error codes Error Codes.
description#
This function decides whether the shakeamessage can be sent once or requires multiple calls to send the message
rsi_sha3#
int32_t rsi_sha3 (uint8_t mode, uint8_t * msg, uint16_t msg_length, uint8_t * digest)
Decides whether the sha message can be sent once or requires multiple calls to send.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint8_t | [in] | mode | 17 - SHA3_256 |
uint8_t * | [in] | msg | Pointer to message |
uint16_t | [in] | msg_length | Total message length |
uint8_t * | [out] | digest | Output parameter to hold computed digest from SHA3 |
Returns
0 - Success
Non-Zero Value - Failure
Note
Refer Error Codes section for above error codes Error Codes.
description#
This function decides whether the sha message can be sent once or requires multiple calls to send the message
rsi_chachapoly#
int32_t rsi_chachapoly (uint16_t chachapoly_mode, uint16_t enc_dec, uint16_t dma_use, uint8_t * msg, uint16_t msg_length, key_descriptor_t * key_info, uint8_t * nonce, uint8_t * header_input, uint16_t header_length, uint8_t * output)
Decides whether the CHACHAPOLY message can be sent once or requires multiple calls to send.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint16_t | [in] | chachapoly_mode | - 0 – For CHACHA20POLY1305 mode |
uint16_t | [in] | enc_dec | - 0 – For CHACHAPOLY Encryption |
uint16_t | [in] | dma_use | - 1 - DMA enable |
uint8_t * | [in] | msg | - Pointer to message |
uint16_t | [in] | msg_length | - Total message length |
key_descriptor_t * | [in] | key_info | - Structure pointer for key_info |
uint8_t * | [in] | nonce | - pointer to nonce (1st index is IV) |
uint8_t * | [in] | header_input | Pointer to header |
uint16_t | [in] | header_length | - header length in bytes |
uint8_t * | [out] | output | Output parameter to hold encrypted/decrypted from chachapoly |
Returns
0 - Success
Non-Zero Value - Failure
Note
Refer Error Codes section for above error codes Error Codes.
rsi_chachapoly_pen#
int32_t rsi_chachapoly_pen (uint16_t chachapoly_mode, uint16_t enc_dec, uint16_t dma_use, uint8_t * msg, uint16_t msg_length, uint16_t chunk_len, key_descriptor_t * key_info, uint8_t * nonce, uint8_t * header_input, uint16_t header_length, uint8_t chachapoly_flags, uint8_t * output, chachapoly_flags, output)
Encrypt/Decrypt the data using CHACHA_POLY.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint16_t | [in] | chachapoly_mode | : 0 – For CHACHA20POLY1305 mode |
uint16_t | [in] | enc_dec | 0 – For CHACHAPOLY Encryption |
uint16_t | [in] | dma_use | 0 - DMA disable |
uint8_t * | [in] | msg | Pointer to message |
uint16_t | [in] | msg_length | Total message length |
uint16_t | [in] | chunk_len | current chunk length |
key_descriptor_t * | [in] | key_info | Pointer to chacha key |
uint8_t * | [in] | nonce | pointer to keyr_in |
uint8_t * | [in] | header_input | pointer to keys_in |
uint16_t | [in] | header_length | pointer to nonce (1st index is IV) |
uint8_t | [in] | chachapoly_flags | Pointer to header |
uint8_t * | [in] | output | header length in bytes |
[in] | chachapoly_flags | BIT(0) - 1st chunk | |
[out] | output | Output parameter to hold encrypted/decrypted from chachapoly |
Returns
0 - Success
Non-Zero Value - Failure
Note
Refer Error Codes section for above error codes Error Codes.
rsi_gcm#
int32_t rsi_gcm (uint32_t gcm_mode, uint8_t enc_dec, uint16_t dma_use, uint8_t * msg, uint16_t msg_length, key_descriptor_t * key_info, uint8_t * iv, uint16_t iv_sz, uint8_t * header, uint16_t header_length, uint8_t * output)
Decides whether the GCM/CMAC message can be sent once or requires multiple calls to send.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint32_t | [in] | gcm_mode | - 0 – For GCM, 1 – For CMAC. CMAC doesn't support decryption |
uint8_t | [in] | enc_dec | - 0 – For GCM/CMAC Encryption 1 – For GCM Decryption |
uint16_t | [in] | dma_use | - 0 - DMA disable 1: DMA Enable |
uint8_t * | [in] | msg | - Pointer to message |
uint16_t | [in] | msg_length | - Total message length |
key_descriptor_t * | [in] | key_info | - Structure pointer for key_info |
uint8_t * | [in] | iv | - Pointer to GCM iv |
uint16_t | [in] | iv_sz | - size of IV |
uint8_t * | [in] | header | - pointer to header |
uint16_t | [in] | header_length | - Total length of header |
uint8_t * | [out] | output | - Output parameter to hold encrypted/decrypted from GCM |
Returns
0 - Success
Non-Zero Value - Failure
Note
Refer Error Codes section for above error codes Error Codes.
description#
This function decides whether the GCM/CMAC message can be sent once or requires multiple calls to send the message
rsi_wrap#
int32_t rsi_wrap (key_descriptor_wrap_t * key_info, uint8_t * output, output)
Type | Direction | Argument Name | Description |
---|---|---|---|
key_descriptor_wrap_t * | [in] | key_info | - size of keys in bytes, 32- M4_OTA_KEY, 96- M4_PUBLIC_KEY |
uint8_t * | [in] | output | - 1- M4_OTA_KEY, 2- M4_PUBLIC_KEY |
[out] | output | - Output parameter to hold built-in-key |