VirtualBox

source: vbox/trunk/src/libs/openssl-3.0.7/test/poly1305_internal_test.c@ 97673

最後變更 在這個檔案從97673是 94320,由 vboxsync 提交於 3 年 前

libs/openssl-3.0.1: Export to OSE and fix copyright headers in Makefiles, bugref:10128

檔案大小: 56.2 KB
 
1/*
2 * Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.
3 *
4 * Licensed under the Apache License 2.0 (the "License"). You may not use
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
8 */
9
10/* Internal tests for the poly1305 module */
11
12#include <stdio.h>
13#include <string.h>
14
15#include "testutil.h"
16#include "crypto/poly1305.h"
17#include "internal/nelem.h"
18
19typedef struct {
20 size_t size;
21 const unsigned char data[1024];
22} SIZED_DATA;
23
24typedef struct {
25 SIZED_DATA input;
26 SIZED_DATA key;
27 SIZED_DATA expected;
28} TESTDATA;
29
30/**********************************************************************
31 *
32 * Test of poly1305 internal functions
33 *
34 ***/
35
36static TESTDATA tests[] = {
37 /*
38 * RFC7539
39 */
40 {
41 {
42 34,
43 {
44 0x43, 0x72, 0x79, 0x70, 0x74, 0x6f, 0x67, 0x72,
45 0x61, 0x70, 0x68, 0x69, 0x63, 0x20, 0x46, 0x6f,
46 0x72, 0x75, 0x6d, 0x20, 0x52, 0x65, 0x73, 0x65,
47 0x61, 0x72, 0x63, 0x68, 0x20, 0x47, 0x72, 0x6f,
48
49 0x75, 0x70
50 }
51 },
52 {
53 32,
54 {
55 0x85, 0xd6, 0xbe, 0x78, 0x57, 0x55, 0x6d, 0x33,
56 0x7f, 0x44, 0x52, 0xfe, 0x42, 0xd5, 0x06, 0xa8,
57 0x01, 0x03, 0x80, 0x8a, 0xfb, 0x0d, 0xb2, 0xfd,
58 0x4a, 0xbf, 0xf6, 0xaf, 0x41, 0x49, 0xf5, 0x1b
59 }
60 },
61 {
62 16,
63 {
64 0xa8, 0x06, 0x1d, 0xc1, 0x30, 0x51, 0x36, 0xc6,
65 0xc2, 0x2b, 0x8b, 0xaf, 0x0c, 0x01, 0x27, 0xa9
66 }
67 }
68 },
69 /*
70 * test vectors from "The Poly1305-AES message-authentication code"
71 */
72 {
73 {
74 2,
75 {
76 0xf3, 0xf6
77 }
78 },
79 {
80 32,
81 {
82 0x85, 0x1f, 0xc4, 0x0c, 0x34, 0x67, 0xac, 0x0b,
83 0xe0, 0x5c, 0xc2, 0x04, 0x04, 0xf3, 0xf7, 0x00,
84 0x58, 0x0b, 0x3b, 0x0f, 0x94, 0x47, 0xbb, 0x1e,
85 0x69, 0xd0, 0x95, 0xb5, 0x92, 0x8b, 0x6d, 0xbc
86 }
87 },
88 {
89 16,
90 {
91 0xf4, 0xc6, 0x33, 0xc3, 0x04, 0x4f, 0xc1, 0x45,
92 0xf8, 0x4f, 0x33, 0x5c, 0xb8, 0x19, 0x53, 0xde
93 }
94 }
95 },
96 {
97 {
98 0,
99 {
100 0
101 }
102 },
103 {
104 32,
105 {
106 0xa0, 0xf3, 0x08, 0x00, 0x00, 0xf4, 0x64, 0x00,
107 0xd0, 0xc7, 0xe9, 0x07, 0x6c, 0x83, 0x44, 0x03,
108 0xdd, 0x3f, 0xab, 0x22, 0x51, 0xf1, 0x1a, 0xc7,
109 0x59, 0xf0, 0x88, 0x71, 0x29, 0xcc, 0x2e, 0xe7
110 }
111 },
112 {
113 16,
114 {
115 0xdd, 0x3f, 0xab, 0x22, 0x51, 0xf1, 0x1a, 0xc7,
116 0x59, 0xf0, 0x88, 0x71, 0x29, 0xcc, 0x2e, 0xe7
117 }
118 }
119 },
120 {
121 {
122 32,
123 {
124 0x66, 0x3c, 0xea, 0x19, 0x0f, 0xfb, 0x83, 0xd8,
125 0x95, 0x93, 0xf3, 0xf4, 0x76, 0xb6, 0xbc, 0x24,
126 0xd7, 0xe6, 0x79, 0x10, 0x7e, 0xa2, 0x6a, 0xdb,
127 0x8c, 0xaf, 0x66, 0x52, 0xd0, 0x65, 0x61, 0x36
128 }
129 },
130 {
131 32,
132 {
133 0x48, 0x44, 0x3d, 0x0b, 0xb0, 0xd2, 0x11, 0x09,
134 0xc8, 0x9a, 0x10, 0x0b, 0x5c, 0xe2, 0xc2, 0x08,
135 0x83, 0x14, 0x9c, 0x69, 0xb5, 0x61, 0xdd, 0x88,
136 0x29, 0x8a, 0x17, 0x98, 0xb1, 0x07, 0x16, 0xef
137 }
138 },
139 {
140 16,
141 {
142 0x0e, 0xe1, 0xc1, 0x6b, 0xb7, 0x3f, 0x0f, 0x4f,
143 0xd1, 0x98, 0x81, 0x75, 0x3c, 0x01, 0xcd, 0xbe
144 }
145 }
146 },
147 {
148 {
149 63,
150 {
151 0xab, 0x08, 0x12, 0x72, 0x4a, 0x7f, 0x1e, 0x34,
152 0x27, 0x42, 0xcb, 0xed, 0x37, 0x4d, 0x94, 0xd1,
153 0x36, 0xc6, 0xb8, 0x79, 0x5d, 0x45, 0xb3, 0x81,
154 0x98, 0x30, 0xf2, 0xc0, 0x44, 0x91, 0xfa, 0xf0,
155
156 0x99, 0x0c, 0x62, 0xe4, 0x8b, 0x80, 0x18, 0xb2,
157 0xc3, 0xe4, 0xa0, 0xfa, 0x31, 0x34, 0xcb, 0x67,
158 0xfa, 0x83, 0xe1, 0x58, 0xc9, 0x94, 0xd9, 0x61,
159 0xc4, 0xcb, 0x21, 0x09, 0x5c, 0x1b, 0xf9
160 }
161 },
162 {
163 32,
164 {
165 0x12, 0x97, 0x6a, 0x08, 0xc4, 0x42, 0x6d, 0x0c,
166 0xe8, 0xa8, 0x24, 0x07, 0xc4, 0xf4, 0x82, 0x07,
167 0x80, 0xf8, 0xc2, 0x0a, 0xa7, 0x12, 0x02, 0xd1,
168 0xe2, 0x91, 0x79, 0xcb, 0xcb, 0x55, 0x5a, 0x57
169 }
170 },
171 {
172 16,
173 {
174 0x51, 0x54, 0xad, 0x0d, 0x2c, 0xb2, 0x6e, 0x01,
175 0x27, 0x4f, 0xc5, 0x11, 0x48, 0x49, 0x1f, 0x1b
176 }
177 },
178 },
179 /*
180 * self-generated vectors exercise "significant" lengths, such that
181 * are handled by different code paths
182 */
183 {
184 {
185 64,
186 {
187 0xab, 0x08, 0x12, 0x72, 0x4a, 0x7f, 0x1e, 0x34,
188 0x27, 0x42, 0xcb, 0xed, 0x37, 0x4d, 0x94, 0xd1,
189 0x36, 0xc6, 0xb8, 0x79, 0x5d, 0x45, 0xb3, 0x81,
190 0x98, 0x30, 0xf2, 0xc0, 0x44, 0x91, 0xfa, 0xf0,
191
192 0x99, 0x0c, 0x62, 0xe4, 0x8b, 0x80, 0x18, 0xb2,
193 0xc3, 0xe4, 0xa0, 0xfa, 0x31, 0x34, 0xcb, 0x67,
194 0xfa, 0x83, 0xe1, 0x58, 0xc9, 0x94, 0xd9, 0x61,
195 0xc4, 0xcb, 0x21, 0x09, 0x5c, 0x1b, 0xf9, 0xaf
196 }
197 },
198 {
199 32,
200 {
201 0x12, 0x97, 0x6a, 0x08, 0xc4, 0x42, 0x6d, 0x0c,
202 0xe8, 0xa8, 0x24, 0x07, 0xc4, 0xf4, 0x82, 0x07,
203 0x80, 0xf8, 0xc2, 0x0a, 0xa7, 0x12, 0x02, 0xd1,
204 0xe2, 0x91, 0x79, 0xcb, 0xcb, 0x55, 0x5a, 0x57
205 }
206 },
207 {
208 16,
209 {
210 0x81, 0x20, 0x59, 0xa5, 0xda, 0x19, 0x86, 0x37,
211 0xca, 0xc7, 0xc4, 0xa6, 0x31, 0xbe, 0xe4, 0x66
212 }
213 },
214 },
215 {
216 {
217 48,
218 {
219 0xab, 0x08, 0x12, 0x72, 0x4a, 0x7f, 0x1e, 0x34,
220 0x27, 0x42, 0xcb, 0xed, 0x37, 0x4d, 0x94, 0xd1,
221 0x36, 0xc6, 0xb8, 0x79, 0x5d, 0x45, 0xb3, 0x81,
222 0x98, 0x30, 0xf2, 0xc0, 0x44, 0x91, 0xfa, 0xf0,
223
224 0x99, 0x0c, 0x62, 0xe4, 0x8b, 0x80, 0x18, 0xb2,
225 0xc3, 0xe4, 0xa0, 0xfa, 0x31, 0x34, 0xcb, 0x67
226 }
227 },
228 {
229 32,
230 {
231 0x12, 0x97, 0x6a, 0x08, 0xc4, 0x42, 0x6d, 0x0c,
232 0xe8, 0xa8, 0x24, 0x07, 0xc4, 0xf4, 0x82, 0x07,
233 0x80, 0xf8, 0xc2, 0x0a, 0xa7, 0x12, 0x02, 0xd1,
234 0xe2, 0x91, 0x79, 0xcb, 0xcb, 0x55, 0x5a, 0x57
235
236 }
237 },
238 {
239 16,
240 {
241 0x5b, 0x88, 0xd7, 0xf6, 0x22, 0x8b, 0x11, 0xe2,
242 0xe2, 0x85, 0x79, 0xa5, 0xc0, 0xc1, 0xf7, 0x61
243 }
244 },
245 },
246 {
247 {
248 96,
249 {
250 0xab, 0x08, 0x12, 0x72, 0x4a, 0x7f, 0x1e, 0x34,
251 0x27, 0x42, 0xcb, 0xed, 0x37, 0x4d, 0x94, 0xd1,
252 0x36, 0xc6, 0xb8, 0x79, 0x5d, 0x45, 0xb3, 0x81,
253 0x98, 0x30, 0xf2, 0xc0, 0x44, 0x91, 0xfa, 0xf0,
254
255 0x99, 0x0c, 0x62, 0xe4, 0x8b, 0x80, 0x18, 0xb2,
256 0xc3, 0xe4, 0xa0, 0xfa, 0x31, 0x34, 0xcb, 0x67,
257 0xfa, 0x83, 0xe1, 0x58, 0xc9, 0x94, 0xd9, 0x61,
258 0xc4, 0xcb, 0x21, 0x09, 0x5c, 0x1b, 0xf9, 0xaf,
259
260 0x66, 0x3c, 0xea, 0x19, 0x0f, 0xfb, 0x83, 0xd8,
261 0x95, 0x93, 0xf3, 0xf4, 0x76, 0xb6, 0xbc, 0x24,
262 0xd7, 0xe6, 0x79, 0x10, 0x7e, 0xa2, 0x6a, 0xdb,
263 0x8c, 0xaf, 0x66, 0x52, 0xd0, 0x65, 0x61, 0x36
264 }
265 },
266 {
267 32,
268 {
269 0x12, 0x97, 0x6a, 0x08, 0xc4, 0x42, 0x6d, 0x0c,
270 0xe8, 0xa8, 0x24, 0x07, 0xc4, 0xf4, 0x82, 0x07,
271 0x80, 0xf8, 0xc2, 0x0a, 0xa7, 0x12, 0x02, 0xd1,
272 0xe2, 0x91, 0x79, 0xcb, 0xcb, 0x55, 0x5a, 0x57
273 }
274 },
275 {
276 16,
277 {
278 0xbb, 0xb6, 0x13, 0xb2, 0xb6, 0xd7, 0x53, 0xba,
279 0x07, 0x39, 0x5b, 0x91, 0x6a, 0xae, 0xce, 0x15
280 }
281 },
282 },
283 {
284 {
285 112,
286 {
287 0xab, 0x08, 0x12, 0x72, 0x4a, 0x7f, 0x1e, 0x34,
288 0x27, 0x42, 0xcb, 0xed, 0x37, 0x4d, 0x94, 0xd1,
289 0x36, 0xc6, 0xb8, 0x79, 0x5d, 0x45, 0xb3, 0x81,
290 0x98, 0x30, 0xf2, 0xc0, 0x44, 0x91, 0xfa, 0xf0,
291
292 0x99, 0x0c, 0x62, 0xe4, 0x8b, 0x80, 0x18, 0xb2,
293 0xc3, 0xe4, 0xa0, 0xfa, 0x31, 0x34, 0xcb, 0x67,
294 0xfa, 0x83, 0xe1, 0x58, 0xc9, 0x94, 0xd9, 0x61,
295 0xc4, 0xcb, 0x21, 0x09, 0x5c, 0x1b, 0xf9, 0xaf,
296
297 0x48, 0x44, 0x3d, 0x0b, 0xb0, 0xd2, 0x11, 0x09,
298 0xc8, 0x9a, 0x10, 0x0b, 0x5c, 0xe2, 0xc2, 0x08,
299 0x83, 0x14, 0x9c, 0x69, 0xb5, 0x61, 0xdd, 0x88,
300 0x29, 0x8a, 0x17, 0x98, 0xb1, 0x07, 0x16, 0xef,
301
302 0x66, 0x3c, 0xea, 0x19, 0x0f, 0xfb, 0x83, 0xd8,
303 0x95, 0x93, 0xf3, 0xf4, 0x76, 0xb6, 0xbc, 0x24
304 }
305 },
306 {
307 32,
308 {
309 0x12, 0x97, 0x6a, 0x08, 0xc4, 0x42, 0x6d, 0x0c,
310 0xe8, 0xa8, 0x24, 0x07, 0xc4, 0xf4, 0x82, 0x07,
311 0x80, 0xf8, 0xc2, 0x0a, 0xa7, 0x12, 0x02, 0xd1,
312 0xe2, 0x91, 0x79, 0xcb, 0xcb, 0x55, 0x5a, 0x57
313 }
314 },
315 {
316 16,
317 {
318 0xc7, 0x94, 0xd7, 0x05, 0x7d, 0x17, 0x78, 0xc4,
319 0xbb, 0xee, 0x0a, 0x39, 0xb3, 0xd9, 0x73, 0x42
320 }
321 },
322 },
323 {
324 {
325 128,
326 {
327 0xab, 0x08, 0x12, 0x72, 0x4a, 0x7f, 0x1e, 0x34,
328 0x27, 0x42, 0xcb, 0xed, 0x37, 0x4d, 0x94, 0xd1,
329 0x36, 0xc6, 0xb8, 0x79, 0x5d, 0x45, 0xb3, 0x81,
330 0x98, 0x30, 0xf2, 0xc0, 0x44, 0x91, 0xfa, 0xf0,
331
332 0x99, 0x0c, 0x62, 0xe4, 0x8b, 0x80, 0x18, 0xb2,
333 0xc3, 0xe4, 0xa0, 0xfa, 0x31, 0x34, 0xcb, 0x67,
334 0xfa, 0x83, 0xe1, 0x58, 0xc9, 0x94, 0xd9, 0x61,
335 0xc4, 0xcb, 0x21, 0x09, 0x5c, 0x1b, 0xf9, 0xaf,
336
337 0x48, 0x44, 0x3d, 0x0b, 0xb0, 0xd2, 0x11, 0x09,
338 0xc8, 0x9a, 0x10, 0x0b, 0x5c, 0xe2, 0xc2, 0x08,
339 0x83, 0x14, 0x9c, 0x69, 0xb5, 0x61, 0xdd, 0x88,
340 0x29, 0x8a, 0x17, 0x98, 0xb1, 0x07, 0x16, 0xef,
341
342 0x66, 0x3c, 0xea, 0x19, 0x0f, 0xfb, 0x83, 0xd8,
343 0x95, 0x93, 0xf3, 0xf4, 0x76, 0xb6, 0xbc, 0x24,
344 0xd7, 0xe6, 0x79, 0x10, 0x7e, 0xa2, 0x6a, 0xdb,
345 0x8c, 0xaf, 0x66, 0x52, 0xd0, 0x65, 0x61, 0x36
346 }
347 },
348 {
349 32,
350 {
351 0x12, 0x97, 0x6a, 0x08, 0xc4, 0x42, 0x6d, 0x0c,
352 0xe8, 0xa8, 0x24, 0x07, 0xc4, 0xf4, 0x82, 0x07,
353 0x80, 0xf8, 0xc2, 0x0a, 0xa7, 0x12, 0x02, 0xd1,
354 0xe2, 0x91, 0x79, 0xcb, 0xcb, 0x55, 0x5a, 0x57
355 }
356 },
357 {
358 16,
359 {
360 0xff, 0xbc, 0xb9, 0xb3, 0x71, 0x42, 0x31, 0x52,
361 0xd7, 0xfc, 0xa5, 0xad, 0x04, 0x2f, 0xba, 0xa9
362 }
363 },
364 },
365 {
366 {
367 144,
368 {
369 0xab, 0x08, 0x12, 0x72, 0x4a, 0x7f, 0x1e, 0x34,
370 0x27, 0x42, 0xcb, 0xed, 0x37, 0x4d, 0x94, 0xd1,
371 0x36, 0xc6, 0xb8, 0x79, 0x5d, 0x45, 0xb3, 0x81,
372 0x98, 0x30, 0xf2, 0xc0, 0x44, 0x91, 0xfa, 0xf0,
373
374 0x99, 0x0c, 0x62, 0xe4, 0x8b, 0x80, 0x18, 0xb2,
375 0xc3, 0xe4, 0xa0, 0xfa, 0x31, 0x34, 0xcb, 0x67,
376 0xfa, 0x83, 0xe1, 0x58, 0xc9, 0x94, 0xd9, 0x61,
377 0xc4, 0xcb, 0x21, 0x09, 0x5c, 0x1b, 0xf9, 0xaf,
378
379 0x48, 0x44, 0x3d, 0x0b, 0xb0, 0xd2, 0x11, 0x09,
380 0xc8, 0x9a, 0x10, 0x0b, 0x5c, 0xe2, 0xc2, 0x08,
381 0x83, 0x14, 0x9c, 0x69, 0xb5, 0x61, 0xdd, 0x88,
382 0x29, 0x8a, 0x17, 0x98, 0xb1, 0x07, 0x16, 0xef,
383
384 0x66, 0x3c, 0xea, 0x19, 0x0f, 0xfb, 0x83, 0xd8,
385 0x95, 0x93, 0xf3, 0xf4, 0x76, 0xb6, 0xbc, 0x24,
386 0xd7, 0xe6, 0x79, 0x10, 0x7e, 0xa2, 0x6a, 0xdb,
387 0x8c, 0xaf, 0x66, 0x52, 0xd0, 0x65, 0x61, 0x36,
388
389 0x81, 0x20, 0x59, 0xa5, 0xda, 0x19, 0x86, 0x37,
390 0xca, 0xc7, 0xc4, 0xa6, 0x31, 0xbe, 0xe4, 0x66
391 }
392 },
393 {
394 32,
395 {
396 0x12, 0x97, 0x6a, 0x08, 0xc4, 0x42, 0x6d, 0x0c,
397 0xe8, 0xa8, 0x24, 0x07, 0xc4, 0xf4, 0x82, 0x07,
398 0x80, 0xf8, 0xc2, 0x0a, 0xa7, 0x12, 0x02, 0xd1,
399 0xe2, 0x91, 0x79, 0xcb, 0xcb, 0x55, 0x5a, 0x57
400 }
401 },
402 {
403 16,
404 {
405 0x06, 0x9e, 0xd6, 0xb8, 0xef, 0x0f, 0x20, 0x7b,
406 0x3e, 0x24, 0x3b, 0xb1, 0x01, 0x9f, 0xe6, 0x32
407 }
408 },
409 },
410 {
411 {
412 160,
413 {
414 0xab, 0x08, 0x12, 0x72, 0x4a, 0x7f, 0x1e, 0x34,
415 0x27, 0x42, 0xcb, 0xed, 0x37, 0x4d, 0x94, 0xd1,
416 0x36, 0xc6, 0xb8, 0x79, 0x5d, 0x45, 0xb3, 0x81,
417 0x98, 0x30, 0xf2, 0xc0, 0x44, 0x91, 0xfa, 0xf0,
418
419 0x99, 0x0c, 0x62, 0xe4, 0x8b, 0x80, 0x18, 0xb2,
420 0xc3, 0xe4, 0xa0, 0xfa, 0x31, 0x34, 0xcb, 0x67,
421 0xfa, 0x83, 0xe1, 0x58, 0xc9, 0x94, 0xd9, 0x61,
422 0xc4, 0xcb, 0x21, 0x09, 0x5c, 0x1b, 0xf9, 0xaf,
423
424 0x48, 0x44, 0x3d, 0x0b, 0xb0, 0xd2, 0x11, 0x09,
425 0xc8, 0x9a, 0x10, 0x0b, 0x5c, 0xe2, 0xc2, 0x08,
426 0x83, 0x14, 0x9c, 0x69, 0xb5, 0x61, 0xdd, 0x88,
427 0x29, 0x8a, 0x17, 0x98, 0xb1, 0x07, 0x16, 0xef,
428
429 0x66, 0x3c, 0xea, 0x19, 0x0f, 0xfb, 0x83, 0xd8,
430 0x95, 0x93, 0xf3, 0xf4, 0x76, 0xb6, 0xbc, 0x24,
431 0xd7, 0xe6, 0x79, 0x10, 0x7e, 0xa2, 0x6a, 0xdb,
432 0x8c, 0xaf, 0x66, 0x52, 0xd0, 0x65, 0x61, 0x36,
433
434 0x81, 0x20, 0x59, 0xa5, 0xda, 0x19, 0x86, 0x37,
435 0xca, 0xc7, 0xc4, 0xa6, 0x31, 0xbe, 0xe4, 0x66,
436 0x5b, 0x88, 0xd7, 0xf6, 0x22, 0x8b, 0x11, 0xe2,
437 0xe2, 0x85, 0x79, 0xa5, 0xc0, 0xc1, 0xf7, 0x61
438 }
439 },
440 {
441 32,
442 {
443 0x12, 0x97, 0x6a, 0x08, 0xc4, 0x42, 0x6d, 0x0c,
444 0xe8, 0xa8, 0x24, 0x07, 0xc4, 0xf4, 0x82, 0x07,
445 0x80, 0xf8, 0xc2, 0x0a, 0xa7, 0x12, 0x02, 0xd1,
446 0xe2, 0x91, 0x79, 0xcb, 0xcb, 0x55, 0x5a, 0x57
447 }
448 },
449 {
450 16,
451 {
452 0xcc, 0xa3, 0x39, 0xd9, 0xa4, 0x5f, 0xa2, 0x36,
453 0x8c, 0x2c, 0x68, 0xb3, 0xa4, 0x17, 0x91, 0x33
454 }
455 },
456 },
457 {
458 {
459 288,
460 {
461 0xab, 0x08, 0x12, 0x72, 0x4a, 0x7f, 0x1e, 0x34,
462 0x27, 0x42, 0xcb, 0xed, 0x37, 0x4d, 0x94, 0xd1,
463 0x36, 0xc6, 0xb8, 0x79, 0x5d, 0x45, 0xb3, 0x81,
464 0x98, 0x30, 0xf2, 0xc0, 0x44, 0x91, 0xfa, 0xf0,
465
466 0x99, 0x0c, 0x62, 0xe4, 0x8b, 0x80, 0x18, 0xb2,
467 0xc3, 0xe4, 0xa0, 0xfa, 0x31, 0x34, 0xcb, 0x67,
468 0xfa, 0x83, 0xe1, 0x58, 0xc9, 0x94, 0xd9, 0x61,
469 0xc4, 0xcb, 0x21, 0x09, 0x5c, 0x1b, 0xf9, 0xaf,
470
471 0x48, 0x44, 0x3d, 0x0b, 0xb0, 0xd2, 0x11, 0x09,
472 0xc8, 0x9a, 0x10, 0x0b, 0x5c, 0xe2, 0xc2, 0x08,
473 0x83, 0x14, 0x9c, 0x69, 0xb5, 0x61, 0xdd, 0x88,
474 0x29, 0x8a, 0x17, 0x98, 0xb1, 0x07, 0x16, 0xef,
475
476 0x66, 0x3c, 0xea, 0x19, 0x0f, 0xfb, 0x83, 0xd8,
477 0x95, 0x93, 0xf3, 0xf4, 0x76, 0xb6, 0xbc, 0x24,
478 0xd7, 0xe6, 0x79, 0x10, 0x7e, 0xa2, 0x6a, 0xdb,
479 0x8c, 0xaf, 0x66, 0x52, 0xd0, 0x65, 0x61, 0x36,
480
481 0x81, 0x20, 0x59, 0xa5, 0xda, 0x19, 0x86, 0x37,
482 0xca, 0xc7, 0xc4, 0xa6, 0x31, 0xbe, 0xe4, 0x66,
483 0x5b, 0x88, 0xd7, 0xf6, 0x22, 0x8b, 0x11, 0xe2,
484 0xe2, 0x85, 0x79, 0xa5, 0xc0, 0xc1, 0xf7, 0x61,
485
486 0xab, 0x08, 0x12, 0x72, 0x4a, 0x7f, 0x1e, 0x34,
487 0x27, 0x42, 0xcb, 0xed, 0x37, 0x4d, 0x94, 0xd1,
488 0x36, 0xc6, 0xb8, 0x79, 0x5d, 0x45, 0xb3, 0x81,
489 0x98, 0x30, 0xf2, 0xc0, 0x44, 0x91, 0xfa, 0xf0,
490
491 0x99, 0x0c, 0x62, 0xe4, 0x8b, 0x80, 0x18, 0xb2,
492 0xc3, 0xe4, 0xa0, 0xfa, 0x31, 0x34, 0xcb, 0x67,
493 0xfa, 0x83, 0xe1, 0x58, 0xc9, 0x94, 0xd9, 0x61,
494 0xc4, 0xcb, 0x21, 0x09, 0x5c, 0x1b, 0xf9, 0xaf,
495
496 0x48, 0x44, 0x3d, 0x0b, 0xb0, 0xd2, 0x11, 0x09,
497 0xc8, 0x9a, 0x10, 0x0b, 0x5c, 0xe2, 0xc2, 0x08,
498 0x83, 0x14, 0x9c, 0x69, 0xb5, 0x61, 0xdd, 0x88,
499 0x29, 0x8a, 0x17, 0x98, 0xb1, 0x07, 0x16, 0xef,
500
501 0x66, 0x3c, 0xea, 0x19, 0x0f, 0xfb, 0x83, 0xd8,
502 0x95, 0x93, 0xf3, 0xf4, 0x76, 0xb6, 0xbc, 0x24,
503 0xd7, 0xe6, 0x79, 0x10, 0x7e, 0xa2, 0x6a, 0xdb,
504 0x8c, 0xaf, 0x66, 0x52, 0xd0, 0x65, 0x61, 0x36
505 }
506 },
507 {
508 32,
509 {
510 0x12, 0x97, 0x6a, 0x08, 0xc4, 0x42, 0x6d, 0x0c,
511 0xe8, 0xa8, 0x24, 0x07, 0xc4, 0xf4, 0x82, 0x07,
512 0x80, 0xf8, 0xc2, 0x0a, 0xa7, 0x12, 0x02, 0xd1,
513 0xe2, 0x91, 0x79, 0xcb, 0xcb, 0x55, 0x5a, 0x57
514 }
515 },
516 {
517 16,
518 {
519 0x53, 0xf6, 0xe8, 0x28, 0xa2, 0xf0, 0xfe, 0x0e,
520 0xe8, 0x15, 0xbf, 0x0b, 0xd5, 0x84, 0x1a, 0x34
521 }
522 },
523 },
524 {
525 {
526 320,
527 {
528 0xab, 0x08, 0x12, 0x72, 0x4a, 0x7f, 0x1e, 0x34,
529 0x27, 0x42, 0xcb, 0xed, 0x37, 0x4d, 0x94, 0xd1,
530 0x36, 0xc6, 0xb8, 0x79, 0x5d, 0x45, 0xb3, 0x81,
531 0x98, 0x30, 0xf2, 0xc0, 0x44, 0x91, 0xfa, 0xf0,
532
533 0x99, 0x0c, 0x62, 0xe4, 0x8b, 0x80, 0x18, 0xb2,
534 0xc3, 0xe4, 0xa0, 0xfa, 0x31, 0x34, 0xcb, 0x67,
535 0xfa, 0x83, 0xe1, 0x58, 0xc9, 0x94, 0xd9, 0x61,
536 0xc4, 0xcb, 0x21, 0x09, 0x5c, 0x1b, 0xf9, 0xaf,
537
538 0x48, 0x44, 0x3d, 0x0b, 0xb0, 0xd2, 0x11, 0x09,
539 0xc8, 0x9a, 0x10, 0x0b, 0x5c, 0xe2, 0xc2, 0x08,
540 0x83, 0x14, 0x9c, 0x69, 0xb5, 0x61, 0xdd, 0x88,
541 0x29, 0x8a, 0x17, 0x98, 0xb1, 0x07, 0x16, 0xef,
542
543 0x66, 0x3c, 0xea, 0x19, 0x0f, 0xfb, 0x83, 0xd8,
544 0x95, 0x93, 0xf3, 0xf4, 0x76, 0xb6, 0xbc, 0x24,
545 0xd7, 0xe6, 0x79, 0x10, 0x7e, 0xa2, 0x6a, 0xdb,
546 0x8c, 0xaf, 0x66, 0x52, 0xd0, 0x65, 0x61, 0x36,
547
548 0x81, 0x20, 0x59, 0xa5, 0xda, 0x19, 0x86, 0x37,
549 0xca, 0xc7, 0xc4, 0xa6, 0x31, 0xbe, 0xe4, 0x66,
550 0x5b, 0x88, 0xd7, 0xf6, 0x22, 0x8b, 0x11, 0xe2,
551 0xe2, 0x85, 0x79, 0xa5, 0xc0, 0xc1, 0xf7, 0x61,
552
553 0xab, 0x08, 0x12, 0x72, 0x4a, 0x7f, 0x1e, 0x34,
554 0x27, 0x42, 0xcb, 0xed, 0x37, 0x4d, 0x94, 0xd1,
555 0x36, 0xc6, 0xb8, 0x79, 0x5d, 0x45, 0xb3, 0x81,
556 0x98, 0x30, 0xf2, 0xc0, 0x44, 0x91, 0xfa, 0xf0,
557
558 0x99, 0x0c, 0x62, 0xe4, 0x8b, 0x80, 0x18, 0xb2,
559 0xc3, 0xe4, 0xa0, 0xfa, 0x31, 0x34, 0xcb, 0x67,
560 0xfa, 0x83, 0xe1, 0x58, 0xc9, 0x94, 0xd9, 0x61,
561 0xc4, 0xcb, 0x21, 0x09, 0x5c, 0x1b, 0xf9, 0xaf,
562
563 0x48, 0x44, 0x3d, 0x0b, 0xb0, 0xd2, 0x11, 0x09,
564 0xc8, 0x9a, 0x10, 0x0b, 0x5c, 0xe2, 0xc2, 0x08,
565 0x83, 0x14, 0x9c, 0x69, 0xb5, 0x61, 0xdd, 0x88,
566 0x29, 0x8a, 0x17, 0x98, 0xb1, 0x07, 0x16, 0xef,
567
568 0x66, 0x3c, 0xea, 0x19, 0x0f, 0xfb, 0x83, 0xd8,
569 0x95, 0x93, 0xf3, 0xf4, 0x76, 0xb6, 0xbc, 0x24,
570 0xd7, 0xe6, 0x79, 0x10, 0x7e, 0xa2, 0x6a, 0xdb,
571 0x8c, 0xaf, 0x66, 0x52, 0xd0, 0x65, 0x61, 0x36,
572
573 0x81, 0x20, 0x59, 0xa5, 0xda, 0x19, 0x86, 0x37,
574 0xca, 0xc7, 0xc4, 0xa6, 0x31, 0xbe, 0xe4, 0x66,
575 0x5b, 0x88, 0xd7, 0xf6, 0x22, 0x8b, 0x11, 0xe2,
576 0xe2, 0x85, 0x79, 0xa5, 0xc0, 0xc1, 0xf7, 0x61
577 }
578 },
579 {
580 32,
581 {
582 0x12, 0x97, 0x6a, 0x08, 0xc4, 0x42, 0x6d, 0x0c,
583 0xe8, 0xa8, 0x24, 0x07, 0xc4, 0xf4, 0x82, 0x07,
584 0x80, 0xf8, 0xc2, 0x0a, 0xa7, 0x12, 0x02, 0xd1,
585 0xe2, 0x91, 0x79, 0xcb, 0xcb, 0x55, 0x5a, 0x57
586 }
587 },
588 {
589 16,
590 {
591 0xb8, 0x46, 0xd4, 0x4e, 0x9b, 0xbd, 0x53, 0xce,
592 0xdf, 0xfb, 0xfb, 0xb6, 0xb7, 0xfa, 0x49, 0x33
593 }
594 },
595 },
596 /*
597 * 4th power of the key spills to 131th bit in SIMD key setup
598 */
599 {
600 {
601 256,
602 {
603 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
604 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
605 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
606 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
607
608 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
609 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
610 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
611 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
612
613 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
614 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
615 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
616 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
617
618 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
619 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
620 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
621 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
622
623 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
624 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
625 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
626 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
627
628 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
629 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
630 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
631 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
632
633 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
634 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
635 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
636 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
637
638 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
639 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
640 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
641 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
642 }
643 },
644 {
645 32,
646 {
647 0xad, 0x62, 0x81, 0x07, 0xe8, 0x35, 0x1d, 0x0f,
648 0x2c, 0x23, 0x1a, 0x05, 0xdc, 0x4a, 0x41, 0x06,
649 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
650 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
651 }
652 },
653 {
654 16,
655 {
656 0x07, 0x14, 0x5a, 0x4c, 0x02, 0xfe, 0x5f, 0xa3,
657 0x20, 0x36, 0xde, 0x68, 0xfa, 0xbe, 0x90, 0x66
658 }
659 },
660 },
661 /*
662 * poly1305_ieee754.c failed this in final stage
663 */
664 {
665 {
666 252,
667 {
668 0x84, 0x23, 0x64, 0xe1, 0x56, 0x33, 0x6c, 0x09,
669 0x98, 0xb9, 0x33, 0xa6, 0x23, 0x77, 0x26, 0x18,
670 0x0d, 0x9e, 0x3f, 0xdc, 0xbd, 0xe4, 0xcd, 0x5d,
671 0x17, 0x08, 0x0f, 0xc3, 0xbe, 0xb4, 0x96, 0x14,
672
673 0xd7, 0x12, 0x2c, 0x03, 0x74, 0x63, 0xff, 0x10,
674 0x4d, 0x73, 0xf1, 0x9c, 0x12, 0x70, 0x46, 0x28,
675 0xd4, 0x17, 0xc4, 0xc5, 0x4a, 0x3f, 0xe3, 0x0d,
676 0x3c, 0x3d, 0x77, 0x14, 0x38, 0x2d, 0x43, 0xb0,
677
678 0x38, 0x2a, 0x50, 0xa5, 0xde, 0xe5, 0x4b, 0xe8,
679 0x44, 0xb0, 0x76, 0xe8, 0xdf, 0x88, 0x20, 0x1a,
680 0x1c, 0xd4, 0x3b, 0x90, 0xeb, 0x21, 0x64, 0x3f,
681 0xa9, 0x6f, 0x39, 0xb5, 0x18, 0xaa, 0x83, 0x40,
682
683 0xc9, 0x42, 0xff, 0x3c, 0x31, 0xba, 0xf7, 0xc9,
684 0xbd, 0xbf, 0x0f, 0x31, 0xae, 0x3f, 0xa0, 0x96,
685 0xbf, 0x8c, 0x63, 0x03, 0x06, 0x09, 0x82, 0x9f,
686 0xe7, 0x2e, 0x17, 0x98, 0x24, 0x89, 0x0b, 0xc8,
687
688 0xe0, 0x8c, 0x31, 0x5c, 0x1c, 0xce, 0x2a, 0x83,
689 0x14, 0x4d, 0xbb, 0xff, 0x09, 0xf7, 0x4e, 0x3e,
690 0xfc, 0x77, 0x0b, 0x54, 0xd0, 0x98, 0x4a, 0x8f,
691 0x19, 0xb1, 0x47, 0x19, 0xe6, 0x36, 0x35, 0x64,
692
693 0x1d, 0x6b, 0x1e, 0xed, 0xf6, 0x3e, 0xfb, 0xf0,
694 0x80, 0xe1, 0x78, 0x3d, 0x32, 0x44, 0x54, 0x12,
695 0x11, 0x4c, 0x20, 0xde, 0x0b, 0x83, 0x7a, 0x0d,
696 0xfa, 0x33, 0xd6, 0xb8, 0x28, 0x25, 0xff, 0xf4,
697
698 0x4c, 0x9a, 0x70, 0xea, 0x54, 0xce, 0x47, 0xf0,
699 0x7d, 0xf6, 0x98, 0xe6, 0xb0, 0x33, 0x23, 0xb5,
700 0x30, 0x79, 0x36, 0x4a, 0x5f, 0xc3, 0xe9, 0xdd,
701 0x03, 0x43, 0x92, 0xbd, 0xde, 0x86, 0xdc, 0xcd,
702
703 0xda, 0x94, 0x32, 0x1c, 0x5e, 0x44, 0x06, 0x04,
704 0x89, 0x33, 0x6c, 0xb6, 0x5b, 0xf3, 0x98, 0x9c,
705 0x36, 0xf7, 0x28, 0x2c, 0x2f, 0x5d, 0x2b, 0x88,
706 0x2c, 0x17, 0x1e, 0x74
707 }
708 },
709 {
710 32,
711 {
712 0x95, 0xd5, 0xc0, 0x05, 0x50, 0x3e, 0x51, 0x0d,
713 0x8c, 0xd0, 0xaa, 0x07, 0x2c, 0x4a, 0x4d, 0x06,
714 0x6e, 0xab, 0xc5, 0x2d, 0x11, 0x65, 0x3d, 0xf4,
715 0x7f, 0xbf, 0x63, 0xab, 0x19, 0x8b, 0xcc, 0x26
716 }
717 },
718 {
719 16,
720 {
721 0xf2, 0x48, 0x31, 0x2e, 0x57, 0x8d, 0x9d, 0x58,
722 0xf8, 0xb7, 0xbb, 0x4d, 0x19, 0x10, 0x54, 0x31
723 }
724 },
725 },
726 /*
727 * AVX2 in poly1305-x86.pl failed this with 176+32 split
728 */
729 {
730 {
731 208,
732 {
733 0x24, 0x8a, 0xc3, 0x10, 0x85, 0xb6, 0xc2, 0xad,
734 0xaa, 0xa3, 0x82, 0x59, 0xa0, 0xd7, 0x19, 0x2c,
735 0x5c, 0x35, 0xd1, 0xbb, 0x4e, 0xf3, 0x9a, 0xd9,
736 0x4c, 0x38, 0xd1, 0xc8, 0x24, 0x79, 0xe2, 0xdd,
737
738 0x21, 0x59, 0xa0, 0x77, 0x02, 0x4b, 0x05, 0x89,
739 0xbc, 0x8a, 0x20, 0x10, 0x1b, 0x50, 0x6f, 0x0a,
740 0x1a, 0xd0, 0xbb, 0xab, 0x76, 0xe8, 0x3a, 0x83,
741 0xf1, 0xb9, 0x4b, 0xe6, 0xbe, 0xae, 0x74, 0xe8,
742
743 0x74, 0xca, 0xb6, 0x92, 0xc5, 0x96, 0x3a, 0x75,
744 0x43, 0x6b, 0x77, 0x61, 0x21, 0xec, 0x9f, 0x62,
745 0x39, 0x9a, 0x3e, 0x66, 0xb2, 0xd2, 0x27, 0x07,
746 0xda, 0xe8, 0x19, 0x33, 0xb6, 0x27, 0x7f, 0x3c,
747
748 0x85, 0x16, 0xbc, 0xbe, 0x26, 0xdb, 0xbd, 0x86,
749 0xf3, 0x73, 0x10, 0x3d, 0x7c, 0xf4, 0xca, 0xd1,
750 0x88, 0x8c, 0x95, 0x21, 0x18, 0xfb, 0xfb, 0xd0,
751 0xd7, 0xb4, 0xbe, 0xdc, 0x4a, 0xe4, 0x93, 0x6a,
752
753 0xff, 0x91, 0x15, 0x7e, 0x7a, 0xa4, 0x7c, 0x54,
754 0x44, 0x2e, 0xa7, 0x8d, 0x6a, 0xc2, 0x51, 0xd3,
755 0x24, 0xa0, 0xfb, 0xe4, 0x9d, 0x89, 0xcc, 0x35,
756 0x21, 0xb6, 0x6d, 0x16, 0xe9, 0xc6, 0x6a, 0x37,
757
758 0x09, 0x89, 0x4e, 0x4e, 0xb0, 0xa4, 0xee, 0xdc,
759 0x4a, 0xe1, 0x94, 0x68, 0xe6, 0x6b, 0x81, 0xf2,
760
761 0x71, 0x35, 0x1b, 0x1d, 0x92, 0x1e, 0xa5, 0x51,
762 0x04, 0x7a, 0xbc, 0xc6, 0xb8, 0x7a, 0x90, 0x1f,
763 0xde, 0x7d, 0xb7, 0x9f, 0xa1, 0x81, 0x8c, 0x11,
764 0x33, 0x6d, 0xbc, 0x07, 0x24, 0x4a, 0x40, 0xeb
765 }
766 },
767 {
768 32,
769 {
770 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
771 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
772 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
773 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
774 }
775 },
776 {
777 16,
778 {
779 0xbc, 0x93, 0x9b, 0xc5, 0x28, 0x14, 0x80, 0xfa,
780 0x99, 0xc6, 0xd6, 0x8c, 0x25, 0x8e, 0xc4, 0x2f
781 }
782 },
783 },
784 /*
785 * test vectors from Google
786 */
787 {
788 {
789 0,
790 {
791 0x00,
792 }
793 },
794 {
795 32,
796 {
797 0xc8, 0xaf, 0xaa, 0xc3, 0x31, 0xee, 0x37, 0x2c,
798 0xd6, 0x08, 0x2d, 0xe1, 0x34, 0x94, 0x3b, 0x17,
799 0x47, 0x10, 0x13, 0x0e, 0x9f, 0x6f, 0xea, 0x8d,
800 0x72, 0x29, 0x38, 0x50, 0xa6, 0x67, 0xd8, 0x6c
801 }
802 },
803 {
804 16,
805 {
806 0x47, 0x10, 0x13, 0x0e, 0x9f, 0x6f, 0xea, 0x8d,
807 0x72, 0x29, 0x38, 0x50, 0xa6, 0x67, 0xd8, 0x6c
808 }
809 },
810 },
811 {
812 {
813 12,
814 {
815 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x77, 0x6f,
816 0x72, 0x6c, 0x64, 0x21
817 }
818 },
819 {
820 32,
821 {
822 0x74, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20,
823 0x33, 0x32, 0x2d, 0x62, 0x79, 0x74, 0x65, 0x20,
824 0x6b, 0x65, 0x79, 0x20, 0x66, 0x6f, 0x72, 0x20,
825 0x50, 0x6f, 0x6c, 0x79, 0x31, 0x33, 0x30, 0x35
826 }
827 },
828 {
829 16,
830 {
831 0xa6, 0xf7, 0x45, 0x00, 0x8f, 0x81, 0xc9, 0x16,
832 0xa2, 0x0d, 0xcc, 0x74, 0xee, 0xf2, 0xb2, 0xf0
833 }
834 },
835 },
836 {
837 {
838 32,
839 {
840 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
841 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
842 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
843 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
844 }
845 },
846 {
847 32,
848 {
849 0x74, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20,
850 0x33, 0x32, 0x2d, 0x62, 0x79, 0x74, 0x65, 0x20,
851 0x6b, 0x65, 0x79, 0x20, 0x66, 0x6f, 0x72, 0x20,
852 0x50, 0x6f, 0x6c, 0x79, 0x31, 0x33, 0x30, 0x35
853 }
854 },
855 {
856 16,
857 {
858 0x49, 0xec, 0x78, 0x09, 0x0e, 0x48, 0x1e, 0xc6,
859 0xc2, 0x6b, 0x33, 0xb9, 0x1c, 0xcc, 0x03, 0x07
860 }
861 },
862 },
863 {
864 {
865 128,
866 {
867 0x89, 0xda, 0xb8, 0x0b, 0x77, 0x17, 0xc1, 0xdb,
868 0x5d, 0xb4, 0x37, 0x86, 0x0a, 0x3f, 0x70, 0x21,
869 0x8e, 0x93, 0xe1, 0xb8, 0xf4, 0x61, 0xfb, 0x67,
870 0x7f, 0x16, 0xf3, 0x5f, 0x6f, 0x87, 0xe2, 0xa9,
871
872 0x1c, 0x99, 0xbc, 0x3a, 0x47, 0xac, 0xe4, 0x76,
873 0x40, 0xcc, 0x95, 0xc3, 0x45, 0xbe, 0x5e, 0xcc,
874 0xa5, 0xa3, 0x52, 0x3c, 0x35, 0xcc, 0x01, 0x89,
875 0x3a, 0xf0, 0xb6, 0x4a, 0x62, 0x03, 0x34, 0x27,
876
877 0x03, 0x72, 0xec, 0x12, 0x48, 0x2d, 0x1b, 0x1e,
878 0x36, 0x35, 0x61, 0x69, 0x8a, 0x57, 0x8b, 0x35,
879 0x98, 0x03, 0x49, 0x5b, 0xb4, 0xe2, 0xef, 0x19,
880 0x30, 0xb1, 0x7a, 0x51, 0x90, 0xb5, 0x80, 0xf1,
881
882 0x41, 0x30, 0x0d, 0xf3, 0x0a, 0xdb, 0xec, 0xa2,
883 0x8f, 0x64, 0x27, 0xa8, 0xbc, 0x1a, 0x99, 0x9f,
884 0xd5, 0x1c, 0x55, 0x4a, 0x01, 0x7d, 0x09, 0x5d,
885 0x8c, 0x3e, 0x31, 0x27, 0xda, 0xf9, 0xf5, 0x95
886 }
887 },
888 {
889 32,
890 {
891 0x2d, 0x77, 0x3b, 0xe3, 0x7a, 0xdb, 0x1e, 0x4d,
892 0x68, 0x3b, 0xf0, 0x07, 0x5e, 0x79, 0xc4, 0xee,
893 0x03, 0x79, 0x18, 0x53, 0x5a, 0x7f, 0x99, 0xcc,
894 0xb7, 0x04, 0x0f, 0xb5, 0xf5, 0xf4, 0x3a, 0xea
895 }
896 },
897 {
898 16,
899 {
900 0xc8, 0x5d, 0x15, 0xed, 0x44, 0xc3, 0x78, 0xd6,
901 0xb0, 0x0e, 0x23, 0x06, 0x4c, 0x7b, 0xcd, 0x51
902 }
903 },
904 },
905 {
906 {
907 528,
908 {
909 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b,
910 0x17, 0x03, 0x03, 0x02, 0x00, 0x00, 0x00, 0x00,
911
912 0x06, 0xdb, 0x1f, 0x1f, 0x36, 0x8d, 0x69, 0x6a,
913 0x81, 0x0a, 0x34, 0x9c, 0x0c, 0x71, 0x4c, 0x9a,
914 0x5e, 0x78, 0x50, 0xc2, 0x40, 0x7d, 0x72, 0x1a,
915 0xcd, 0xed, 0x95, 0xe0, 0x18, 0xd7, 0xa8, 0x52,
916
917 0x66, 0xa6, 0xe1, 0x28, 0x9c, 0xdb, 0x4a, 0xeb,
918 0x18, 0xda, 0x5a, 0xc8, 0xa2, 0xb0, 0x02, 0x6d,
919 0x24, 0xa5, 0x9a, 0xd4, 0x85, 0x22, 0x7f, 0x3e,
920 0xae, 0xdb, 0xb2, 0xe7, 0xe3, 0x5e, 0x1c, 0x66,
921
922 0xcd, 0x60, 0xf9, 0xab, 0xf7, 0x16, 0xdc, 0xc9,
923 0xac, 0x42, 0x68, 0x2d, 0xd7, 0xda, 0xb2, 0x87,
924 0xa7, 0x02, 0x4c, 0x4e, 0xef, 0xc3, 0x21, 0xcc,
925 0x05, 0x74, 0xe1, 0x67, 0x93, 0xe3, 0x7c, 0xec,
926
927 0x03, 0xc5, 0xbd, 0xa4, 0x2b, 0x54, 0xc1, 0x14,
928 0xa8, 0x0b, 0x57, 0xaf, 0x26, 0x41, 0x6c, 0x7b,
929 0xe7, 0x42, 0x00, 0x5e, 0x20, 0x85, 0x5c, 0x73,
930 0xe2, 0x1d, 0xc8, 0xe2, 0xed, 0xc9, 0xd4, 0x35,
931
932 0xcb, 0x6f, 0x60, 0x59, 0x28, 0x00, 0x11, 0xc2,
933 0x70, 0xb7, 0x15, 0x70, 0x05, 0x1c, 0x1c, 0x9b,
934 0x30, 0x52, 0x12, 0x66, 0x20, 0xbc, 0x1e, 0x27,
935 0x30, 0xfa, 0x06, 0x6c, 0x7a, 0x50, 0x9d, 0x53,
936
937 0xc6, 0x0e, 0x5a, 0xe1, 0xb4, 0x0a, 0xa6, 0xe3,
938 0x9e, 0x49, 0x66, 0x92, 0x28, 0xc9, 0x0e, 0xec,
939 0xb4, 0xa5, 0x0d, 0xb3, 0x2a, 0x50, 0xbc, 0x49,
940 0xe9, 0x0b, 0x4f, 0x4b, 0x35, 0x9a, 0x1d, 0xfd,
941
942 0x11, 0x74, 0x9c, 0xd3, 0x86, 0x7f, 0xcf, 0x2f,
943 0xb7, 0xbb, 0x6c, 0xd4, 0x73, 0x8f, 0x6a, 0x4a,
944 0xd6, 0xf7, 0xca, 0x50, 0x58, 0xf7, 0x61, 0x88,
945 0x45, 0xaf, 0x9f, 0x02, 0x0f, 0x6c, 0x3b, 0x96,
946
947 0x7b, 0x8f, 0x4c, 0xd4, 0xa9, 0x1e, 0x28, 0x13,
948 0xb5, 0x07, 0xae, 0x66, 0xf2, 0xd3, 0x5c, 0x18,
949 0x28, 0x4f, 0x72, 0x92, 0x18, 0x60, 0x62, 0xe1,
950 0x0f, 0xd5, 0x51, 0x0d, 0x18, 0x77, 0x53, 0x51,
951
952 0xef, 0x33, 0x4e, 0x76, 0x34, 0xab, 0x47, 0x43,
953 0xf5, 0xb6, 0x8f, 0x49, 0xad, 0xca, 0xb3, 0x84,
954 0xd3, 0xfd, 0x75, 0xf7, 0x39, 0x0f, 0x40, 0x06,
955 0xef, 0x2a, 0x29, 0x5c, 0x8c, 0x7a, 0x07, 0x6a,
956
957 0xd5, 0x45, 0x46, 0xcd, 0x25, 0xd2, 0x10, 0x7f,
958 0xbe, 0x14, 0x36, 0xc8, 0x40, 0x92, 0x4a, 0xae,
959 0xbe, 0x5b, 0x37, 0x08, 0x93, 0xcd, 0x63, 0xd1,
960 0x32, 0x5b, 0x86, 0x16, 0xfc, 0x48, 0x10, 0x88,
961
962 0x6b, 0xc1, 0x52, 0xc5, 0x32, 0x21, 0xb6, 0xdf,
963 0x37, 0x31, 0x19, 0x39, 0x32, 0x55, 0xee, 0x72,
964 0xbc, 0xaa, 0x88, 0x01, 0x74, 0xf1, 0x71, 0x7f,
965 0x91, 0x84, 0xfa, 0x91, 0x64, 0x6f, 0x17, 0xa2,
966
967 0x4a, 0xc5, 0x5d, 0x16, 0xbf, 0xdd, 0xca, 0x95,
968 0x81, 0xa9, 0x2e, 0xda, 0x47, 0x92, 0x01, 0xf0,
969 0xed, 0xbf, 0x63, 0x36, 0x00, 0xd6, 0x06, 0x6d,
970 0x1a, 0xb3, 0x6d, 0x5d, 0x24, 0x15, 0xd7, 0x13,
971
972 0x51, 0xbb, 0xcd, 0x60, 0x8a, 0x25, 0x10, 0x8d,
973 0x25, 0x64, 0x19, 0x92, 0xc1, 0xf2, 0x6c, 0x53,
974 0x1c, 0xf9, 0xf9, 0x02, 0x03, 0xbc, 0x4c, 0xc1,
975 0x9f, 0x59, 0x27, 0xd8, 0x34, 0xb0, 0xa4, 0x71,
976
977 0x16, 0xd3, 0x88, 0x4b, 0xbb, 0x16, 0x4b, 0x8e,
978 0xc8, 0x83, 0xd1, 0xac, 0x83, 0x2e, 0x56, 0xb3,
979 0x91, 0x8a, 0x98, 0x60, 0x1a, 0x08, 0xd1, 0x71,
980 0x88, 0x15, 0x41, 0xd5, 0x94, 0xdb, 0x39, 0x9c,
981
982 0x6a, 0xe6, 0x15, 0x12, 0x21, 0x74, 0x5a, 0xec,
983 0x81, 0x4c, 0x45, 0xb0, 0xb0, 0x5b, 0x56, 0x54,
984 0x36, 0xfd, 0x6f, 0x13, 0x7a, 0xa1, 0x0a, 0x0c,
985 0x0b, 0x64, 0x37, 0x61, 0xdb, 0xd6, 0xf9, 0xa9,
986
987 0xdc, 0xb9, 0x9b, 0x1a, 0x6e, 0x69, 0x08, 0x54,
988 0xce, 0x07, 0x69, 0xcd, 0xe3, 0x97, 0x61, 0xd8,
989 0x2f, 0xcd, 0xec, 0x15, 0xf0, 0xd9, 0x2d, 0x7d,
990 0x8e, 0x94, 0xad, 0xe8, 0xeb, 0x83, 0xfb, 0xe0
991 }
992 },
993 {
994 32,
995 {
996 0x99, 0xe5, 0x82, 0x2d, 0xd4, 0x17, 0x3c, 0x99,
997 0x5e, 0x3d, 0xae, 0x0d, 0xde, 0xfb, 0x97, 0x74,
998 0x3f, 0xde, 0x3b, 0x08, 0x01, 0x34, 0xb3, 0x9f,
999 0x76, 0xe9, 0xbf, 0x8d, 0x0e, 0x88, 0xd5, 0x46
1000 }
1001 },
1002 {
1003 16,
1004 {
1005 0x26, 0x37, 0x40, 0x8f, 0xe1, 0x30, 0x86, 0xea,
1006 0x73, 0xf9, 0x71, 0xe3, 0x42, 0x5e, 0x28, 0x20
1007 }
1008 },
1009 },
1010 /*
1011 * test vectors from Hanno Böck
1012 */
1013 {
1014 {
1015 257,
1016 {
1017 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc,
1018 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc,
1019 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc,
1020 0xcc, 0x80, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc,
1021
1022 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc,
1023 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc,
1024 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc,
1025 0xcc, 0xcc, 0xcc, 0xcc, 0xce, 0xcc, 0xcc, 0xcc,
1026
1027 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc,
1028 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xc5,
1029 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc,
1030 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc,
1031
1032 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xe3, 0xcc, 0xcc,
1033 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc,
1034 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc,
1035 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc,
1036
1037 0xcc, 0xcc, 0xcc, 0xcc, 0xac, 0xcc, 0xcc, 0xcc,
1038 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xe6,
1039 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x00, 0x00, 0x00,
1040 0xaf, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc,
1041
1042 0xcc, 0xcc, 0xff, 0xff, 0xff, 0xf5, 0x00, 0x00,
1043 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1044 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1045 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1046
1047 0x00, 0xff, 0xff, 0xff, 0xe7, 0x00, 0x00, 0x00,
1048 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1049 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1050 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1051
1052 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1053 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1054 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1055 0x00, 0x00, 0x71, 0x92, 0x05, 0xa8, 0x52, 0x1d,
1056
1057 0xfc
1058 }
1059 },
1060 {
1061 32,
1062 {
1063 0x7f, 0x1b, 0x02, 0x64, 0x00, 0x00, 0x00, 0x00,
1064 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1065 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1066 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc
1067 }
1068 },
1069 {
1070 16,
1071 {
1072 0x85, 0x59, 0xb8, 0x76, 0xec, 0xee, 0xd6, 0x6e,
1073 0xb3, 0x77, 0x98, 0xc0, 0x45, 0x7b, 0xaf, 0xf9
1074 }
1075 },
1076 },
1077 {
1078 {
1079 39,
1080 {
1081 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1082 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1083 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1084 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00, 0x00,
1085
1086 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x64
1087 }
1088 },
1089 {
1090 32,
1091 {
1092 0xe0, 0x00, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00,
1093 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1094 0x00, 0x00, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1095 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa
1096 }
1097 },
1098 {
1099 16,
1100 {
1101 0x00, 0xbd, 0x12, 0x58, 0x97, 0x8e, 0x20, 0x54,
1102 0x44, 0xc9, 0xaa, 0xaa, 0x82, 0x00, 0x6f, 0xed
1103 }
1104 },
1105 },
1106 {
1107 {
1108 2,
1109 {
1110 0x02, 0xfc
1111 }
1112 },
1113 {
1114 32,
1115 {
1116 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c,
1117 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c,
1118 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c,
1119 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c
1120 }
1121 },
1122 {
1123 16,
1124 {
1125 0x06, 0x12, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c,
1126 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c
1127 }
1128 },
1129 },
1130 {
1131 {
1132 415,
1133 {
1134 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b,
1135 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b,
1136 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b,
1137 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b,
1138
1139 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7a, 0x7b,
1140 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b,
1141 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b,
1142 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b,
1143
1144 0x7b, 0x7b, 0x5c, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b,
1145 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b,
1146 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b,
1147 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b,
1148
1149 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b,
1150 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b,
1151 0x7b, 0x7b, 0x7b, 0x7b, 0x6e, 0x7b, 0x00, 0x7b,
1152 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b,
1153
1154 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b,
1155 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b,
1156 0x7b, 0x7b, 0x7b, 0x7a, 0x7b, 0x7b, 0x7b, 0x7b,
1157 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b,
1158
1159 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b,
1160 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x5c,
1161 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b,
1162 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b,
1163
1164 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b,
1165 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b,
1166 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b,
1167 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b, 0x7b,
1168
1169 0x7b, 0x6e, 0x7b, 0x00, 0x13, 0x00, 0x00, 0x00,
1170 0x00, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1171 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1172 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1173
1174 0xf2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1175 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1176 0x00, 0x00, 0x00, 0x20, 0x00, 0xef, 0xff, 0x00,
1177 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1178
1179 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,
1180 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x64, 0x00,
1181 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1182 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x00,
1183
1184 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1185 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1186 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf2,
1187 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1188
1189 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1190 0x00, 0x00, 0x20, 0x00, 0xef, 0xff, 0x00, 0x09,
1191 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1192 0x00, 0x7a, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
1193
1194 0x00, 0x09, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00,
1195 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1196 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1197 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc
1198 }
1199 },
1200 {
1201 32,
1202 {
1203 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1204 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1205 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00,
1206 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7b, 0x7b
1207 }
1208 },
1209 {
1210 16,
1211 {
1212 0x33, 0x20, 0x5b, 0xbf, 0x9e, 0x9f, 0x8f, 0x72,
1213 0x12, 0xab, 0x9e, 0x2a, 0xb9, 0xb7, 0xe4, 0xa5
1214 }
1215 },
1216 },
1217 {
1218 {
1219 118,
1220 {
1221 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
1222 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
1223 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
1224 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
1225
1226 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
1227 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
1228 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
1229 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
1230
1231 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77,
1232 0x77, 0x77, 0x77, 0x77, 0xff, 0xff, 0xff, 0xe9,
1233 0xe9, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac,
1234 0xac, 0xac, 0xac, 0xac, 0x00, 0x00, 0xac, 0xac,
1235
1236 0xec, 0x01, 0x00, 0xac, 0xac, 0xac, 0x2c, 0xac,
1237 0xa2, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac, 0xac,
1238 0xac, 0xac, 0xac, 0xac, 0x64, 0xf2
1239 }
1240 },
1241 {
1242 32,
1243 {
1244 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x7f,
1245 0x01, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00,
1246 0x00, 0x00, 0xcf, 0x77, 0x77, 0x77, 0x77, 0x77,
1247 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77, 0x77
1248 }
1249 },
1250 {
1251 16,
1252 {
1253 0x02, 0xee, 0x7c, 0x8c, 0x54, 0x6d, 0xde, 0xb1,
1254 0xa4, 0x67, 0xe4, 0xc3, 0x98, 0x11, 0x58, 0xb9
1255 }
1256 },
1257 },
1258 /*
1259 * test vectors from Andrew Moon
1260 */
1261 { /* nacl */
1262 {
1263 131,
1264 {
1265 0x8e, 0x99, 0x3b, 0x9f, 0x48, 0x68, 0x12, 0x73,
1266 0xc2, 0x96, 0x50, 0xba, 0x32, 0xfc, 0x76, 0xce,
1267 0x48, 0x33, 0x2e, 0xa7, 0x16, 0x4d, 0x96, 0xa4,
1268 0x47, 0x6f, 0xb8, 0xc5, 0x31, 0xa1, 0x18, 0x6a,
1269
1270 0xc0, 0xdf, 0xc1, 0x7c, 0x98, 0xdc, 0xe8, 0x7b,
1271 0x4d, 0xa7, 0xf0, 0x11, 0xec, 0x48, 0xc9, 0x72,
1272 0x71, 0xd2, 0xc2, 0x0f, 0x9b, 0x92, 0x8f, 0xe2,
1273 0x27, 0x0d, 0x6f, 0xb8, 0x63, 0xd5, 0x17, 0x38,
1274
1275 0xb4, 0x8e, 0xee, 0xe3, 0x14, 0xa7, 0xcc, 0x8a,
1276 0xb9, 0x32, 0x16, 0x45, 0x48, 0xe5, 0x26, 0xae,
1277 0x90, 0x22, 0x43, 0x68, 0x51, 0x7a, 0xcf, 0xea,
1278 0xbd, 0x6b, 0xb3, 0x73, 0x2b, 0xc0, 0xe9, 0xda,
1279
1280 0x99, 0x83, 0x2b, 0x61, 0xca, 0x01, 0xb6, 0xde,
1281 0x56, 0x24, 0x4a, 0x9e, 0x88, 0xd5, 0xf9, 0xb3,
1282 0x79, 0x73, 0xf6, 0x22, 0xa4, 0x3d, 0x14, 0xa6,
1283 0x59, 0x9b, 0x1f, 0x65, 0x4c, 0xb4, 0x5a, 0x74,
1284
1285 0xe3, 0x55, 0xa5
1286 }
1287 },
1288 {
1289 32,
1290 {
1291 0xee, 0xa6, 0xa7, 0x25, 0x1c, 0x1e, 0x72, 0x91,
1292 0x6d, 0x11, 0xc2, 0xcb, 0x21, 0x4d, 0x3c, 0x25,
1293 0x25, 0x39, 0x12, 0x1d, 0x8e, 0x23, 0x4e, 0x65,
1294 0x2d, 0x65, 0x1f, 0xa4, 0xc8, 0xcf, 0xf8, 0x80
1295 }
1296 },
1297 {
1298 16,
1299 {
1300 0xf3, 0xff, 0xc7, 0x70, 0x3f, 0x94, 0x00, 0xe5,
1301 0x2a, 0x7d, 0xfb, 0x4b, 0x3d, 0x33, 0x05, 0xd9
1302 }
1303 },
1304 },
1305 { /* wrap 2^130-5 */
1306 {
1307 16,
1308 {
1309 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
1310 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
1311 }
1312 },
1313 {
1314 32,
1315 {
1316 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1317 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1318 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1319 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
1320 }
1321 },
1322 {
1323 16,
1324 {
1325 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1326 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
1327 }
1328 },
1329 },
1330 { /* wrap 2^128 */
1331 {
1332 16,
1333 {
1334 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1335 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
1336 }
1337 },
1338 {
1339 32,
1340 {
1341 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1342 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1343 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
1344 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
1345 }
1346 },
1347 {
1348 16,
1349 {
1350 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1351 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
1352 }
1353 },
1354 },
1355 { /* limb carry */
1356 {
1357 48,
1358 {
1359 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
1360 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
1361 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
1362 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
1363
1364 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1365 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
1366 }
1367 },
1368 {
1369 32,
1370 {
1371 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1372 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1373 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1374 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
1375 }
1376 },
1377 {
1378 16,
1379 {
1380 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1381 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
1382 }
1383 },
1384 },
1385 { /* 2^130-5 */
1386 {
1387 48,
1388 {
1389 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
1390 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
1391 0xfb, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe,
1392 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe,
1393
1394 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
1395 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01
1396 }
1397 },
1398 {
1399 32,
1400 {
1401 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1402 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1403 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1404 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
1405 }
1406 },
1407 {
1408 16,
1409 {
1410 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1411 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
1412
1413 }
1414 },
1415 },
1416 { /* 2^130-6 */
1417 {
1418 16,
1419 {
1420 0xfd, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
1421 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
1422 }
1423 },
1424 {
1425 32,
1426 {
1427 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1428 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1429 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1430 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
1431 }
1432 },
1433 {
1434 16,
1435 {
1436 0xfa, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
1437 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
1438 }
1439 },
1440 },
1441 { /* 5*H+L reduction intermediate */
1442 {
1443 64,
1444 {
1445 0xe3, 0x35, 0x94, 0xd7, 0x50, 0x5e, 0x43, 0xb9,
1446 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1447 0x33, 0x94, 0xd7, 0x50, 0x5e, 0x43, 0x79, 0xcd,
1448 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1449
1450 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1451 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1452 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1453 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
1454 }
1455 },
1456 {
1457 32,
1458 {
1459 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1460 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1461 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1462 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
1463 }
1464 },
1465 {
1466 16,
1467 {
1468 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1469 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
1470 }
1471 },
1472 },
1473 { /* 5*H+L reduction final */
1474 {
1475 48,
1476 {
1477 0xe3, 0x35, 0x94, 0xd7, 0x50, 0x5e, 0x43, 0xb9,
1478 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1479 0x33, 0x94, 0xd7, 0x50, 0x5e, 0x43, 0x79, 0xcd,
1480 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1481
1482 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1483 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
1484
1485 }
1486 },
1487 {
1488 32,
1489 {
1490 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1491 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1492 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1493 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
1494 }
1495 },
1496 {
1497 16,
1498 {
1499 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1500 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
1501 }
1502 }
1503 }
1504};
1505
1506static int test_poly1305(int idx)
1507{
1508 POLY1305 poly1305;
1509 const TESTDATA test = tests[idx];
1510 const unsigned char *in = test.input.data;
1511 size_t inlen = test.input.size;
1512 const unsigned char *key = test.key.data;
1513 const unsigned char *expected = test.expected.data;
1514 size_t expectedlen = test.expected.size;
1515 unsigned char out[16];
1516
1517 if (!TEST_size_t_eq(expectedlen, sizeof(out)))
1518 return 0;
1519
1520 Poly1305_Init(&poly1305, key);
1521 Poly1305_Update(&poly1305, in, inlen);
1522 Poly1305_Final(&poly1305, out);
1523
1524 if (!TEST_mem_eq(out, expectedlen, expected, expectedlen)) {
1525 TEST_info("Poly1305 test #%d failed.", idx);
1526 return 0;
1527 }
1528
1529 if (inlen > 16) {
1530 Poly1305_Init(&poly1305, key);
1531 Poly1305_Update(&poly1305, in, 1);
1532 Poly1305_Update(&poly1305, in+1, inlen-1);
1533 Poly1305_Final(&poly1305, out);
1534
1535 if (!TEST_mem_eq(out, expectedlen, expected, expectedlen)) {
1536 TEST_info("Poly1305 test #%d/1+(N-1) failed.", idx);
1537 return 0;
1538 }
1539 }
1540
1541 if (inlen > 32) {
1542 size_t half = inlen / 2;
1543
1544 Poly1305_Init(&poly1305, key);
1545 Poly1305_Update(&poly1305, in, half);
1546 Poly1305_Update(&poly1305, in+half, inlen-half);
1547 Poly1305_Final(&poly1305, out);
1548
1549 if (!TEST_mem_eq(out, expectedlen, expected, expectedlen)) {
1550 TEST_info("Poly1305 test #%d/2 failed.", idx);
1551 return 0;
1552 }
1553
1554 for (half = 16; half < inlen; half += 16) {
1555 Poly1305_Init(&poly1305, key);
1556 Poly1305_Update(&poly1305, in, half);
1557 Poly1305_Update(&poly1305, in+half, inlen-half);
1558 Poly1305_Final(&poly1305, out);
1559
1560 if (!TEST_mem_eq(out, expectedlen, expected, expectedlen)) {
1561 TEST_info("Poly1305 test #%d/%zu+%zu failed.",
1562 idx, half, inlen-half);
1563 return 0;
1564 }
1565 }
1566 }
1567
1568 return 1;
1569}
1570
1571int setup_tests(void)
1572{
1573 ADD_ALL_TESTS(test_poly1305, OSSL_NELEM(tests));
1574 return 1;
1575}
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette