Crypto APIs#

This section describes the Crypto APIs

Functions#

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.

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.

int32_t
rsi_hmac_sha_pen(uint8_t hmac_sha_mode, uint8_t *data, uint16_t total_length, uint16_t chunk_length, uint32_t key_length, uint8_t pending_flag, uint8_t *digest)

Hold computed digest from HMAC-SHA. This is a blocking API.

int32_t
rsi_hmac_sha(uint8_t hmac_sha_mode, uint8_t *msg, uint32_t msg_length, uint8_t *key, uint32_t key_length, 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.

int32_t
rsi_aes(uint16_t aes_mode, uint16_t enc_dec, uint8_t *msg, uint16_t msg_length, uint8_t *key, uint16_t key_length, 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.

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.

int32_t
rsi_ecdh_point_multiplication(uint8_t ecdh_mode, uint8_t *d, uint8_t *sx, uint8_t *sy, uint8_t *sz, uint8_t *rx, uint8_t *ry, uint8_t *rz)

Compute the ECDH point multiplication vector. This is a blocking API.

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.

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.

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.

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.

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.

Parameters
[in]sha_mode

1 – For SHA1 2 – For SHA256 3 – For SHA384 4 – For SHA512

[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

Note

  • This API is not supported in current release.

Returns

  • 0 - Success Non-Zero Value - Failure

Note

  • Refer Error Codes section for above error codes Error Codes.


Definition at line 42 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.

Parameters
[in]sha_mode

1 – For SHA1 2 – For SHA256 3 – For SHA384 4 – For SHA512

[in]msg

- Pointer to message

[in]msg_length

- Total message length

[out]digest

- Output parameter to hold computed digest from SHA

Note

  • This API is not supported in current release.

Returns

  • 0 - Success Non-Zero Value - Failure

Note

  • Refer Error Codes section for above error codes Error Codes.


Definition at line 186 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, uint32_t key_length, uint8_t pending_flag, uint8_t * digest)

Hold computed digest from HMAC-SHA. This is a blocking API.

Parameters
[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_length

- BIT(0) - 1st chunk BIT(1) - Middle chunk BIT(2) - Last chunk

[out]pending_flag

- Output parameter to hold computed digest from HMAC-SHA

N/Adigest

Note

  • This API is not supported in current release.

Returns

  • 0 - Success Non-Zero Value - Failure

Note

  • Refer Error Codes section for above error codes Error Codes.


Definition at line 253 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, uint32_t key_length, 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.

Parameters
[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_length

- HMAC key length in bytes

[out]digest

- Output parameter to hold computed digest from HMAC-SHA

N/Ahmac_buffer

Note

  • This API is not supported in current release.

Returns

  • 0 - Success Non-Zero Value - If return value is lesser than 0 -2: Invalid parameters -3: Command given in wrong state -4: Buffer not available to serve the command If return value is greater than 0 0xFF15, 0xCC9C, 0xCC9B

Note

  • Refer Error Codes section for above error codes Error Codes.


Definition at line 414 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, uint8_t * key, uint16_t key_length, 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.

Parameters
[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

[in]key

- Pointer to AES key

[in]key_length

- AES key length in bytes

[in]iv

- Pointer to AES iv

[out]output

- Output parameter to hold encrypted/decrypted from AES

Note

  • This API is not supported in current release.

Returns

  • 0 - Success Non-Zero Value - If return value is lesser than 0 -2: Invalid parameters -3: Command given in wrong state -4: Buffer not available to serve the command If return value is greater than 0 0xFF15, 0xCC9C, 0xCC9B

Note

  • Refer Error Codes section for above error codes Error Codes.


Definition at line 509 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.

Parameters
[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

Note

  • This API is not supported in current release.

Returns

  • 0 - Success Non-Zero Value - If return value is lesser than 0 -2: Invalid parameters -3: Command given in wrong state -4: Buffer not available to serve the command If return value is greater than 0 0xFF15, 0xCC9C, 0xCC9B

Note

  • Refer Error Codes section for above error codes Error Codes.


Definition at line 755 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, uint8_t * rx, uint8_t * ry, uint8_t * rz)

Compute the ECDH point multiplication vector. This is a blocking API.

Parameters
[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

- Pointers to x, y, z coordinates of the point to be multiplied with scalar ‘d’

[out]sy

- Pointers to x, y, z coordinates of the result point

N/Asz
N/Arx
N/Ary
N/Arz

Note

  • This API is not supported in current release.

Returns

  • 0 - Success Non-Zero Value - If return value is lesser than 0 -2: Invalid parameters -3: Command given in wrong state -4: Buffer not available to serve the command If return value is greater than 0 0xFF15, 0xCC9C, 0xCC9B

Note

  • Refer Error Codes section for above error codes Error Codes.


Definition at line 906 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.

Parameters
[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 added

[in]sy

- Pointers to x, y, z coordinates of the point2 that needs to be added

[out]sz

- Pointers to x, y, z coordinates of the result point

N/Atx
N/Aty
N/Atz
N/Arx
N/Ary
N/Arz

Note

  • This API is not supported in current release.

Returns

  • 0 - Success Non-Zero Value - If return value is lesser than 0 -2: Invalid parameters -3: Command given in wrong state -4: Buffer not available to serve the command If return value is greater than 0 0xFF15, 0xCC9C, 0xCC9B

Note

  • Refer Error Codes section for above error codes Error Codes.


Definition at line 1073 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.

Parameters
[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/Atx
N/Aty
N/Atz
N/Arx
N/Ary
N/Arz

Note

  • This API is not supported in current release.

Returns

  • 0 - Success Non-Zero Value - If return value is lesser than 0 -2: Invalid parameters -3: Command given in wrong state -4: Buffer not available to serve the command If return value is greater than 0 0xFF15, 0xCC9C, 0xCC9B


Definition at line 1254 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.

Parameters
[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/Asz
N/Arx
N/Ary
N/Arz

Note

  • This API is not supported in current release.

Returns

  • 0 - Success Non-Zero Value - If return value is lesser than 0 -2: Invalid parameters -3: Command given in wrong state -4: Buffer not available to serve the command If return value is greater than 0 0xFF15, 0xCC9C, 0xCC9B

Note

  • Refer Error Codes section for above error codes Error Codes.


Definition at line 1437 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.

Parameters
[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/Asz
N/Arx
N/Ary
N/Arz

Note

  • This API is not supported in current release.

Returns

  • 0 - Success Non-Zero Value - If return value is lesser than 0 -2: Invalid parameters -3: Command given in wrong state -4: Buffer not available to serve the command If return value is greater than 0 0xFF15, 0xCC9C, 0xCC9B

Note

  • Refer Error Codes section for above error codes Error Codes.


Definition at line 1597 of file crypto/rsi_crypto.c