Synergy Software Package User's Manual

RTOS-integrated Crypto Key Framework Module. More...

Data Structures

struct  sf_crypto_key_instance_ctrl_t
 

Macros

#define SF_CRYPTO_KEY_CODE_VERSION_MAJOR   (2U)
 

Functions

ssp_err_t sf_crypto_key_open_aes (sf_crypto_key_instance_ctrl_t *p_ctrl, sf_crypto_key_cfg_t const *const p_cfg)
 Subroutine to open a Crypto AES HAL module. This function is called by SF_CRYPTO_KEY_Open(). More...
 
ssp_err_t sf_crypto_key_close_aes (sf_crypto_key_instance_ctrl_t *p_ctrl)
 Subroutine to close a Crypto AES HAL module. This function is called by SF_CRYPTO_KEY_Close(). More...
 
ssp_err_t sf_crypto_key_generate_aes (sf_crypto_key_instance_ctrl_t *p_ctrl, sf_crypto_key_t *const p_secret_key)
 Subroutine to generate a AES key. This function is called by SF_CRYPTO_KEY_Generate(). More...
 
void sf_crypto_key_aes_interface_get (sf_crypto_key_instance_ctrl_t *const p_ctrl)
 Subroutine to get a AES HAL API instance. This function is called by sf_crypto_key_open_aes(). Key framework control block's p_hal_api field is filled with HAL AES interface. This will be set to NULL if the API interface is not found on the particular MCU. More...
 
void sf_crypto_key_aes_get_available_api_interface (sf_crypto_key_instance_ctrl_t *const p_ctrl, crypto_interface_get_param_t *p_param)
 Subroutine to get first available AES HAL API instance for ECB/CBC/CTR/GCM chaining modes. This function is called by sf_crypto_key_aes_interface_get(). Key framework control block's p_hal_api field is filled with HAL AES interface. This will be set to NULL if the API interface is not found on the particular MCU. More...
 
ssp_err_t sf_crypto_key_aes_verify_wrappedkey_buffersize (sf_crypto_key_size_t key_size, uint32_t buffer_length)
 Subroutine to verify that the provided buffer_length (indicates size of the secret AES Wrapped key) is sufficient or not, before proceeding with key Generate function. This function is called by AES Key Generate function before passing request to Crypto HAL Key generate API call. More...
 
ssp_err_t sf_crypto_key_aes_verify_wrapped_xtskey_buffersize (sf_crypto_key_size_t key_size, uint32_t buffer_length)
 Subroutine to verify that the provided num_words (indicates size of the secret AES Wrapped key for XTS AES chaining mode) is sufficient or not, before proceeding with key operations. This function is called by sf_crypto_key_aes_verify_wrappedkey_buffersize as an internal function call. More...
 
ssp_err_t sf_crypto_key_open_ecc (sf_crypto_key_instance_ctrl_t *p_ctrl, sf_crypto_key_cfg_t const *const p_cfg)
 Subroutine to open a Crypto ECC HAL module. This function is called by SF_CRYPTO_KEY_Open(). The configuration parameters are validated before opening the HAL module. More...
 
ssp_err_t sf_crypto_key_close_ecc (sf_crypto_key_instance_ctrl_t *p_ctrl)
 Subroutine to close a Crypto ECC HAL module. This function is called by SF_CRYPTO_KEY_Close(). More...
 
ssp_err_t sf_crypto_key_generate_ecc (sf_crypto_key_instance_ctrl_t *p_ctrl, sf_crypto_key_t *const p_secret_key, sf_crypto_key_t *const p_public_key)
 Subroutine to generate a ECC key. This function is called by SF_CRYPTO_KEY_Generate(). More...
 
