HAL PKA Functions ¶
Initialization and deinitialization functions ¶
Note
This section is not available for STM32C562xx.
- group PKA_Exported_Functions_Group1
-
This sub-section provides a set of functions allowing to initialize and de-initialize the PKA peripheral:
Call the function HAL_PKA_Init() to initialize the HAL PKA handle and associate a PKA peripheral instance.
Call the function HAL_PKA_DeInit() to de-initialize the HAL PKA instance by stopping any ongoing process and resetting the state machine.
Functions
-
hal_status_t
HAL_PKA_Init
(
hal_pka_handle_t
*
hpka
,
hal_pka_t
instance
)
¶
-
Initialize the PKA handle and associate physical instance.
- Parameters :
-
hpka – Pointer to hal_pka_handle_t PKA handle.
instance – Specify the PKA instance.
- Return values :
-
HAL_INVALID_PARAM – Invalid parameter when hpka pointer is NULL.
HAL_ERROR – Returned when the PKA is not correctly initialized; this check is performed when PKA_SR_CCEN flag is defined.
HAL_OK – Returned when the PKA is successfully initialized.
-
void
HAL_PKA_DeInit
(
hal_pka_handle_t
*
hpka
)
¶
-
De-initialize the PKA handle by aborting any PKA operation in progress.
- Parameters :
-
hpka – Pointer to hal_pka_handle_t PKA handle.
Note
This section is not available for STM32C542xx.
Configuration functions ¶
Note
This section is not available for STM32C562xx.
- group PKA_Exported_Functions_Group2
-
This sub-section provides a set of functions allowing to configure the PKA operations.
PKA Modular exponentiation configuration functions
Call the function HAL_PKA_SetConfigModExp() to configure the Modular exponentiation operation.
Call the function HAL_PKA_SetConfigModExpFast() to configure the Modular exponentiation (fast) operation.
Call the function HAL_PKA_SetConfigModExpProtect() to configure the Modular exponentiation (protected) operation when the mode is supported.
PKA arithmetic configuration functions
Call the function HAL_PKA_SetConfigAdd() to configure the Arithmetic addition operation.
Call the function HAL_PKA_SetConfigSub() to configure the Arithmetic subtraction operation.
Call the function HAL_PKA_SetConfigCmp() to configure the Arithmetic comparison operation.
Call the function HAL_PKA_SetConfigMul() to configure the Arithmetic multiplication operation.
Call the function HAL_PKA_SetConfigModAdd() to configure the Modular addition operation.
Call the function HAL_PKA_SetConfigModSub() to configure the Modular subtraction operation.
Call the function HAL_PKA_SetConfigModInv() to configure the Modular inversion operation.
Call the function HAL_PKA_SetConfigModRed() to configure the Modular reduction operation.
Call the function HAL_PKA_SetConfigMontgomeryMul() to configure the Montgomery multiplication operation.
Call the function HAL_PKA_SetConfigMontgomery() to configure the Montgomery parameter operation.
PKA RSA configuration functions
Call the function HAL_PKA_RSA_SetConfigCRTExp() to configure the RSA CRT exponentiation operation.
Call the function HAL_PKA_RSA_SetConfigSignature() to configure the RSA signature operation.
Call the function HAL_PKA_RSA_SetConfigSignatureFast() to configure the RSA signature (fast) operation.
Call the function HAL_PKA_RSA_SetConfigSignatureProtect() to configure the RSA signature (protected) operation when the mode is supported.
Call the function HAL_PKA_RSA_SetConfigVerifSignature() to configure the RSA verification operation.
PKA ECDSA configuration functions
Call the function HAL_PKA_ECDSA_SetConfigSignatureProtect() to configure the elliptic curves over prime fields signature (protected) operation when the mode is supported.
Call the function HAL_PKA_ECDSA_SetConfigVerifSignature() to configure the elliptic curves over prime fields verification operation.
PKA ECC configuration functions
Call the function HAL_PKA_ECC_SetConfigPointCheck() to configure the Point on elliptic curve check operation.
Call the function HAL_PKA_ECC_SetConfigMulProtect() to configure the ECC scalar multiplication (protected) operation when the mode is supported.
Call the function HAL_PKA_ECC_SetConfigDoubleBaseLadder() to configure the ECC double base ladder operation.
Call the function HAL_PKA_ECC_SetConfigProjectiveToAffine() to configure the ECC projective to affine operation.
Call the function HAL_PKA_ECC_SetConfigCompleteAdd() to configure the ECC complete addition operation.
Functions
-
hal_status_t
HAL_PKA_SetConfigModExp
(
hal_pka_handle_t
*
hpka
,
const
hal_pka_mod_exp_config_t
*
p_config
)
¶
-
Set the modular exponentiation configuration.
- Parameters :
-
hpka – Pointer to hal_pka_handle_t PKA handle.
p_config – Pointer to hal_pka_mod_exp_config_t configuration structure.
- Return values :
-
HAL_INVALID_PARAM – Invalid parameter return when p_config pointer is NULL.
HAL_ERROR – PKA is not correctly initialized.
HAL_OK – Modular exponentiation is successfully configured.
-
hal_status_t
HAL_PKA_SetConfigModExpFast
(
hal_pka_handle_t
*
hpka
,
const
hal_pka_mod_exp_fast_config_t
*
p_config
)
¶
-
Set the modular exponentiation (fast) mode configuration.
- Parameters :
-
hpka – Pointer to hal_pka_handle_t PKA handle.
p_config – Pointer to hal_pka_mod_exp_fast_config_t configuration structure.
- Return values :
-
HAL_INVALID_PARAM – Invalid parameter return when p_config pointer is NULL.
HAL_ERROR – PKA is not correctly initialized.
HAL_OK – Modular exponentiation (fast) is successfully configured.
-
hal_status_t
HAL_PKA_SetConfigModExpProtect
(
hal_pka_handle_t
*
hpka
,
const
hal_pka_mod_exp_protect_config_t
*
p_config
)
¶
-
Set the modular exponentiation (protected) configuration. Useful when secret information is involved (RSA decryption).
- Parameters :
-
hpka – Pointer to hal_pka_handle_t PKA handle.
p_config – Pointer to hal_pka_mod_exp_protect_config_t configuration structure.
- Return values :
-
HAL_INVALID_PARAM – Invalid parameter return when p_config pointer is NULL.
HAL_ERROR – PKA is not correctly initialized.
HAL_OK – Modular exponentiation (protected) is successfully configured.
-
hal_status_t
HAL_PKA_ECDSA_SetConfigSignatureProtect
(
hal_pka_handle_t
*
hpka
,
const
hal_pka_ecdsa_signature_protect_config_t
*
p_config
)
¶
-
Set the message signature (protected) configuration using elliptic curves over prime fields.
- Parameters :
-
hpka – Pointer to hal_pka_handle_t PKA handle.
p_config – Pointer to hal_pka_ecdsa_signature_protect_config_t configuration structure.
- Return values :
-
HAL_INVALID_PARAM – Invalid parameter return when p_config pointer is NULL.
HAL_ERROR – PKA is not correctly initialized.
HAL_OK – Signature of a message is successfully configured.
-
hal_status_t
HAL_PKA_ECDSA_SetConfigVerifSignature
(
hal_pka_handle_t
*
hpka
,
const
hal_pka_ecdsa_verif_config_t
*
p_config
)
¶
-
Set the configuration for verifying the validity of a signature using elliptic curves over prime fields.
- Parameters :
-
hpka – Pointer to hal_pka_handle_t PKA handle.
p_config – Pointer to hal_pka_ecdsa_verif_config_t configuration structure.
- Return values :
-
HAL_INVALID_PARAM – Invalid parameter return when p_config pointer is NULL.
HAL_ERROR – PKA is not correctly initialized.
HAL_OK – The verification of signature validity is successfully configured.
-
hal_status_t
HAL_PKA_RSA_SetConfigCRTExp
(
hal_pka_handle_t
*
hpka
,
const
hal_pka_rsa_crt_exp_config_t
*
p_config
)
¶
-
Set the RSA CRT exponentiation configuration.
- Parameters :
-
hpka – Pointer to hal_pka_handle_t PKA handle.
p_config – Pointer to hal_pka_rsa_crt_exp_config_t configuration structure.
- Return values :
-
HAL_INVALID_PARAM – Invalid parameter return when p_config pointer is NULL.
HAL_ERROR – PKA is not correctly initialized.
HAL_OK – RSA CRT exponentiation is successfully configured.
-
hal_status_t
HAL_PKA_RSA_SetConfigSignature
(
hal_pka_handle_t
*
hpka
,
const
hal_pka_rsa_signature_config_t
*
p_config
)
¶
-
Set the message signature configuration using RSA CRT exponentiation.
- Parameters :
-
hpka – Pointer to hal_pka_handle_t PKA handle.
p_config – Pointer to hal_pka_rsa_signature_config_t configuration structure.
- Return values :
-
HAL_INVALID_PARAM – Invalid parameter return when p_config pointer is NULL.
HAL_ERROR – PKA is not correctly initialized.
HAL_OK – RSA CRT exponentiation is successfully configured.
-
hal_status_t
HAL_PKA_RSA_SetConfigSignatureFast
(
hal_pka_handle_t
*
hpka
,
const
hal_pka_rsa_signature_fast_config_t
*
p_config
)
¶
-
Set the message signature (fast) configuration using RSA CRT exponentiation.
- Parameters :
-
hpka – Pointer to hal_pka_handle_t PKA handle.
p_config – Pointer to hal_pka_rsa_signature_fast_config_t configuration structure.
- Return values :
-
HAL_INVALID_PARAM – Invalid parameter return when p_config pointer is NULL.
HAL_ERROR – PKA is not correctly initialized.
HAL_OK – RSA CRT exponentiation is successfully configured.
-
hal_status_t
HAL_PKA_RSA_SetConfigSignatureProtect
(
hal_pka_handle_t
*
hpka
,
const
hal_pka_rsa_signature_protect_config_t
*
p_config
)
¶
-
Set the message signature (protected) configuration using RSA CRT exponentiation.
- Parameters :
-
hpka – Pointer to hal_pka_handle_t PKA handle.
p_config – Pointer to hal_pka_rsa_signature_protect_config_t configuration structure.
- Return values :
-
HAL_INVALID_PARAM – Invalid parameter return when p_config pointer is NULL.
HAL_ERROR – PKA is not correctly initialized.
HAL_OK – RSA CRT exponentiation is successfully configured.
-
hal_status_t
HAL_PKA_RSA_SetConfigVerifSignature
(
hal_pka_handle_t
*
hpka
,
const
hal_pka_rsa_verif_config_t
*
p_config
)
¶
-
Set the configuration for verifying the validity of a signature using RSA CRT exponentiation.
- Parameters :
-
hpka – Pointer to hal_pka_handle_t PKA handle.
p_config – Pointer to hal_pka_rsa_verif_config_t configuration structure.
- Return values :
-
HAL_INVALID_PARAM – Invalid parameter return when p_config pointer is NULL.
HAL_ERROR – PKA is not correctly initialized.
HAL_OK – The verification of signature validity is successfully configured.
-
hal_status_t
HAL_PKA_SetConfigAdd
(
hal_pka_handle_t
*
hpka
,
const
hal_pka_add_config_t
*
p_config
)
¶
-
Set arithmetic addition configuration.
- Parameters :
-
hpka – Pointer to hal_pka_handle_t PKA handle.
p_config – Pointer to hal_pka_add_config_t configuration structure.
- Return values :
-
HAL_INVALID_PARAM – Invalid parameter return when p_config pointer is NULL.
HAL_ERROR – PKA is not correctly initialized.
HAL_OK – Arithmetic addition is successfully configured.
-
hal_status_t
HAL_PKA_SetConfigSub
(
hal_pka_handle_t
*
hpka
,
const
hal_pka_sub_config_t
*
p_config
)
¶
-
Set arithmetic subtraction configuration.
- Parameters :
-
hpka – Pointer to hal_pka_handle_t PKA handle.
p_config – Pointer to hal_pka_sub_config_t configuration structure.
- Return values :
-
HAL_INVALID_PARAM – Invalid parameter return when p_config pointer is NULL.
HAL_ERROR – PKA is not correctly initialized.
HAL_OK – Arithmetic subtraction is successfully configured.
-
hal_status_t
HAL_PKA_SetConfigCmp
(
hal_pka_handle_t
*
hpka
,
const
hal_pka_cmp_config_t
*
p_config
)
¶
-
Set comparison configuration.
- Parameters :
-
hpka – Pointer to hal_pka_handle_t PKA handle.
p_config – Pointer to hal_pka_cmp_config_t configuration structure.
- Return values :
-
HAL_INVALID_PARAM – Invalid parameter return when p_config pointer is NULL.
HAL_ERROR – PKA is not correctly initialized.
HAL_OK – Comparison is successfully configured.
-
hal_status_t
HAL_PKA_SetConfigMul
(
hal_pka_handle_t
*
hpka
,
const
hal_pka_mul_config_t
*
p_config
)
¶
-
Set arithmetic multiplication configuration.
- Parameters :
-
hpka – Pointer to hal_pka_handle_t PKA handle.
p_config – Pointer to hal_pka_mul_config_t configuration structure.
- Return values :
-
HAL_INVALID_PARAM – Invalid parameter return when p_config pointer is NULL.
HAL_ERROR – PKA is not correctly initialized.
HAL_OK – Arithmetic multiplication is successfully configured.
-
hal_status_t
HAL_PKA_SetConfigModAdd
(
hal_pka_handle_t
*
hpka
,
const
hal_pka_mod_add_config_t
*
p_config
)
¶
-
Set modular addition configuration.
- Parameters :
-
hpka – Pointer to hal_pka_handle_t PKA handle.
p_config – Pointer to hal_pka_mod_add_config_t configuration structure.
- Return values :
-
HAL_INVALID_PARAM – Invalid parameter return when p_config pointer is NULL.
HAL_ERROR – PKA is not correctly initialized.
HAL_OK – Modular addition is successfully configured.
-
hal_status_t
HAL_PKA_SetConfigModSub
(
hal_pka_handle_t
*
hpka
,
const
hal_pka_mod_sub_config_t
*
p_config
)
¶
-
Set modular subtraction configuration.
- Parameters :
-
hpka – Pointer to hal_pka_handle_t PKA handle.
p_config – Pointer to hal_pka_mod_sub_config_t configuration structure.
- Return values :
-
HAL_INVALID_PARAM – Invalid parameter return when p_config pointer is NULL.
HAL_ERROR – PKA is not correctly initialized.
HAL_OK – Modular subtraction is successfully configured.
-
hal_status_t
HAL_PKA_SetConfigModInv
(
hal_pka_handle_t
*
hpka
,
const
hal_pka_mod_inv_config_t
*
p_config
)
¶
-
Set modular inversion configuration.
- Parameters :
-
hpka – Pointer to hal_pka_handle_t PKA handle.
p_config – Pointer to hal_pka_mod_inv_config_t configuration structure.
- Return values :
-
HAL_INVALID_PARAM – Invalid parameter return when p_config pointer is NULL.
HAL_ERROR – PKA is not correctly initialized.
HAL_OK – Modular inversion is successfully configured.
-
hal_status_t
HAL_PKA_SetConfigModRed
(
hal_pka_handle_t
*
hpka
,
const
hal_pka_mod_red_config_t
*
p_config
)
¶
-
Set the modular reduction configuration.
- Parameters :
-
hpka – Pointer to hal_pka_handle_t PKA handle.
p_config – Pointer to hal_pka_mod_red_config_t configuration structure.
- Return values :
-
HAL_INVALID_PARAM – Invalid parameter return when p_config pointer is NULL.
HAL_ERROR – PKA is not correctly initialized.
HAL_OK – Modular reduction is successfully configured.
-
hal_status_t
HAL_PKA_SetConfigMontgomeryMul
(
hal_pka_handle_t
*
hpka
,
const
hal_pka_montgomery_mul_config_t
*
p_config
)
¶
-
Set Montgomery multiplication configuration.
- Parameters :
-
hpka – Pointer to hal_pka_handle_t PKA handle.
p_config – Pointer to hal_pka_montgomery_mul_config_t configuration structure.
- Return values :
-
HAL_INVALID_PARAM – Invalid parameter return when p_config pointer is NULL.
HAL_ERROR – PKA is not correctly initialized.
HAL_OK – Montgomery multiplication is successfully configured.
-
hal_status_t
HAL_PKA_SetConfigMontgomery
(
hal_pka_handle_t
*
hpka
,
const
hal_pka_montgomery_config_t
*
p_config
)
¶
-
Set Montgomery parameter configuration.
- Parameters :
-
hpka – Pointer to hal_pka_handle_t PKA handle.
p_config – Pointer to hal_pka_montgomery_config_t configuration structure.
- Return values :
-
HAL_INVALID_PARAM – Invalid parameter return when p_config pointer is NULL.
HAL_ERROR – PKA is not correctly initialized.
HAL_OK – Montgomery parameter is successfully configured.
-
hal_status_t
HAL_PKA_ECC_SetConfigPointCheck
(
hal_pka_handle_t
*
hpka
,
const
hal_pka_point_check_config_t
*
p_config
)
¶
-
Set Point on elliptic curve check configuration.
- Parameters :
-
hpka – Pointer to hal_pka_handle_t PKA handle.
p_config – Pointer to hal_pka_point_check_config_t configuration structure.
- Return values :
-
HAL_INVALID_PARAM – Invalid parameter return when p_config pointer is NULL.
HAL_ERROR – PKA is not correctly initialized.
HAL_OK – Point on elliptic curve check is successfully configured.
-
hal_status_t
HAL_PKA_ECC_SetConfigMulProtect
(
hal_pka_handle_t
*
hpka
,
const
hal_pka_ecc_mul_protect_config_t
*
p_config
)
¶
-
Set the ECC scalar multiplication (protected) configuration.
- Parameters :
-
hpka – Pointer to hal_pka_handle_t PKA handle.
p_config – Pointer to hal_pka_ecc_mul_protect_config_t configuration structure.
- Return values :
-
HAL_INVALID_PARAM – Invalid parameter return when p_config pointer is NULL.
HAL_ERROR – PKA is not correctly initialized.
HAL_OK – ECC scalar multiplication is successfully configured.
-
hal_status_t
HAL_PKA_ECC_SetConfigDoubleBaseLadder
(
hal_pka_handle_t
*
hpka
,
const
hal_pka_ecc_double_base_ladder_config_t
*
p_config
)
¶
-
Set ECC double base ladder configuration.
- Parameters :
-
hpka – Pointer to hal_pka_handle_t PKA handle.
p_config – Pointer to hal_pka_ecc_double_base_ladder_config_t configuration structure.
- Return values :
-
HAL_INVALID_PARAM – Invalid parameter return when p_config pointer is NULL.
HAL_ERROR – PKA is not correctly initialized.
HAL_OK – ECC double base ladder is successfully configured.
-
hal_status_t
HAL_PKA_ECC_SetConfigProjectiveToAffine
(
hal_pka_handle_t
*
hpka
,
const
hal_pka_ecc_projective_to_affine_config_t
*
p_config
)
¶
-
Set ECC projective to affine configuration.
- Parameters :
-
hpka – Pointer to hal_pka_handle_t PKA handle.
p_config – Pointer to hal_pka_ecc_projective_to_affine_config_t configuration structure.
- Return values :
-
HAL_INVALID_PARAM – Invalid parameter return when p_config pointer is NULL.
HAL_ERROR – PKA is not correctly initialized.
HAL_OK – ECC projective to affine is successfully configured.
-
hal_status_t
HAL_PKA_ECC_SetConfigCompleteAdd
(
hal_pka_handle_t
*
hpka
,
const
hal_pka_ecc_complete_add_config_t
*
p_config
)
¶
-
Set ECC complete addition configuration.
- Parameters :
-
hpka – Pointer to hal_pka_handle_t PKA handle.
p_config – Pointer to hal_pka_ecc_complete_add_config_t configuration structure.
- Return values :
-
HAL_INVALID_PARAM – Invalid parameter return when p_config pointer is NULL.
HAL_ERROR – PKA is not correctly initialized.
HAL_OK – ECC complete addition is successfully configured.
Note
This section is not available for STM32C542xx.
Process management functions ¶
Note
This section is not available for STM32C562xx.
- group PKA_Exported_Functions_Group3
-
This sub-section provides a set of functions allowing to manage the calculation data for an operation.
PKA calculating process functions
Call the function HAL_PKA_Compute() to start the computation in blocking mode.
Call the function HAL_PKA_Compute_IT() to start the computation in interrupt mode.
Call the function HAL_PKA_IRQHandler() to handle PKA event interrupt request.
Call the function HAL_PKA_Abort() to abort any ongoing operation.
PKA Modular exponentiation result functions
Call the function HAL_PKA_GetResultModExp() to retrieve the result of the Modular exponentiation operation.
Call the function HAL_PKA_GetResultModExpFast() to retrieve the result of the Modular exponentiation (Fast) operation.
Call the function HAL_PKA_GetResultModExpProtect() to retrieve the result of the Modular exponentiation (Protected) operation when the mode is supported.
PKA arithmetic result functions
Call the function HAL_PKA_GetResultAdd() to retrieve the result of the addition operation.
Call the function HAL_PKA_GetResultSub() to retrieve the result of the subtraction operation.
Call the function HAL_PKA_GetResultMul() to retrieve the result of the multiplication operation.
Call the function HAL_PKA_GetResultCmp() to retrieve the result of the comparison operation.
Call the function HAL_PKA_GetResultModAdd() to retrieve the result of the Modular Addition operation.
Call the function HAL_PKA_GetResultModSub() to retrieve the result of the Modular subtraction operation.
Call the function HAL_PKA_GetResultModInv() to retrieve the result of the modular inversion operation.
Call the function HAL_PKA_GetResultModRed() to retrieve the result of the modular reduction operation.
Call the function HAL_PKA_GetResultMontgomeryMul() to retrieve the result of the Montgomery parameter operation.
Call the function HAL_PKA_GetResultMontgomery() to retrieve the result of the Montgomery parameter operation.
PKA RSA result functions
Call the function HAL_PKA_RSA_GetResultCRTExp() to retrieve the result of RSA CRT exponentiation operation.
Call the function HAL_PKA_RSA_GetResultSignature() to retrieve the result of the RSA signature operation.
Call the function HAL_PKA_RSA_GetResultSignatureFast() to retrieve the result of the RSA signature (fast) operation.
Call the function HAL_PKA_RSA_GetResultSignatureProtect() to retrieve the result of the RSA signature (protected) operation when the mode is supported.
Call the function HAL_PKA_RSA_IsValidVerifSignature() to check if the signature is verified.
PKA ECDSA result functions
Call the function HAL_PKA_ECDSA_GetResultSignatureProtect() to retrieve the result of elliptic curves over prime fields signature (protected) operation when the mode is supported.
Call the function HAL_PKA_ECDSA_IsValidVerifSignature() to check if the signature is verified.
PKA ECC result functions
Call the function HAL_PKA_ECC_IsPointCheckOnCurve() to check if the point is on the curve.
Call the function HAL_PKA_ECC_GetResultMulProtect() to retrieve the result of ECC scalar multiplication (protected) operation when the mode is supported.
Call the function HAL_PKA_ECC_GetResultDoubleBaseLadder() to retrieve the result of ECC double base ladder operation.
Call the function HAL_PKA_ECC_GetResultProjectiveToAffine() to retrieve the result of ECC projective to affine operation.
Call the function HAL_PKA_ECC_GetResultCompleteAdd() to retrieve the result of ECC complete addition operation.
Functions
-
hal_status_t
HAL_PKA_Compute
(
hal_pka_handle_t
*
hpka
,
uint32_t
timeout_ms
)
¶
-
Generic function to start a PKA operation in blocking mode.
- Parameters :
-
hpka – PKA handle.
timeout_ms – Timeout duration.
- Return values :
-
HAL_INVALID_PARAM – Invalid parameter return when hpka pointer or timeout_ms are NULL.
HAL_TIMEOUT – In case of user timeout.
HAL_ERROR – PKA error is occurred.
HAL_BUSY – PKA state is active when calling this API.
HAL_OK – Operation is successfully computed.
-
hal_status_t
HAL_PKA_Compute_IT
(
hal_pka_handle_t
*
hpka
)
¶
-
Generic function to start a PKA operation in non-blocking mode with interrupt.
- Parameters :
-
hpka – PKA handle.
- Return values :
-
HAL_INVALID_PARAM – Invalid parameter return when hpka pointer is NULL.
HAL_BUSY – PKA state is active when calling this API.
HAL_OK – Operation is successfully computed.
-
void
HAL_PKA_IRQHandler
(
hal_pka_handle_t
*
hpka
)
¶
-
This function handles PKA event interrupt request.
- Parameters :
-
hpka – Pointer to hal_pka_handle_t PKA handle.
-
hal_status_t
HAL_PKA_Abort
(
hal_pka_handle_t
*
hpka
)
¶
-
Abort any ongoing operation.
- Parameters :
-
hpka – Pointer to hal_pka_handle_t PKA handle.
- Return values :
-
HAL_INVALID_PARAM – Invalid parameter return when hpka pointer is NULL.
HAL_OK – Operation is successfully aborted.
-
uint32_t
HAL_PKA_GetResultModExp
(
hal_pka_handle_t
*
hpka
,
uint8_t
*
p_result
)
¶
-
Retrieve Modular exponentiation operation result.
Note
The retrieved data are in big-endian format and start at the base address of the user buffer.
- Parameters :
-
hpka – Pointer to hal_pka_handle_t PKA handle.
p_result – Pointer to operation result.
- Return values :
-
size_byte – Size of result in bytes.
0 – In case of invalid parameter.
-
uint32_t
HAL_PKA_GetResultModExpFast
(
hal_pka_handle_t
*
hpka
,
uint8_t
*
p_result
)
¶
-
Retrieve Modular exponentiation (Fast) operation result.
Note
The retrieved data are in big-endian format and start at the base address of the user buffer.
- Parameters :
-
hpka – Pointer to hal_pka_handle_t PKA handle.
p_result – Pointer to operation result.
- Return values :
-
size_byte – Size of result in bytes.
0 – In case of invalid parameter.
-
uint32_t
HAL_PKA_GetResultModExpProtect
(
hal_pka_handle_t
*
hpka
,
uint8_t
*
p_result
)
¶
-
Retrieve Modular exponentiation (Protected) operation result.
Note
The retrieved data are in big-endian format and start at the base address of the user buffer.
- Parameters :
-
hpka – Pointer to hal_pka_handle_t PKA handle.
p_result – Pointer to operation result.
- Return values :
-
size_byte – Size of result in bytes.
0 – In case of result error or invalid parameter.
-
uint32_t
HAL_PKA_ECDSA_GetResultSignatureProtect
(
hal_pka_handle_t
*
hpka
,
hal_pka_ecdsa_signature_protect_result_t
*
p_result
,
hal_pka_ecdsa_signature_result_ext_config_t
*
p_result_ext
)
¶
-
Retrieve ECDSA signature (protected) operation result.
Note
The retrieved data are in big-endian format and start at the base address of the user buffer. The returned size corresponds to the maximum effective size of the signature components and the coordinates.
- Parameters :
-
hpka – Pointer to hal_pka_handle_t PKA handle.
p_result – Pointer to hal_pka_ecdsa_signature_protect_result_t result structure.
p_result_ext – Pointer to hal_pka_ecdsa_signature_result_ext_config_t structure (optional).
- Return values :
-
size_byte – Size of result in bytes.
0 – In case of result error or invalid parameter.
-
hal_pka_ecdsa_signature_status_t
HAL_PKA_ECDSA_IsValidVerifSignature
(
const
hal_pka_handle_t
*
hpka
)
¶
-
Retrieve ECDSA verification signature result.
- Parameters :
-
hpka – Pointer to hal_pka_handle_t PKA handle.
- Return values :
-
PKA_ECDSA_SIGNATURE_VALID – Signature validated.
PKA_ECDSA_SIGNATURE_NOT_VALID – In case of signature not validated or invalid parameter.
-
uint32_t
HAL_PKA_RSA_GetResultCRTExp
(
hal_pka_handle_t
*
hpka
,
uint8_t
*
p_result
)
¶
-
Retrieve RSA CRT exponentiation operation result.
Note
The retrieved data are in big-endian format and start at the base address of the user buffer.
- Parameters :
-
hpka – Pointer to hal_pka_handle_t PKA handle.
p_result – Pointer to operation result.
- Return values :
-
size_byte – Size of result in bytes.
0 – In case of invalid parameter.
-
uint32_t
HAL_PKA_RSA_GetResultSignature
(
hal_pka_handle_t
*
hpka
,
uint8_t
*
p_result
)
¶
-
Retrieve RSA signature operation result.
Note
The retrieved data are in big-endian format and start at the base address of the user buffer.
- Parameters :
-
hpka – Pointer to hal_pka_handle_t PKA handle.
p_result – Pointer to operation result.
- Return values :
-
size_byte – Size of result in bytes.
0 – In case of invalid parameter.
-
uint32_t
HAL_PKA_RSA_GetResultSignatureFast
(
hal_pka_handle_t
*
hpka
,
uint8_t
*
p_result
)
¶
-
Retrieve RSA signature (fast) operation result.
Note
The retrieved data are in big-endian format and start at the base address of the user buffer.
- Parameters :
-
hpka – Pointer to hal_pka_handle_t PKA handle.
p_result – Pointer to operation result buffer.
- Return values :
-
size_byte – Size of result in bytes.
0 – In case of invalid parameter.
-
uint32_t
HAL_PKA_RSA_GetResultSignatureProtect
(
hal_pka_handle_t
*
hpka
,
uint8_t
*
p_result
)
¶
-
Retrieve RSA signature (protected) operation result.
Note
The retrieved data are in big-endian format and start at the base address of the user buffer.
- Parameters :
-
hpka – Pointer to hal_pka_handle_t PKA handle.
p_result – Pointer to operation result buffer.
- Return values :
-
size_byte – Size of result in bytes.
0 – In case of invalid parameter.
-
hal_pka_rsa_signature_status_t
HAL_PKA_RSA_IsValidVerifSignature
(
hal_pka_handle_t
*
hpka
,
const
uint8_t
*
p_hash
)
¶
-
Retrieve RSA verification signature result.
Note
The verification result is checked against the effective output data returned by the PKA in big-endian format.
- Parameters :
-
hpka – Pointer to hal_pka_handle_t PKA handle.
p_hash – Pointer to hashed message provided by the user.
- Return values :
-
PKA_RSA_SIGNATURE_VALID – Signature validated.
PKA_RSA_SIGNATURE_NOT_VALID – In case of signature not validated or invalid parameter.
-
uint32_t
HAL_PKA_GetResultAdd
(
hal_pka_handle_t
*
hpka
,
uint8_t
*
p_result
)
¶
-
Retrieve Addition operation result.
Note
The retrieved data are in big-endian format and start at the base address of the user buffer.
- Parameters :
-
hpka – Pointer to hal_pka_handle_t PKA handle.
p_result – Pointer to operation result buffer.
- Return values :
-
size_byte – Size of result in bytes.
0 – In case of invalid parameter.
-
uint32_t
HAL_PKA_GetResultSub
(
hal_pka_handle_t
*
hpka
,
uint8_t
*
p_result
)
¶
-
Retrieve subtraction operation result.
Note
The retrieved data are in big-endian format and start at the base address of the user buffer.
- Parameters :
-
hpka – Pointer to hal_pka_handle_t PKA handle.
p_result – Pointer to operation result buffer.
- Return values :
-
size_byte – Size of result in bytes.
0 – In case of invalid parameter.
-
uint32_t
HAL_PKA_GetResultMul
(
hal_pka_handle_t
*
hpka
,
uint8_t
*
p_result
)
¶
-
Retrieve multiplication operation result.
Note
The retrieved data are in big-endian format and start at the base address of the user buffer.
- Parameters :
-
hpka – Pointer to hal_pka_handle_t PKA handle.
p_result – Pointer to operation result buffer.
- Return values :
-
size_byte – Size of result in bytes.
0 – In case of invalid parameter.
-
uint32_t
HAL_PKA_GetResultCmp
(
hal_pka_handle_t
*
hpka
,
uint8_t
*
p_result
)
¶
-
Retrieve comparison operation result.
Note
The comparison result is returned in big-endian format and start at the base address of the user buffer.
- Parameters :
-
hpka – Pointer to hal_pka_handle_t PKA handle.
p_result – Pointer to operation result buffer.
- Return values :
-
PKA_CMP_RESULT_SIZE – Size of the comparison result in bytes.
0 – In case of invalid parameter.
-
uint32_t
HAL_PKA_GetResultModAdd
(
hal_pka_handle_t
*
hpka
,
uint8_t
*
p_result
)
¶
-
Retrieve Modular Addition operation result.
Note
The retrieved data are in big-endian format and start at the base address of the user buffer.
- Parameters :
-
hpka – Pointer to hal_pka_handle_t PKA handle.
p_result – Pointer to operation result buffer.
- Return values :
-
size_byte – Size of result in bytes.
0 – In case of invalid parameter.
-
uint32_t
HAL_PKA_GetResultModSub
(
hal_pka_handle_t
*
hpka
,
uint8_t
*
p_result
)
¶
-
Retrieve Modular subtraction operation result.
Note
The retrieved data are in big-endian format and start at the base address of the user buffer.
- Parameters :
-
hpka – Pointer to hal_pka_handle_t PKA handle.
p_result – Pointer to operation result buffer.
- Return values :
-
size_byte – Size of result in bytes.
0 – In case of invalid parameter.
-
uint32_t
HAL_PKA_GetResultModRed
(
hal_pka_handle_t
*
hpka
,
uint8_t
*
p_result
)
¶
-
Retrieve Modular Reduction operation result.
Note
The retrieved data are in big-endian format and start at the base address of the user buffer.
- Parameters :
-
hpka – Pointer to hal_pka_handle_t PKA handle.
p_result – Pointer to operation result buffer.
- Return values :
-
size_byte – Size of result in bytes.
0 – In case of invalid parameter.
-
uint32_t
HAL_PKA_GetResultModInv
(
hal_pka_handle_t
*
hpka
,
uint8_t
*
p_result
)
¶
-
Retrieve Modular Inversion operation result.
Note
The retrieved data are in big-endian format and start at the base address of the user buffer.
- Parameters :
-
hpka – Pointer to hal_pka_handle_t PKA handle.
p_result – Pointer to operation result buffer.
- Return values :
-
size_byte – Size of result in bytes.
0 – In case of invalid parameter.
-
uint32_t
HAL_PKA_GetResultMontgomeryMul
(
hal_pka_handle_t
*
hpka
,
uint8_t
*
p_result
)
¶
-
Retrieve Montgomery multiplication operation result.
Note
The retrieved data are in big-endian format and start at the base address of the user buffer.
- Parameters :
-
hpka – Pointer to hal_pka_handle_t PKA handle.
p_result – Pointer to operation result buffer.
- Return values :
-
size_byte – Size of result in bytes.
0 – In case of invalid parameter.
-
uint32_t
HAL_PKA_GetResultMontgomery
(
hal_pka_handle_t
*
hpka
,
uint8_t
*
p_result
)
¶
-
Retrieve Montgomery parameter operation result.
Note
The retrieved data are in big-endian format and start at the base address of the user buffer.
- Parameters :
-
hpka – Pointer to hal_pka_handle_t PKA handle.
p_result – Pointer to operation result buffer.
- Return values :
-
size_byte – Size of result in bytes.
0 – In case of invalid parameter.
-
hal_pka_ecc_point_status_t
HAL_PKA_ECC_IsPointCheckOnCurve
(
const
hal_pka_handle_t
*
hpka
)
¶
-
Retrieve point-on-elliptic-curve check operation result.
- Parameters :
-
hpka – Pointer to hal_pka_handle_t PKA handle.
- Return values :
-
PKA_ECC_POINT_ON_CURVE – ECC point is on the curve.
PKA_ECC_POINT_NOT_ON_CURVE – When the ECC point is not on the curve or a parameter is invalid.
-
uint32_t
HAL_PKA_ECC_GetResultMulProtect
(
hal_pka_handle_t
*
hpka
,
hal_pka_ecc_mul_protect_result_t
*
p_result
)
¶
-
Retrieve ECC scalar multiplication (protected) operation result.
Note
The retrieved data are in big-endian format and start at the base address of the user buffer. The returned size corresponds to the maximum effective size of the coordinates.
- Parameters :
-
hpka – Pointer to hal_pka_handle_t PKA handle.
p_result – Pointer to hal_pka_ecc_mul_protect_result_t result structure.
- Return values :
-
size_byte – Size of result in bytes.
0 – In case of result error or invalid parameter.
-
uint32_t
HAL_PKA_ECC_GetResultDoubleBaseLadder
(
hal_pka_handle_t
*
hpka
,
hal_pka_ecc_double_base_ladder_result_t
*
p_result
)
¶
-
Retrieve ECC double base ladder operation result.
Note
The retrieved data are in big-endian format and start at the base address of the user buffer. The returned size corresponds to the maximum effective size of the coordinates.
- Parameters :
-
hpka – Pointer to hal_pka_handle_t PKA handle.
p_result – Pointer to hal_pka_ecc_double_base_ladder_result_t result structure.
- Return values :
-
size_byte – Size of result in bytes.
0 – In case of result error or invalid parameter.
-
uint32_t
HAL_PKA_ECC_GetResultProjectiveToAffine
(
hal_pka_handle_t
*
hpka
,
hal_pka_ecc_projective_to_affine_result_t
*
p_result
)
¶
-
Retrieve ECC projective to affine operation result.
Note
The retrieved data are in big-endian format and start at the base address of the user buffer. The returned size corresponds to the maximum effective size of the coordinates.
- Parameters :
-
hpka – Pointer to hal_pka_handle_t PKA handle.
p_result – Pointer to hal_pka_ecc_projective_to_affine_result_t result structure.
- Return values :
-
size_byte – Size of result in bytes.
0 – In case of result error or invalid parameter.
-
uint32_t
HAL_PKA_ECC_GetResultCompleteAdd
(
hal_pka_handle_t
*
hpka
,
hal_pka_ecc_complete_add_result_t
*
p_result
)
¶
-
Retrieve ECC complete addition operation result.
Note
The retrieved data are in big-endian format and start at the base address of the user buffer. The returned size corresponds to the maximum effective size of the coordinates.
- Parameters :
-
hpka – Pointer to hal_pka_handle_t PKA handle.
p_result – Pointer to hal_pka_ecc_complete_add_result_t result structure.
- Return values :
-
size_byte – Size of result in bytes.
0 – In case of invalid parameter.
Note
This section is not available for STM32C542xx.
Callback functions ¶
Note
This section is not available for STM32C562xx.
- group PKA_Exported_Functions_Group4
-
This sub-section provides a set of callback functions allowing you to register the PKA operation and error callbacks:
The HAL_PKA_OperationCpltCallback() function is called when the process is complete.
The HAL_PKA_ErrorCallback() function is called in case of an error.
Call the function HAL_PKA_RegisterOperationCpltCallback() to register the PKA operation complete callback.
Call the function HAL_PKA_RegisterErrorCallback() to register the PKA error callback.
Functions
-
void
HAL_PKA_OperationCpltCallback
(
hal_pka_handle_t
*
hpka
)
¶
-
Process completed callback.
- Parameters :
-
hpka – Pointer to hal_pka_handle_t PKA handle.
-
void
HAL_PKA_ErrorCallback
(
hal_pka_handle_t
*
hpka
)
¶
-
Error callback.
- Parameters :
-
hpka – Pointer to hal_pka_handle_t PKA handle.
-
hal_status_t
HAL_PKA_RegisterOperationCpltCallback
(
hal_pka_handle_t
*
hpka
,
hal_pka_cb_t
p_callback
)
¶
-
Register the PKA command complete Callback TO be used instead of the weak HAL_PKA_OperCpltCallback() predefined callback.
- Parameters :
-
hpka – Pointer to hal_pka_handle_t PKA handle.
p_callback – Pointer to hal_pka_cb_t Callback function.
- Return values :
-
HAL_INVALID_PARAM – Invalid parameter.
HAL_OK – Register completed successfully.
-
hal_status_t
HAL_PKA_RegisterErrorCallback
(
hal_pka_handle_t
*
hpka
,
hal_pka_cb_t
p_callback
)
¶
-
Register the PKA Error Callback to be used instead of the weak HAL_PKA_ErrorCallback() predefined callback.
- Parameters :
-
hpka – Pointer to hal_pka_handle_t PKA handle.
p_callback – Pointer to hal_pka_cb_t Callback function.
- Return values :
-
HAL_INVALID_PARAM – Invalid parameter.
HAL_OK – Register completed successfully.
Note
This section is not available for STM32C542xx.
State and Error functions ¶
Note
This section is not available for STM32C562xx.
- group PKA_Exported_Functions_Group5
-
This sub-section provides a set of functions allowing you to get the PKA state, error code, and data information:
Call the function HAL_PKA_GetState() to get the current PKA state.
Call the function HAL_PKA_GetLastErrorCodes() to get the last PKA hardware or software error codes.
Call the function HAL_PKA_SetUserData() to set the PKA user data.
Call the function HAL_PKA_GetUserData() to get the PKA user data.
Functions
-
hal_pka_state_t
HAL_PKA_GetState
(
const
hal_pka_handle_t
*
hpka
)
¶
-
Retrieve the PKA global state.
- Parameters :
-
hpka – Pointer to hal_pka_handle_t PKA handle.
- Return values :
-
hal_pka_state_t – PKA state
-
uint32_t
HAL_PKA_GetLastErrorCodes
(
const
hal_pka_handle_t
*
hpka
)
¶
-
Retrieve the PKA error code.
- Parameters :
-
hpka – Pointer to hal_pka_handle_t PKA handle.
- Return values :
-
PKA – error code.
-
void
HAL_PKA_SetUserData
(
hal_pka_handle_t
*
hpka
,
const
void
*
p_user_data
)
¶
-
Store the user data into the pka handle.
- Parameters :
-
hpka – Pointer to hal_pka_handle_t PKA handle.
p_user_data – Pointer to the user data.
-
const
void
*
HAL_PKA_GetUserData
(
const
hal_pka_handle_t
*
hpka
)
¶
-
Retrieve the user data from the pka handle.
- Parameters :
-
hpka – Pointer to hal_pka_handle_t PKA handle.
- Return values :
-
Pointer – to the user data.
Note
This section is not available for STM32C542xx.
PKA RAM Mass Erase function ¶
Note
This section is not available for STM32C562xx.
- group PKA_Exported_Functions_Group6
-
This sub-section provides a function called HAL_PKA_RAMMassErase() allowing to erase the content of the PKA RAM.
Functions
-
hal_status_t
HAL_PKA_RAMMassErase
(
hal_pka_handle_t
*
hpka
)
¶
-
Erase the content of PKA RAM.
- Parameters :
-
hpka – Pointer to hal_pka_handle_t PKA handle.
- Return values :
-
HAL_INVALID_PARAM – Invalid parameter.
HAL_OK – The content of PKA RAM is fully and successfully erased.
-
hal_status_t
HAL_PKA_RAMMassErase
(
hal_pka_handle_t
*
hpka
)
¶
Note
This section is not available for STM32C542xx.