same54_crypto_pukcc.h
Go to the documentation of this file.
1 /**
2  * @file same54_crypto_pukcc.h
3  * @brief SAME54 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.4
29  **/
30 
31 #ifndef _SAME54_CRYPTO_PUKCC_H
32 #define _SAME54_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 CRT service parameters
121  **/
122 
123 typedef struct
124 {
125  uint8_t *mod;
126  uint8_t *x;
127  uint8_t *exp;
128  uint8_t *p;
129  uint8_t *q;
130  uint8_t *dp;
131  uint8_t *dq;
132  uint8_t *r;
134 
135 
136 /**
137  * @brief ZpEcPointIsOnCurve service parameters
138  **/
139 
140 typedef struct
141 {
142  uint8_t *mod;
143  uint8_t *cns;
145  uint8_t *a;
146  uint8_t *b;
147  uint8_t *r;
148  uint8_t *x;
149  uint8_t *w;
151 
152 
153 /**
154  * @brief ZpEcConvProjToAffine service parameters
155  **/
156 
157 typedef struct
158 {
159  uint8_t *mod;
160  uint8_t *cns;
161  uint8_t *k;
163  uint8_t *r;
164  uint8_t *x;
165  uint8_t *w;
167 
168 
169 /**
170  * @brief ZpEccMul service parameters
171  **/
172 
173 typedef struct
174 {
175  uint8_t *mod;
176  uint8_t *cns;
177  uint8_t *k;
179  uint8_t *a;
180  uint8_t *r;
181  uint8_t *x;
182  uint8_t *w;
184 
185 
186 
187 /**
188  * @brief ZpEcDsaGenerate service parameters
189  **/
190 
191 typedef struct
192 {
193  uint8_t *mod;
194  uint8_t *cns;
196  uint8_t *order;
197  uint8_t *a;
198  uint8_t *privateKey;
199  uint8_t *k;
200  uint8_t *h;
201  uint8_t *r;
202  uint8_t *x;
203  uint8_t *w;
205 
206 
207 /**
208  * @brief ZpEcDsaVerify service parameters
209  **/
210 
211 typedef struct
212 {
213  uint8_t *mod;
214  uint8_t *cns;
216  uint8_t *order;
217  uint8_t *a;
219  uint8_t *h;
220  uint8_t *r;
221  uint8_t *s;
222  uint8_t *x;
223  uint8_t *w;
225 
226 
227 //PUKCC related function
228 error_t pukccInit(void);
229 
230 //C++ guard
231 #ifdef __cplusplus
232  }
233 #endif
234 
235 #endif
General definitions for cryptographic algorithms.
RedMod service parameters.
ZpEcDsaVerify service parameters.
ZpEcConvProjToAffine service parameters.
Elliptic curve point.
error_t
Error codes.
Definition: error.h:42
Fmult service parameters.
ZpEcPointIsOnCurve service parameters.
ZpEccMul service parameters.
ExpMod service parameters.
GCD service parameters.
CRT service parameters.
ZpEcDsaGenerate service parameters.
error_t pukccInit(void)
Initialize PUKCC public key accelerator.