ssp_err_t sf_crypto_key_scalar_multiplication_ecc (sf_crypto_key_instance_ctrl_t *p_ctrl, sf_crypto_key_t *const p_secret_key, sf_crypto_key_t *const p_point_on_curve, sf_crypto_key_t *const p_resultant_vector)
 Subroutine to perform a ECC scalar multiplication. This function is called by SF_CRYPTO_KEY_ECDHCompute(). More...
 
ssp_err_t sf_crypto_key_open_rsa (sf_crypto_key_instance_ctrl_t *p_ctrl, sf_crypto_key_cfg_t const *const p_cfg)
 Subroutine to open a Crypto RSA HAL module. This function is called by SF_CRYPTO_KEY_Open(). More...
 
ssp_err_t sf_crypto_key_close_rsa (sf_crypto_key_instance_ctrl_t *p_ctrl)
 Subroutine to close a Crypto RSA HAL module. This function is called by SF_CRYPTO_KEY_Close(). More...
 
ssp_err_t sf_crypto_key_generate_rsa (sf_crypto_key_instance_ctrl_t *p_ctrl, sf_crypto_key_t *const p_secret_key, sf_crypto_key_t *const p_public_key)
 Subroutine to generate a RSA key. This function is called by SF_CRYPTO_KEY_Generate(). More...
 
void sf_crypto_key_rsa_interface_get (sf_crypto_key_instance_ctrl_t *const p_ctrl)
 Subroutine to get a RSA HAL API instance. This function is called by sf_crypto_key_open_rsa(). More...
 
ssp_err_t sf_crypto_key_rsa_verify_privatekey_buffersize (sf_crypto_key_type_t key_type, sf_crypto_key_size_t key_size, uint32_t buffer_length)
 Subroutine to verify that the provided buffer_length (buffer to hold the secret RSA private key) is sufficient or not, before proceeding with key Generate function. This function is called by RSA Key Generate function before passing request to Crypto HAL Key generate API call. More...
 
ssp_err_t sf_crypto_key_rsa_verify_publickey_buffersize (sf_crypto_key_type_t key_type, sf_crypto_key_size_t key_size, uint32_t buffer_length)
 Subroutine to verify that the provided buffer_length (buffer to hold the secret RSA Public key) is sufficient or not, before proceeding with key Generate function. This function is called by RSA Key Generate function before passing request to Crypto HAL Key generate API call. More...
 
ssp_err_t sf_crypto_key_rsa_verify_plaintext_buffersize (sf_crypto_key_size_t key_size, uint32_t buffer_length)
 Subroutine to verify that the provided buffer_length (buffer to hold the secret RSA Plain text key) is sufficient or not, before proceeding with key Generate function. This function is called by sf_crypto_key_rsa_verify_privatekey_buffersize as an internal function call. More...
 
ssp_err_t sf_crypto_key_rsa_verify_crtplaintext_buffersize (sf_crypto_key_size_t key_size, uint32_t buffer_length)
 Subroutine to verify that the provided buffer_length (buffer to hold the secret RSA CRT Plain text key) is sufficient or not, before proceeding with key Generate function. This function is called by sf_crypto_key_rsa_verify_privatekey_buffersize as an internal function call. More...
 
ssp_err_t sf_crypto_key_rsa_verify_wrapped_buffersize (sf_crypto_key_size_t key_size, uint32_t buffer_length)
 Subroutine to verify that the provided buffer_length (buffer to hold the secret RSA Wrapped key) is sufficient or not, before proceeding with key Generate function. This function is called by sf_crypto_key_rsa_verify_privatekey_buffersize as an internal function call. More...
 
ssp_err_t SF_CRYPTO_KEY_Open (sf_crypto_key_ctrl_t *const p_api_ctrl, sf_crypto_key_cfg_t const *const p_cfg)
 SSP Crypto KeyFramework Open operation. More...
 
ssp_err_t SF_CRYPTO_KEY_Close (sf_crypto_key_ctrl_t *const p_api_ctrl)
 SSP Crypto Key Framework Close operation. More...
 
ssp_err_t SF_CRYPTO_KEY_Generate (sf_crypto_key_ctrl_t *const p_api_ctrl, sf_crypto_key_t *const p_secret_key, sf_crypto_key_t *const p_public_key)
 SSP Crypto Framework Key Generate operation. More...
 
ssp_err_t SF_CRYPTO_KEY_EcdhSharedSecretCompute (sf_crypto_key_ctrl_t *const p_api_ctrl, sf_crypto_key_t *const p_local_secret_key, sf_crypto_key_t *const p_remote_public_key, sf_crypto_key_t *const p_shared_secret)
 SSP Crypto Framework ECDH Shared Secret Computation operation. More...
 
ssp_err_t SF_CRYPTO_KEY_VersionGet (ssp_version_t *const p_version)
 Gets driver version based on compile time macros. More...
 

Detailed Description

RTOS-integrated Crypto Key Framework Module.

Macro Definition Documentation

◆ SF_CRYPTO_KEY_CODE_VERSION_MAJOR

#define SF_CRYPTO_KEY_CODE_VERSION_MAJOR   (2U)

The API version of SSP Crypto Framework

Function Documentation

◆ sf_crypto_key_aes_get_available_api_interface()

void sf_crypto_key_aes_get_available_api_interface ( sf_crypto_key_instance_ctrl_t *const  p_ctrl,
crypto_interface_get_param_t p_param 
)

Subroutine to get first available AES HAL API instance for ECB/CBC/CTR/GCM chaining modes. This function is called by sf_crypto_key_aes_interface_get(). Key framework control block's p_hal_api field is filled with HAL AES interface. This will be set to NULL if the API interface is not found on the particular MCU.

Parameters
[in,out]p_ctrlPointer to a Key framework control block.
[in]p_paramInterface get param. Algorithm type, key type and key size is set by the caller.

◆ sf_crypto_key_aes_interface_get()

void sf_crypto_key_aes_interface_get ( sf_crypto_key_instance_ctrl_t *const  p_ctrl)

Subroutine to get a AES HAL API instance. This function is called by sf_crypto_key_open_aes(). Key framework control block's p_hal_api field is filled with HAL AES interface. This will be set to NULL if the API interface is not found on the particular MCU.

Parameters
[in,out]p_ctrlPointer to a Key framework control block. interface. This indicates NULL, for not supported MCUs

◆ sf_crypto_key_aes_verify_wrapped_xtskey_buffersize()

ssp_err_t sf_crypto_key_aes_verify_wrapped_xtskey_buffersize ( sf_crypto_key_size_t  key_size,
uint32_t  buffer_length 
)

Subroutine to verify that the provided num_words (indicates size of the secret AES Wrapped key for XTS AES chaining mode) is sufficient or not, before proceeding with key operations. This function is called by sf_crypto_key_aes_verify_wrappedkey_buffersize as an internal function call.

Parameters
[in]key_sizeIndicates AES key sizes - 128/256-bits, supported chaining mode - XTS
[in]buffer_lengthLength of the secret key which shall be filled by AES Key generation algorithm.
Return values
SSP_SUCCESSKey length is successful, and proceed with AES Key Generation.
SSP_ERR_INVALID_SIZEFailed, as the allocated key length is not sufficient for the Key generation operation of AES
Note
This function is not a user API but an internal function for SF_CRYPTO_KEY to verify whether passed buffer size is sufficient for Key to hold in Key Generate API call.

◆ sf_crypto_key_aes_verify_wrappedkey_buffersize()

ssp_err_t sf_crypto_key_aes_verify_wrappedkey_buffersize ( sf_crypto_key_size_t  key_size,
uint32_t  buffer_length 
)

Subroutine to verify that the provided buffer_length (indicates size of the secret AES Wrapped key) is sufficient or not, before proceeding with key Generate function. This function is called by AES Key Generate function before passing request to Crypto HAL Key generate API call.

Parameters
[in]key_sizeIndicates AES key sizes - 128/192/256-bits, supported chaining modes - CBC, ECB, GCM, CTR
[in]buffer_lengthLength of the secret key which shall be filled by AES Key generation algorithm.
Return values
SSP_SUCCESSKey length is successful, and proceed with AES Key Generation.
SSP_ERR_INVALID_SIZEFailed, as the allocated key length is not sufficient for the Key generation operation of AES
Note
This function is not a user API but an internal function for SF_CRYPTO_KEY to verify whether passed buffer size is sufficient for Key to hold in Key Generate API call.

◆ SF_CRYPTO_KEY_Close()

ssp_err_t SF_CRYPTO_KEY_Close ( sf_crypto_key_ctrl_t *const  p_api_ctrl)

SSP Crypto Key Framework Close operation.

Return values
SSP_SUCCESSThe module was successfully closed.
SSP_ERR_ASSERTIONNULL is passed through the argument.
SSP_ERR_NOT_OPENThe module has yet been opened. Call Open API first.
Returns
See Common Error Codes for other possible return codes.

Get a Crypto common control block and the interface.

Check if the Crypto Framework has been opened. If not yet opened, return an error.

Close Crypto HAL module.

Decrement the open counter to enable users to close SF_CRYPTO module.

◆ sf_crypto_key_close_aes()

ssp_err_t sf_crypto_key_close_aes ( sf_crypto_key_instance_ctrl_t p_ctrl)

Subroutine to close a Crypto AES HAL module. This function is called by SF_CRYPTO_KEY_Close().

Parameters
[in]p_ctrlPointer to a Crypto Key Framework module control block
Return values
SSP_SUCCESSAES HAL module is successfully closed.
Returns
See Common Error Codes for other possible return codes.

◆ sf_crypto_key_close_ecc()

ssp_err_t sf_crypto_key_close_ecc ( sf_crypto_key_instance_ctrl_t p_ctrl)

Subroutine to close a Crypto ECC HAL module. This function is called by SF_CRYPTO_KEY_Close().

Parameters
[in]p_ctrlPointer to a Crypto Key Framework module control block
Return values
SSP_SUCCESSECC HAL module is successfully closed.
Returns
See Common Error Codes for other possible return codes.

Close the Crypto HAL driver.

Release the control block memory back to byte pool

◆ sf_crypto_key_close_rsa()

ssp_err_t sf_crypto_key_close_rsa ( sf_crypto_key_instance_ctrl_t p_ctrl)

Subroutine to close a Crypto RSA HAL module. This function is called by SF_CRYPTO_KEY_Close().

Parameters
[in]p_ctrlPointer to a Crypto Key Framework module control block
Return values
SSP_SUCCESSRSA HAL module is successfully closed.
Returns
See Common Error Codes for other possible return codes.

◆ SF_CRYPTO_KEY_EcdhSharedSecretCompute()

ssp_err_t SF_CRYPTO_KEY_EcdhSharedSecretCompute ( sf_crypto_key_ctrl_t *const  p_api_ctrl,
sf_crypto_key_t *const  p_local_secret_key,
sf_crypto_key_t *const  p_remote_public_key,
sf_crypto_key_t *const  p_shared_secret 
)

SSP Crypto Framework ECDH Shared Secret Computation operation.

Return values
SSP_SUCCESSThe module created a key successfully.
SSP_ERR_ASSERTIONNULL is passed through an argument.
SSP_ERR_NOT_OPENThe module has yet been opened. Call Open API first.
SSP_ERR_UNSUPPORTEDThe module does not support scalar multiplication operation.
SSP_ERR_INVALID_SIZEThe length of the buffer supplied for the key to be generated, is insufficient.
Returns
See Common Error Codes for other possible return codes.

Check if ECDH computation is used with ECC, otherwise return an error.

Check if the Crypto Framework has been opened. If not yet opened, return an error.

Lock the module to access to Crypto HAL module.

Perform the scalar multiplication.

Unlock the module.

◆ SF_CRYPTO_KEY_Generate()

ssp_err_t SF_CRYPTO_KEY_Generate ( sf_crypto_key_ctrl_t *const  p_api_ctrl,
sf_crypto_key_t *const  p_secret_key,
sf_crypto_key_t *const  p_public_key 
)

SSP Crypto Framework Key Generate operation.

Return values
SSP_SUCCESSThe module created a key successfully.
SSP_ERR_ASSERTIONNULL is passed through an argument.
SSP_ERR_NOT_OPENThe module has yet been opened. Call Open API first.
SSP_ERR_UNSUPPORTEDThe module does not support the key type specified by user.
SSP_ERR_INVALID_SIZEThe length of the buffer supplied for the key to be generated, is insufficient.
Returns
See Common Error Codes for other possible return codes.

Check if the Crypto Framework has been opened. If not yet opened, return an error.

Lock the module to access to Crypto HAL module.

Generate a key.

Unlock the module.

◆ sf_crypto_key_generate_aes()

ssp_err_t sf_crypto_key_generate_aes ( sf_crypto_key_instance_ctrl_t p_ctrl,
sf_crypto_key_t *const  p_secret_key 
)

Subroutine to generate a AES key. This function is called by SF_CRYPTO_KEY_Generate().

Parameters
[in]p_ctrlPointer to a Crypto Key Framework module control block.
[out]p_secret_keyPointer to a secret key.
Return values
SSP_SUCCESSThe module created the AES Secret key successfully.
SSP_ERR_INVALID_SIZEFailed, as the allocated key buffer length is not sufficient for the AES Key generation operation.
SSP_ERR_UNSUPPORTEDProcedure is not supported for the supplied parameters.
Returns
See Common Error Codes for other possible return codes.

◆ sf_crypto_key_generate_ecc()

ssp_err_t sf_crypto_key_generate_ecc ( sf_crypto_key_instance_ctrl_t p_ctrl,
sf_crypto_key_t *const  p_secret_key,
sf_crypto_key_t *const  p_public_key 
)

Subroutine to generate a ECC key. This function is called by SF_CRYPTO_KEY_Generate().

Parameters
[in]p_ctrlPointer to a Crypto Key Framework module control block
[out]p_secret_keyPointer to a secret key
[out]p_public_keyPointer to a public key
Return values
SSP_SUCCESSThe module created a key successfully.
SSP_ERR_INVALID_SIZEFailed, as the allocated key buffer length is not sufficient for the ECC Key generation operation.
SSP_ERR_UNSUPPORTEDProcedure is not supported for the supplied parameters.
Returns
See Common Error Codes for other possible return codes.

Verify the domain parameter input buffer size. The length has to be exactly as specified

Verify the public key buffer size that holds the generated public key.

Verify the secret key buffer size that holds the generated private key.

Local variable created to call the HAL API.

Note that the HAL driver requires data in WORDS

Call Crypto HAL driver.

◆ sf_crypto_key_generate_rsa()

ssp_err_t sf_crypto_key_generate_rsa ( sf_crypto_key_instance_ctrl_t p_ctrl,
sf_crypto_key_t *const  p_secret_key,
sf_crypto_key_t *const  p_public_key 
)

Subroutine to generate a RSA key. This function is called by SF_CRYPTO_KEY_Generate().

Parameters
[in]p_ctrlPointer to a Crypto Key Framework module control block
[out]p_secret_keyPointer to a secret key
[out]p_public_keyPointer to a public key
Return values
SSP_SUCCESSThe module created a key successfully.
SSP_ERR_INVALID_SIZEFailed, as the allocated key buffer length is not sufficient for the RSA Key generation operation.
SSP_ERR_UNSUPPORTEDProcedure is not supported for the supplied parameters.
Returns
See Common Error Codes for other possible return codes.

