1 /***************************************************************************//**
2 * \file cy_crypto_core_ecc_domain_params.c
3 * \version 2.40
4 *
5 * \brief
6 * This file provides constant and parameters for the API for the ECC
7 * in the Crypto driver.
8 *
9 ********************************************************************************
10 * Copyright 2016-2020 Cypress Semiconductor Corporation
11 * SPDX-License-Identifier: Apache-2.0
12 *
13 * Licensed under the Apache License, Version 2.0 (the "License");
14 * you may not use this file except in compliance with the License.
15 * You may obtain a copy of the License at
16 *
17 * http://www.apache.org/licenses/LICENSE-2.0
18 *
19 * Unless required by applicable law or agreed to in writing, software
20 * distributed under the License is distributed on an "AS IS" BASIS,
21 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 * See the License for the specific language governing permissions and
23 * limitations under the License.
24 *******************************************************************************/
25
26 #include "cy_device.h"
27
28 #if defined (CY_IP_MXCRYPTO)
29
30 #include "cy_crypto_core_ecc.h"
31
32 #if defined(__cplusplus)
33 extern "C" {
34 #endif
35
36 /*******************************************************************************
37 * Function Name: Cy_Crypto_Core_ECC_GetCurveParams
38 ****************************************************************************//**
39 *
40 * Get curve domain parameters if this curve is supported.
41 *
42 * \param curveId
43 * See \ref cy_en_crypto_ecc_curve_id_t.
44 *
45 * \return
46 * Pointer to curve domain parameters. See \ref cy_stc_crypto_ecc_dp_type.
47 *
48 *******************************************************************************/
Cy_Crypto_Core_ECC_GetCurveParams(cy_en_crypto_ecc_curve_id_t curveId)49 cy_stc_crypto_ecc_dp_type *Cy_Crypto_Core_ECC_GetCurveParams(cy_en_crypto_ecc_curve_id_t curveId)
50 {
51 /* P192 CURVE PARAMETERS */
52 CY_ALIGN(4) static const uint8_t eccP192Polynomial[CY_CRYPTO_ECC_P192_BYTE_SIZE] =
53 {
54 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu,
55 0xfeu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu,
56 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu,
57 };
58
59 CY_ALIGN(4) static const uint8_t eccP192PolyBarrett[CY_CRYPTO_ECC_P192_BYTE_SIZE + 1u] =
60 { /* pre-calculated */
61 0x01u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u,
62 0x01u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u,
63 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u,
64 0x01u
65 };
66 CY_ALIGN(4) static const uint8_t eccP192Order[CY_CRYPTO_ECC_P192_BYTE_SIZE] =
67 {
68 0x31u, 0x28u, 0xD2u, 0xB4u, 0xB1u, 0xC9u, 0x6Bu, 0x14u,
69 0x36u, 0xF8u, 0xDEu, 0x99u, 0xffu, 0xffu, 0xffu, 0xffu,
70 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu
71 };
72
73 /* barrett_o: "1000000000000000000000000662107c9eb94364e4b2dd7cf" */
74 CY_ALIGN(4) static const uint8_t eccP192OrderBarrett[CY_CRYPTO_ECC_P192_BYTE_SIZE + 1u] =
75 { /* pre-calculated */
76 0xcfu, 0xd7u, 0x2du, 0x4bu, 0x4eu, 0x36u, 0x94u, 0xebu,
77 0xc9u, 0x07u, 0x21u, 0x66u, 0x00u, 0x00u, 0x00u, 0x00u,
78 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u,
79 0x01u
80 };
81
82 /* base point x: "188DA80EB03090F67CBF20EB43A18800F4FF0AFD82FF1012" */
83 CY_ALIGN(4) static const uint8_t eccP192BasePointX[CY_CRYPTO_ECC_P192_BYTE_SIZE] =
84 {
85 0x12u, 0x10u, 0xffu, 0x82u, 0xfdu, 0x0au, 0xffu, 0xf4u,
86 0x00u, 0x88u, 0xa1u, 0x43u, 0xebu, 0x20u, 0xbfu, 0x7cu,
87 0xf6u, 0x90u, 0x30u, 0xb0u, 0x0eu, 0xa8u, 0x8du, 0x18u
88 };
89
90 /* base point y: "07192B95FFC8DA78631011ED6B24CDD573F977A11E794811" */
91 CY_ALIGN(4) static const uint8_t eccP192BasePointY[CY_CRYPTO_ECC_P192_BYTE_SIZE] =
92 {
93 0x11u, 0x48u, 0x79u, 0x1eu, 0xa1u, 0x77u, 0xf9u, 0x73u,
94 0xd5u, 0xcdu, 0x24u, 0x6bu, 0xedu, 0x11u, 0x10u, 0x63u,
95 0x78u, 0xdau, 0xc8u, 0xffu, 0x95u, 0x2bu, 0x19u, 0x07u
96 };
97
98 /* P224 CURVE PARAMETERS */
99 CY_ALIGN(4) static const uint8_t eccP224Polynomial[CY_CRYPTO_ECC_P224_BYTE_SIZE] =
100 {
101 0x01u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u,
102 0x00u, 0x00u, 0x00u, 0x00u, 0xffu, 0xffu, 0xffu, 0xffu,
103 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu,
104 0xffu, 0xffu, 0xffu, 0xffu
105 };
106
107 CY_ALIGN(4) static const uint8_t eccP224PolyBarrett[CY_CRYPTO_ECC_P224_BYTE_SIZE + 1u] =
108 { /* pre-calculated */
109 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu,
110 0xffu, 0xffu, 0xffu, 0xffu, 0x00u, 0x00u, 0x00u, 0x00u,
111 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u,
112 0x00u, 0x00u, 0x00u, 0x00u, 0x01u
113 };
114
115 CY_ALIGN(4) static const uint8_t eccP224Order[CY_CRYPTO_ECC_P224_BYTE_SIZE] =
116 {
117 0x3Du, 0x2Au, 0x5Cu, 0x5Cu, 0x45u, 0x29u, 0xDDu, 0x13u,
118 0x3Eu, 0xF0u, 0xB8u, 0xE0u, 0xA2u, 0x16u, 0xffu, 0xffu,
119 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu,
120 0xffu, 0xffu, 0xffu, 0xffu
121 };
122 /* barrett_o: "10000000000000000000000000000e95d1f470fc1ec22d6baa3a3d5c3" */
123 CY_ALIGN(4) static const uint8_t eccP224OrderBarrett[CY_CRYPTO_ECC_P224_BYTE_SIZE + 1u] =
124 { /* pre-calculated */
125 0xc3u, 0xd5u, 0xa3u, 0xa3u, 0xbau, 0xd6u, 0x22u, 0xecu,
126 0xc1u, 0x0fu, 0x47u, 0x1fu, 0x5du, 0xe9u, 0x00u, 0x00u,
127 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u,
128 0x00u, 0x00u, 0x00u, 0x00u, 0x01u
129 };
130
131 /* Gx - base point x: "B70E0CBD6BB4BF7F321390B94A03C1D356C21122343280D6115C1D21" */
132 CY_ALIGN(4) static const uint8_t eccP224BasePointX[CY_CRYPTO_ECC_P224_BYTE_SIZE] =
133 {
134 0x21u, 0x1du, 0x5cu, 0x11u, 0xd6u, 0x80u, 0x32u, 0x34u,
135 0x22u, 0x11u, 0xc2u, 0x56u, 0xd3u, 0xc1u, 0x03u, 0x4au,
136 0xb9u, 0x90u, 0x13u, 0x32u, 0x7fu, 0xbfu, 0xb4u, 0x6bu,
137 0xbdu, 0x0cu, 0x0eu, 0xb7u
138 };
139
140 /* Gy - base point y: "BD376388B5F723FB4C22DFE6CD4375A05A07476444D5819985007E34" */
141 CY_ALIGN(4) static const uint8_t eccP224BasePointY[CY_CRYPTO_ECC_P224_BYTE_SIZE] =
142 {
143 0x34u, 0x7eu, 0x00u, 0x85u, 0x99u, 0x81u, 0xd5u, 0x44u,
144 0x64u, 0x47u, 0x07u, 0x5au, 0xa0u, 0x75u, 0x43u, 0xcdu,
145 0xe6u, 0xdfu, 0x22u, 0x4cu, 0xfbu, 0x23u, 0xf7u, 0xb5u,
146 0x88u, 0x63u, 0x37u, 0xbdu
147 };
148
149
150 /* P256 CURVE PARAMETERS */
151 /* prime: "FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF" */
152 CY_ALIGN(4) static const uint8_t eccP256Polynomial[CY_CRYPTO_ECC_P256_BYTE_SIZE] =
153 {
154 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu,
155 0xffu, 0xffu, 0xffu, 0xffu, 0x00u, 0x00u, 0x00u, 0x00u,
156 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u,
157 0x01u, 0x00u, 0x00u, 0x00u, 0xffu, 0xffu, 0xffu, 0xffu
158 };
159
160 /* barrett_p: "100000000fffffffffffffffefffffffefffffffeffffffff0000000000000003" */
161 CY_ALIGN(4) static const uint8_t eccP256PolyBarrett[CY_CRYPTO_ECC_P256_BYTE_SIZE + 1u] =
162 { /* pre-calculated! */
163 0x03u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u,
164 0xffu, 0xffu, 0xffu, 0xffu, 0xfeu, 0xffu, 0xffu, 0xffu,
165 0xfeu, 0xffu, 0xffu, 0xffu, 0xfeu, 0xffu, 0xffu, 0xffu,
166 0xffu, 0xffu, 0xffu, 0xffu, 0x00u, 0x00u, 0x00u, 0x00u,
167 0x01u
168 };
169
170 /* order: "FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551" */
171 CY_ALIGN(4) static const uint8_t eccP256Order[CY_CRYPTO_ECC_P256_BYTE_SIZE] =
172 {
173 0x51u, 0x25u, 0x63u, 0xfcu, 0xc2u, 0xcau, 0xb9u, 0xf3u,
174 0x84u, 0x9eu, 0x17u, 0xa7u, 0xadu, 0xfau, 0xe6u, 0xbcu,
175 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu,
176 0x00u, 0x00u, 0x00u, 0x00u, 0xffu, 0xffu, 0xffu, 0xffu
177 };
178
179 /* barrett_o: 100000000fffffffffffffffeffffffff43190552df1a6c21012ffd85eedf9bfe" */
180 CY_ALIGN(4) static const uint8_t eccP256OrderBarrett[CY_CRYPTO_ECC_P256_BYTE_SIZE + 1u] =
181 { /* pre-calculated */
182 0xfeu, 0x9bu, 0xdfu, 0xeeu, 0x85u, 0xfdu, 0x2fu, 0x01u,
183 0x21u, 0x6cu, 0x1au, 0xdfu, 0x52u, 0x05u, 0x19u, 0x43u,
184 0xffu, 0xffu, 0xffu, 0xffu, 0xfeu, 0xffu, 0xffu, 0xffu,
185 0xffu, 0xffu, 0xffu, 0xffu, 0x00u, 0x00u, 0x00u, 0x00u,
186 0x01u
187 };
188
189 /* base point x: "6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296" */
190 CY_ALIGN(4) static const uint8_t eccP256BasePointX[CY_CRYPTO_ECC_P256_BYTE_SIZE] =
191 {
192 0x96u, 0xc2u, 0x98u, 0xd8u, 0x45u, 0x39u, 0xa1u, 0xf4u,
193 0xa0u, 0x33u, 0xebu, 0x2du, 0x81u, 0x7du, 0x03u, 0x77u,
194 0xf2u, 0x40u, 0xa4u, 0x63u, 0xe5u, 0xe6u, 0xbcu, 0xf8u,
195 0x47u, 0x42u, 0x2cu, 0xe1u, 0xf2u, 0xd1u, 0x17u, 0x6bu
196 };
197
198 /* base point y: "4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5" */
199 CY_ALIGN(4) static const uint8_t eccP256BasePointY[CY_CRYPTO_ECC_P256_BYTE_SIZE] =
200 {
201 0xf5u, 0x51u, 0xbfu, 0x37u, 0x68u, 0x40u, 0xb6u, 0xcbu,
202 0xceu, 0x5eu, 0x31u, 0x6bu, 0x57u, 0x33u, 0xceu, 0x2bu,
203 0x16u, 0x9eu, 0x0fu, 0x7cu, 0x4au, 0xebu, 0xe7u, 0x8eu,
204 0x9bu, 0x7fu, 0x1au, 0xfeu, 0xe2u, 0x42u, 0xe3u, 0x4fu,
205 };
206
207 /* prime: "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFF" */
208 CY_ALIGN(4) static const uint8_t eccP384Polynomial[CY_CRYPTO_ECC_P384_BYTE_SIZE] =
209 {
210 0xffu, 0xffu, 0xffu, 0xffu, 0x00u, 0x00u, 0x00u, 0x00u,
211 0x00u, 0x00u, 0x00u, 0x00u, 0xffu, 0xffu, 0xffu, 0xffu,
212 0xfeu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu,
213 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu,
214 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu,
215 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu
216 };
217
218 /* barrett_p: "1000000000000000000000000000000000000000000000000000000000000000100000000ffffffffffffffff00000001" */
219 CY_ALIGN(4) static const uint8_t eccP384PolyBarrett[CY_CRYPTO_ECC_P384_BYTE_SIZE + 1u] =
220 { /* pre-calculated */
221 0x01u, 0x00u, 0x00u, 0x00u, 0xffu, 0xffu, 0xffu, 0xffu,
222 0xffu, 0xffu, 0xffu, 0xffu, 0x00u, 0x00u, 0x00u, 0x00u,
223 0x01u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u,
224 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u,
225 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u,
226 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u,
227 0x01u
228 };
229
230 /* order: "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC7634D81F4372DDF581A0DB248B0A77AECEC196ACCC52973" */
231 CY_ALIGN(4) static const uint8_t eccP384Order[CY_CRYPTO_ECC_P384_BYTE_SIZE] =
232 {
233 0x73u, 0x29u, 0xC5u, 0xCCu, 0x6Au, 0x19u, 0xECu, 0xECu,
234 0x7Au, 0xA7u, 0xB0u, 0x48u, 0xB2u, 0x0Du, 0x1Au, 0x58u,
235 0xDFu, 0x2Du, 0x37u, 0xF4u, 0x81u, 0x4Du, 0x63u, 0xC7u,
236 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu,
237 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu,
238 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu
239 };
240
241 /* barrett_o: "1000000000000000000000000000000000000000000000000389cb27e0bc8d220a7e5f24db74f58851313e695333ad68d" */
242 CY_ALIGN(4) static const uint8_t eccP384OrderBarrett[CY_CRYPTO_ECC_P384_BYTE_SIZE + 1u] =
243 { /* pre-calculated */
244 0x8du, 0xd6u, 0x3au, 0x33u, 0x95u, 0xe6u, 0x13u, 0x13u,
245 0x85u, 0x58u, 0x4fu, 0xb7u, 0x4du, 0xf2u, 0xe5u, 0xa7u,
246 0x20u, 0xd2u, 0xc8u, 0x0bu, 0x7eu, 0xb2u, 0x9cu, 0x38u,
247 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u,
248 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u,
249 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u,
250 0x01u
251 };
252
253 /* base point x: "AA87CA22BE8B05378EB1C71EF320AD746E1D3B628BA79B9859F741E082542A385502F25DBF55296C3A545E3872760AB7" */
254 CY_ALIGN(4) static const uint8_t eccP384BasePointX[CY_CRYPTO_ECC_P384_BYTE_SIZE] =
255 {
256 0xb7u, 0x0au, 0x76u, 0x72u, 0x38u, 0x5eu, 0x54u, 0x3au,
257 0x6cu, 0x29u, 0x55u, 0xbfu, 0x5du, 0xf2u, 0x02u, 0x55u,
258 0x38u, 0x2au, 0x54u, 0x82u, 0xe0u, 0x41u, 0xf7u, 0x59u,
259 0x98u, 0x9bu, 0xa7u, 0x8bu, 0x62u, 0x3bu, 0x1du, 0x6eu,
260 0x74u, 0xadu, 0x20u, 0xf3u, 0x1eu, 0xc7u, 0xb1u, 0x8eu,
261 0x37u, 0x05u, 0x8bu, 0xbeu, 0x22u, 0xcau, 0x87u, 0xaau
262 };
263
264 /* base point y: "3617DE4A96262C6F5D9E98BF9292DC29F8F41DBD289A147CE9DA3113B5F0B8C00A60B1CE1D7E819D7A431D7C90EA0E5F" */
265 CY_ALIGN(4) static const uint8_t eccP384BasePointY[CY_CRYPTO_ECC_P384_BYTE_SIZE] =
266 {
267 0x5fu, 0x0eu, 0xeau, 0x90u, 0x7cu, 0x1du, 0x43u, 0x7au,
268 0x9du, 0x81u, 0x7eu, 0x1du, 0xceu, 0xb1u, 0x60u, 0x0au,
269 0xc0u, 0xb8u, 0xf0u, 0xb5u, 0x13u, 0x31u, 0xdau, 0xe9u,
270 0x7cu, 0x14u, 0x9au, 0x28u, 0xbdu, 0x1du, 0xf4u, 0xf8u,
271 0x29u, 0xdcu, 0x92u, 0x92u, 0xbfu, 0x98u, 0x9eu, 0x5du,
272 0x6fu, 0x2cu, 0x26u, 0x96u, 0x4au, 0xdeu, 0x17u, 0x36u
273 };
274
275 CY_ALIGN(4) static const uint8_t eccP521Polynomial[CY_CRYPTO_ECC_P521_BYTE_SIZE] =
276 {
277 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu,
278 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu,
279 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu,
280 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu,
281 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu,
282 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu,
283 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu,
284 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu,
285 0xffu, 0x01u
286 };
287
288 CY_ALIGN(4) static const uint8_t eccP521PolyBarrett[CY_CRYPTO_ECC_P521_BYTE_SIZE] =
289 { /* pre-calculated */
290 0x01u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u,
291 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u,
292 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u,
293 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u,
294 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u,
295 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u,
296 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u,
297 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u,
298 0x00u, 0x02u
299 };
300
301 CY_ALIGN(4) static const uint8_t eccP521Order[CY_CRYPTO_ECC_P521_BYTE_SIZE] =
302 {
303 0x09u, 0x64u, 0x38u, 0x91u, 0x1Eu, 0xB7u, 0x6Fu, 0xBBu,
304 0xAEu, 0x47u, 0x9Cu, 0x89u, 0xB8u, 0xC9u, 0xB5u, 0x3Bu,
305 0xD0u, 0xA5u, 0x09u, 0xF7u, 0x48u, 0x01u, 0xCCu, 0x7Fu,
306 0x6Bu, 0x96u, 0x2Fu, 0xBFu, 0x83u, 0x87u, 0x86u, 0x51u,
307 0xFAu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu,
308 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu,
309 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu,
310 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu, 0xffu,
311 0xffu, 0x01u
312 };
313
314 /* barrett_o: "2000000000000000000000000000000000000000000000000000000000000000005ae79787c40d069948033feb708f65a2fc44a36477663b851449048e16ec79bf7" */
315 CY_ALIGN(4) static const uint8_t eccP521OrderBarrett[CY_CRYPTO_ECC_P521_BYTE_SIZE] =
316 { /* pre-calculated */
317 0xf7u, 0x9bu, 0xc7u, 0x6eu, 0xe1u, 0x48u, 0x90u, 0x44u,
318 0x51u, 0xb8u, 0x63u, 0x76u, 0x47u, 0x36u, 0x4au, 0xc4u,
319 0x2fu, 0x5au, 0xf6u, 0x08u, 0xb7u, 0xfeu, 0x33u, 0x80u,
320 0x94u, 0x69u, 0xd0u, 0x40u, 0x7cu, 0x78u, 0x79u, 0xaeu,
321 0x05u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u,
322 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u,
323 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u,
324 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u,
325 0x00u, 0x02u
326 };
327
328 /* base point x: "00C6858E06B70404E9CD9E3ECB662395B4429C648139053FB521F828AF606B4D3DBAA14B5E77EFE75928FE1DC127A2FFA8DE3348B3C1856A429BF97E7E31C2E5BD66" */
329 CY_ALIGN(4) static const uint8_t eccP521BasePointX[CY_CRYPTO_ECC_P521_BYTE_SIZE] =
330 {
331 0x66u, 0xbdu, 0xe5u, 0xc2u, 0x31u, 0x7eu, 0x7eu, 0xf9u,
332 0x9bu, 0x42u, 0x6au, 0x85u, 0xc1u, 0xb3u, 0x48u, 0x33u,
333 0xdeu, 0xa8u, 0xffu, 0xa2u, 0x27u, 0xc1u, 0x1du, 0xfeu,
334 0x28u, 0x59u, 0xe7u, 0xefu, 0x77u, 0x5eu, 0x4bu, 0xa1u,
335 0xbau, 0x3du, 0x4du, 0x6bu, 0x60u, 0xafu, 0x28u, 0xf8u,
336 0x21u, 0xb5u, 0x3fu, 0x05u, 0x39u, 0x81u, 0x64u, 0x9cu,
337 0x42u, 0xb4u, 0x95u, 0x23u, 0x66u, 0xcbu, 0x3eu, 0x9eu,
338 0xcdu, 0xe9u, 0x04u, 0x04u, 0xb7u, 0x06u, 0x8eu, 0x85u,
339 0xc6u, 0x00u
340 };
341
342 /* base point y: "011839296A789A3BC0045C8A5FB42C7D1BD998F54449579B446817AFBD17273E662C97EE72995EF42640C550B9013FAD0761353C7086A272C24088BE94769FD16650" */
343 CY_ALIGN(4) static const uint8_t eccP521BasePointY[CY_CRYPTO_ECC_P521_BYTE_SIZE] =
344 {
345 0x50u, 0x66u, 0xd1u, 0x9fu, 0x76u, 0x94u, 0xbeu, 0x88u,
346 0x40u, 0xc2u, 0x72u, 0xa2u, 0x86u, 0x70u, 0x3cu, 0x35u,
347 0x61u, 0x07u, 0xadu, 0x3fu, 0x01u, 0xb9u, 0x50u, 0xc5u,
348 0x40u, 0x26u, 0xf4u, 0x5eu, 0x99u, 0x72u, 0xeeu, 0x97u,
349 0x2cu, 0x66u, 0x3eu, 0x27u, 0x17u, 0xbdu, 0xafu, 0x17u,
350 0x68u, 0x44u, 0x9bu, 0x57u, 0x49u, 0x44u, 0xf5u, 0x98u,
351 0xd9u, 0x1bu, 0x7du, 0x2cu, 0xb4u, 0x5fu, 0x8au, 0x5cu,
352 0x04u, 0xc0u, 0x3bu, 0x9au, 0x78u, 0x6au, 0x29u, 0x39u,
353 0x18u, 0x01u
354 };
355
356 static const cy_stc_crypto_ecc_dp_type eccDomainParams[] =
357 {
358 {
359 CY_CRYPTO_ECC_ECP_NONE,
360 0u,
361 NULL,
362 CY_CRYPTO_NIST_P_CURVE_SPECIFIC_RED_ALG,
363 NULL,
364 NULL,
365 NULL,
366 NULL,
367 NULL,
368 NULL
369 },
370 {
371 CY_CRYPTO_ECC_ECP_SECP192R1,
372 CY_CRYPTO_ECC_P192_SIZE,
373 "NIST P-192",
374 CY_CRYPTO_NIST_P_CURVE_SPECIFIC_RED_ALG,
375 /* prime: "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFF" */
376 eccP192Polynomial,
377 /* barrett_p: "1000000000000000000000000000000010000000000000001" */
378 eccP192PolyBarrett,
379 /* order: "FFFFFFFFFFFFFFFFFFFFFFFF99DEF836146BC9B1B4D22831" */
380 eccP192Order,
381 /* barrett_o: "1000000000000000000000000662107c9eb94364e4b2dd7cf" */
382 eccP192OrderBarrett,
383 /* base point x: "188DA80EB03090F67CBF20EB43A18800F4FF0AFD82FF1012" */
384 eccP192BasePointX,
385 /* base point y: "07192B95FFC8DA78631011ED6B24CDD573F977A11E794811" */
386 eccP192BasePointY
387 },
388 {
389 CY_CRYPTO_ECC_ECP_SECP224R1,
390 CY_CRYPTO_ECC_P224_SIZE,
391 "NIST P-224",
392 CY_CRYPTO_NIST_P_CURVE_SPECIFIC_RED_ALG,
393 /* prime: "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000001" */
394 eccP224Polynomial,
395 /* barrett_p: "100000000000000000000000000000000ffffffffffffffffffffffff" */
396 eccP224PolyBarrett,
397 /* order: "FFFFFFFFFFFFFFFFFFFFFFFFFFFF16A2E0B8F03E13DD29455C5C2A3D" */
398 eccP224Order,
399 /* barrett_o: "10000000000000000000000000000e95d1f470fc1ec22d6baa3a3d5c3" */
400 eccP224OrderBarrett,
401 /* Gx - base point x: "B70E0CBD6BB4BF7F321390B94A03C1D356C21122343280D6115C1D21" */
402 eccP224BasePointX,
403 /* Gy - base point y: "BD376388B5F723FB4C22DFE6CD4375A05A07476444D5819985007E34" */
404 eccP224BasePointY
405 },
406 {
407 CY_CRYPTO_ECC_ECP_SECP256R1,
408 CY_CRYPTO_ECC_P256_SIZE,
409 "NIST P-256",
410 CY_CRYPTO_NIST_P_BARRETT_RED_ALG,
411 /* prime: "FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF" */
412 eccP256Polynomial,
413 /* barrett_p: "100000000fffffffffffffffefffffffefffffffeffffffff0000000000000003" */
414 eccP256PolyBarrett,
415 /* order: "FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551" */
416 eccP256Order,
417 /* barrett_o: "100000000fffffffffffffffeffffffff43190552df1a6c21012ffd85eedf9bfe" */
418 eccP256OrderBarrett,
419 /* Gx - base point x: "6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296" */
420 eccP256BasePointX,
421 /* Gy - base point y: "4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5" */
422 eccP256BasePointY
423 },
424 {
425 CY_CRYPTO_ECC_ECP_SECP384R1,
426 CY_CRYPTO_ECC_P384_SIZE,
427 "NIST P-384",
428 CY_CRYPTO_NIST_P_BARRETT_RED_ALG,
429 /* prime: "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFF" */
430 eccP384Polynomial,
431 /* barrett_p: "1000000000000000000000000000000000000000000000000000000000000000100000000ffffffffffffffff00000001" */
432 eccP384PolyBarrett,
433 /* order: "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC7634D81F4372DDF581A0DB248B0A77AECEC196ACCC52973" */
434 eccP384Order,
435 /* barrett_o: "1000000000000000000000000000000000000000000000000389cb27e0bc8d220a7e5f24db74f58851313e695333ad68d" */
436 eccP384OrderBarrett,
437 /* base point x: "AA87CA22BE8B05378EB1C71EF320AD746E1D3B628BA79B9859F741E082542A385502F25DBF55296C3A545E3872760AB7" */
438 eccP384BasePointX,
439 /* base point y: "3617DE4A96262C6F5D9E98BF9292DC29F8F41DBD289A147CE9DA3113B5F0B8C00A60B1CE1D7E819D7A431D7C90EA0E5F" */
440 eccP384BasePointY
441 },
442 {
443 CY_CRYPTO_ECC_ECP_SECP521R1,
444 CY_CRYPTO_ECC_P521_SIZE,
445 "NIST P-521",
446 CY_CRYPTO_NIST_P_CURVE_SPECIFIC_RED_ALG,
447 /* prime: "1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" */
448 eccP521Polynomial,
449 /* barrett_p: "20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001" */
450 eccP521PolyBarrett,
451 /* order: "1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA51868783BF2F966B7FCC0148F709A5D03BB5C9B8899C47AEBB6FB71E91386409" */
452 eccP521Order,
453 /* barrett_o: "2000000000000000000000000000000000000000000000000000000000000000005ae79787c40d069948033feb708f65a2fc44a36477663b851449048e16ec79bf7" */
454 eccP521OrderBarrett,
455 /* base point x: "0C6858E06B70404E9CD9E3ECB662395B4429C648139053FB521F828AF606B4D3DBAA14B5E77EFE75928FE1DC127A2FFA8DE3348B3C1856A429BF97E7E31C2E5BD66" */
456 eccP521BasePointX,
457 /* base point y: "11839296A789A3BC0045C8A5FB42C7D1BD998F54449579B446817AFBD17273E662C97EE72995EF42640C550B9013FAD0761353C7086A272C24088BE94769FD16650" */
458 eccP521BasePointY
459 }
460 };
461
462 cy_stc_crypto_ecc_dp_type *tmpResult = NULL;
463
464 if ((curveId > CY_CRYPTO_ECC_ECP_NONE) && (curveId < CY_CRYPTO_ECC_ECP_CURVES_CNT))
465 {
466 tmpResult = (cy_stc_crypto_ecc_dp_type *)&eccDomainParams[curveId];
467 }
468
469 return tmpResult;
470 }
471
472 #if defined(__cplusplus)
473 }
474 #endif
475
476 #endif /* CY_IP_MXCRYPTO */
477
478
479 /* [] END OF FILE */
480