samd51_crypto_pukcc.h
Go to the documentation of this file.
1 /**
2  * @file samd51_crypto_pukcc.h
3  * @brief SAMD51 PUKCC public key accelerator
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2010-2019 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 1.9.6
29  **/
30 
31 #ifndef _SAMD51_CRYPTO_PUKCC_H
32 #define _SAMD51_CRYPTO_PUKCC_H
33 
34 //Dependencies
35 #include "core/crypto.h"
36 
37 //Crypto memory base address
38 #define PUKCC_CRYPTO_RAM_BASE 0x02011000UL
39 
40 //Far to near pointer conversion
41 #define PUKCC_FAR_TO_NEAR(p) ((uint16_t) ((uint32_t) (p)))
42 
43 //C++ guard
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47 
48 
49 /**
50  * @brief Elliptic curve point
51  **/
52 
53 typedef struct
54 {
55  uint8_t *x;
56  uint8_t *y;
57  uint8_t *z;
58 } PukccEcPoint;
59 
60 
61 /**
62  * @brief Fmult service parameters
63  **/
64 
65 typedef struct
66 {
67  uint8_t *mod;
68  uint8_t *cns;
69  uint8_t *x;
70  uint8_t *y;
71  uint8_t *z;
72  uint8_t *r;
74 
75 
76 /**
77  * @brief GCD service parameters
78  **/
79 
80 typedef struct
81 {
82  uint8_t *x;
83  uint8_t *y;
84  uint8_t *a;
85  uint8_t *z;
86  uint8_t *w;
88 
89 
90 /**
91  * @brief RedMod service parameters
92  **/
93 
94 typedef struct
95 {
96  uint8_t *mod;
97  uint8_t *cns;
98  uint8_t *exp;
99  uint8_t *r;
100  uint8_t *x;
102 
103 
104 /**
105  * @brief ExpMod service parameters
106  **/
107 
108 typedef struct
109 {
110  uint8_t *mod;
111  uint8_t *cns;
112  uint8_t *exp;
113  uint8_t *r;
114  uint8_t *x;
115  uint8_t *w;
117 
118 
119 /**
120  * @brief PrimeGen service parameters
121  **/
122 
123 typedef struct
124 {
125  uint8_t *n;
126  uint8_t *cns;
127  uint8_t *rnd;
128  uint8_t *w;
129  uint8_t *r;
130  uint8_t *exp;
132 
133 
134 /**
135  * @brief CRT service parameters
136  **/
137 
138 typedef struct
139 {
140  uint8_t *mod;
141  uint8_t *x;
142  uint8_t *exp;
143  uint8_t *p;
144  uint8_t *q;
145  uint8_t *dp;
146  uint8_t *dq;
147  uint8_t *r;
149 
150 
151 /**
152  * @brief ZpEcPointIsOnCurve service parameters
153  **/
154 
155 typedef struct
156 {
157  uint8_t *mod;
158  uint8_t *cns;
160  uint8_t *a;
161  uint8_t *b;
162  uint8_t *r;
163  uint8_t *x;
164  uint8_t *w;
166 
167 
168 /**
169  * @brief ZpEcConvProjToAffine service parameters
170  **/
171 
172 typedef struct
173 {
174  uint8_t *mod;
175  uint8_t *cns;
176  uint8_t *k;
178  uint8_t *r;
179  uint8_t *x;
180  uint8_t *w;
182 
183 
184 /**
185  * @brief ZpEccMul service parameters
186  **/
187 
188 typedef struct
189 {
190  uint8_t *mod;
191  uint8_t *cns;
192  uint8_t *k;
194  uint8_t *a;
195  uint8_t *r;
196  uint8_t *x;
197  uint8_t *w;
199 
200 
201 
202 /**
203  * @brief ZpEcDsaGenerate service parameters
204  **/
205 
206 typedef struct
207 {
208  uint8_t *mod;
209  uint8_t *cns;
211  uint8_t *order;
212  uint8_t *a;
213  uint8_t *privateKey;
214  uint8_t *k;
215  uint8_t *h;
216  uint8_t *r;
217  uint8_t *x;
218  uint8_t *w;
220 
221 
222 /**
223  * @brief ZpEcDsaVerify service parameters
224  **/
225 
226 typedef struct
227 {
228  uint8_t *mod;
229  uint8_t *cns;
231  uint8_t *order;
232  uint8_t *a;
234  uint8_t *h;
235  uint8_t *r;
236  uint8_t *s;
237  uint8_t *x;
238  uint8_t *w;
240 
241 
242 //PUKCC related function
243 error_t pukccInit(void);
244 
245 //C++ guard
246 #ifdef __cplusplus
247 }
248 #endif
249 
250 #endif
ZpEccMul service parameters.
ZpEcPointIsOnCurve service parameters.
PrimeGen service parameters.
Fmult service parameters.
ExpMod service parameters.
Elliptic curve point.
error_t
Error codes.
Definition: error.h:42
ZpEcConvProjToAffine service parameters.
ZpEcDsaVerify service parameters.
General definitions for cryptographic algorithms.
RedMod service parameters.
GCD service parameters.
error_t pukccInit(void)
Initialize PUKCC public key accelerator.
CRT service parameters.
ZpEcDsaGenerate service parameters.