◆ SF_CRYPTO_KEY_Open()

ssp_err_t SF_CRYPTO_KEY_Open ( sf_crypto_key_ctrl_t *const  p_api_ctrl,
sf_crypto_key_cfg_t const *const  p_cfg 
)

SSP Crypto KeyFramework Open operation.

Return values
SSP_SUCCESSThe module was successfully opened.
SSP_ERR_ASSERTIONNULL is passed through an argument.
SSP_ERR_CRYPTO_COMMON_NOT_OPENEDCrypto Framework Common Module has yet been opened.
SSP_ERR_ALREADY_OPENThe module has been already opened.
SSP_ERR_UNSUPPORTEDThe module does not support the key type specified by user.
SSP_ERR_INVALID_SIZEThe buffer length of one of the configuration parameters is invalid.
Returns
See Common Error Codes for other possible return codes.

Get a Crypto common control block and the interface.

Check if the Crypto Framework has been opened. If not yet opened, return an error.

Check if the Crypto key framework module has been already opened. If yes, return an error.

Set a key type, size, domain and generator point. Generator point and domain are UNUSED for RSA and AES algorithms, applicable only for ECC.

Open Crypto HAL module.

◆ sf_crypto_key_open_aes()

ssp_err_t sf_crypto_key_open_aes ( sf_crypto_key_instance_ctrl_t p_ctrl,
sf_crypto_key_cfg_t const *const  p_cfg 
)

Subroutine to open a Crypto AES HAL module. This function is called by SF_CRYPTO_KEY_Open().

Parameters
[in,out]p_ctrlPointer to a Crypto Key Framework module control block
[in]p_cfgPointer to a Crypto Key Framework module configuration structure
Return values
SSP_SUCCESSAES HAL module is successfully opened.
SSP_ERR_OUT_OF_MEMORYFailed to allocate memory to store AES HAL module control block.
SSP_ERR_INTERNALRTOS service returned a unexpected error.
Returns
See Common Error Codes for other possible return codes.

◆ sf_crypto_key_open_ecc()

ssp_err_t sf_crypto_key_open_ecc ( sf_crypto_key_instance_ctrl_t p_ctrl,
sf_crypto_key_cfg_t const *const  p_cfg 
)

Subroutine to open a Crypto ECC HAL module. This function is called by SF_CRYPTO_KEY_Open(). The configuration parameters are validated before opening the HAL module.

Parameters
[in,out]p_ctrlPointer to a Crypto Key Framework module control block
[in,out]p_cfgPointer to a Crypto Key Framework module configuration structure
Return values
SSP_SUCCESSECC HAL module is successfully opened.
SSP_ERR_OUT_OF_MEMORYFailed to allocate memory to store ECC HAL module control block.
SSP_ERR_INTERNALRTOS service returned a unexpected error.
Returns
See Common Error Codes for other possible return codes.

Validate the cfg parameters. The key type is already validated.

Verify the key size.

Verify the domain parameter input buffer size. The length has to be exactly as specified

Verify the generator point input buffer size. The length has to be exactly as specified

Get a Crypto common control block and the interface.

Allocate memory for a Crypto HAL control block in the byte pool.

Get a ECC interface instance.

Set Crypto HAL API instance with the control common hardware api.

Open the Crypto HAL module.

◆ sf_crypto_key_open_rsa()

ssp_err_t sf_crypto_key_open_rsa ( sf_crypto_key_instance_ctrl_t p_ctrl,
sf_crypto_key_cfg_t const *const  p_cfg 
)

Subroutine to open a Crypto RSA HAL module. This function is called by SF_CRYPTO_KEY_Open().

Parameters
[in,out]p_ctrlPointer to a Crypto Key Framework module control block
[in,out]p_cfgPointer to a Crypto Key Framework module configuration structure
Return values
SSP_SUCCESSRSA HAL module is successfully opened.
SSP_ERR_OUT_OF_MEMORYFailed to allocate memory to store RSA HAL module control block.
SSP_ERR_INTERNALRTOS service returned a unexpected error.
Returns
See Common Error Codes for other possible return codes.

