hal_pkc.h
Go to the documentation of this file.
1 /**
2 ****************************************************************************************
3 *
4 * @file hal_pkc.h
5 * @author BLE Driver Team
6 * @brief Header file containing functions prototypes of PKC HAL library.
7 *
8 ****************************************************************************************
9 * @attention
10 #####Copyright (c) 2019 GOODIX
11 All rights reserved.
12
13 Redistribution and use in source and binary forms, with or without
14 modification, are permitted provided that the following conditions are met:
15 * Redistributions of source code must retain the above copyright
16 notice, this list of conditions and the following disclaimer.
17 * Redistributions in binary form must reproduce the above copyright
18 notice, this list of conditions and the following disclaimer in the
19 documentation and/or other materials provided with the distribution.
20 * Neither the name of GOODIX nor the names of its contributors may be used
21 to endorse or promote products derived from this software without
22 specific prior written permission.
23
24 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
28 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 POSSIBILITY OF SUCH DAMAGE.
35 ****************************************************************************************
36 */
37
38 /** @addtogroup PERIPHERAL Peripheral Driver
39 * @{
40 */
41
42 /** @addtogroup HAL_DRIVER HAL Driver
43 * @{
44 */
45
46 /** @defgroup HAL_PKC PKC
47 * @brief PKC HAL module driver.
48 * @{
49 */
50
51 /* Define to prevent recursive inclusion -------------------------------------*/
52 #ifndef __GR5xx_HAL_PKC_H__
53 #define __GR5xx_HAL_PKC_H__
54
55 #ifdef __cplusplus
56 extern "C" {
57 #endif
58
59 /* Includes ------------------------------------------------------------------*/
60 #include "ll_pkc.h"
61 #include "hal_def.h"
62
63 /* Exported types ------------------------------------------------------------*/
64 /** @addtogroup HAL_PKC_ENUMERATIONS Enumerations
65 * @{
66 */
67
68 /** @defgroup HAL_PKC_state HAL PKC state
69 * @{
70 */
71
72 /**
73 * @brief HAL PKC State Enumerations definition
74 */
75 typedef enum
76 {
77 HAL_PKC_STATE_RESET = 0x00, /**< Peripheral not initialized */
78 HAL_PKC_STATE_READY = 0x01, /**< Peripheral initialized and ready for use */
79 HAL_PKC_STATE_BUSY = 0x02, /**< Peripheral in indirect mode and busy */
80 } hal_pkc_state_t;
81
82 /** @} */
83
84 /** @} */
85
86 /** @addtogroup HAL_PKC_STRUCTURES Structures
87 * @{
88 */
89
90 /** @defgroup PKC_Configuration PKC Configuration
91 * @{
92 */
93
94 /**
95 * @brief PKC ECC Point Structure definition
96 */
97 typedef struct _ll_ecc_point ecc_point_t;
98
99 /**
100 * @brief PKC ECC P-256 Elliptic Curve Init Structure definition
101 */
102 typedef struct _ll_ecc_curve_init ecc_curve_init_t;
103
104 /**
105 * @brief PKC Init Structure definition
106 */
107 typedef struct
108 {
109 ecc_curve_init_t *p_ecc_curve; /**< Specifies the pointer to elliptic curve description */
110 uint32_t data_bits; /**< Specifies the Data size: 256 ~ 2048 bits */
111 uint32_t secure_mode; /**< Specifies the Secure Mode. It indicates that DPA-resistance software algorithm
112 and hardware measures are applied at a cost of about 35%- 50% performance loss.
113 This parameter can be a value of @ref PKC_Secure_Mode. */
114 uint32_t (*random_func)(void); /**< Specifies the function to generate random number. */
115 } pkc_init_t;
116
117 /** @} */
118
119 /** @defgroup PKC_handle PKC handle
120 * @{
121 */
122
123 /**
124 * @brief PKC handle Structure definition
125 */
126 typedef struct _pkc_handle
127 {
128 pkc_regs_t *p_instance; /**< PKC registers base address */
129 pkc_init_t init; /**< PKC operation parameters */
130 void *p_result; /**< Pointer to PKC result buffer */
131 uint32_t shift_count; /**< Count to left shift */
132 uint32_t *p_P; /**< Prime number */
133 __IO hal_pkc_state_t state; /**< PKC operation state */
134 __IO uint32_t error_code; /**< PKC Error code */
135 } pkc_handle_t;
136 /** @} */
137
138 /** @defgroup PKC_Expression_Input PKC expression input
139 * @{
140 */
141
142 /**
143 * @brief PKC ECC Point Multiplication expression input
144 * @note Result = K * Point
145 */
146 typedef struct _pkc_ecc_point_multi
147 {
148 uint32_t *p_K; /**< Pointer to operand K */
149 ecc_point_t *p_ecc_point; /**< Pointer to ECC Point */
150 } pkc_ecc_point_multi_t;
151
152 /**
153 * @brief PKC RSA Modular Exponentiation expression input
154 * @note Result = A^B mod P
155 */
156 typedef struct _pkc_rsa_modular_exponent
157 {
158 uint32_t *p_A; /**< Pointer to operand A */
159 uint32_t *p_B; /**< Pointer to operand B */
160 uint32_t *p_P; /**< Pointer to prime number P */
161 uint32_t *p_P_R2; /**< P_R2 = R^2 mod P, where R = 2^DataBits */
162 uint32_t ConstP; /**< Montgomery multiplication constant of P */
163 } pkc_rsa_modular_exponent_t;
164
165 /**
166 * @brief PKC Modular Addition expression input
167 * @note Result = (A + B) mod P
168 */
169 typedef struct _pkc_modular_add
170 {
171 uint32_t *p_A; /**< Pointer to operand A */
172 uint32_t *p_B; /**< Pointer to operand B */
173 uint32_t *p_P; /**< Pointer to prime number P */
174 } pkc_modular_add_t;
175
176 /**
177 * @brief PKC Modular Subtraction expression input
178 * @note Result = (A - B) mod P
179 */
180 typedef struct _pkc_modular_sub
181 {
182 uint32_t *p_A; /**< Pointer to operand A */
183 uint32_t *p_B; /**< Pointer to operand B */
184 uint32_t *p_P; /**< Pointer to prime number P */
185 } pkc_modular_sub_t;
186
187 /**
188 * @brief PKC Modular Left Shift expression input
189 * @note Result = (A << ShiftBits) mod P
190 */
191 typedef struct _pkc_modular_shift
192 {
193 uint32_t *p_A; /**< Pointer to operand A */
194 uint32_t shift_bits; /**< Pointer to operand A */
195 uint32_t *p_P; /**< Pointer to prime number P */
196 } pkc_modular_shift_t;
197
198 /**
199 * @brief PKC Modular Comparison expression input
200 * @note Result = A mod P
201 */
202 typedef struct _pkc_modular_compare
203 {
204 uint32_t *p_A; /**< Pointer to operand A */
205 uint32_t *p_P; /**< Pointer to prime number P */
206 } pkc_modular_compare_t;
207
208 /**
209 * @brief PKC Montgomery Modular Multiplication expression input
210 * @note Result = A * B * R^(-1) mod P, where R = 2^DataBits
211 */
212 typedef struct _pkc_montgomery_multi
213 {
214 uint32_t *p_A; /**< Pointer to operand A */
215 uint32_t *p_B; /**< Pointer to operand B */
216 uint32_t *p_P; /**< Pointer to prime number P */
217 uint32_t ConstP; /**< Montgomery multiplication constant for P,
218 where constp = (-P[0])^(-1) mod 2^32 */
219 } pkc_montgomery_multi_t;
220
221 /**
222 * @brief PKC Montgomery Inversion expression input
223 * @note Result = A^(-1) * 2^(K) mod P
224 */
225 typedef struct _pkc_montgomery_inversion
226 {
227 uint32_t *p_A; /**< Pointer to operand A */
228 uint32_t *p_P; /**< Pointer to prime number P */
229 uint32_t ConstP; /**< Montgomery multiplication constant for P,
230 where ConstP = (-P[0])^(-1) mod 2^32 */
231 } pkc_montgomery_inversion_t;
232
233 /**
234 * @brief PKC Big Number Multiplication expression input
235 * @note Result = A * B, up to 1024 bits
236 */
237 typedef struct _pkc_big_number_multi
238 {
239 uint32_t *p_A; /**< Pointer to operand A */
240 uint32_t *p_B; /**< Pointer to operand B */
241 } pkc_big_number_multi_t;
242
243 /**
244 * @brief PKC Big Number Addition expression input
245 * @note Result = A + B, up to 2048 bits
246 */
247 typedef struct _pkc_big_number_add
248 {
249 uint32_t *p_A; /**< Pointer to operand A */
250 uint32_t *p_B; /**< Pointer to operand B */
251 } pkc_big_number_add_t;
252
253 /** @} */
254
255 /** @} */
256
257 /** @addtogroup HAL_PKC_CALLBACK_STRUCTURES Callback Structures
258 * @{
259 */
260
261 /** @defgroup HAL_PKC_Callback Callback
262 * @{
263 */
264
265 /**
266 * @brief HAL_PKC Callback function definition
267 */
268
269 typedef struct _hal_pkc_callback
270 {
271 void (*pkc_msp_init)(pkc_handle_t *p_pkc); /**< PKC init MSP callback */
272 void (*pkc_msp_deinit)(pkc_handle_t *p_pkc); /**< PKC de-init MSP callback */
273 void (*pkc_done_callback)(pkc_handle_t *p_pkc); /**< PKC calculate done callback */
274 void (*pkc_error_callback)(pkc_handle_t *p_pkc); /**< PKC error callback */
275 void (*pkc_overflow_callback)(pkc_handle_t *p_pkc); /**< PKC over flow callback */
276 } hal_pkc_callback_t;
277
278 /** @} */
279
280 /** @} */
281
282 /**
283 * @defgroup HAL_PKC_MACRO Defines
284 * @{
285 */
286
287 /* Exported constants --------------------------------------------------------*/
288 /** @defgroup PKC_Exported_Constants PKC Exported Constants
289 * @{
290 */
291
292 /** @defgroup PKC_Error_Code PKC Error Code
293 * @{
294 */
295 #define HAL_PKC_ERROR_NONE ((uint32_t)0x00000000) /**< No error */
296 #define HAL_PKC_ERROR_TIMEOUT ((uint32_t)0x00000001) /**< Timeout error */
297 #define HAL_PKC_ERROR_TRANSFER ((uint32_t)0x00000002) /**< Transfer error */
298 #define HAL_PKC_ERROR_OVERFLOW ((uint32_t)0x00000004) /**< Result overflow error */
299 #define HAL_PKC_ERROR_INVALID_PARAM ((uint32_t)0x00000008) /**< Invalid parameters error */
300 #define HAL_PKC_ERROR_INVERSE_K ((uint32_t)0x00000010) /**< Inverse K error */
301 #define HAL_PKC_ERROR_IRREVERSIBLE ((uint32_t)0x00000020) /**< Irreversible error */
302 /** @} */
303
304 /** @defgroup PKC_Secure_Mode PKC Secure Mode
305 * @{
306 */
307 #define PKC_SECURE_MODE_DISABLE ((uint32_t)0x00000000) /**< Secure mode disable */
308 #define PKC_SECURE_MODE_ENABLE ((uint32_t)0x00000001) /**< Secure mode enable */
309 /** @} */
310
311 /** @defgroup PKC_Operation_Mode PKC Operation Mode
312 * @{
313 */
314 #define PKC_OPERATION_MODE_MULTI LL_PKC_operation_mode_MULTIPLY /**< Multiplication operation mode */
315 #define PKC_OPERATION_MODE_INVER LL_PKC_operation_mode_INVERTION /**< Inversion operation mode */
316 #define PKC_OPERATION_MODE_ADD LL_PKC_operation_mode_ADD /**< Addition operation mode */
317 #define PKC_OPERATION_MODE_SUB LL_PKC_operation_mode_SUB /**< Subtraction operation mode */
318 #define PKC_OPERATION_MODE_CMP LL_PKC_operation_mode_COMPARE /**< Comparison operation mode */
319 #define PKC_OPERATION_MODE_LSHIFT LL_PKC_operation_mode_LEFTSHIFT /**< Left Shift operation mode */
320 #define PKC_OPERATION_MODE_BIGMULTI LL_PKC_operation_mode_BIGINTEGERMULTIPLY /**< Big Number Multiplication operation mode */
321 #define PKC_OPERATION_MODE_BIGADD LL_PKC_operation_mode_BIGINTEGERADD /**< Big Number Addition operation mode */
322 /** @} */
323
324 /** @defgroup PKC_Bits_Length PKC Bits Length
325 * @{
326 */
327 #define PKC_BITS_LENGTH_MIN LL_PKC_BITS_LENGTH_MIN /**< Min value of bits length */
328 #define PKC_BITS_LENGTH_MAX LL_PKC_BITS_LENGTH_MAX /**< Max value of bits length */
329 #define PKC_BIGMULTI_BITS_LENGTH_MAX LL_PKC_BIGMULTI_BITS_LENGTH_MAX /**< Max value of big number multiplication bits length */
330 /** @} */
331
332 /** @defgroup PKC_Flags PKC Flags
333 * @{
334 */
335 #define PKC_FLAG_BUSY LL_PKC_WORKSTAT_BUSY /**< Busy flag */
336 /** @} */
337
338 /** @defgroup PKC_Interrupt_definition PKC Interrupt_definition
339 * @{
340 */
341 #define PKC_IT_DONE LL_PKC_INTEN_DONE /**< Operation Done Interrupt source */
342 #define PKC_IT_ERR LL_PKC_INTEN_ERR /**< Operation Error Interrupt source */
343 #define PKC_IT_OVF LL_PKC_INTEN_BAOVF /**< Big Integer Result Overflow Interrupt source */
344 /** @} */
345
346 /** @defgroup PKC_Timeout_definition PKC Timeout_definition
347 * @{
348 */
349 #define HAL_PKC_TIMEOUT_DEFAULT_VALUE ((uint32_t)5000U) /**< The default value of PKC timeout is 5s */
350 /** @} */
351
352 /** @defgroup PKC_SPRAM_definition PKC SPRAM Definition
353 * @{
354 */
355 #define PKC_SPRAM_BASE_ADDR (PKC_BASE + 0x800UL) /**< PKC SPRAM base address */
356 #define PKC_SPRAM_SIZE (2048U) /**< PKC SPRAM size */
357 /** @} */
358
359 /** @} */
360
361 /* Exported macro ------------------------------------------------------------*/
362 /** @defgroup PKC_Exported_Macros PKC Exported Macros
363 * @{
364 */
365
366 /** @brief Reset the specified PKC peripheral.
367 * @param __HANDLE__ PKC handle.
368 * @retval None
369 */
370
371 #define __HAL_PKC_RESET(__HANDLE__) CLEAR_BITS((__HANDLE__)->p_instance->CTRL, PKC_CTRL_RST); \
372 SET_BITS((__HANDLE__)->p_instance->CTRL, PKC_CTRL_RST)
373
374 /** @brief Enable the specified PKC peripheral.
375 * @param __HANDLE__ Specifies the PKC Handle.
376 * @retval None
377 */
378 #define __HAL_PKC_ENABLE(__HANDLE__) SET_BITS((__HANDLE__)->p_instance->CTRL, PKC_CTRL_EN)
379
380 /** @brief Disable the specified PKC peripheral.
381 * @param __HANDLE__ Specifies the PKC Handle.
382 * @retval None
383 */
384 #define __HAL_PKC_DISABLE(__HANDLE__) CLEAR_BITS((__HANDLE__)->p_instance->CTRL, PKC_CTRL_EN)
385
386 /** @brief Enable the specified PKC interrupts.
387 * @param __HANDLE__ Specifies the PKC Handle.
388 * @param __INTERRUPT__ Specifies the interrupt source to enable.
389 * This parameter can be one of the following values:
390 * @arg @ref PKC_IT_DONE Operation Done Interrupt source
391 * @arg @ref PKC_IT_ERR Operation Error Interrupt source
392 * @arg @ref PKC_IT_OVF Big Integer Result Overflow Interrupt source
393 * @retval None
394 */
395
396 #define __HAL_PKC_ENABLE_IT(__HANDLE__, __INTERRUPT__) SET_BITS((__HANDLE__)->p_instance->INT_EN, (__INTERRUPT__))
397
398 /** @brief Disable the specified PKC interrupts.
399 * @param __HANDLE__ Specifies the PKC Handle.
400 * @param __INTERRUPT__ Specifies the interrupt source to disable.
401 * This parameter can be one of the following values:
402 * @arg @ref PKC_IT_DONE Operation Done Interrupt source
403 * @arg @ref PKC_IT_ERR Operation Error Interrupt source
404 * @arg @ref PKC_IT_OVF Big Integer Result Overflow Interrupt source
405 * @retval None
406 */
407
408 #define __HAL_PKC_DISABLE_IT(__HANDLE__, __INTERRUPT__) CLEAR_BITS((__HANDLE__)->p_instance->INT_EN, (__INTERRUPT__))
409
410 /** @brief Check whether the specified PKC interrupt flag is set or not.
411 * @param __HANDLE__ Specifies the PKC Handle.
412 * @param __FLAG__ Specifies the interrupt flag to check.
413 * This parameter can be one of the following values:
414 * @arg @ref PKC_IT_DONE Operation Done Interrupt source
415 * @arg @ref PKC_IT_ERR Operation Error Interrupt source
416 * @arg @ref PKC_IT_OVF Big Integer Result Overflow Interrupt source
417 * @retval The new state of __FLAG__ (TRUE or FALSE).
418 */
419
420 #define __HAL_PKC_GET_FLAG_IT(__HANDLE__, __FLAG__) (READ_BITS((__HANDLE__)->p_instance->INT_STAT, (__FLAG__)) == (__FLAG__))
421
422 /** @brief Clear the specified PKC interrupt flag.
423 * @param __HANDLE__ Specifies the PKC Handle.
424 * @param __FLAG__ Specifies the interrupt flag to clear.
425 * This parameter can be one of the following values:
426 * @arg @ref PKC_IT_DONE Operation Done Interrupt source
427 * @arg @ref PKC_IT_ERR Operation Error Interrupt source
428 * @arg @ref PKC_IT_OVF Big Integer Result Overflow Interrupt source
429 * @retval None
430 */
431
432 #define __HAL_PKC_CLEAR_FLAG_IT(__HANDLE__, __FLAG__) SET_BITS((__HANDLE__)->p_instance->INT_STAT, (__FLAG__))
433
434 /** @brief Check whether the specified PKC flag is set or not.
435 * @param __HANDLE__ Specifies the PKC Handle.
436 * @param __FLAG__ Specifies the flag to check.
437 * This parameter can be one of the following values:
438 * @arg @ref PKC_FLAG_BUSY Busy flag
439 * @retval The new state of __FLAG__ (TRUE or FALSE).
440 */
441
442 #define __HAL_PKC_GET_FLAG(__HANDLE__, __FLAG__) ((READ_BITS((__HANDLE__)->p_instance->STAT, (__FLAG__)) != 0U) ? SET : RESET)
443
444 /** @} */
445
446 /* Private macros ------------------------------------------------------------*/
447 /** @defgroup PKC_Private_Macro PKC Private Macros
448 * @{
449 */
450
451 /** @brief Check if PKC Bits Length is valid.
452 * @param __BITS__ PKC Bits Length.
453 * @retval SET (__BITS__ is valid) or RESET (__BITS__ is invalid)
454 */
455 #define IS_PKC_BITS_LENGTH(__BITS__) (((__BITS__) >= PKC_BITS_LENGTH_MIN) && ((__BITS__) <= PKC_BITS_LENGTH_MAX))
456
457 /** @brief Check if PKC Big Number Multiplication Bits Length is valid.
458 * @param __BITS__ PKC Big Number Multiplication Bits Length.
459 * @retval SET (__BITS__ is valid) or RESET (__BITS__ is invalid)
460 */
461 #define IS_PKC_BIGMULTI_BITS_LENGTH(__BITS__) (((__BITS__) >= PKC_BITS_LENGTH_MIN) && ((__BITS__) <= PKC_BIGMULTI_BITS_LENGTH_MAX))
462
463 /** @brief Check if PKC Secure Mode is valid.
464 * @param __MODE__ PKC Secure Mode.
465 * @retval SET (__MODE__ is valid) or RESET (__MODE__ is invalid)
466 */
467 #define IS_PKC_SECURE_MODE(__MODE__) (((__MODE__) == PKC_SECURE_MODE_DISABLE) || \
468 ((__MODE__) == PKC_SECURE_MODE_ENABLE))
469
470 /** @} */
471
472 /** @} */
473
474
475
476 /* Exported functions --------------------------------------------------------*/
477 /** @addtogroup HAL_PKC_DRIVER_FUNCTIONS Functions
478 * @{
479 */
480
481 /** @defgroup PKC_Exported_Functions_Group1 Initialization and de-initialization functions
482 * @brief Initialization and de-initialization functions
483 *
484 @verbatim
485 ===============================================================================
486 ##### Initialization and de-initialization functions #####
487 ===============================================================================
488 [..] This subsection provides a set of functions allowing to initialize and
489 de-initialize the PKC peripheral:
490
491 (+) User must implement hal_pkc_msp_init() function in which it configures
492 all related peripherals resources (IT and NVIC ).
493
494 (+) Call the function hal_pkc_init() to configure the selected device with
495 the selected configuration:
496 (++) pECC_Curve
497 (++) DataBits
498 (++) SecureMode
499 (++) pRandomFunc
500
501 (+) Call the function hal_pkc_deinit() to restore the default configuration
502 of the selected PKC peripheral.
503
504 @endverbatim
505 * @{
506 */
507
508 /**
509 ****************************************************************************************
510 * @brief Initialize the PKC according to the specified parameters
511 * in the pkc_init_t and initialize the associated handle.
512 * @param[in] p_pkc: Pointer to a PKC handle which contains the configuration
513 * information for the specified PKC module.
514 * @retval ::HAL_OK: Operation is OK.
515 * @retval ::HAL_ERROR: Parameter error or operation not supported.
516 * @retval ::HAL_BUSY: Driver is busy.
517 * @retval ::HAL_TIMEOUT: Timeout occurred.
518 ****************************************************************************************
519 */
520 hal_status_t hal_pkc_init(pkc_handle_t *p_pkc);
521
522 /**
523 ****************************************************************************************
524 * @brief De-initialize the PKC peripheral.
525 * @param[in] p_pkc: Pointer to a PKC handle which contains the configuration
526 * information for the specified PKC module.
527 * @retval ::HAL_OK: Operation is OK.
528 * @retval ::HAL_ERROR: Parameter error or operation not supported.
529 * @retval ::HAL_BUSY: Driver is busy.
530 * @retval ::HAL_TIMEOUT: Timeout occurred.
531 ****************************************************************************************
532 */
533 hal_status_t hal_pkc_deinit(pkc_handle_t *p_pkc);
534
535 /**
536 ****************************************************************************************
537 * @brief Initialize the PKC MSP.
538 * @note This function should not be modified. When the callback is needed,
539 the hal_pkc_msp_deinit can be implemented in the user file.
540 * @param[in] p_pkc: Pointer to a PKC handle which contains the configuration
541 * information for the specified PKC module.
542 ****************************************************************************************
543 */
544 void hal_pkc_msp_init(pkc_handle_t *p_pkc);
545
546 /**
547 ****************************************************************************************
548 * @brief De-initialize the PKC MSP.
549 * @note This function should not be modified. When the callback is needed,
550 the hal_pkc_msp_deinit can be implemented in the user file.
551 * @param[in] p_pkc: Pointer to a PKC handle which contains the configuration
552 * information for the specified PKC module.
553 ****************************************************************************************
554 */
555 void hal_pkc_msp_deinit(pkc_handle_t *p_pkc);
556
557 /** @} */
558
559 /** @defgroup PKC_Exported_Functions_Group2 IO Operation Functions
560 * @brief Data transfers functions
561 *
562 @verbatim
563 ==============================================================================
564 ##### IO operation functions #####
565 ===============================================================================
566 [..]
567 This subsection provides a set of functions allowing to manage the PKC
568 data transfers.
569
570 (#) There are two modes of transfer:
571 (++) Blocking mode: The communication is performed in polling mode.
572 The HAL status of all data processing is returned by the same function
573 after finishing transfer.
574 (++) No-Blocking mode: The communication is performed using Interrupts
575 , These APIs return the HAL status.
576 The end of the data processing will be indicated through the
577 dedicated PKC IRQ when using Interrupt mode.
578 The hal_pkc_done_callback() user callbacks will be executed respectively at the end of the calculate process
579 The hal_pkc_error_callback() user callback will be executed when a communication error is detected
580
581 @endverbatim
582 * @{
583 */
584
585 /**
586 ****************************************************************************************
587 * @brief Execute RSA Modular Exponentiation in blocking mode.
588 * @note The computed result will be stored in the buffter pointed by p_pkc->pResult.
589 * @param[in] p_pkc: Pointer to a PKC handle which contains the configuration
590 * information for the specified PKC module.
591 * @param[in] p_input: Pointer to an expression structure which contains the input computing parameters.
592 * @param[in] timeout: Timeout duration
593 * @retval ::HAL_OK: Operation is OK.
594 * @retval ::HAL_ERROR: Parameter error or operation not supported.
595 * @retval ::HAL_BUSY: Driver is busy.
596 * @retval ::HAL_TIMEOUT: Timeout occurred.
597 ****************************************************************************************
598 */
599 hal_status_t hal_pkc_rsa_modular_exponent(pkc_handle_t *p_pkc, pkc_rsa_modular_exponent_t *p_input, uint32_t timeout);
600
601 /**
602 ****************************************************************************************
603 * @brief Execute ECC Point Multiplication in blocking mode.
604 * @note The computed result will be stored in the buffter pointed by p_pkc->pResult.
605 * @param[in] p_pkc: Pointer to a PKC handle which contains the configuration
606 * information for the specified PKC module.
607 * @param[in] p_input: Pointer to an expression structure which contains the input computing parameters.
608 * @param[in] timeout: Timeout duration
609 * @retval ::HAL_OK: Operation is OK.
610 * @retval ::HAL_ERROR: Parameter error or operation not supported.
611 * @retval ::HAL_BUSY: Driver is busy.
612 * @retval ::HAL_TIMEOUT: Timeout occurred.
613 ****************************************************************************************
614 */
615 hal_status_t hal_pkc_ecc_point_multi(pkc_handle_t *p_pkc, pkc_ecc_point_multi_t *p_input, uint32_t timeout);
616
617 /**
618 ****************************************************************************************
619 * @brief Execute ECC Point Multiplication in non-blocking mode with Interrupt.
620 * @note The computed result will be stored in the buffter pointed by p_pkc->pResult.
621 * @param[in] p_pkc: Pointer to a PKC handle which contains the configuration
622 * information for the specified PKC module.
623 * @param[in] p_input: Pointer to an expression structure which contains the input computing parameters.
624 * @retval ::HAL_OK: Operation is OK.
625 * @retval ::HAL_ERROR: Parameter error or operation not supported.
626 * @retval ::HAL_BUSY: Driver is busy.
627 * @retval ::HAL_TIMEOUT: Timeout occurred.
628 ****************************************************************************************
629 */
630 hal_status_t hal_pkc_ecc_point_multi_it(pkc_handle_t *p_pkc, pkc_ecc_point_multi_t *p_input);
631
632 /**
633 ****************************************************************************************
634 * @brief Execute Modular Addition in blocking mode.
635 * @note The computed result will be stored in the buffter pointed by p_pkc->pResult.
636 * @param[in] p_pkc: Pointer to a PKC handle which contains the configuration
637 * information for the specified PKC module.
638 * @param[in] p_input: Pointer to an expression structure which contains the input computing parameters.
639 * @param[in] timeout: Timeout duration
640 * @retval ::HAL_OK: Operation is OK.
641 * @retval ::HAL_ERROR: Parameter error or operation not supported.
642 * @retval ::HAL_BUSY: Driver is busy.
643 * @retval ::HAL_TIMEOUT: Timeout occurred.
644 ****************************************************************************************
645 */
646 hal_status_t hal_pkc_modular_add(pkc_handle_t *p_pkc, pkc_modular_add_t *p_input, uint32_t timeout);
647
648 /**
649 ****************************************************************************************
650 * @brief Execute Modular Addition in non-blocking mode with Interrupt.
651 * @note The computed result will be stored in the buffter pointed by p_pkc->pResult.
652 * @param[in] p_pkc: Pointer to a PKC handle which contains the configuration
653 * information for the specified PKC module.
654 * @param[in] p_input: Pointer to an expression structure which contains the input computing parameters.
655 * @retval ::HAL_OK: Operation is OK.
656 * @retval ::HAL_ERROR: Parameter error or operation not supported.
657 * @retval ::HAL_BUSY: Driver is busy.
658 * @retval ::HAL_TIMEOUT: Timeout occurred.
659 ****************************************************************************************
660 */
661 hal_status_t hal_pkc_modular_add_it(pkc_handle_t *p_pkc, pkc_modular_add_t *p_input);
662
663 /**
664 ****************************************************************************************
665 * @brief Execute Modular Subtraction in blocking mode.
666 * @note The computed result will be stored in the buffter pointed by p_pkc->pResult.
667 * @param[in] p_pkc: Pointer to a PKC handle which contains the configuration
668 * information for the specified PKC module.
669 * @param[in] p_input: Pointer to an expression structure which contains the input computing parameters.
670 * @param[in] timeout: Timeout duration
671 * @retval ::HAL_OK: Operation is OK.
672 * @retval ::HAL_ERROR: Parameter error or operation not supported.
673 * @retval ::HAL_BUSY: Driver is busy.
674 * @retval ::HAL_TIMEOUT: Timeout occurred.
675 ****************************************************************************************
676 */
677 hal_status_t hal_pkc_modular_sub(pkc_handle_t *p_pkc, pkc_modular_sub_t *p_input, uint32_t timeout);
678
679 /**
680 ****************************************************************************************
681 * @brief Execute Modular Subtraction in non-blocking mode with Interrupt.
682 * @note The computed result will be stored in the buffter pointed by p_pkc->pResult.
683 * @param[in] p_pkc: Pointer to a PKC handle which contains the configuration
684 * information for the specified PKC module.
685 * @param[in] p_input: Pointer to an expression structure which contains the input computing parameters.
686 * @retval ::HAL_OK: Operation is OK.
687 * @retval ::HAL_ERROR: Parameter error or operation not supported.
688 * @retval ::HAL_BUSY: Driver is busy.
689 * @retval ::HAL_TIMEOUT: Timeout occurred.
690 ****************************************************************************************
691 */
692 hal_status_t hal_pkc_modular_sub_it(pkc_handle_t *p_pkc, pkc_modular_sub_t *p_input);
693
694 /**
695 ****************************************************************************************
696 * @brief Execute Modular Left Shift in blocking mode.
697 * @note The computed result will be stored in the buffter pointed by p_pkc->pResult.
698 * @param[in] p_pkc: Pointer to a PKC handle which contains the configuration
699 * information for the specified PKC module.
700 * @param[in] p_input: Pointer to an expression structure which contains the input computing parameters.
701 * @param[in] timeout: Timeout duration
702 * @retval ::HAL_OK: Operation is OK.
703 * @retval ::HAL_ERROR: Parameter error or operation not supported.
704 * @retval ::HAL_BUSY: Driver is busy.
705 * @retval ::HAL_TIMEOUT: Timeout occurred.
706 ****************************************************************************************
707 */
708 hal_status_t hal_pkc_modular_left_shift(pkc_handle_t *p_pkc, pkc_modular_shift_t *p_input, uint32_t timeout);
709
710 /**
711 ****************************************************************************************
712 * @brief Execute Modular Left Shift in non-blocking mode with Interrupt.
713 * @note The computed result will be stored in the buffter pointed by p_pkc->pResult.
714 * @param[in] p_pkc: Pointer to a PKC handle which contains the configuration
715 * information for the specified PKC module.
716 * @param[in] p_input: Pointer to an expression structure which contains the input computing parameters.
717 * @retval ::HAL_OK: Operation is OK.
718 * @retval ::HAL_ERROR: Parameter error or operation not supported.
719 * @retval ::HAL_BUSY: Driver is busy.
720 * @retval ::HAL_TIMEOUT: Timeout occurred.
721 ****************************************************************************************
722 */
723 hal_status_t hal_pkc_modular_left_shift_it(pkc_handle_t *p_pkc, pkc_modular_shift_t *p_input);
724
725 /**
726 ****************************************************************************************
727 * @brief Execute Modular Comparison in blocking mode.
728 * @note The computed result will be stored in the buffter pointed by p_pkc->pResult.
729 * @param[in] p_pkc: Pointer to a PKC handle which contains the configuration
730 * information for the specified PKC module.
731 * @param[in] p_input: Pointer to an expression structure which contains the input computing parameters.
732 * @param[in] timeout: Timeout duration
733 * @retval ::HAL_OK: Operation is OK.
734 * @retval ::HAL_ERROR: Parameter error or operation not supported.
735 * @retval ::HAL_BUSY: Driver is busy.
736 * @retval ::HAL_TIMEOUT: Timeout occurred.
737 ****************************************************************************************
738 */
739 hal_status_t hal_pkc_modular_compare(pkc_handle_t *p_pkc, pkc_modular_compare_t *p_input, uint32_t timeout);
740
741 /**
742 ****************************************************************************************
743 * @brief Execute Modular Comparison in non-blocking mode with Interrupt.
744 * @note The computed result will be stored in the buffter pointed by p_pkc->pResult.
745 * @param[in] p_pkc: Pointer to a PKC handle which contains the configuration
746 * information for the specified PKC module.
747 * @param[in] p_input: Pointer to an expression structure which contains the input computing parameters.
748 * @retval ::HAL_OK: Operation is OK.
749 * @retval ::HAL_ERROR: Parameter error or operation not supported.
750 * @retval ::HAL_BUSY: Driver is busy.
751 * @retval ::HAL_TIMEOUT: Timeout occurred.
752 ****************************************************************************************
753 */
754 hal_status_t hal_pkc_modular_compare_it(pkc_handle_t *p_pkc, pkc_modular_compare_t *p_input);
755
756 /**
757 ****************************************************************************************
758 * @brief Execute Montgomery Modular Multiplication in blocking mode.
759 * @note The computed result will be stored in the buffter pointed by p_pkc->pResult.
760 * @param[in] p_pkc: Pointer to a PKC handle which contains the configuration
761 * information for the specified PKC module.
762 * @param[in] p_input: Pointer to an expression structure which contains the input computing parameters.
763 * @param[in] timeout: Timeout duration
764 * @retval ::HAL_OK: Operation is OK.
765 * @retval ::HAL_ERROR: Parameter error or operation not supported.
766 * @retval ::HAL_BUSY: Driver is busy.
767 * @retval ::HAL_TIMEOUT: Timeout occurred.
768 ****************************************************************************************
769 */
770 hal_status_t hal_pkc_montgomery_multi(pkc_handle_t *p_pkc, pkc_montgomery_multi_t *p_input, uint32_t timeout);
771
772 /**
773 ****************************************************************************************
774 * @brief Execute Montgomery Modular Multiplication in non-blocking mode with Interrupt.
775 * @note The computed result will be stored in the buffter pointed by p_pkc->pResult.
776 * @param[in] p_pkc: Pointer to a PKC handle which contains the configuration
777 * information for the specified PKC module.
778 * @param[in] p_input: Pointer to an expression structure which contains the input computing parameters.
779 * @retval ::HAL_OK: Operation is OK.
780 * @retval ::HAL_ERROR: Parameter error or operation not supported.
781 * @retval ::HAL_BUSY: Driver is busy.
782 * @retval ::HAL_TIMEOUT: Timeout occurred.
783 ****************************************************************************************
784 */
785 hal_status_t hal_pkc_montgomery_multi_it(pkc_handle_t *p_pkc, pkc_montgomery_multi_t *p_input);
786
787 /**
788 ****************************************************************************************
789 * @brief Execute Montgomery Inversion in blocking mode.
790 * @note The computed result will be stored in the buffter pointed by p_pkc->pResult.
791 * @param[in] p_pkc: Pointer to a PKC handle which contains the configuration
792 * information for the specified PKC module.
793 * @param[in] p_input: Pointer to an expression structure which contains the input computing parameters.
794 * @param[in] timeout: Timeout duration
795 * @retval ::HAL_OK: Operation is OK.
796 * @retval ::HAL_ERROR: Parameter error or operation not supported.
797 * @retval ::HAL_BUSY: Driver is busy.
798 * @retval ::HAL_TIMEOUT: Timeout occurred.
799 ****************************************************************************************
800 */
801 hal_status_t hal_pkc_montgomery_inversion(pkc_handle_t *p_pkc, pkc_montgomery_inversion_t *p_input, uint32_t timeout);
802
803 /**
804 ****************************************************************************************
805 * @brief Execute Montgomery Inversion in non-blocking mode with Interrupt.
806 * @note The computed result will be stored in the buffter pointed by p_pkc->pResult.
807 * @param[in] p_pkc: Pointer to a PKC handle which contains the configuration
808 * information for the specified PKC module.
809 * @param[in] p_input: Pointer to an expression structure which contains the input computing parameters.
810 * @retval ::HAL_OK: Operation is OK.
811 * @retval ::HAL_ERROR: Parameter error or operation not supported.
812 * @retval ::HAL_BUSY: Driver is busy.
813 * @retval ::HAL_TIMEOUT: Timeout occurred.
814 ****************************************************************************************
815 */
816 hal_status_t hal_pkc_montgomery_inversion_it(pkc_handle_t *p_pkc, pkc_montgomery_inversion_t *p_input);
817
818 /**
819 ****************************************************************************************
820 * @brief Execute Big Number Multiplication in blocking mode.
821 * @note The computed result will be stored in the buffter pointed by p_pkc->pResult.
822 * @param[in] p_pkc: Pointer to a PKC handle which contains the configuration
823 * information for the specified PKC module.
824 * @param[in] p_input: Pointer to an expression structure which contains the input computing parameters.
825 * @param[in] timeout: Timeout duration
826 * @retval ::HAL_OK: Operation is OK.
827 * @retval ::HAL_ERROR: Parameter error or operation not supported.
828 * @retval ::HAL_BUSY: Driver is busy.
829 * @retval ::HAL_TIMEOUT: Timeout occurred.
830 ****************************************************************************************
831 */
832 hal_status_t hal_pkc_big_number_multi(pkc_handle_t *p_pkc, pkc_big_number_multi_t *p_input, uint32_t timeout);
833
834 /**
835 ****************************************************************************************
836 * @brief Execute Big Number Multiplication in non-blocking mode with Interrupt.
837 * @note The computed result will be stored in the buffter pointed by p_pkc->pResult.
838 * @param[in] p_pkc: Pointer to a PKC handle which contains the configuration
839 * information for the specified PKC module.
840 * @param[in] p_input: Pointer to an expression structure which contains the input computing parameters.
841 * @retval ::HAL_OK: Operation is OK.
842 * @retval ::HAL_ERROR: Parameter error or operation not supported.
843 * @retval ::HAL_BUSY: Driver is busy.
844 * @retval ::HAL_TIMEOUT: Timeout occurred.
845 ****************************************************************************************
846 */
847 hal_status_t hal_pkc_big_number_multi_it(pkc_handle_t *p_pkc, pkc_big_number_multi_t *p_input);
848
849 /**
850 ****************************************************************************************
851 * @brief Execute Big Number Addition in blocking mode.
852 * @note The computed result will be stored in the buffter pointed by p_pkc->pResult.
853 * @param[in] p_pkc: Pointer to a PKC handle which contains the configuration
854 * information for the specified PKC module.
855 * @param[in] p_input: Pointer to an expression structure which contains the input computing parameters.
856 * @param[in] timeout: Timeout duration
857 * @retval ::HAL_OK: Operation is OK.
858 * @retval ::HAL_ERROR: Parameter error or operation not supported.
859 * @retval ::HAL_BUSY: Driver is busy.
860 * @retval ::HAL_TIMEOUT: Timeout occurred.
861 ****************************************************************************************
862 */
863 hal_status_t hal_pkc_big_number_add(pkc_handle_t *p_pkc, pkc_big_number_add_t *p_input, uint32_t timeout);
864
865 /**
866 ****************************************************************************************
867 * @brief Execute Big Number Addition in non-blocking mode with Interrupt.
868 * @note The computed result will be stored in the buffter pointed by p_pkc->pResult.
869 * @param[in] p_pkc: Pointer to a PKC handle which contains the configuration
870 * information for the specified PKC module.
871 * @param[in] p_input: Pointer to an expression structure which contains the input computing parameters.
872 * @retval ::HAL_OK: Operation is OK.
873 * @retval ::HAL_ERROR: Parameter error or operation not supported.
874 * @retval ::HAL_BUSY: Driver is busy.
875 * @retval ::HAL_TIMEOUT: Timeout occurred.
876 ****************************************************************************************
877 */
878 hal_status_t hal_pkc_big_number_add_it(pkc_handle_t *p_pkc, pkc_big_number_add_t *p_input);
879
880 /** @} */
881
882 /** @addtogroup PKC_IRQ_Handler_and_Callbacks IRQ Handler and Callbacks
883 * @brief IRQ Handler and Callbacks functions
884 * @{
885 */
886
887 /**
888 ****************************************************************************************
889 * @brief Handle PKC interrupt request.
890 * @param[in] p_pkc: Pointer to a PKC handle which contains the configuration
891 * information for the specified PKC module.
892 ****************************************************************************************
893 */
894 void hal_pkc_irq_handler(pkc_handle_t *p_pkc);
895
896 /**
897 ****************************************************************************************
898 * @brief PKC calculate done callback.
899 * @param[in] p_pkc: Pointer to a PKC handle which contains the configuration
900 * information for the specified PKC module.
901 ****************************************************************************************
902 */
903 void hal_pkc_done_callback(pkc_handle_t *p_pkc);
904
905 /**
906 ****************************************************************************************
907 * @brief PKC error callback.
908 * @param[in] p_pkc: Pointer to a PKC handle which contains the configuration
909 * information for the specified PKC module.
910 ****************************************************************************************
911 */
912 void hal_pkc_error_callback(pkc_handle_t *p_pkc);
913
914 /**
915 ****************************************************************************************
916 * @brief PKC over flow callback.
917 * @param[in] p_pkc: Pointer to a PKC handle which contains the configuration
918 * information for the specified PKC module.
919 ****************************************************************************************
920 */
921 void hal_pkc_overflow_callback(pkc_handle_t *p_pkc);
922
923 /** @} */
924
925 /** @addtogroup PKC_Exported_Functions_Group3 Peripheral Control and State functions
926 * @brief PKC Peripheral State functions
927 *
928 @verbatim
929 ==============================================================================
930 ##### Peripheral Control and State functions #####
931 ==============================================================================
932 [..]
933 This subsection provides functions allowing to :
934 (+) Return the PKC handle state.
935 (+) Return the PKC handle error code.
936 (+) Set the timeout during internal process.
937
938 @endverbatim
939 * @{
940 */
941
942 /**
943 ****************************************************************************************
944 * @brief Return the PKC handle state.
945 * @param[in] p_pkc: Pointer to a pkc_handle_t structure that contains
946 * the configuration information for the specified PKC.
947 * @retval ::HAL_PKC_STATE_RESET: Peripheral not initialized.
948 * @retval ::HAL_PKC_STATE_READY: Peripheral initialized and ready for use.
949 * @retval ::HAL_PKC_STATE_BUSY: Peripheral in indirect mode and busy.
950 * @retval ::HAL_PKC_STATE_ERROR: Peripheral in error.
951 * @retval ::HAL_PKC_STATE_TIMEOUT: Peripheral in timeout.
952 ****************************************************************************************
953 */
954 hal_pkc_state_t hal_pkc_get_state(pkc_handle_t *p_pkc);
955
956 /**
957 ****************************************************************************************
958 * @brief Return the PKC error code.
959 * @param[in] p_pkc: Pointer to a PKC handle which contains the configuration
960 * information for the specified PKC module.
961 * @return PKC error code in bitmap format
962 ****************************************************************************************
963 */
964 uint32_t hal_pkc_get_error(pkc_handle_t *p_pkc);
965
966 /** @} */
967
968 /** @} */
969
970 #ifdef __cplusplus
971 }
972 #endif
973
974 #endif /* __GR5xx_HAL_PKC_H__ */
975
976 /** @} */
977
978 /** @} */
979
980 /** @} */
hal_pkc_rsa_modular_exponent
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.
hal_pkc_montgomery_multi
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.
_pkc_modular_sub::p_B
uint32_t * p_B
Definition: hal_pkc.h:183
_pkc_modular_add::p_B
uint32_t * p_B
Definition: hal_pkc.h:172
_pkc_big_number_add::p_A
uint32_t * p_A
Definition: hal_pkc.h:249
_pkc_handle::p_instance
pkc_regs_t * p_instance
Definition: hal_pkc.h:128
_pkc_montgomery_multi::ConstP
uint32_t ConstP
Definition: hal_pkc.h:217
_pkc_handle::shift_count
uint32_t shift_count
Definition: hal_pkc.h:131
HAL_PKC_STATE_RESET
@ HAL_PKC_STATE_RESET
Definition: hal_pkc.h:77
_pkc_montgomery_multi
PKC Montgomery Modular Multiplication expression input.
Definition: hal_pkc.h:213
hal_pkc_modular_sub
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.
_pkc_modular_shift::shift_bits
uint32_t shift_bits
Definition: hal_pkc.h:194
_pkc_ecc_point_multi::p_ecc_point
ecc_point_t * p_ecc_point
Definition: hal_pkc.h:149
_pkc_modular_sub::p_P
uint32_t * p_P
Definition: hal_pkc.h:184
_pkc_montgomery_multi::p_A
uint32_t * p_A
Definition: hal_pkc.h:214
_pkc_montgomery_inversion
PKC Montgomery Inversion expression input.
Definition: hal_pkc.h:226
_pkc_big_number_add::p_B
uint32_t * p_B
Definition: hal_pkc.h:250
hal_pkc_montgomery_inversion
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.
_pkc_modular_shift
PKC Modular Left Shift expression input.
Definition: hal_pkc.h:192
hal_pkc_modular_compare
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.
pkc_montgomery_inversion_t
struct _pkc_montgomery_inversion pkc_montgomery_inversion_t
PKC Montgomery Inversion expression input.
_pkc_montgomery_inversion::p_P
uint32_t * p_P
Definition: hal_pkc.h:228
hal_pkc_ecc_point_multi
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.
_pkc_handle::state
__IO hal_pkc_state_t state
Definition: hal_pkc.h:133
_hal_pkc_callback::pkc_error_callback
void(* pkc_error_callback)(pkc_handle_t *p_pkc)
Definition: hal_pkc.h:274
HAL_PKC_STATE_READY
@ HAL_PKC_STATE_READY
Definition: hal_pkc.h:78
_pkc_modular_compare
PKC Modular Comparison expression input.
Definition: hal_pkc.h:203
_pkc_handle::error_code
__IO uint32_t error_code
Definition: hal_pkc.h:134
_pkc_modular_add::p_A
uint32_t * p_A
Definition: hal_pkc.h:171
pkc_init_t::p_ecc_curve
ecc_curve_init_t * p_ecc_curve
Definition: hal_pkc.h:109
_pkc_modular_shift::p_P
uint32_t * p_P
Definition: hal_pkc.h:195
ll_pkc.h
Header file containing functions prototypes of PKC LL library.
hal_pkc_modular_left_shift_it
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.
_pkc_handle
PKC handle Structure definition.
Definition: hal_pkc.h:127
_pkc_big_number_add
PKC Big Number Addition expression input.
Definition: hal_pkc.h:248
hal_pkc_init
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 associa...
hal_pkc_get_state
hal_pkc_state_t hal_pkc_get_state(pkc_handle_t *p_pkc)
Return the PKC handle state.
_pkc_montgomery_multi::p_B
uint32_t * p_B
Definition: hal_pkc.h:215
_ll_ecc_curve_init
LL PKC ECC P-256 Elliptic Curve Init Structure definition.
Definition: ll_pkc.h:103
_pkc_handle::p_P
uint32_t * p_P
Definition: hal_pkc.h:132
pkc_modular_sub_t
struct _pkc_modular_sub pkc_modular_sub_t
PKC Modular Subtraction expression input.
hal_pkc_deinit
hal_status_t hal_pkc_deinit(pkc_handle_t *p_pkc)
De-initialize the PKC peripheral.
_pkc_ecc_point_multi::p_K
uint32_t * p_K
Definition: hal_pkc.h:148
_pkc_modular_add::p_P
uint32_t * p_P
Definition: hal_pkc.h:173
pkc_ecc_point_multi_t
struct _pkc_ecc_point_multi pkc_ecc_point_multi_t
PKC ECC Point Multiplication expression input.
pkc_big_number_multi_t
struct _pkc_big_number_multi pkc_big_number_multi_t
PKC Big Number Multiplication expression input.
hal_pkc_montgomery_multi_it
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.
hal_pkc_modular_add
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.
_pkc_big_number_multi::p_A
uint32_t * p_A
Definition: hal_pkc.h:239
pkc_init_t::secure_mode
uint32_t secure_mode
Definition: hal_pkc.h:111
hal_pkc_modular_sub_it
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.
pkc_init_t
PKC Init Structure definition.
Definition: hal_pkc.h:108
hal_pkc_msp_init
void hal_pkc_msp_init(pkc_handle_t *p_pkc)
Initialize the PKC MSP.
_pkc_modular_sub
PKC Modular Subtraction expression input.
Definition: hal_pkc.h:181
pkc_modular_compare_t
struct _pkc_modular_compare pkc_modular_compare_t
PKC Modular Comparison expression input.
_pkc_modular_compare::p_A
uint32_t * p_A
Definition: hal_pkc.h:204
_pkc_rsa_modular_exponent::p_P_R2
uint32_t * p_P_R2
Definition: hal_pkc.h:161
hal_pkc_msp_deinit
void hal_pkc_msp_deinit(pkc_handle_t *p_pkc)
De-initialize the PKC MSP.
_pkc_montgomery_inversion::ConstP
uint32_t ConstP
Definition: hal_pkc.h:229
_pkc_handle::init
pkc_init_t init
Definition: hal_pkc.h:129
hal_pkc_overflow_callback
void hal_pkc_overflow_callback(pkc_handle_t *p_pkc)
PKC over flow callback.
_pkc_handle::p_result
void * p_result
Definition: hal_pkc.h:130
_pkc_rsa_modular_exponent::ConstP
uint32_t ConstP
Definition: hal_pkc.h:162
_ll_ecc_point
LL PKC ECC Point Structure definition.
Definition: ll_pkc.h:92
_pkc_modular_sub::p_A
uint32_t * p_A
Definition: hal_pkc.h:182
_hal_pkc_callback::pkc_done_callback
void(* pkc_done_callback)(pkc_handle_t *p_pkc)
Definition: hal_pkc.h:273
_pkc_ecc_point_multi
PKC ECC Point Multiplication expression input.
Definition: hal_pkc.h:147
hal_status_t
hal_status_t
HAL Status structures definition.
Definition: gr_common.h:140
pkc_big_number_add_t
struct _pkc_big_number_add pkc_big_number_add_t
PKC Big Number Addition expression input.
hal_def.h
This file contains HAL common definitions, enumeration, macros and structures definitions.
hal_pkc_modular_left_shift
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.
pkc_modular_shift_t
struct _pkc_modular_shift pkc_modular_shift_t
PKC Modular Left Shift expression input.
_pkc_rsa_modular_exponent::p_B
uint32_t * p_B
Definition: hal_pkc.h:159
pkc_init_t::data_bits
uint32_t data_bits
Definition: hal_pkc.h:110
hal_pkc_done_callback
void hal_pkc_done_callback(pkc_handle_t *p_pkc)
PKC calculate done callback.
_pkc_big_number_multi::p_B
uint32_t * p_B
Definition: hal_pkc.h:240
_pkc_rsa_modular_exponent::p_A
uint32_t * p_A
Definition: hal_pkc.h:158
_pkc_montgomery_inversion::p_A
uint32_t * p_A
Definition: hal_pkc.h:227
hal_pkc_big_number_add_it
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.
_pkc_montgomery_multi::p_P
uint32_t * p_P
Definition: hal_pkc.h:216
hal_pkc_modular_add_it
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.
hal_pkc_error_callback
void hal_pkc_error_callback(pkc_handle_t *p_pkc)
PKC error callback.
hal_pkc_big_number_add
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.
hal_pkc_montgomery_inversion_it
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.
hal_pkc_big_number_multi_it
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.
HAL_PKC_STATE_BUSY
@ HAL_PKC_STATE_BUSY
Definition: hal_pkc.h:79
hal_pkc_modular_compare_it
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.
hal_pkc_irq_handler
void hal_pkc_irq_handler(pkc_handle_t *p_pkc)
Handle PKC interrupt request.
pkc_modular_add_t
struct _pkc_modular_add pkc_modular_add_t
PKC Modular Addition expression input.
_hal_pkc_callback
HAL_PKC Callback function definition.
Definition: hal_pkc.h:270
_pkc_modular_add
PKC Modular Addition expression input.
Definition: hal_pkc.h:170
_pkc_big_number_multi
PKC Big Number Multiplication expression input.
Definition: hal_pkc.h:238
_pkc_modular_shift::p_A
uint32_t * p_A
Definition: hal_pkc.h:193
pkc_rsa_modular_exponent_t
struct _pkc_rsa_modular_exponent pkc_rsa_modular_exponent_t
PKC RSA Modular Exponentiation expression input.
hal_pkc_state_t
hal_pkc_state_t
HAL PKC State Enumerations definition.
Definition: hal_pkc.h:76
_hal_pkc_callback::pkc_msp_deinit
void(* pkc_msp_deinit)(pkc_handle_t *p_pkc)
Definition: hal_pkc.h:272
_hal_pkc_callback::pkc_overflow_callback
void(* pkc_overflow_callback)(pkc_handle_t *p_pkc)
Definition: hal_pkc.h:275
hal_pkc_callback_t
struct _hal_pkc_callback hal_pkc_callback_t
HAL_PKC Callback function definition.
_pkc_rsa_modular_exponent::p_P
uint32_t * p_P
Definition: hal_pkc.h:160
_pkc_modular_compare::p_P
uint32_t * p_P
Definition: hal_pkc.h:205
pkc_handle_t
struct _pkc_handle pkc_handle_t
PKC handle Structure definition.
_hal_pkc_callback::pkc_msp_init
void(* pkc_msp_init)(pkc_handle_t *p_pkc)
Definition: hal_pkc.h:271
_pkc_rsa_modular_exponent
PKC RSA Modular Exponentiation expression input.
Definition: hal_pkc.h:157
pkc_montgomery_multi_t
struct _pkc_montgomery_multi pkc_montgomery_multi_t
PKC Montgomery Modular Multiplication expression input.
hal_pkc_get_error
uint32_t hal_pkc_get_error(pkc_handle_t *p_pkc)
Return the PKC error code.
hal_pkc_big_number_multi
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.
hal_pkc_ecc_point_multi_it
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.