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.
Encrypt/Decrypt the data using GCM/CMAC. CMAC Descryption is not supported.
This function is used to get wrap version of plain key.
This function is used to get wrap version of plain key.
This function is used to get built-in-keys.
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.
[in] | sha_mode | 1 – For SHA1 2 – For SHA256 3 – For SHA384 4 – For SHA512 5 – For SHA224 |
[in] | msg | - Pointer to message |
[in] | msg_length | - Total message length |
[in] | chunk_len | - Current chunk length |
[in] | pending_flag | - BIT(0) - 1st chunk BIT(1) - Middle chunk BIT(2) - Last chunk |
[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.
39
of file crypto/rsi_crypto.c
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.
[in] | sha_mode | 1 – For SHA1 2 – For SHA256 3 – For SHA384 4 – For SHA512 5– For SHA224 |
[in] | msg | - Pointer to message |
[in] | msg_length | - Total message length |
[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.
197
of file crypto/rsi_crypto.c
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.
[in] | hmac_sha_mode | - 1 – For HMAC-SHA1 2 – For HMAC-SHA256 3 – For HMAC-SHA384 4 – For HMAC-SHA512 |
[in] | data | - Pointer to key along with message |
[in] | total_length | - Total message length |
[in] | chunk_length | - Current chunk length |
[in] | key_info | - Structure pointer for key_info |
[in] | pending_flag | - BIT(0) - 1st chunk BIT(1) - Middle chunk BIT(2) - Last chunk |
[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.
271
of file crypto/rsi_crypto.c
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.
[in] | hmac_sha_mode | - 1 – For HMAC-SHA1 2 – For HMAC-SHA256 3 – For HMAC-SHA384 4 – For HMAC-SHA512 |
[in] | msg | - Pointer to message |
[in] | msg_length | - Total message length |
[in] | key | - Pointer to HMAC key |
[in] | key_info | - Structure Pointer to key_info |
[in] | digest | - HMAC key length in bytes |
[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.
520
of file crypto/rsi_crypto.c
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.
[in] | aes_mode | - 1 – For AES CBC mode 2 – For AES ECB mode 3 – For AES CTR mode |
[in] | enc_dec | - 1 – For AES Encryption 2 – For AES Decryption |
[in] | msg | - Pointer to message |
[in] | msg_length | - Total message length (must be divisible by 16) |
[in] | key_info | - Structure pointer for key_info |
[in] | iv | - Pointer to AES iv |
[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.
645
of file crypto/rsi_crypto.c
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.
[in] | aes_mode | - 1 – For AES CBC mode 2 – For AES ECB mode 3 – For AES CTR mode |
[in] | enc_dec | - 1 – For AES Encryption 2 – For AES Decryption |
[in] | msg | - Pointer to message |
[in] | msg_length | - Total message length (must be divisible by 16) |
[in] | chunk_length | - Current chunk length |
[in] | key_info | - Structure pointer for key_info |
[in] | iv | - Pointer to AES iv |
[in] | aes_flags | - BIT(0) - 1st chunk BIT(1) - Middle chunk BIT(2) - Last chunk |
[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.
758
of file crypto/rsi_crypto.c
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.
[in] | prime | - Pointer to the prime |
[in] | prime_length | - Length of the prime |
[in] | base | - Pointer to base |
[in] | base_length | - Length of the base |
[in] | exponent | - Pointer to exponent |
[in] | exponent_length | - Length of the exponent |
[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.
1031
of file crypto/rsi_crypto.c
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.
[in] | ecdh_mode | - 1 – For ECDH 192 2 – For ECDH 224 3 – For ECDH 256 |
[in] | d | - Pointer to scalar value that needs to be multiplied |
[in] | sx | Pointer to x coordinate of the point to be multiplied with scalar ‘d’ |
[in] | sy | Pointer to y coordinate of the point to be multiplied with scalar ‘d’ |
[in] | sz | Pointer to z coordinate of the point to be multiplied with scalar ‘d’ |
[in] | affinity | - 0 – no affinity 1 – affinity on input 2 – affinity on output 3 – affinity on both input and output |
[out] | rx | Pointer to x coordinate of the result point |
[out] | ry | Pointer to y coordinate of the result point |
[out] | rz | Pointer to z coordinate of the result point |
[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.
1191
of file crypto/rsi_crypto.c
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.
[in] | ecdh_mode | - 1 – For ECDH 192 2 – For ECDH 224 3 – For ECDH 256 |
[in] | sx | - Pointer to x coordinate of the point1 that needs to be added |
[in] | sy | - Pointer to y coordinate of the point1 that needs to be added |
[in] | sz | - Pointer to z coordinate of the point1 that needs to be added |
[in] | tx | - Pointer to x coordinate of the point2 that needs to be added |
[in] | ty | - Pointer to y coordinate of the point2 that needs to be added |
[in] | tz | - Pointer to z coordinate of the point2 that needs to be added |
[out] | rx | - Pointer to x coordinate of the result point |
[out] | ry | - Pointer to y coordinate of the result point |
[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.
1392
of file crypto/rsi_crypto.c
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.
[in] | ecdh_mode | - 1 – For ECDH 192 2 – For ECDH 224 3 – For ECDH 256 |
[in] | sx | - Pointers to x, y, z coordinates of the point1 that needs to be subtracted |
[in] | sy | - Pointers to x, y, z coordinates of the point2 that needs to be subtracted |
[out] | sz | - Pointers to x, y, z coordinates of the result point |
N/A | tx | |
N/A | ty | |
N/A | tz | |
N/A | rx | |
N/A | ry | |
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.
1579
of file crypto/rsi_crypto.c
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.
[in] | ecdh_mode | - 1 – For ECDH 192 2 – For ECDH 224 3 – For ECDH 256 |
[in] | sx | - Pointers to x, y, z coordinates of the point1 that needs to be doubled |
[out] | sy | - Pointers to x, y, z coordinates of the result point |
N/A | sz | |
N/A | rx | |
N/A | ry | |
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.
1769
of file crypto/rsi_crypto.c
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.
[in] | ecdh_mode | - 1 – For ECDH 192 2 – For ECDH 224 3 – For ECDH 256 |
[in] | sx | - Pointers to x, y, z coordinates of the point1 that needs to be affinified |
[out] | sy | - Pointers to x, y, z coordinates of the result point |
N/A | sz | |
N/A | rx | |
N/A | ry | |
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.
1936
of file crypto/rsi_crypto.c
rsi_ccm#
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.
[in] | enc_dec | 0 – For CCM Encryption 1 – For CCM Decryption |
[in] | msg | Pointer to message |
[in] | msg_length | Total message length |
[in] | key_info | - Structure pointer for key_info |
[in] | iv | Pointer to CCM iv |
[in] | iv_sz | of IV |
[in] | tag | Pointer to CCM tag |
[in] | tag_len | size of tag |
[in] | ad | to AD |
[in] | ad_len | Total length of AD |
[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
2128
of file crypto/rsi_crypto.c
rsi_ccm_pen#
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.
[in] | enc_dec | 0 – For CCM Encryption 1 – For CCM Decryption |
[in] | msg | Pointer to message |
[in] | msg_length | Total message length |
[in] | chunk_length | current chunk length |
[in] | key_info | - Structure pointer for key_info |
[in] | iv | Pointer to CCM iv |
[in] | iv_sz | size of IV |
[in] | tag | Pointer to CCM tag |
[in] | tag_len | size of tag |
[in] | ad | to AD |
[in] | ad_len | Total length of AD |
[in] | ccm_flags | BIT(0) - 1st chunk BIT(1) - Middle chunk BIT(2) - Last chunk |
[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
2335
of file crypto/rsi_crypto.c
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.
[in] | trng_key | - Pointer to trng_key |
[in] | trng_test_data | - Pointer to test data for trng |
[in] | input_length | - Length of test data in dwords |
[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
2609
of file crypto/rsi_crypto.c
trng_entropy#
int32 trng_entropy (void )
This API check the health of Trng.
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
2718
of file crypto/rsi_crypto.c
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.
[in] | trng_key | - Pointer to trng_key |
[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
2807
of file crypto/rsi_crypto.c
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.
[in] | random_number | - Address for Random number |
[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
2904
of file crypto/rsi_crypto.c
sl_attestation_get_token#
int32_t sl_attestation_get_token (uint8_t * token, uint16_t length, uint32_t * nonce)
This API gets token.
[in] | token | - Address for token |
[in] | length | -Length of token request |
[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
3010
of file crypto/rsi_crypto.c
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.
[in] | pad_char | 0x1F SHAKE, 0x06 SHA3 |
[in] | mode | 21 - SHAKE_128 17 - SHAKE_256, SHA3_256 18 - SHA3_224 13 - SHA3_384 9 - SHA3_512 |
[in] | msg | Pointer to message |
[in] | msg_length | Total message length |
[in] | chunk_len | current chunk length |
[in] | pending_flag | BIT(0) - 1st chunk BIT(1) - Middle chunk BIT(2) - Last chunk |
[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
3130
of file crypto/rsi_crypto.c
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.
[in] | mode | 21 - SHAKE_128 17 - SHAKE_256 |
[in] | msg | Pointer to message |
[in] | msg_length | Total message length |
[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
3289
of file crypto/rsi_crypto.c
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.
[in] | mode | 17 - SHA3_256 18 - SHA3_224 13 - SHA3_384 9 - SHA3_512 |
[in] | msg | Pointer to message |
[in] | msg_length | Total message length |
[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
3364
of file crypto/rsi_crypto.c
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.
[in] | chachapoly_mode | - 0 – For CHACHA20POLY1305 mode 1 – For CHACHA20 mode 3 – For POLY1305 mode |
[in] | enc_dec | - 0 – For CHACHAPOLY Encryption 1 – For CHACHAPOLY Decryption |
[in] | dma_use | - 1 - DMA enable 0- disable DMA |
[in] | msg | - Pointer to message |
[in] | msg_length | - Total message length |
[in] | key_info | - Structure pointer for key_info |
[in] | nonce | - pointer to nonce (1st index is IV) |
[in] | header_input | Pointer to header |
[in] | header_length | - header length in bytes |
[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.
3439
of file crypto/rsi_crypto.c
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.
[in] | chachapoly_mode | : 0 – For CHACHA20POLY1305 mode 1 – For CHACHA20 mode 3 – For POLY1305 mode |
[in] | enc_dec | 0 – For CHACHAPOLY Encryption 1 – For CHACHAPOLY Decryption |
[in] | dma_use | 0 - DMA disable 1- DMA enable |
[in] | msg | Pointer to message |
[in] | msg_length | Total message length |
[in] | chunk_len | current chunk length |
[in] | key_info | Pointer to chacha key |
[in] | nonce | pointer to keyr_in |
[in] | header_input | pointer to keys_in |
[in] | header_length | pointer to nonce (1st index is IV) |
[in] | chachapoly_flags | Pointer to header |
[in] | output | header length in bytes |
[in] | chachapoly_flags | BIT(0) - 1st chunk BIT(1) - Middle chunk BIT(2) - Last 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.
3593
of file crypto/rsi_crypto.c
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.
[in] | gcm_mode | - 0 – For GCM, 1 – For CMAC. CMAC doesn't support decryption |
[in] | enc_dec | - 0 – For GCM/CMAC Encryption 1 – For GCM Decryption |
[in] | dma_use | - 0 - DMA disable 1: DMA Enable |
[in] | msg | - Pointer to message |
[in] | msg_length | - Total message length |
[in] | key_info | - Structure pointer for key_info |
[in] | iv | - Pointer to GCM iv |
[in] | iv_sz | - size of IV |
[in] | header | - pointer to header |
[in] | header_length | - Total length of header |
[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
3907
of file crypto/rsi_crypto.c
rsi_gcm_pen#
int32_t rsi_gcm_pen (uint32_t gcm_mode, uint8_t enc_dec, uint16_t dma_use, 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 * header, uint16_t header_length, uint8_t gcm_flags, uint8_t * output)
Encrypt/Decrypt the data using GCM/CMAC. CMAC Descryption is not supported.
[in] | gcm_mode | - 0- GCM mode, 1- CMAC mode |
[in] | enc_dec | - 0 – For GCM/CMAC Encryption 1 – For GCM Decryption |
[in] | dma_use | - 0 - DMA disable 1 - DMA Enable |
[in] | msg | - Pointer to message |
[in] | msg_length | - Total message length |
[in] | chunk_length | - current chunk length |
[in] | key_info | - Structure pointer for key_info |
[in] | iv | - Pointer to GCM iv |
[in] | iv_sz | - size of IV |
[in] | header | - pointer to header |
[in] | header_length | - Total length of header |
[in] | gcm_flags | - BIT(0) - 1st chunk BIT(1) - Middle chunk BIT(2) - Last chunk |
[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 encrypt/decrypt the data using GCM/CMAC
4071
of file crypto/rsi_crypto.c
rsi_wrap_pen#
rsi_wrap_pen (key_descriptor_wrap_t * key_info, uint8_t wrap_flags, uint16_t chunk_length, uint8_t * output)
This function is used to get wrap version of plain key.
[in] | key_info | - structure pointer of key_descriptor_wrap_t |
[in] | wrap_flags | - BIT(0) - 1st chunk BIT(1) - Middle chunk BIT(2) - Last chunk |
[in] | chunk_length | - current chunk length |
[out] | output | - Output parameter to hold wrap key |
Returns
0 - Success Non-Zero Value - Failure
Note
Refer Error Codes section for above error codes Error Codes.
description#
This function is used to get wrap version of plain key
4354
of file crypto/rsi_crypto.c
rsi_wrap#
rsi_wrap (key_descriptor_wrap_t * key_info, uint8_t * output)
This function is used to get wrap version of plain key.
[in] | key_info | - structure pointer of key_descriptor_wrap_t |
[out] | output | - Output parameter to hold wrap key |
Returns
0 - Success Non-Zero Value - Failure
Note
Refer Error Codes section for above error codes Error Codes.
description#
This function is used to get wrap version of plain key
4501
of file crypto/rsi_crypto.c
rsi_get_built_in_keys#
rsi_get_built_in_keys (uint16_t key_size, uint32_t key_slot, uint8_t * output)
This function is used to get built-in-keys.
[in] | key_size | - size of keys in bytes, 32- M4_OTA_KEY, 96- M4_PUBLIC_KEY |
[in] | key_slot | - 1- M4_OTA_KEY, 2- M4_PUBLIC_KEY |
[out] | output | - Output parameter to hold built-in-key |
Returns
0 - Success Non-Zero Value - Failure
Note
Refer Error Codes section for above error codes Error Codes.
description#
This function is used to get built-in-keys
4575
of file crypto/rsi_crypto.c