stm32wlxx_crypto_pkc.h
Go to the documentation of this file.
1 /**
2  * @file stm32wlxx_crypto_pkc.h
3  * @brief STM32WL public-key hardware accelerator (PKA)
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.
10  *
11  * This file is part of CycloneCRYPTO Open.
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26  *
27  * @author Oryx Embedded SARL (www.oryx-embedded.com)
28  * @version 2.4.4
29  **/
30 
31 #ifndef _STM32WLXX_CRYPTO_PKC_H
32 #define _STM32WLXX_CRYPTO_PKC_H
33 
34 //Dependencies
35 #include "core/crypto.h"
36 
37 //Public-key hardware accelerator
38 #ifndef STM32WLXX_CRYPTO_PKC_SUPPORT
39  #define STM32WLXX_CRYPTO_PKC_SUPPORT DISABLED
40 #elif (STM32WLXX_CRYPTO_PKC_SUPPORT != ENABLED && STM32WLXX_CRYPTO_PKC_SUPPORT != DISABLED)
41  #error STM32WLXX_CRYPTO_PKC_SUPPORT parameter is not valid
42 #endif
43 
44 //Maximum RSA operand size, in bits
45 #define PKA_MAX_ROS 3136
46 //Maximum ECC operand size, in bits
47 #define PKA_MAX_EOS 640
48 
49 //PKA operation modes
50 #define PKA_CR_MODE_MODULAR_EXP 0x00
51 #define PKA_CR_MODE_MONTGOMERY_PARAM 0x01
52 #define PKA_CR_MODE_MODULAR_EXP_FAST 0x02
53 #define PKA_CR_MODE_RSA_CRT_EXP 0x07
54 #define PKA_CR_MODE_MODULAR_INV 0x08
55 #define PKA_CR_MODE_ARITHMETIC_ADD 0x09
56 #define PKA_CR_MODE_ARITHMETIC_SUB 0x0A
57 #define PKA_CR_MODE_ARITHMETIC_MUL 0x0B
58 #define PKA_CR_MODE_COMPARISON 0x0C
59 #define PKA_CR_MODE_MODULAR_RED 0x0D
60 #define PKA_CR_MODE_MODULAR_ADD 0x0E
61 #define PKA_CR_MODE_MODULAR_SUB 0x0F
62 #define PKA_CR_MODE_MONTGOMERY_MUL 0x10
63 #define PKA_CR_MODE_ECC_MUL 0x20
64 #define PKA_CR_MODE_ECC_MUL_FAST 0x22
65 #define PKA_CR_MODE_ECDSA_SIGN 0x24
66 #define PKA_CR_MODE_ECDSA_VERIFY 0x26
67 #define PKA_CR_MODE_POINT_CHECK 0x28
68 
69 //PKA status codes
70 #define PKA_STATUS_SUCCESS 0x00000000
71 #define PKA_STATUS_INVALID 0xFFFFFFFF
72 
73 //C++ guard
74 #ifdef __cplusplus
75 extern "C" {
76 #endif
77 
78 //PKA related functions
79 error_t pkaInit(void);
80 
81 //C++ guard
82 #ifdef __cplusplus
83 }
84 #endif
85 
86 #endif
error_t pkaInit(void)
PKA module initialization.
error_t
Error codes.
Definition: error.h:43
General definitions for cryptographic algorithms.