◆ sf_crypto_key_rsa_interface_get()

void sf_crypto_key_rsa_interface_get ( sf_crypto_key_instance_ctrl_t *const  p_ctrl)

Subroutine to get a RSA HAL API instance. This function is called by sf_crypto_key_open_rsa().

Parameters
[in,out]p_ctrlPointer to a Key framework control block, whose p_hal_api filled with HAL RSA interface. This indicates NULL, for not supported MCUs

◆ sf_crypto_key_rsa_verify_crtplaintext_buffersize()

ssp_err_t sf_crypto_key_rsa_verify_crtplaintext_buffersize ( sf_crypto_key_size_t  key_size,
uint32_t  buffer_length 
)

Subroutine to verify that the provided buffer_length (buffer to hold the secret RSA CRT Plain text key) is sufficient or not, before proceeding with key Generate function. This function is called by sf_crypto_key_rsa_verify_privatekey_buffersize as an internal function call.

Parameters
[in]key_sizeIndicates RSA key size - 1024/2048-bits.
[in]buffer_lengthLength of the secret key which shall be filled by RSA Key generation algorithm.
Return values
SSP_SUCCESSKey length is successful, and proceed with RSA Key Generation.
SSP_ERR_INVALID_SIZEFailed, as the allocated key length is not sufficient for the Key generation operation of RSA.
Note
This function is not a user API but an internal function for SF_CRYPTO_KEY to verify whether passed buffer size is sufficient for Key to hold in Key Generate API call.

◆ sf_crypto_key_rsa_verify_plaintext_buffersize()

ssp_err_t sf_crypto_key_rsa_verify_plaintext_buffersize ( sf_crypto_key_size_t  key_size,
uint32_t  buffer_length 
)

Subroutine to verify that the provided buffer_length (buffer to hold the secret RSA Plain text key) is sufficient or not, before proceeding with key Generate function. This function is called by sf_crypto_key_rsa_verify_privatekey_buffersize as an internal function call.

Parameters
[in]key_sizeIndicates RSA key size - 1024/2048-bits.
[in]buffer_lengthLength of the secret key which shall be filled by RSA Key generation algorithm.
Return values
SSP_SUCCESSKey length is successful, and proceed with RSA Key Generation.
SSP_ERR_INVALID_SIZEFailed, as the allocated key length is not sufficient for the Key generation operation of RSA.
Note
This function is not a user API but an internal function for SF_CRYPTO_KEY to verify whether passed buffer size is sufficient for Key to hold in Key Generate API call.

◆ sf_crypto_key_rsa_verify_privatekey_buffersize()

ssp_err_t sf_crypto_key_rsa_verify_privatekey_buffersize ( sf_crypto_key_type_t  key_type,
sf_crypto_key_size_t  key_size,
uint32_t  buffer_length 
)

Subroutine to verify that the provided buffer_length (buffer to hold the secret RSA private key) is sufficient or not, before proceeding with key Generate function. This function is called by RSA Key Generate function before passing request to Crypto HAL Key generate API call.

Parameters
[in]key_typeIndicates RSA key type - Plain text/CRT Plain Text/ Wrapped key.
[in]key_sizeIndicates RSA key size - 1024/2048-bits.
[in]buffer_lengthLength of the secret key which shall be filled by RSA Key generation algorithm.
Return values
SSP_SUCCESSKey length is successful, and proceed with RSA Key Generation.
SSP_ERR_INVALID_SIZEFailed, as the allocated key length is not sufficient for the Key generation operation of RSA.
Note
This function is not a user API but an internal function for SF_CRYPTO_KEY to verify whether passed buffer size is sufficient for Key to hold in Key Generate API call.

