stm32h5xx_crypto_pkc.h
Go to the documentation of this file.
1 /**
2  * @file stm32h5xx_crypto_pkc.h
3  * @brief STM32H5 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.0
29  **/
30 
31 #ifndef _STM32H5XX_CRYPTO_PKC_H
32 #define _STM32H5XX_CRYPTO_PKC_H
33 
34 //Dependencies
35 #include "core/crypto.h"
36 
37 //Public-key hardware accelerator
38 #ifndef STM32H5XX_CRYPTO_PKC_SUPPORT
39  #define STM32H5XX_CRYPTO_PKC_SUPPORT DISABLED
40 #elif (STM32H5XX_CRYPTO_PKC_SUPPORT != ENABLED && STM32H5XX_CRYPTO_PKC_SUPPORT != DISABLED)
41  #error STM32H5XX_CRYPTO_PKC_SUPPORT parameter is not valid
42 #endif
43 
44 //Maximum RSA operand size, in bits
45 #define PKA_MAX_ROS 4160
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_MODULAR_EXP_PROTECTED 0x03
54 #define PKA_CR_MODE_RSA_CRT_EXP 0x07
55 #define PKA_CR_MODE_MODULAR_INV 0x08
56 #define PKA_CR_MODE_ARITHMETIC_ADD 0x09
57 #define PKA_CR_MODE_ARITHMETIC_SUB 0x0A
58 #define PKA_CR_MODE_ARITHMETIC_MUL 0x0B
59 #define PKA_CR_MODE_COMPARISON 0x0C
60 #define PKA_CR_MODE_MODULAR_RED 0x0D
61 #define PKA_CR_MODE_MODULAR_ADD 0x0E
62 #define PKA_CR_MODE_MODULAR_SUB 0x0F
63 #define PKA_CR_MODE_MONTGOMERY_MUL 0x10
64 #define PKA_CR_MODE_ECC_MUL 0x20
65 #define PKA_CR_MODE_ECC_COMPLETE_ADD 0x23
66 #define PKA_CR_MODE_ECDSA_SIGN 0x24
67 #define PKA_CR_MODE_ECDSA_VERIFY 0x26
68 #define PKA_CR_MODE_DOUBLE_BASE_LADDER 0x27
69 #define PKA_CR_MODE_POINT_CHECK 0x28
70 #define PKA_CR_MODE_ECC_PROJECTIVE_AFF 0x2F
71 
72 //PKA status codes
73 #define PKA_STATUS_SUCCESS 0xD60D
74 #define PKA_STATUS_INVALID 0x0000
75 
76 //C++ guard
77 #ifdef __cplusplus
78 extern "C" {
79 #endif
80 
81 //PKA related functions
82 error_t pkaInit(void);
83 
84 //C++ guard
85 #ifdef __cplusplus
86 }
87 #endif
88 
89 #endif
General definitions for cryptographic algorithms.
error_t
Error codes.
Definition: error.h:43
error_t pkaInit(void)
PKA module initialization.