Security and Crypto#

The Security and Crypto module provides interfaces for implementing cryptographic operations within the Sidewalk SDK. These interfaces ensure secure data transmission and storage by offering functionalities such as encryption, decryption, hashing, and key management, enabling developers to protect sensitive information across different hardware platforms.

Modules#

Type definitions

Functions#

sid_error_t

Initialize sid_pal crypto HAL.

sid_error_t

Deinitialize crypto HAL.

sid_error_t
sid_pal_crypto_rand(uint8_t *rand, size_t size)

Generate random number.

sid_error_t
sid_pal_crypto_hash(sid_pal_hash_params_t *params)

Generate hash.

sid_error_t
sid_pal_crypto_hmac(sid_pal_hmac_params_t *params)

Generate HMAC.

sid_error_t
sid_pal_crypto_aes_crypt(sid_pal_aes_params_t *params)

Encrypt or decrypt using following AES algorithm.

sid_error_t
sid_pal_crypto_aead_crypt(sid_pal_aead_params_t *params)

Encrypt or decrypt using AEAD algorithm.

sid_error_t
sid_pal_crypto_ecc_dsa(sid_pal_dsa_params_t *params)

Sign or verify elliptic curve digital signature using given algorithm.

sid_error_t
sid_pal_crypto_ecc_ecdh(sid_pal_ecdh_params_t *params)

Generate shared secret using private key and public key.

sid_error_t
sid_pal_crypto_ecc_key_gen(sid_pal_ecc_key_gen_params_t *params)

Generate ECC key pair using given algorithm.

Function Documentation#

sid_pal_crypto_init#

sid_error_t sid_pal_crypto_init (void )

Initialize sid_pal crypto HAL.

Parameters
TypeDirectionArgument NameDescription
voidN/A

This function initializes the SID PAL crypto HAL and prepares it for cryptographic operations.


sid_pal_crypto_deinit#

sid_error_t sid_pal_crypto_deinit (void )

Deinitialize crypto HAL.

Parameters
TypeDirectionArgument NameDescription
voidN/A

This function deinitializes the SID PAL crypto HAL and releases any resources that were allocated.


sid_pal_crypto_rand#

sid_error_t sid_pal_crypto_rand (uint8_t * rand, size_t size)

Generate random number.

Parameters
TypeDirectionArgument NameDescription
uint8_t *[out]rand

Pointer to rand buffer.

size_t[in]size

Size of rand number

This function generates a random number and stores it in the provided buffer.


sid_pal_crypto_hash#

sid_error_t sid_pal_crypto_hash (sid_pal_hash_params_t * params)

Generate hash.

Parameters
TypeDirectionArgument NameDescription
sid_pal_hash_params_t *[inout]params

Pointer to the hash parameters.

SHA256 and SHA512 is now supported.

This function generates a hash using the specified parameters.


sid_pal_crypto_hmac#

sid_error_t sid_pal_crypto_hmac (sid_pal_hmac_params_t * params)

Generate HMAC.

Parameters
TypeDirectionArgument NameDescription
sid_pal_hmac_params_t *[inout]params

Pointer to the hash parameters.

HMAC/SHA256 and HMAC/SHA512 is now supported.

This function generates an HMAC using the specified parameters.


sid_pal_crypto_aes_crypt#

sid_error_t sid_pal_crypto_aes_crypt (sid_pal_aes_params_t * params)

Encrypt or decrypt using following AES algorithm.

Parameters
TypeDirectionArgument NameDescription
sid_pal_aes_params_t *[inout]params

Pointer to AES parameters.

AES-CMAC AES-CTR are supported.

This function encrypts or decrypts data using the specified AES algorithm.


sid_pal_crypto_aead_crypt#

sid_error_t sid_pal_crypto_aead_crypt (sid_pal_aead_params_t * params)

Encrypt or decrypt using AEAD algorithm.

Parameters
TypeDirectionArgument NameDescription
sid_pal_aead_params_t *[inout]params

Pointer to the AEAD parameters.

This function encrypts or decrypts data using the specified AEAD algorithm.


sid_pal_crypto_ecc_dsa#

sid_error_t sid_pal_crypto_ecc_dsa (sid_pal_dsa_params_t * params)

Sign or verify elliptic curve digital signature using given algorithm.

Parameters
TypeDirectionArgument NameDescription
sid_pal_dsa_params_t *[inout]params

Pointer to the ECC DSA parameters.

This function signs or verifies an elliptic curve digital signature using the specified parameters.


sid_pal_crypto_ecc_ecdh#

sid_error_t sid_pal_crypto_ecc_ecdh (sid_pal_ecdh_params_t * params)

Generate shared secret using private key and public key.

Parameters
TypeDirectionArgument NameDescription
sid_pal_ecdh_params_t *[inout]params

Pointer to the ECDH parameters.

This function generates a shared secret using the specified private key and public key.


sid_pal_crypto_ecc_key_gen#

sid_error_t sid_pal_crypto_ecc_key_gen (sid_pal_ecc_key_gen_params_t * params)

Generate ECC key pair using given algorithm.

Parameters
TypeDirectionArgument NameDescription
sid_pal_ecc_key_gen_params_t *[inout]params

Generate ECC key pair using given algorithm.

This function generates an ECC key pair using the specified algorithm.