◆ sf_crypto_key_rsa_verify_publickey_buffersize()

ssp_err_t sf_crypto_key_rsa_verify_publickey_buffersize ( sf_crypto_key_type_t  key_type,
sf_crypto_key_size_t  key_size,
uint32_t  buffer_length 
)

Subroutine to verify that the provided buffer_length (buffer to hold the secret RSA Public key) is sufficient or not, before proceeding with key Generate function. This function is called by RSA Key Generate function before passing request to Crypto HAL Key generate API call.

Parameters
[in]key_typeIndicates RSA key type - Plain text/CRT Plain Text/ Wrapped key.
[in]key_sizeIndicates RSA key size - 1024/2048-bits.
[in]buffer_lengthLength of the secret key which shall be filled by RSA Key generation algorithm.
Return values
SSP_SUCCESSKey length is successful, and proceed with RSA Key Generation.
SSP_ERR_INVALID_SIZEFailed, as the allocated key length is not sufficient for the Key generation operation of RSA.
Note
This function is not a user API but an internal function for SF_CRYPTO_KEY to verify whether passed buffer size is sufficient for Key to hold in Key Generate API call.

◆ sf_crypto_key_rsa_verify_wrapped_buffersize()

ssp_err_t sf_crypto_key_rsa_verify_wrapped_buffersize ( sf_crypto_key_size_t  key_size,
uint32_t  buffer_length 
)

Subroutine to verify that the provided buffer_length (buffer to hold the secret RSA Wrapped key) is sufficient or not, before proceeding with key Generate function. This function is called by sf_crypto_key_rsa_verify_privatekey_buffersize as an internal function call.

Parameters
[in]key_sizeIndicates RSA key size - 1024/2048-bits.
[in]buffer_lengthLength of the secret key which shall be filled by RSA Key generation algorithm.
Return values
SSP_SUCCESSKey length is successful, and proceed with RSA Key Generation.
SSP_ERR_INVALID_SIZEFailed, as the allocated key length is not sufficient for the Key generation operation of RSA.
Note
This function is not a user API but an internal function for SF_CRYPTO_KEY to verify whether passed buffer size is sufficient for Key to hold in Key Generate API call.

◆ sf_crypto_key_scalar_multiplication_ecc()

ssp_err_t sf_crypto_key_scalar_multiplication_ecc ( sf_crypto_key_instance_ctrl_t p_ctrl,
sf_crypto_key_t *const  p_secret_key,
sf_crypto_key_t *const  p_point_on_curve,
sf_crypto_key_t *const  p_resultant_vector 
)

Subroutine to perform a ECC scalar multiplication. This function is called by SF_CRYPTO_KEY_ECDHCompute().

Parameters
[in]p_ctrlPointer to a Crypto Key Framework module control block
[in]p_secret_keyPointer to a secret key
[in]p_point_on_curvePointer to a point specified on the curve.
[in]p_resultant_vectorPointer to the resultant point on the curve.
Return values
SSP_SUCCESSThe module created a key successfully.
SSP_ERR_INVALID_SIZEFailed, as the allocated key buffer length is not sufficient for the ECC Key generation operation.
SSP_ERR_UNSUPPORTEDProcedure is not supported for the supplied parameters.
Returns
See Common Error Codes for other possible return codes.

Verify the secret key buffer size that holds the generated private key.

Verify the input buffer size for holding the data, representing point on the curve data.

Verify the output buffer size to hold the resultant data, representing point on the curve.

Local variable created to call the HAL API.

Note that the HAL driver requires data in WORDS

Call Crypto HAL driver.

◆ SF_CRYPTO_KEY_VersionGet()

ssp_err_t SF_CRYPTO_KEY_VersionGet ( ssp_version_t *const  p_version)

Gets driver version based on compile time macros.

Return values
SSP_SUCCESSSuccessful close.
SSP_ERR_ASSERTIONThe parameter p_version is NULL.