max32690_crypto_pkc.h
Go to the documentation of this file.
1 /**
2  * @file max32690_crypto_pkc.h
3  * @brief MAX32690 public-key hardware accelerator
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 _MAX32690_CRYPTO_PKC_H
32 #define _MAX32690_CRYPTO_PKC_H
33 
34 //Dependencies
35 #include "core/crypto.h"
36 
37 //Public-key hardware accelerator
38 #ifndef MAX32690_CRYPTO_PKC_SUPPORT
39  #define MAX32690_CRYPTO_PKC_SUPPORT DISABLED
40 #elif (MAX32690_CRYPTO_PKC_SUPPORT != ENABLED && MAX32690_CRYPTO_PKC_SUPPORT != DISABLED)
41  #error MAX32690_CRYPTO_PKC_SUPPORT parameter is not valid
42 #endif
43 
44 //MAA memory instances
45 #define CTB_MAA_MEM_INSTANCE_0 0x0100
46 #define CTB_MAA_MEM_INSTANCE_1 0x0200
47 #define CTB_MAA_MEM_INSTANCE_2 0x0300
48 #define CTB_MAA_MEM_INSTANCE_3 0x0400
49 #define CTB_MAA_MEM_INSTANCE_4 0x0500
50 #define CTB_MAA_MEM_INSTANCE_5 0x0600
51 
52 //Cryptographic Control register
53 #define CTB_CTRL_MAA_DONE_Pos 28
54 #define TB_CTRL_MAA_DONE_Msk 0x10000000
55 #define TB_CTRL_MAA_DONE(n) (((n) << CTB_CTRL_MAA_DONE_Pos) & TB_CTRL_MAA_DONE_Msk)
56 
57 //MAA Control register
58 #define CTB_MAA_CTRL_TMA_Pos 28
59 #define CTB_MAA_CTRL_TMA_Msk 0xF0000000
60 #define CTB_MAA_CTRL_TMA(n) (((n) << CTB_MAA_CTRL_TMA_Pos) & CTB_MAA_CTRL_TMA_Msk)
61 
62 #define CTB_MAA_CTRL_RMA_Pos 24
63 #define CTB_MAA_CTRL_RMA_Msk 0x0F000000
64 #define CTB_MAA_CTRL_RMA(n) (((n) << CTB_MAA_CTRL_RMA_Pos) & CTB_MAA_CTRL_RMA_Msk)
65 
66 #define CTB_MAA_CTRL_BMA_Pos 20
67 #define CTB_MAA_CTRL_BMA_Msk 0x00F00000
68 #define CTB_MAA_CTRL_BMA(n) (((n) << CTB_MAA_CTRL_BMA_Pos) & CTB_MAA_CTRL_BMA_Msk)
69 
70 #define CTB_MAA_CTRL_AMA_Pos 16
71 #define CTB_MAA_CTRL_AMA_Msk 0x000F0000
72 #define CTB_MAA_CTRL_AMA(n) (((n) << CTB_MAA_CTRL_AMA_Pos) & CTB_MAA_CTRL_AMA_Msk)
73 
74 #define CTB_MAA_CTRL_MMS_Pos 14
75 #define CTB_MAA_CTRL_MMS_Msk 0x0000C000
76 #define CTB_MAA_CTRL_MMS(n) (((n) << CTB_MAA_CTRL_MMS_Pos) & CTB_MAA_CTRL_MMS_Msk)
77 
78 #define CTB_MAA_CTRL_EMS_Pos 12
79 #define CTB_MAA_CTRL_EMS_Msk 0x00003000
80 #define CTB_MAA_CTRL_EMS(n) (((n) << CTB_MAA_CTRL_EMS_Pos) & CTB_MAA_CTRL_EMS_Msk)
81 
82 #define CTB_MAA_CTRL_BMS_Pos 10
83 #define CTB_MAA_CTRL_BMS_Msk 0x00000C00
84 #define CTB_MAA_CTRL_BMS(n) (((n) << CTB_MAA_CTRL_BMS_Pos) & CTB_MAA_CTRL_BMS_Msk)
85 
86 #define CTB_MAA_CTRL_AMS_Pos 8
87 #define CTB_MAA_CTRL_AMS_Msk 0x00000300
88 #define CTB_MAA_CTRL_AMS(n) (((n) << CTB_MAA_CTRL_AMS_Pos) & CTB_MAA_CTRL_AMS_Msk)
89 
90 #define CTB_MAA_CTRL_OPT_Pos 4
91 #define CTB_MAA_CTRL_OPT_Msk 0x00000010
92 #define CTB_MAA_CTRL_OPT(n) (((n) << CTB_MAA_CTRL_OPT_Pos) & CTB_MAA_CTRL_OPT_Msk)
93 
94 #define CTB_MAA_CTRL_CALC_Pos 1
95 #define CTB_MAA_CTRL_CALC_Msk 0x0000000E
96 #define CTB_MAA_CTRL_CALC_MOD_EXP_Val 0
97 #define CTB_MAA_CTRL_CALC_MOD_SQR_Val 1
98 #define CTB_MAA_CTRL_CALC_MOD_MUL_Val 2
99 #define CTB_MAA_CTRL_CALC_MOD_SQR_MUL_Val 3
100 #define CTB_MAA_CTRL_CALC_MOD_ADD_Val 4
101 #define CTB_MAA_CTRL_CALC_MOD_SUB_Val 5
102 #define CTB_MAA_CTRL_CALC(n) (((n) << CTB_MAA_CTRL_CALC_Pos) & CTB_MAA_CTRL_CALC_Msk)
103 
104 #define CTB_MAA_CTRL_START_Pos 0
105 #define CTB_MAA_CTRL_START_Msk 0x00000001
106 #define CTB_MAA_CTRL_START(n) (((n) << CTB_MAA_CTRL_START_Pos) & CTB_MAA_CTRL_START_Msk)
107 
108 //C++ guard
109 #ifdef __cplusplus
110 extern "C" {
111 #endif
112 
113 //C++ guard
114 #ifdef __cplusplus
115 }
116 #endif
117 
118 #endif
General definitions for cryptographic algorithms.