xref: /dpdk/app/test/test_cryptodev_ecpm_test_vectors.h (revision f225c04008535027be29c8fc9cc5125fdf2b6995)
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright (C) 2020 Marvell International Ltd.
3  */
4 
5 #ifndef __TEST_CRYPTODEV_ECPM_TEST_VECTORS_H__
6 #define __TEST_CRYPTODEV_ECPM_TEST_VECTORS_H__
7 
8 #include "rte_crypto_asym.h"
9 
10 struct crypto_testsuite_ecpm_params {
11 	rte_crypto_param gen_x;
12 	rte_crypto_param gen_y;
13 	rte_crypto_param privkey;
14 	rte_crypto_param pubkey_x;
15 	rte_crypto_param pubkey_y;
16 	int curve;
17 };
18 
19 /* SECP192R1 (P-192 NIST) test vectors */
20 
21 static uint8_t gen_x_secp192r1[] = {
22 	0x18, 0x8d, 0xa8, 0x0e, 0xb0, 0x30, 0x90, 0xf6,
23 	0x7c, 0xbf, 0x20, 0xeb, 0x43, 0xa1, 0x88, 0x00,
24 	0xf4, 0xff, 0x0a, 0xfd, 0x82, 0xff, 0x10, 0x12
25 };
26 
27 static uint8_t gen_y_secp192r1[] = {
28 	0x07, 0x19, 0x2b, 0x95, 0xff, 0xc8, 0xda, 0x78,
29 	0x63, 0x10, 0x11, 0xed, 0x6b, 0x24, 0xcd, 0xd5,
30 	0x73, 0xf9, 0x77, 0xa1, 0x1e, 0x79, 0x48, 0x11
31 };
32 
33 static uint8_t privkey_secp192r1[] = {
34 	0x24, 0xed, 0xd2, 0x2f, 0x7d, 0xdd, 0x6f, 0xa5,
35 	0xbc, 0x61, 0xfc, 0x06, 0x53, 0x47, 0x9a, 0xa4,
36 	0x08, 0x09, 0xef, 0x86, 0x5c, 0xf2, 0x7a, 0x47
37 };
38 static uint8_t pubkey_x_secp192r1[] = {
39 	0x9b, 0xf1, 0x2d, 0x71, 0x74, 0xb7, 0x70, 0x8a,
40 	0x07, 0x6a, 0x38, 0xbc, 0x80, 0xaa, 0x28, 0x66,
41 	0x2f, 0x25, 0x1e, 0x2e, 0xd8, 0xd4, 0x14, 0xdc
42 };
43 
44 static uint8_t pubkey_y_secp192r1[] = {
45 	0x48, 0x54, 0xc8, 0xd0, 0x7d, 0xfc, 0x08, 0x82,
46 	0x4e, 0x9e, 0x47, 0x1c, 0xa2, 0xfe, 0xdc, 0xfc,
47 	0xff, 0x3d, 0xdc, 0xb0, 0x11, 0x57, 0x34, 0x98
48 };
49 
50 struct crypto_testsuite_ecpm_params ecpm_param_secp192r1 = {
51 	.gen_x = {
52 		.data = gen_x_secp192r1,
53 		.length = sizeof(gen_x_secp192r1),
54 	},
55 	.gen_y = {
56 		.data = gen_y_secp192r1,
57 		.length = sizeof(gen_y_secp192r1),
58 	},
59 	.privkey = {
60 		.data = privkey_secp192r1,
61 		.length = sizeof(privkey_secp192r1),
62 	},
63 	.pubkey_x = {
64 		.data = pubkey_x_secp192r1,
65 		.length = sizeof(pubkey_x_secp192r1),
66 	},
67 	.pubkey_y = {
68 		.data = pubkey_y_secp192r1,
69 		.length = sizeof(pubkey_y_secp192r1),
70 	},
71 	.curve = RTE_CRYPTO_EC_GROUP_SECP192R1
72 };
73 
74 /* SECP224R1 (P-224 NIST) test vectors */
75 
76 static uint8_t gen_x_secp224r1[] = {
77 	0xb7, 0x0e, 0x0c, 0xbd, 0x6b, 0xb4, 0xbf, 0x7f,
78 	0x32, 0x13, 0x90, 0xb9, 0x4a, 0x03, 0xc1, 0xd3,
79 	0x56, 0xc2, 0x11, 0x22, 0x34, 0x32, 0x80, 0xd6,
80 	0x11, 0x5c, 0x1d, 0x21
81 };
82 
83 static uint8_t gen_y_secp224r1[] = {
84 	0xbd, 0x37, 0x63, 0x88, 0xb5, 0xf7, 0x23, 0xfb,
85 	0x4c, 0x22, 0xdf, 0xe6, 0xcd, 0x43, 0x75, 0xa0,
86 	0x5a, 0x07, 0x47, 0x64, 0x44, 0xd5, 0x81, 0x99,
87 	0x85, 0x00, 0x7e, 0x34
88 };
89 
90 static uint8_t privkey_secp224r1[] = {
91 	0x88, 0x8f, 0xc9, 0x92, 0x89, 0x3b, 0xdd, 0x8a,
92 	0xa0, 0x2c, 0x80, 0x76, 0x88, 0x32, 0x60, 0x5d,
93 	0x02, 0x0b, 0x81, 0xae, 0x0b, 0x25, 0x47, 0x41,
94 	0x54, 0xec, 0x89, 0xaa
95 };
96 
97 static uint8_t pubkey_x_secp224r1[] = {
98 	0x4c, 0x74, 0x1e, 0x4d, 0x20, 0x10, 0x36, 0x70,
99 	0xb7, 0x16, 0x1a, 0xe7, 0x22, 0x71, 0x08, 0x21,
100 	0x55, 0x83, 0x84, 0x18, 0x08, 0x43, 0x35, 0x33,
101 	0x8a, 0xc3, 0x8f, 0xa4
102 };
103 
104 static uint8_t pubkey_y_secp224r1[] = {
105 	0xdb, 0x79, 0x19, 0x15, 0x1a, 0xc2, 0x85, 0x87,
106 	0xb7, 0x2b, 0xad, 0x7a, 0xb1, 0x80, 0xec, 0x8e,
107 	0x95, 0xab, 0x9e, 0x2c, 0x8d, 0x81, 0xd9, 0xb9,
108 	0xd7, 0xe2, 0xe3, 0x83
109 };
110 
111 struct crypto_testsuite_ecpm_params ecpm_param_secp224r1 = {
112 	.gen_x = {
113 		.data = gen_x_secp224r1,
114 		.length = sizeof(gen_x_secp224r1),
115 	},
116 	.gen_y = {
117 		.data = gen_y_secp224r1,
118 		.length = sizeof(gen_y_secp224r1),
119 	},
120 	.privkey = {
121 		.data = privkey_secp224r1,
122 		.length = sizeof(privkey_secp224r1),
123 	},
124 	.pubkey_x = {
125 		.data = pubkey_x_secp224r1,
126 		.length = sizeof(pubkey_x_secp224r1),
127 	},
128 	.pubkey_y = {
129 		.data = pubkey_y_secp224r1,
130 		.length = sizeof(pubkey_y_secp224r1),
131 	},
132 	.curve = RTE_CRYPTO_EC_GROUP_SECP224R1
133 };
134 
135 /* SECP256R1 (P-256 NIST) test vectors */
136 
137 static uint8_t gen_x_secp256r1[] = {
138 	0x6b, 0x17, 0xd1, 0xf2, 0xe1, 0x2c, 0x42, 0x47,
139 	0xf8, 0xbc, 0xe6, 0xe5, 0x63, 0xa4, 0x40, 0xf2,
140 	0x77, 0x03, 0x7d, 0x81, 0x2d, 0xeb, 0x33, 0xa0,
141 	0xf4, 0xa1, 0x39, 0x45, 0xd8, 0x98, 0xc2, 0x96
142 };
143 
144 static uint8_t gen_y_secp256r1[] = {
145 	0x4f, 0xe3, 0x42, 0xe2, 0xfe, 0x1a, 0x7f, 0x9b,
146 	0x8e, 0xe7, 0xeb, 0x4a, 0x7c, 0x0f, 0x9e, 0x16,
147 	0x2b, 0xce, 0x33, 0x57, 0x6b, 0x31, 0x5e, 0xce,
148 	0xcb, 0xb6, 0x40, 0x68, 0x37, 0xbf, 0x51, 0xf5
149 };
150 
151 static uint8_t pubkey_x_secp256r1[] = {
152 	0x06, 0x27, 0x5d, 0x38, 0x7b, 0x8f, 0xcd, 0x29,
153 	0x12, 0x02, 0xa5, 0xad, 0x72, 0x35, 0x55, 0xd4,
154 	0xe1, 0xca, 0xd6, 0x32, 0x91, 0xe7, 0x8c, 0xb7,
155 	0xf9, 0x85, 0xfe, 0xb5, 0xca, 0x61, 0xfd, 0xa7,
156 };
157 
158 static uint8_t pubkey_y_secp256r1[] = {
159 	0x6d, 0x28, 0x17, 0x9c, 0x88, 0x2a, 0x06, 0x8c,
160 	0x85, 0x52, 0x44, 0xc1, 0x2f, 0xf6, 0x45, 0x80,
161 	0x63, 0x1c, 0x52, 0xe4, 0xa5, 0xf8, 0x21, 0x43,
162 	0xec, 0xeb, 0xe2, 0xbb, 0x39, 0xff, 0x1f, 0xd8
163 };
164 
165 static uint8_t privkey_secp256r1[] = {
166 	0x36, 0xf7, 0xe3, 0x07, 0x84, 0xfa, 0xb5, 0x8d,
167 	0x8d, 0x1d, 0x00, 0x21, 0x8b, 0x59, 0xd1, 0x70,
168 	0x14, 0x94, 0x86, 0x69, 0xec, 0xd3, 0x99, 0xc8,
169 	0x7a, 0xf0, 0x2d, 0x05, 0xbf, 0x16, 0xed, 0x36
170 };
171 
172 struct crypto_testsuite_ecpm_params ecpm_param_secp256r1 = {
173 	.gen_x = {
174 		.data = gen_x_secp256r1,
175 		.length = sizeof(gen_x_secp256r1),
176 	},
177 	.gen_y = {
178 		.data = gen_y_secp256r1,
179 		.length = sizeof(gen_y_secp256r1),
180 	},
181 	.privkey = {
182 		.data = privkey_secp256r1,
183 		.length = sizeof(privkey_secp256r1),
184 	},
185 	.pubkey_x = {
186 		.data = pubkey_x_secp256r1,
187 		.length = sizeof(pubkey_x_secp256r1),
188 	},
189 	.pubkey_y = {
190 		.data = pubkey_y_secp256r1,
191 		.length = sizeof(pubkey_y_secp256r1),
192 	},
193 	.curve = RTE_CRYPTO_EC_GROUP_SECP256R1
194 };
195 
196 /* SECP384R1 (P-384 NIST) test vectors */
197 
198 static uint8_t gen_x_secp384r1[] = {
199 	0xAA, 0x87, 0xCA, 0x22, 0xBE, 0x8B, 0x05, 0x37,
200 	0x8E, 0xB1, 0xC7, 0x1E, 0xF3, 0x20, 0xAD, 0x74,
201 	0x6E, 0x1D, 0x3B, 0x62, 0x8B, 0xA7, 0x9B, 0x98,
202 	0x59, 0xF7, 0x41, 0xE0, 0x82, 0x54, 0x2A, 0x38,
203 	0x55, 0x02, 0xF2, 0x5D, 0xBF, 0x55, 0x29, 0x6C,
204 	0x3A, 0x54, 0x5E, 0x38, 0x72, 0x76, 0x0A, 0xB7
205 };
206 
207 static uint8_t gen_y_secp384r1[] = {
208 	0x36, 0x17, 0xDE, 0x4A, 0x96, 0x26, 0x2C, 0x6F,
209 	0x5D, 0x9E, 0x98, 0xBF, 0x92, 0x92, 0xDC, 0x29,
210 	0xF8, 0xF4, 0x1D, 0xBD, 0x28, 0x9A, 0x14, 0x7C,
211 	0xE9, 0xDA, 0x31, 0x13, 0xB5, 0xF0, 0xB8, 0xC0,
212 	0x0A, 0x60, 0xB1, 0xCE, 0x1D, 0x7E, 0x81, 0x9D,
213 	0x7A, 0x43, 0x1D, 0x7C, 0x90, 0xEA, 0x0E, 0x5F
214 };
215 
216 static uint8_t privkey_secp384r1[] = {
217 	0xc6, 0x02, 0xbc, 0x74, 0xa3, 0x45, 0x92, 0xc3,
218 	0x11, 0xa6, 0x56, 0x96, 0x61, 0xe0, 0x83, 0x2c,
219 	0x84, 0xf7, 0x20, 0x72, 0x74, 0x67, 0x6c, 0xc4,
220 	0x2a, 0x89, 0xf0, 0x58, 0x16, 0x26, 0x30, 0x18,
221 	0x4b, 0x52, 0xf0, 0xd9, 0x9b, 0x85, 0x5a, 0x77,
222 	0x83, 0xc9, 0x87, 0x47, 0x6d, 0x7f, 0x9e, 0x6b
223 };
224 
225 static uint8_t pubkey_x_secp384r1[] = {
226 	0x04, 0x00, 0x19, 0x3b, 0x21, 0xf0, 0x7c, 0xd0,
227 	0x59, 0x82, 0x6e, 0x94, 0x53, 0xd3, 0xe9, 0x6d,
228 	0xd1, 0x45, 0x04, 0x1c, 0x97, 0xd4, 0x9f, 0xf6,
229 	0xb7, 0x04, 0x7f, 0x86, 0xbb, 0x0b, 0x04, 0x39,
230 	0xe9, 0x09, 0x27, 0x4c, 0xb9, 0xc2, 0x82, 0xbf,
231 	0xab, 0x88, 0x67, 0x4c, 0x07, 0x65, 0xbc, 0x75
232 };
233 
234 static uint8_t pubkey_y_secp384r1[] = {
235 	0xf7, 0x0d, 0x89, 0xc5, 0x2a, 0xcb, 0xc7, 0x04,
236 	0x68, 0xd2, 0xc5, 0xae, 0x75, 0xc7, 0x6d, 0x7f,
237 	0x69, 0xb7, 0x6a, 0xf6, 0x2d, 0xcf, 0x95, 0xe9,
238 	0x9e, 0xba, 0x5d, 0xd1, 0x1a, 0xdf, 0x8f, 0x42,
239 	0xec, 0x9a, 0x42, 0x5b, 0x0c, 0x5e, 0xc9, 0x8e,
240 	0x2f, 0x23, 0x4a, 0x92, 0x6b, 0x82, 0xa1, 0x47
241 };
242 
243 struct crypto_testsuite_ecpm_params ecpm_param_secp384r1 = {
244 	.gen_x = {
245 		.data = gen_x_secp384r1,
246 		.length = sizeof(gen_x_secp384r1),
247 	},
248 	.gen_y = {
249 		.data = gen_y_secp384r1,
250 		.length = sizeof(gen_y_secp384r1),
251 	},
252 	.privkey = {
253 		.data = privkey_secp384r1,
254 		.length = sizeof(privkey_secp384r1),
255 	},
256 	.pubkey_x = {
257 		.data = pubkey_x_secp384r1,
258 		.length = sizeof(pubkey_x_secp384r1),
259 	},
260 	.pubkey_y = {
261 		.data = pubkey_y_secp384r1,
262 		.length = sizeof(pubkey_y_secp384r1),
263 	},
264 	.curve = RTE_CRYPTO_EC_GROUP_SECP384R1
265 };
266 
267 /* SECP521R1 (P-521 NIST) test vectors */
268 
269 static uint8_t gen_x_secp521r1[] = {
270 	0xc6, 0x85, 0x8e, 0x06, 0xb7, 0x04, 0x04,
271 	0xe9, 0xcd, 0x9e, 0x3e, 0xcb, 0x66, 0x23, 0x95,
272 	0xb4, 0x42, 0x9c, 0x64, 0x81, 0x39, 0x05, 0x3f,
273 	0xb5, 0x21, 0xf8, 0x28, 0xaf, 0x60, 0x6b, 0x4d,
274 	0x3d, 0xba, 0xa1, 0x4b, 0x5e, 0x77, 0xef, 0xe7,
275 	0x59, 0x28, 0xfe, 0x1d, 0xc1, 0x27, 0xa2, 0xff,
276 	0xa8, 0xde, 0x33, 0x48, 0xb3, 0xc1, 0x85, 0x6a,
277 	0x42, 0x9b, 0xf9, 0x7e, 0x7e, 0x31, 0xc2, 0xe5,
278 	0xbd, 0x66
279 };
280 
281 static uint8_t gen_y_secp521r1[] = {
282 	0x01, 0x18, 0x39, 0x29, 0x6a, 0x78, 0x9a, 0x3b,
283 	0xc0, 0x04, 0x5c, 0x8a, 0x5f, 0xb4, 0x2c, 0x7d,
284 	0x1b, 0xd9, 0x98, 0xf5, 0x44, 0x49, 0x57, 0x9b,
285 	0x44, 0x68, 0x17, 0xaf, 0xbd, 0x17, 0x27, 0x3e,
286 	0x66, 0x2c, 0x97, 0xee, 0x72, 0x99, 0x5e, 0xf4,
287 	0x26, 0x40, 0xc5, 0x50, 0xb9, 0x01, 0x3f, 0xad,
288 	0x07, 0x61, 0x35, 0x3c, 0x70, 0x86, 0xa2, 0x72,
289 	0xc2, 0x40, 0x88, 0xbe, 0x94, 0x76, 0x9f, 0xd1,
290 	0x66, 0x50
291 };
292 
293 static uint8_t privkey_secp521r1[] = {
294 	0x01, 0xe8, 0xc0, 0x59, 0x96, 0xb8, 0x5e, 0x6f,
295 	0x3f, 0x87, 0x57, 0x12, 0xa0, 0x9c, 0x1b, 0x40,
296 	0x67, 0x2b, 0x5e, 0x7a, 0x78, 0xd5, 0x85, 0x2d,
297 	0xe0, 0x15, 0x85, 0xc5, 0xfb, 0x99, 0x0b, 0xf3,
298 	0x81, 0x2c, 0x32, 0x45, 0x53, 0x4a, 0x71, 0x43,
299 	0x89, 0xae, 0x90, 0x14, 0xd6, 0x77, 0xa4, 0x49,
300 	0xef, 0xd6, 0x58, 0x25, 0x4e, 0x61, 0x0d, 0xa8,
301 	0xe6, 0xca, 0xd3, 0x34, 0x14, 0xb9, 0xd3, 0x3e,
302 	0x0d, 0x7a
303 };
304 
305 static uint8_t pubkey_x_secp521r1[] = {
306 	0x00, 0x7d, 0x04, 0x2c, 0xa1, 0x94, 0x08, 0x52,
307 	0x4e, 0x68, 0xb9, 0x81, 0xf1, 0x41, 0x93, 0x51,
308 	0xe3, 0xb8, 0x47, 0x36, 0xc7, 0x7f, 0xe5, 0x8f,
309 	0xee, 0x7d, 0x11, 0x31, 0x7d, 0xf2, 0xe8, 0x50,
310 	0xd9, 0x60, 0xc7, 0xdd, 0x10, 0xd1, 0x0b, 0xa7,
311 	0x14, 0xc8, 0xa6, 0x09, 0xd1, 0x63, 0x50, 0x2b,
312 	0x79, 0xd6, 0x82, 0xe8, 0xbb, 0xec, 0xd4, 0xf5,
313 	0x25, 0x91, 0xd2, 0x74, 0x85, 0x33, 0xe4, 0x5a,
314 	0x86, 0x7a
315 };
316 
317 static uint8_t pubkey_y_secp521r1[] = {
318 	0x01, 0x97, 0xac, 0x64, 0x16, 0x11, 0x1c, 0xcf,
319 	0x98, 0x7d, 0x29, 0x04, 0x59, 0xeb, 0xc8, 0xad,
320 	0x9e, 0xc5, 0x6e, 0x49, 0x05, 0x9c, 0x99, 0x21,
321 	0x55, 0x53, 0x9a, 0x36, 0xa6, 0x26, 0x63, 0x1f,
322 	0x4a, 0x2d, 0x89, 0x16, 0x4b, 0x98, 0x51, 0x54,
323 	0xf2, 0xdd, 0xdc, 0x02, 0x81, 0xee, 0x5b, 0x51,
324 	0x78, 0x27, 0x1f, 0x3a, 0x76, 0xa0, 0x91, 0x4c,
325 	0x3f, 0xcd, 0x1f, 0x97, 0xbe, 0x8e, 0x83, 0x76,
326 	0xef, 0xb3
327 };
328 
329 struct crypto_testsuite_ecpm_params ecpm_param_secp521r1 = {
330 	.gen_x = {
331 		.data = gen_x_secp521r1,
332 		.length = sizeof(gen_x_secp521r1),
333 	},
334 	.gen_y = {
335 		.data = gen_y_secp521r1,
336 		.length = sizeof(gen_y_secp521r1),
337 	},
338 	.privkey = {
339 		.data = privkey_secp521r1,
340 		.length = sizeof(privkey_secp521r1),
341 	},
342 	.pubkey_x = {
343 		.data = pubkey_x_secp521r1,
344 		.length = sizeof(pubkey_x_secp521r1),
345 	},
346 	.pubkey_y = {
347 		.data = pubkey_y_secp521r1,
348 		.length = sizeof(pubkey_y_secp521r1),
349 	},
350 	.curve = RTE_CRYPTO_EC_GROUP_SECP521R1
351 };
352 
353 #endif /* __TEST_CRYPTODEV_ECPM_TEST_VECTORS_H__ */
354