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) |
#define | HAL_PKC_ERROR_TIMEOUT ((uint32_t)0x00000001) |
#define | HAL_PKC_ERROR_TRANSFER ((uint32_t)0x00000002) |
#define | HAL_PKC_ERROR_OVERFLOW ((uint32_t)0x00000004) |
#define | HAL_PKC_ERROR_INVALID_PARAM ((uint32_t)0x00000008) |
#define | HAL_PKC_ERROR_INVERSE_K ((uint32_t)0x00000010) |
#define | HAL_PKC_ERROR_IRREVERSIBLE ((uint32_t)0x00000020) |
#define | PKC_SECURE_MODE_DISABLE ((uint32_t)0x00000000) |
#define | PKC_SECURE_MODE_ENABLE ((uint32_t)0x00000001) |
#define | PKC_OPERATION_MODE_MULTI LL_PKC_operation_mode_MULTIPLY |
#define | PKC_OPERATION_MODE_INVER LL_PKC_operation_mode_INVERTION |
#define | PKC_OPERATION_MODE_ADD LL_PKC_operation_mode_ADD |
#define | PKC_OPERATION_MODE_SUB LL_PKC_operation_mode_SUB |
#define | PKC_OPERATION_MODE_CMP LL_PKC_operation_mode_COMPARE |
#define | PKC_OPERATION_MODE_LSHIFT LL_PKC_operation_mode_LEFTSHIFT |
#define | PKC_OPERATION_MODE_BIGMULTI LL_PKC_operation_mode_BIGINTEGERMULTIPLY |
#define | PKC_OPERATION_MODE_BIGADD LL_PKC_operation_mode_BIGINTEGERADD |
#define | PKC_BITS_LENGTH_MIN LL_PKC_BITS_LENGTH_MIN |
#define | PKC_BITS_LENGTH_MAX LL_PKC_BITS_LENGTH_MAX |
#define | PKC_BIGMULTI_BITS_LENGTH_MAX LL_PKC_BIGMULTI_BITS_LENGTH_MAX |
#define | PKC_FLAG_BUSY LL_PKC_WORKSTAT_BUSY |
#define | PKC_IT_DONE LL_PKC_INTEN_DONE |
#define | PKC_IT_ERR LL_PKC_INTEN_ERR |
#define | PKC_IT_OVF LL_PKC_INTEN_BAOVF |
#define | HAL_PKC_TIMEOUT_DEFAULT_VALUE ((uint32_t)5000U) |
#define | PKC_SPRAM_BASE_ADDR (PKC_BASE + 0x800UL) |
#define | PKC_SPRAM_SIZE (2048U) |
#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->INT_EN, (__INTERRUPT__)) |
Enable the specified PKC interrupts. More... | |
#define | __HAL_PKC_DISABLE_IT(__HANDLE__, __INTERRUPT__) CLEAR_BITS((__HANDLE__)->p_instance->INT_EN, (__INTERRUPT__)) |
Disable the specified PKC interrupts. More... | |
#define | __HAL_PKC_GET_FLAG_IT(__HANDLE__, __FLAG__) (READ_BITS((__HANDLE__)->p_instance->INT_STAT, (__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->INT_STAT, (__FLAG__)) |
Clear the specified PKC interrupt flag. More... | |
#define | __HAL_PKC_GET_FLAG(__HANDLE__, __FLAG__) ((READ_BITS((__HANDLE__)->p_instance->STAT, (__FLAG__)) != 0U) ? 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... | |
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 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... | |
Header file containing functions prototypes of PKC HAL library.
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 hal_pkc.h.