Header file containing functions prototypes of PKC HAL library. More...
Go to the source code of this file.
Classes | |
struct | pkc_init_t |
PKC Init Structure definition. More... | |
struct | _pkc_handle |
PKC handle Structure definition. More... | |
struct | _pkc_ecc_point_multi |
PKC ECC Point Multiplication expression input. More... | |
struct | _pkc_rsa_modular_exponent |
PKC RSA Modular Exponentiation expression input. More... | |
struct | _pkc_modular_add |
PKC Modular Addition expression input. More... | |
struct | _pkc_modular_sub |
PKC Modular Subtraction expression input. More... | |
struct | _pkc_modular_shift |
PKC Modular Left Shift expression input. More... | |
struct | _pkc_modular_compare |
PKC Modular Comparison expression input. More... | |
struct | _pkc_montgomery_multi |
PKC Montgomery Modular Multiplication expression input. More... | |
struct | _pkc_montgomery_inversion |
PKC Montgomery Inversion expression input. More... | |
struct | _pkc_big_number_multi |
PKC Big Number Multiplication expression input. More... | |
struct | _pkc_big_number_add |
PKC Big Number Addition expression input. More... | |
struct | _hal_pkc_callback |
HAL_PKC Callback function definition. More... | |
Macros | |
#define | HAL_PKC_ERROR_NONE ((uint32_t)0x00000000) |
No error More... | |
#define | HAL_PKC_ERROR_TIMEOUT ((uint32_t)0x00000001) |
Timeout error More... | |
#define | HAL_PKC_ERROR_TRANSFER ((uint32_t)0x00000002) |
Transfer error More... | |
#define | HAL_PKC_ERROR_OVERFLOW ((uint32_t)0x00000004) |
Result overflow error More... | |
#define | HAL_PKC_ERROR_INVALID_PARAM ((uint32_t)0x00000008) |
Invalid parameters error More... | |
#define | HAL_PKC_ERROR_INVERSE_K ((uint32_t)0x00000010) |
Inverse K error More... | |
#define | HAL_PKC_ERROR_IRREVERSIBLE ((uint32_t)0x00000020) |
Irreversible error More... | |
#define | PKC_SECURE_MODE_DISABLE ((uint32_t)0x00000000) |
Secure mode disable. More... | |
#define | PKC_SECURE_MODE_ENABLE ((uint32_t)0x00000001) |
Secure mode enable More... | |
#define | PKC_OPERATION_MODE_MULTI LL_PKC_operation_mode_MULTIPLY |
Multiplication operation mode More... | |
#define | PKC_OPERATION_MODE_INVER LL_PKC_operation_mode_INVERTION |
Inversion operation mode More... | |
#define | PKC_OPERATION_MODE_ADD LL_PKC_operation_mode_ADD |
Addition operation mode More... | |
#define | PKC_OPERATION_MODE_SUB LL_PKC_operation_mode_SUB |
Subtraction operation mode More... | |
#define | PKC_OPERATION_MODE_CMP LL_PKC_operation_mode_COMPARE |
Comparison operation mode More... | |
#define | PKC_OPERATION_MODE_LSHIFT LL_PKC_operation_mode_LEFTSHIFT |
Left Shift operation mode More... | |
#define | PKC_OPERATION_MODE_BIGMULTI LL_PKC_operation_mode_BIGINTEGERMULTIPLY |
Big Number Multiplication operation mode More... | |
#define | PKC_OPERATION_MODE_BIGADD LL_PKC_operation_mode_BIGINTEGERADD |
Big Number Addition operation mode More... | |
#define | PKC_BITS_LENGTH_MIN LL_PKC_BITS_LENGTH_MIN |
Min value of bits length More... | |
#define | PKC_BITS_LENGTH_MAX LL_PKC_BITS_LENGTH_MAX |
Max value of bits length More... | |
#define | PKC_BIGMULTI_BITS_LENGTH_MAX LL_PKC_BIGMULTI_BITS_LENGTH_MAX |
Max value of big number multiplication bits length. More... | |
#define | PKC_FLAG_BUSY LL_PKC_WORKSTAT_BUSY |
Busy flag. More... | |
#define | PKC_IT_DONE LL_PKC_INTEN_DONE |
Operation Done Interrupt source More... | |
#define | PKC_IT_ERR LL_PKC_INTEN_ERR |
Operation Error Interrupt source More... | |
#define | PKC_IT_OVF LL_PKC_INTEN_BAOVF |
Big Integer Result Overflow Interrupt source. More... | |
#define | HAL_PKC_TIMEOUT_DEFAULT_VALUE ((uint32_t)5000) |
The default value of PKC timeout is 5s. More... | |
#define | __HAL_PKC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->state = HAL_PKC_STATE_RESET) |
Reset PKC handle states. More... | |
#define | __HAL_PKC_RESET(__HANDLE__) |
Reset the specified PKC peripheral. More... | |
#define | __HAL_PKC_ENABLE(__HANDLE__) SET_BITS((__HANDLE__)->p_instance->CTRL, PKC_CTRL_EN) |
Enable the specified PKC peripheral. More... | |
#define | __HAL_PKC_DISABLE(__HANDLE__) CLEAR_BITS((__HANDLE__)->p_instance->CTRL, PKC_CTRL_EN) |
Disable the specified PKC peripheral. More... | |
#define | __HAL_PKC_ENABLE_IT(__HANDLE__, __INTERRUPT__) SET_BITS((__HANDLE__)->p_instance->INTEN, (__INTERRUPT__)) |
Enable the specified PKC interrupts. More... | |
#define | __HAL_PKC_DISABLE_IT(__HANDLE__, __INTERRUPT__) CLEAR_BITS((__HANDLE__)->p_instance->INTEN, (__INTERRUPT__)) |
Disable the specified PKC interrupts. More... | |
#define | __HAL_PKC_GET_FLAG_IT(__HANDLE__, __FLAG__) (READ_BITS((__HANDLE__)->p_instance->INTSTAT, (__FLAG__)) == (__FLAG__)) |
Check whether the specified PKC interrupt flag is set or not. More... | |
#define | __HAL_PKC_CLEAR_FLAG_IT(__HANDLE__, __FLAG__) SET_BITS((__HANDLE__)->p_instance->INTSTAT, (__FLAG__)) |
Clear the specified PKC interrupt flag. More... | |
#define | __HAL_PKC_GET_FLAG(__HANDLE__, __FLAG__) ((READ_BITS((__HANDLE__)->p_instance->WORKSTAT, (__FLAG__)) != 0) ? SET : RESET) |
Check whether the specified PKC flag is set or not. More... | |
#define | IS_PKC_BITS_LENGTH(__BITS__) (((__BITS__) >= PKC_BITS_LENGTH_MIN) && ((__BITS__) <= PKC_BITS_LENGTH_MAX)) |
Check if PKC Bits Length is valid. More... | |
#define | IS_PKC_BIGMULTI_BITS_LENGTH(__BITS__) (((__BITS__) >= PKC_BITS_LENGTH_MIN) && ((__BITS__) <= PKC_BIGMULTI_BITS_LENGTH_MAX)) |
Check if PKC Big Number Multiplication Bits Length is valid. More... | |
#define | IS_PKC_SECURE_MODE(__MODE__) |
Check if PKC Secure Mode is valid. More... | |
#define | IS_PKC_OPERATION_MODE(__MODE__) |
Check if PKC Operation Mode is valid. More... | |
Typedefs | |
typedef struct _ll_ecc_point | ecc_point_t |
PKC ECC Point Structure definition. More... | |
typedef struct _ll_ecc_curve_init | ecc_curve_init_t |
PKC ECC P-256 Elliptic Curve Init Structure definition. More... | |
typedef struct _pkc_handle | pkc_handle_t |
PKC handle Structure definition. More... | |
typedef struct _pkc_ecc_point_multi | pkc_ecc_point_multi_t |
PKC ECC Point Multiplication expression input. More... | |
typedef struct _pkc_rsa_modular_exponent | pkc_rsa_modular_exponent_t |
PKC RSA Modular Exponentiation expression input. More... | |
typedef struct _pkc_modular_add | pkc_modular_add_t |
PKC Modular Addition expression input. More... | |
typedef struct _pkc_modular_sub | pkc_modular_sub_t |
PKC Modular Subtraction expression input. More... | |
typedef struct _pkc_modular_shift | pkc_modular_shift_t |
PKC Modular Left Shift expression input. More... | |
typedef struct _pkc_modular_compare | pkc_modular_compare_t |
PKC Modular Comparison expression input. More... | |
typedef struct _pkc_montgomery_multi | pkc_montgomery_multi_t |
PKC Montgomery Modular Multiplication expression input. More... | |
typedef struct _pkc_montgomery_inversion | pkc_montgomery_inversion_t |
PKC Montgomery Inversion expression input. More... | |
typedef struct _pkc_big_number_multi | pkc_big_number_multi_t |
PKC Big Number Multiplication expression input. More... | |
typedef struct _pkc_big_number_add | pkc_big_number_add_t |
PKC Big Number Addition expression input. More... | |
typedef struct _hal_pkc_callback | hal_pkc_callback_t |
HAL_PKC Callback function definition. More... | |
Enumerations | |
enum | hal_pkc_state_t { HAL_PKC_STATE_RESET = 0x00, HAL_PKC_STATE_READY = 0x01, HAL_PKC_STATE_BUSY = 0x02, HAL_PKC_STATE_ERROR = 0x04, HAL_PKC_STATE_TIMEOUT = 0x08 } |
HAL PKC State Enumerations definition. More... | |
Functions | |
hal_status_t | hal_pkc_init (pkc_handle_t *p_pkc) |
Initialize the PKC according to the specified parameters in the pkc_init_t and initialize the associated handle. More... | |
hal_status_t | hal_pkc_deinit (pkc_handle_t *p_pkc) |
De-initialize the PKC peripheral. More... | |
void | hal_pkc_msp_init (pkc_handle_t *p_pkc) |
Initialize the PKC MSP. More... | |
void | hal_pkc_msp_deinit (pkc_handle_t *p_pkc) |
De-initialize the PKC MSP. More... | |
hal_status_t | hal_pkc_rsa_modular_exponent (pkc_handle_t *p_pkc, pkc_rsa_modular_exponent_t *p_input, uint32_t timeout) |
Execute RSA Modular Exponentiation in blocking mode. More... | |
hal_status_t | hal_pkc_ecc_point_multi (pkc_handle_t *p_pkc, pkc_ecc_point_multi_t *p_input, uint32_t timeout) |
Execute ECC Point Multiplication in blocking mode. More... | |
hal_status_t | hal_pkc_ecc_point_multi_it (pkc_handle_t *p_pkc, pkc_ecc_point_multi_t *p_input) |
Execute ECC Point Multiplication in non-blocking mode with Interrupt. More... | |
hal_status_t | hal_pkc_modular_add (pkc_handle_t *p_pkc, pkc_modular_add_t *p_input, uint32_t timeout) |
Execute Modular Addition in blocking mode. More... | |
hal_status_t | hal_pkc_modular_add_it (pkc_handle_t *p_pkc, pkc_modular_add_t *p_input) |
Execute Modular Addition in non-blocking mode with Interrupt. More... | |
hal_status_t | hal_pkc_modular_sub (pkc_handle_t *p_pkc, pkc_modular_sub_t *p_input, uint32_t timeout) |
Execute Modular Subtraction in blocking mode. More... | |
hal_status_t | hal_pkc_modular_sub_it (pkc_handle_t *p_pkc, pkc_modular_sub_t *p_input) |
Execute Modular Subtraction in non-blocking mode with Interrupt. More... | |
hal_status_t | hal_pkc_modular_left_shift (pkc_handle_t *p_pkc, pkc_modular_shift_t *p_input, uint32_t timeout) |
Execute Modular Left Shift in blocking mode. More... | |
hal_status_t | hal_pkc_modular_left_shift_it (pkc_handle_t *p_pkc, pkc_modular_shift_t *p_input) |
Execute Modular Left Shift in non-blocking mode with Interrupt. More... | |
hal_status_t | hal_pkc_modular_compare (pkc_handle_t *p_pkc, pkc_modular_compare_t *p_input, uint32_t timeout) |
Execute Modular Comparison in blocking mode. More... | |
hal_status_t | hal_pkc_modular_compare_it (pkc_handle_t *p_pkc, pkc_modular_compare_t *p_input) |
Execute Modular Comparison in non-blocking mode with Interrupt. More... | |
hal_status_t | hal_pkc_montgomery_multi (pkc_handle_t *p_pkc, pkc_montgomery_multi_t *p_input, uint32_t timeout) |
Execute Montgomery Modular Multiplication in blocking mode. More... | |
hal_status_t | hal_pkc_montgomery_multi_it (pkc_handle_t *p_pkc, pkc_montgomery_multi_t *p_input) |
Execute Montgomery Modular Multiplication in non-blocking mode with Interrupt. More... | |
hal_status_t | hal_pkc_montgomery_inversion (pkc_handle_t *p_pkc, pkc_montgomery_inversion_t *p_input, uint32_t timeout) |
Execute Montgomery Inversion in blocking mode. More... | |
hal_status_t | hal_pkc_montgomery_inversion_it (pkc_handle_t *p_pkc, pkc_montgomery_inversion_t *p_input) |
Execute Montgomery Inversion in non-blocking mode with Interrupt. More... | |
hal_status_t | hal_pkc_big_number_multi (pkc_handle_t *p_pkc, pkc_big_number_multi_t *p_input, uint32_t timeout) |
Execute Big Number Multiplication in blocking mode. More... | |
hal_status_t | hal_pkc_big_number_multi_it (pkc_handle_t *p_pkc, pkc_big_number_multi_t *p_input) |
Execute Big Number Multiplication in non-blocking mode with Interrupt. More... | |
hal_status_t | hal_pkc_big_number_add (pkc_handle_t *p_pkc, pkc_big_number_add_t *p_input, uint32_t timeout) |
Execute Big Number Addition in blocking mode. More... | |
hal_status_t | hal_pkc_big_number_add_it (pkc_handle_t *p_pkc, pkc_big_number_add_t *p_input) |
Execute Big Number Addition in non-blocking mode with Interrupt. More... | |
void | hal_pkc_irq_handler (pkc_handle_t *p_pkc) |
Handle PKC interrupt request. More... | |
void | hal_pkc_done_callback (pkc_handle_t *p_pkc) |
PKC calculate done callback. More... | |
void | hal_pkc_error_callback (pkc_handle_t *p_pkc) |
PKC error callback. More... | |
void | hal_pkc_overflow_callback (pkc_handle_t *p_pkc) |
PKC over flow callback. More... | |
hal_pkc_state_t | hal_pkc_get_state (pkc_handle_t *p_pkc) |
Return the PKC handle state. More... | |
uint32_t | hal_pkc_get_error (pkc_handle_t *p_pkc) |
Return the PKC error code. More... | |
void | hal_pkc_set_timeout (pkc_handle_t *p_pkc, uint32_t timeout) |
Set the PKC internal process timeout value. More... | |
hal_status_t | hal_pkc_suspend_reg (pkc_handle_t *p_pkc) |
Suspend some registers related to PKC configuration before sleep. More... | |
hal_status_t | hal_pkc_resume_reg (pkc_handle_t *p_pkc) |
Restore some registers related to PKC configuration after sleep. More... | |
Header file containing functions prototypes of PKC HAL library.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of GOODIX nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Definition in file gr55xx_hal_pkc.h.