Fixed comment.
[BearSSL] / test / test_crypto.c
1 /*
2 * Copyright (c) 2016 Thomas Pornin <pornin@bolet.org>
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining
5 * a copy of this software and associated documentation files (the
6 * "Software"), to deal in the Software without restriction, including
7 * without limitation the rights to use, copy, modify, merge, publish,
8 * distribute, sublicense, and/or sell copies of the Software, and to
9 * permit persons to whom the Software is furnished to do so, subject to
10 * the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be
13 * included in all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
19 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
20 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 * SOFTWARE.
23 */
24
25 #include <stdio.h>
26 #include <stdlib.h>
27 #include <string.h>
28 #include "bearssl.h"
29 #include "inner.h"
30
31 /*
32 * Decode an hexadecimal string. Returned value is the number of decoded
33 * bytes.
34 */
35 static size_t
36 hextobin(unsigned char *dst, const char *src)
37 {
38 size_t num;
39 unsigned acc;
40 int z;
41
42 num = 0;
43 z = 0;
44 acc = 0;
45 while (*src != 0) {
46 int c = *src ++;
47 if (c >= '0' && c <= '9') {
48 c -= '0';
49 } else if (c >= 'A' && c <= 'F') {
50 c -= ('A' - 10);
51 } else if (c >= 'a' && c <= 'f') {
52 c -= ('a' - 10);
53 } else {
54 continue;
55 }
56 if (z) {
57 *dst ++ = (acc << 4) + c;
58 num ++;
59 } else {
60 acc = c;
61 }
62 z = !z;
63 }
64 return num;
65 }
66
67 static void
68 check_equals(const char *banner, const void *v1, const void *v2, size_t len)
69 {
70 size_t u;
71 const unsigned char *b;
72
73 if (memcmp(v1, v2, len) == 0) {
74 return;
75 }
76 fprintf(stderr, "\n%s failed\n", banner);
77 fprintf(stderr, "v1: ");
78 for (u = 0, b = v1; u < len; u ++) {
79 fprintf(stderr, "%02X", b[u]);
80 }
81 fprintf(stderr, "\nv2: ");
82 for (u = 0, b = v2; u < len; u ++) {
83 fprintf(stderr, "%02X", b[u]);
84 }
85 fprintf(stderr, "\n");
86 exit(EXIT_FAILURE);
87 }
88
89 #define HASH_SIZE(cname) br_ ## cname ## _SIZE
90
91 #define TEST_HASH(Name, cname) \
92 static void \
93 test_ ## cname ## _internal(char *data, char *refres) \
94 { \
95 br_ ## cname ## _context mc; \
96 unsigned char res[HASH_SIZE(cname)], ref[HASH_SIZE(cname)]; \
97 size_t u, n; \
98 \
99 hextobin(ref, refres); \
100 n = strlen(data); \
101 br_ ## cname ## _init(&mc); \
102 br_ ## cname ## _update(&mc, data, n); \
103 br_ ## cname ## _out(&mc, res); \
104 check_equals("KAT " #Name " 1", res, ref, HASH_SIZE(cname)); \
105 br_ ## cname ## _init(&mc); \
106 for (u = 0; u < n; u ++) { \
107 br_ ## cname ## _update(&mc, data + u, 1); \
108 } \
109 br_ ## cname ## _out(&mc, res); \
110 check_equals("KAT " #Name " 2", res, ref, HASH_SIZE(cname)); \
111 for (u = 0; u < n; u ++) { \
112 br_ ## cname ## _context mc2; \
113 br_ ## cname ## _init(&mc); \
114 br_ ## cname ## _update(&mc, data, u); \
115 mc2 = mc; \
116 br_ ## cname ## _update(&mc, data + u, n - u); \
117 br_ ## cname ## _out(&mc, res); \
118 check_equals("KAT " #Name " 3", res, ref, HASH_SIZE(cname)); \
119 br_ ## cname ## _update(&mc2, data + u, n - u); \
120 br_ ## cname ## _out(&mc2, res); \
121 check_equals("KAT " #Name " 4", res, ref, HASH_SIZE(cname)); \
122 } \
123 memset(&mc, 0, sizeof mc); \
124 memset(res, 0, sizeof res); \
125 br_ ## cname ## _vtable.init(&mc.vtable); \
126 mc.vtable->update(&mc.vtable, data, n); \
127 mc.vtable->out(&mc.vtable, res); \
128 check_equals("KAT " #Name " 5", res, ref, HASH_SIZE(cname)); \
129 memset(res, 0, sizeof res); \
130 mc.vtable->init(&mc.vtable); \
131 mc.vtable->update(&mc.vtable, data, n); \
132 mc.vtable->out(&mc.vtable, res); \
133 check_equals("KAT " #Name " 6", res, ref, HASH_SIZE(cname)); \
134 }
135
136 #define KAT_MILLION_A(Name, cname, refres) do { \
137 br_ ## cname ## _context mc; \
138 unsigned char buf[1000]; \
139 unsigned char res[HASH_SIZE(cname)], ref[HASH_SIZE(cname)]; \
140 int i; \
141 \
142 hextobin(ref, refres); \
143 memset(buf, 'a', sizeof buf); \
144 br_ ## cname ## _init(&mc); \
145 for (i = 0; i < 1000; i ++) { \
146 br_ ## cname ## _update(&mc, buf, sizeof buf); \
147 } \
148 br_ ## cname ## _out(&mc, res); \
149 check_equals("KAT " #Name " 5", res, ref, HASH_SIZE(cname)); \
150 } while (0)
151
152 TEST_HASH(MD5, md5)
153 TEST_HASH(SHA-1, sha1)
154 TEST_HASH(SHA-224, sha224)
155 TEST_HASH(SHA-256, sha256)
156 TEST_HASH(SHA-384, sha384)
157 TEST_HASH(SHA-512, sha512)
158
159 static void
160 test_MD5(void)
161 {
162 printf("Test MD5: ");
163 fflush(stdout);
164 test_md5_internal("", "d41d8cd98f00b204e9800998ecf8427e");
165 test_md5_internal("a", "0cc175b9c0f1b6a831c399e269772661");
166 test_md5_internal("abc", "900150983cd24fb0d6963f7d28e17f72");
167 test_md5_internal("message digest", "f96b697d7cb7938d525a2f31aaf161d0");
168 test_md5_internal("abcdefghijklmnopqrstuvwxyz",
169 "c3fcd3d76192e4007dfb496cca67e13b");
170 test_md5_internal("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstu"
171 "vwxyz0123456789", "d174ab98d277d9f5a5611c2c9f419d9f");
172 test_md5_internal("1234567890123456789012345678901234567890123456789"
173 "0123456789012345678901234567890",
174 "57edf4a22be3c955ac49da2e2107b67a");
175 KAT_MILLION_A(MD5, md5,
176 "7707d6ae4e027c70eea2a935c2296f21");
177 printf("done.\n");
178 fflush(stdout);
179 }
180
181 static void
182 test_SHA1(void)
183 {
184 printf("Test SHA-1: ");
185 fflush(stdout);
186 test_sha1_internal("abc", "a9993e364706816aba3e25717850c26c9cd0d89d");
187 test_sha1_internal("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlm"
188 "nomnopnopq", "84983e441c3bd26ebaae4aa1f95129e5e54670f1");
189
190 KAT_MILLION_A(SHA-1, sha1,
191 "34aa973cd4c4daa4f61eeb2bdbad27316534016f");
192 printf("done.\n");
193 fflush(stdout);
194 }
195
196 static void
197 test_SHA224(void)
198 {
199 printf("Test SHA-224: ");
200 fflush(stdout);
201 test_sha224_internal("abc",
202 "23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7");
203 test_sha224_internal("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlm"
204 "nomnopnopq",
205 "75388b16512776cc5dba5da1fd890150b0c6455cb4f58b1952522525");
206
207 KAT_MILLION_A(SHA-224, sha224,
208 "20794655980c91d8bbb4c1ea97618a4bf03f42581948b2ee4ee7ad67");
209 printf("done.\n");
210 fflush(stdout);
211 }
212
213 static void
214 test_SHA256(void)
215 {
216 printf("Test SHA-256: ");
217 fflush(stdout);
218 test_sha256_internal("abc",
219 "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad");
220 test_sha256_internal("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlm"
221 "nomnopnopq",
222 "248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1");
223
224 KAT_MILLION_A(SHA-256, sha256,
225 "cdc76e5c9914fb9281a1c7e284d73e67f1809a48a497200e046d39ccc7112cd0");
226 printf("done.\n");
227 fflush(stdout);
228 }
229
230 static void
231 test_SHA384(void)
232 {
233 printf("Test SHA-384: ");
234 fflush(stdout);
235 test_sha384_internal("abc",
236 "cb00753f45a35e8bb5a03d699ac65007272c32ab0eded163"
237 "1a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7");
238 test_sha384_internal(
239 "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmn"
240 "hijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu",
241 "09330c33f71147e83d192fc782cd1b4753111b173b3b05d2"
242 "2fa08086e3b0f712fcc7c71a557e2db966c3e9fa91746039");
243
244 KAT_MILLION_A(SHA-384, sha384,
245 "9d0e1809716474cb086e834e310a4a1ced149e9c00f24852"
246 "7972cec5704c2a5b07b8b3dc38ecc4ebae97ddd87f3d8985");
247 printf("done.\n");
248 fflush(stdout);
249 }
250
251 static void
252 test_SHA512(void)
253 {
254 printf("Test SHA-512: ");
255 fflush(stdout);
256 test_sha512_internal("abc",
257 "ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a"
258 "2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f");
259 test_sha512_internal(
260 "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmn"
261 "hijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu",
262 "8e959b75dae313da8cf4f72814fc143f8f7779c6eb9f7fa17299aeadb6889018"
263 "501d289e4900f7e4331b99dec4b5433ac7d329eeb6dd26545e96e55b874be909");
264
265 KAT_MILLION_A(SHA-512, sha512,
266 "e718483d0ce769644e2e42c7bc15b4638e1f98b13b2044285632a803afa973eb"
267 "de0ff244877ea60a4cb0432ce577c31beb009c5c2c49aa2e4eadb217ad8cc09b");
268 printf("done.\n");
269 fflush(stdout);
270 }
271
272 static void
273 test_MD5_SHA1(void)
274 {
275 unsigned char buf[500], out[36], outM[16], outS[20];
276 unsigned char seed[1];
277 br_hmac_drbg_context rc;
278 br_md5_context mc;
279 br_sha1_context sc;
280 br_md5sha1_context cc;
281 size_t u;
282
283 printf("Test MD5+SHA-1: ");
284 fflush(stdout);
285
286 seed[0] = 0;
287 br_hmac_drbg_init(&rc, &br_sha256_vtable, seed, sizeof seed);
288 for (u = 0; u < sizeof buf; u ++) {
289 size_t v;
290
291 br_hmac_drbg_generate(&rc, buf, u);
292 br_md5_init(&mc);
293 br_md5_update(&mc, buf, u);
294 br_md5_out(&mc, outM);
295 br_sha1_init(&sc);
296 br_sha1_update(&sc, buf, u);
297 br_sha1_out(&sc, outS);
298 br_md5sha1_init(&cc);
299 br_md5sha1_update(&cc, buf, u);
300 br_md5sha1_out(&cc, out);
301 check_equals("MD5+SHA-1 [1]", out, outM, 16);
302 check_equals("MD5+SHA-1 [2]", out + 16, outS, 20);
303 br_md5sha1_init(&cc);
304 for (v = 0; v < u; v ++) {
305 br_md5sha1_update(&cc, buf + v, 1);
306 }
307 br_md5sha1_out(&cc, out);
308 check_equals("MD5+SHA-1 [3]", out, outM, 16);
309 check_equals("MD5+SHA-1 [4]", out + 16, outS, 20);
310 }
311
312 printf("done.\n");
313 fflush(stdout);
314 }
315
316 /*
317 * Compute a hash function, on some data, by ID. Returned value is
318 * hash output length.
319 */
320 static size_t
321 do_hash(int id, const void *data, size_t len, void *out)
322 {
323 br_md5_context cmd5;
324 br_sha1_context csha1;
325 br_sha224_context csha224;
326 br_sha256_context csha256;
327 br_sha384_context csha384;
328 br_sha512_context csha512;
329
330 switch (id) {
331 case br_md5_ID:
332 br_md5_init(&cmd5);
333 br_md5_update(&cmd5, data, len);
334 br_md5_out(&cmd5, out);
335 return 16;
336 case br_sha1_ID:
337 br_sha1_init(&csha1);
338 br_sha1_update(&csha1, data, len);
339 br_sha1_out(&csha1, out);
340 return 20;
341 case br_sha224_ID:
342 br_sha224_init(&csha224);
343 br_sha224_update(&csha224, data, len);
344 br_sha224_out(&csha224, out);
345 return 28;
346 case br_sha256_ID:
347 br_sha256_init(&csha256);
348 br_sha256_update(&csha256, data, len);
349 br_sha256_out(&csha256, out);
350 return 32;
351 case br_sha384_ID:
352 br_sha384_init(&csha384);
353 br_sha384_update(&csha384, data, len);
354 br_sha384_out(&csha384, out);
355 return 48;
356 case br_sha512_ID:
357 br_sha512_init(&csha512);
358 br_sha512_update(&csha512, data, len);
359 br_sha512_out(&csha512, out);
360 return 64;
361 default:
362 fprintf(stderr, "Uknown hash function: %d\n", id);
363 exit(EXIT_FAILURE);
364 return 0;
365 }
366 }
367
368 /*
369 * Tests for a multihash. Returned value should be 258 multiplied by the
370 * number of hash functions implemented by the context.
371 */
372 static int
373 test_multihash_inner(br_multihash_context *mc)
374 {
375 /*
376 * Try hashing messages for all lengths from 0 to 257 bytes
377 * (inclusive). Each attempt is done twice, with data input
378 * either in one go, or byte by byte. In the byte by byte
379 * test, intermediate result are obtained and checked.
380 */
381 size_t len;
382 unsigned char buf[258];
383 int i;
384 int tcount;
385
386 tcount = 0;
387 for (len = 0; len < sizeof buf; len ++) {
388 br_sha1_context sc;
389 unsigned char tmp[20];
390
391 br_sha1_init(&sc);
392 br_sha1_update(&sc, buf, len);
393 br_sha1_out(&sc, tmp);
394 buf[len] = tmp[0];
395 }
396 for (len = 0; len <= 257; len ++) {
397 size_t u;
398
399 br_multihash_init(mc);
400 br_multihash_update(mc, buf, len);
401 for (i = 1; i <= 6; i ++) {
402 unsigned char tmp[64], tmp2[64];
403 size_t olen, olen2;
404
405 olen = br_multihash_out(mc, i, tmp);
406 if (olen == 0) {
407 continue;
408 }
409 olen2 = do_hash(i, buf, len, tmp2);
410 if (olen != olen2) {
411 fprintf(stderr,
412 "Bad hash output length: %u / %u\n",
413 (unsigned)olen, (unsigned)olen2);
414 exit(EXIT_FAILURE);
415 }
416 check_equals("Hash output", tmp, tmp2, olen);
417 tcount ++;
418 }
419
420 br_multihash_init(mc);
421 for (u = 0; u < len; u ++) {
422 br_multihash_update(mc, buf + u, 1);
423 for (i = 1; i <= 6; i ++) {
424 unsigned char tmp[64], tmp2[64];
425 size_t olen, olen2;
426
427 olen = br_multihash_out(mc, i, tmp);
428 if (olen == 0) {
429 continue;
430 }
431 olen2 = do_hash(i, buf, u + 1, tmp2);
432 if (olen != olen2) {
433 fprintf(stderr, "Bad hash output"
434 " length: %u / %u\n",
435 (unsigned)olen,
436 (unsigned)olen2);
437 exit(EXIT_FAILURE);
438 }
439 check_equals("Hash output", tmp, tmp2, olen);
440 }
441 }
442 }
443 return tcount;
444 }
445
446 static void
447 test_multihash(void)
448 {
449 br_multihash_context mc;
450
451 printf("Test MultiHash: ");
452 fflush(stdout);
453
454 br_multihash_zero(&mc);
455 br_multihash_setimpl(&mc, br_md5_ID, &br_md5_vtable);
456 if (test_multihash_inner(&mc) != 258) {
457 fprintf(stderr, "Failed test count\n");
458 }
459 printf(".");
460 fflush(stdout);
461
462 br_multihash_zero(&mc);
463 br_multihash_setimpl(&mc, br_sha1_ID, &br_sha1_vtable);
464 if (test_multihash_inner(&mc) != 258) {
465 fprintf(stderr, "Failed test count\n");
466 }
467 printf(".");
468 fflush(stdout);
469
470 br_multihash_zero(&mc);
471 br_multihash_setimpl(&mc, br_sha224_ID, &br_sha224_vtable);
472 if (test_multihash_inner(&mc) != 258) {
473 fprintf(stderr, "Failed test count\n");
474 }
475 printf(".");
476 fflush(stdout);
477
478 br_multihash_zero(&mc);
479 br_multihash_setimpl(&mc, br_sha256_ID, &br_sha256_vtable);
480 if (test_multihash_inner(&mc) != 258) {
481 fprintf(stderr, "Failed test count\n");
482 }
483 printf(".");
484 fflush(stdout);
485
486 br_multihash_zero(&mc);
487 br_multihash_setimpl(&mc, br_sha384_ID, &br_sha384_vtable);
488 if (test_multihash_inner(&mc) != 258) {
489 fprintf(stderr, "Failed test count\n");
490 }
491 printf(".");
492 fflush(stdout);
493
494 br_multihash_zero(&mc);
495 br_multihash_setimpl(&mc, br_sha512_ID, &br_sha512_vtable);
496 if (test_multihash_inner(&mc) != 258) {
497 fprintf(stderr, "Failed test count\n");
498 }
499 printf(".");
500 fflush(stdout);
501
502 br_multihash_zero(&mc);
503 br_multihash_setimpl(&mc, br_md5_ID, &br_md5_vtable);
504 br_multihash_setimpl(&mc, br_sha1_ID, &br_sha1_vtable);
505 br_multihash_setimpl(&mc, br_sha224_ID, &br_sha224_vtable);
506 br_multihash_setimpl(&mc, br_sha256_ID, &br_sha256_vtable);
507 br_multihash_setimpl(&mc, br_sha384_ID, &br_sha384_vtable);
508 br_multihash_setimpl(&mc, br_sha512_ID, &br_sha512_vtable);
509 if (test_multihash_inner(&mc) != 258 * 6) {
510 fprintf(stderr, "Failed test count\n");
511 }
512 printf(".");
513 fflush(stdout);
514
515 printf("done.\n");
516 fflush(stdout);
517 }
518
519 static void
520 do_KAT_HMAC_bin_bin(const br_hash_class *digest_class,
521 const void *key, size_t key_len,
522 const void *data, size_t data_len, const char *href)
523 {
524 br_hmac_key_context kc;
525 br_hmac_context ctx;
526 unsigned char tmp[64], ref[64];
527 size_t u, len;
528
529 len = hextobin(ref, href);
530 br_hmac_key_init(&kc, digest_class, key, key_len);
531 br_hmac_init(&ctx, &kc, 0);
532 br_hmac_update(&ctx, data, data_len);
533 br_hmac_out(&ctx, tmp);
534 check_equals("KAT HMAC 1", tmp, ref, len);
535
536 br_hmac_init(&ctx, &kc, 0);
537 for (u = 0; u < data_len; u ++) {
538 br_hmac_update(&ctx, (const unsigned char *)data + u, 1);
539 }
540 br_hmac_out(&ctx, tmp);
541 check_equals("KAT HMAC 2", tmp, ref, len);
542
543 for (u = 0; u < data_len; u ++) {
544 br_hmac_init(&ctx, &kc, 0);
545 br_hmac_update(&ctx, data, u);
546 br_hmac_out(&ctx, tmp);
547 br_hmac_update(&ctx,
548 (const unsigned char *)data + u, data_len - u);
549 br_hmac_out(&ctx, tmp);
550 check_equals("KAT HMAC 3", tmp, ref, len);
551 }
552 }
553
554 static void
555 do_KAT_HMAC_str_str(const br_hash_class *digest_class, const char *key,
556 const char *data, const char *href)
557 {
558 do_KAT_HMAC_bin_bin(digest_class, key, strlen(key),
559 data, strlen(data), href);
560 }
561
562 static void
563 do_KAT_HMAC_hex_hex(const br_hash_class *digest_class, const char *skey,
564 const char *sdata, const char *href)
565 {
566 unsigned char key[1024];
567 unsigned char data[1024];
568
569 do_KAT_HMAC_bin_bin(digest_class, key, hextobin(key, skey),
570 data, hextobin(data, sdata), href);
571 }
572
573 static void
574 do_KAT_HMAC_hex_str(const br_hash_class *digest_class,
575 const char *skey, const char *data, const char *href)
576 {
577 unsigned char key[1024];
578
579 do_KAT_HMAC_bin_bin(digest_class, key, hextobin(key, skey),
580 data, strlen(data), href);
581 }
582
583 static void
584 test_HMAC_CT(const br_hash_class *digest_class,
585 const void *key, size_t key_len, const void *data)
586 {
587 br_hmac_key_context kc;
588 br_hmac_context hc1, hc2;
589 unsigned char buf1[64], buf2[64];
590 size_t u, v;
591
592 br_hmac_key_init(&kc, digest_class, key, key_len);
593
594 for (u = 0; u < 2; u ++) {
595 for (v = 0; v < 130; v ++) {
596 size_t min_len, max_len;
597 size_t w;
598
599 min_len = v;
600 max_len = v + 256;
601 for (w = min_len; w <= max_len; w ++) {
602 char tmp[30];
603 size_t hlen1, hlen2;
604
605 br_hmac_init(&hc1, &kc, 0);
606 br_hmac_update(&hc1, data, u + w);
607 hlen1 = br_hmac_out(&hc1, buf1);
608 br_hmac_init(&hc2, &kc, 0);
609 br_hmac_update(&hc2, data, u);
610 hlen2 = br_hmac_outCT(&hc2,
611 (const unsigned char *)data + u, w,
612 min_len, max_len, buf2);
613 if (hlen1 != hlen2) {
614 fprintf(stderr, "HMAC length mismatch:"
615 " %u / %u\n", (unsigned)hlen1,
616 (unsigned)hlen2);
617 exit(EXIT_FAILURE);
618 }
619 sprintf(tmp, "HMAC CT %u,%u,%u",
620 (unsigned)u, (unsigned)v, (unsigned)w);
621 check_equals(tmp, buf1, buf2, hlen1);
622 }
623 }
624 printf(".");
625 fflush(stdout);
626 }
627 printf(" ");
628 fflush(stdout);
629 }
630
631 static void
632 test_HMAC(void)
633 {
634 unsigned char data[1000];
635 unsigned x;
636 size_t u;
637 const char key[] = "test HMAC key";
638
639 printf("Test HMAC: ");
640 fflush(stdout);
641 do_KAT_HMAC_hex_str(&br_md5_vtable,
642 "0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b",
643 "Hi There",
644 "9294727a3638bb1c13f48ef8158bfc9d");
645 do_KAT_HMAC_str_str(&br_md5_vtable,
646 "Jefe",
647 "what do ya want for nothing?",
648 "750c783e6ab0b503eaa86e310a5db738");
649 do_KAT_HMAC_hex_hex(&br_md5_vtable,
650 "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
651 "DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD",
652 "56be34521d144c88dbb8c733f0e8b3f6");
653 do_KAT_HMAC_hex_hex(&br_md5_vtable,
654 "0102030405060708090a0b0c0d0e0f10111213141516171819",
655 "CDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCD",
656 "697eaf0aca3a3aea3a75164746ffaa79");
657 do_KAT_HMAC_hex_str(&br_md5_vtable,
658 "0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c",
659 "Test With Truncation",
660 "56461ef2342edc00f9bab995690efd4c");
661 do_KAT_HMAC_hex_str(&br_md5_vtable,
662 "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
663 "Test Using Larger Than Block-Size Key - Hash Key First",
664 "6b1ab7fe4bd7bf8f0b62e6ce61b9d0cd");
665 do_KAT_HMAC_hex_str(&br_md5_vtable,
666 "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
667 "Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data",
668 "6f630fad67cda0ee1fb1f562db3aa53e");
669
670 do_KAT_HMAC_hex_str(&br_sha1_vtable,
671 "0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b",
672 "Hi There",
673 "b617318655057264e28bc0b6fb378c8ef146be00");
674 do_KAT_HMAC_str_str(&br_sha1_vtable,
675 "Jefe",
676 "what do ya want for nothing?",
677 "effcdf6ae5eb2fa2d27416d5f184df9c259a7c79");
678 do_KAT_HMAC_hex_hex(&br_sha1_vtable,
679 "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
680 "DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD",
681 "125d7342b9ac11cd91a39af48aa17b4f63f175d3");
682 do_KAT_HMAC_hex_hex(&br_sha1_vtable,
683 "0102030405060708090a0b0c0d0e0f10111213141516171819",
684 "CDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCD",
685 "4c9007f4026250c6bc8414f9bf50c86c2d7235da");
686 do_KAT_HMAC_hex_str(&br_sha1_vtable,
687 "0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c",
688 "Test With Truncation",
689 "4c1a03424b55e07fe7f27be1d58bb9324a9a5a04");
690 do_KAT_HMAC_hex_str(&br_sha1_vtable,
691 "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
692 "Test Using Larger Than Block-Size Key - Hash Key First",
693 "aa4ae5e15272d00e95705637ce8a3b55ed402112");
694 do_KAT_HMAC_hex_str(&br_sha1_vtable,
695 "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
696 "Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data",
697 "e8e99d0f45237d786d6bbaa7965c7808bbff1a91");
698
699 /* From RFC 4231 */
700
701 do_KAT_HMAC_hex_hex(&br_sha224_vtable,
702 "0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b",
703 "4869205468657265",
704 "896fb1128abbdf196832107cd49df33f"
705 "47b4b1169912ba4f53684b22");
706
707 do_KAT_HMAC_hex_hex(&br_sha256_vtable,
708 "0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b",
709 "4869205468657265",
710 "b0344c61d8db38535ca8afceaf0bf12b"
711 "881dc200c9833da726e9376c2e32cff7");
712
713 do_KAT_HMAC_hex_hex(&br_sha384_vtable,
714 "0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b",
715 "4869205468657265",
716 "afd03944d84895626b0825f4ab46907f"
717 "15f9dadbe4101ec682aa034c7cebc59c"
718 "faea9ea9076ede7f4af152e8b2fa9cb6");
719
720 do_KAT_HMAC_hex_hex(&br_sha512_vtable,
721 "0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b",
722 "4869205468657265",
723 "87aa7cdea5ef619d4ff0b4241a1d6cb0"
724 "2379f4e2ce4ec2787ad0b30545e17cde"
725 "daa833b7d6b8a702038b274eaea3f4e4"
726 "be9d914eeb61f1702e696c203a126854");
727
728 do_KAT_HMAC_hex_hex(&br_sha224_vtable,
729 "4a656665",
730 "7768617420646f2079612077616e7420"
731 "666f72206e6f7468696e673f",
732 "a30e01098bc6dbbf45690f3a7e9e6d0f"
733 "8bbea2a39e6148008fd05e44");
734
735 do_KAT_HMAC_hex_hex(&br_sha256_vtable,
736 "4a656665",
737 "7768617420646f2079612077616e7420"
738 "666f72206e6f7468696e673f",
739 "5bdcc146bf60754e6a042426089575c7"
740 "5a003f089d2739839dec58b964ec3843");
741
742 do_KAT_HMAC_hex_hex(&br_sha384_vtable,
743 "4a656665",
744 "7768617420646f2079612077616e7420"
745 "666f72206e6f7468696e673f",
746 "af45d2e376484031617f78d2b58a6b1b"
747 "9c7ef464f5a01b47e42ec3736322445e"
748 "8e2240ca5e69e2c78b3239ecfab21649");
749
750 do_KAT_HMAC_hex_hex(&br_sha512_vtable,
751 "4a656665",
752 "7768617420646f2079612077616e7420"
753 "666f72206e6f7468696e673f",
754 "164b7a7bfcf819e2e395fbe73b56e0a3"
755 "87bd64222e831fd610270cd7ea250554"
756 "9758bf75c05a994a6d034f65f8f0e6fd"
757 "caeab1a34d4a6b4b636e070a38bce737");
758
759 do_KAT_HMAC_hex_hex(&br_sha224_vtable,
760 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
761 "aaaaaaaa",
762 "dddddddddddddddddddddddddddddddd"
763 "dddddddddddddddddddddddddddddddd"
764 "dddddddddddddddddddddddddddddddd"
765 "dddd",
766 "7fb3cb3588c6c1f6ffa9694d7d6ad264"
767 "9365b0c1f65d69d1ec8333ea");
768
769 do_KAT_HMAC_hex_hex(&br_sha256_vtable,
770 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
771 "aaaaaaaa",
772 "dddddddddddddddddddddddddddddddd"
773 "dddddddddddddddddddddddddddddddd"
774 "dddddddddddddddddddddddddddddddd"
775 "dddd",
776 "773ea91e36800e46854db8ebd09181a7"
777 "2959098b3ef8c122d9635514ced565fe");
778
779 do_KAT_HMAC_hex_hex(&br_sha384_vtable,
780 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
781 "aaaaaaaa",
782 "dddddddddddddddddddddddddddddddd"
783 "dddddddddddddddddddddddddddddddd"
784 "dddddddddddddddddddddddddddddddd"
785 "dddd",
786 "88062608d3e6ad8a0aa2ace014c8a86f"
787 "0aa635d947ac9febe83ef4e55966144b"
788 "2a5ab39dc13814b94e3ab6e101a34f27");
789
790 do_KAT_HMAC_hex_hex(&br_sha512_vtable,
791 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
792 "aaaaaaaa",
793 "dddddddddddddddddddddddddddddddd"
794 "dddddddddddddddddddddddddddddddd"
795 "dddddddddddddddddddddddddddddddd"
796 "dddd",
797 "fa73b0089d56a284efb0f0756c890be9"
798 "b1b5dbdd8ee81a3655f83e33b2279d39"
799 "bf3e848279a722c806b485a47e67c807"
800 "b946a337bee8942674278859e13292fb");
801
802 do_KAT_HMAC_hex_hex(&br_sha224_vtable,
803 "0102030405060708090a0b0c0d0e0f10"
804 "111213141516171819",
805 "cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd"
806 "cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd"
807 "cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd"
808 "cdcd",
809 "6c11506874013cac6a2abc1bb382627c"
810 "ec6a90d86efc012de7afec5a");
811
812 do_KAT_HMAC_hex_hex(&br_sha256_vtable,
813 "0102030405060708090a0b0c0d0e0f10"
814 "111213141516171819",
815 "cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd"
816 "cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd"
817 "cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd"
818 "cdcd",
819 "82558a389a443c0ea4cc819899f2083a"
820 "85f0faa3e578f8077a2e3ff46729665b");
821
822 do_KAT_HMAC_hex_hex(&br_sha384_vtable,
823 "0102030405060708090a0b0c0d0e0f10"
824 "111213141516171819",
825 "cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd"
826 "cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd"
827 "cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd"
828 "cdcd",
829 "3e8a69b7783c25851933ab6290af6ca7"
830 "7a9981480850009cc5577c6e1f573b4e"
831 "6801dd23c4a7d679ccf8a386c674cffb");
832
833 do_KAT_HMAC_hex_hex(&br_sha512_vtable,
834 "0102030405060708090a0b0c0d0e0f10"
835 "111213141516171819",
836 "cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd"
837 "cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd"
838 "cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd"
839 "cdcd",
840 "b0ba465637458c6990e5a8c5f61d4af7"
841 "e576d97ff94b872de76f8050361ee3db"
842 "a91ca5c11aa25eb4d679275cc5788063"
843 "a5f19741120c4f2de2adebeb10a298dd");
844
845 do_KAT_HMAC_hex_hex(&br_sha224_vtable,
846 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
847 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
848 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
849 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
850 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
851 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
852 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
853 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
854 "aaaaaa",
855 "54657374205573696e67204c61726765"
856 "72205468616e20426c6f636b2d53697a"
857 "65204b6579202d2048617368204b6579"
858 "204669727374",
859 "95e9a0db962095adaebe9b2d6f0dbce2"
860 "d499f112f2d2b7273fa6870e");
861
862 do_KAT_HMAC_hex_hex(&br_sha256_vtable,
863 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
864 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
865 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
866 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
867 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
868 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
869 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
870 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
871 "aaaaaa",
872 "54657374205573696e67204c61726765"
873 "72205468616e20426c6f636b2d53697a"
874 "65204b6579202d2048617368204b6579"
875 "204669727374",
876 "60e431591ee0b67f0d8a26aacbf5b77f"
877 "8e0bc6213728c5140546040f0ee37f54");
878
879 do_KAT_HMAC_hex_hex(&br_sha384_vtable,
880 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
881 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
882 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
883 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
884 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
885 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
886 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
887 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
888 "aaaaaa",
889 "54657374205573696e67204c61726765"
890 "72205468616e20426c6f636b2d53697a"
891 "65204b6579202d2048617368204b6579"
892 "204669727374",
893 "4ece084485813e9088d2c63a041bc5b4"
894 "4f9ef1012a2b588f3cd11f05033ac4c6"
895 "0c2ef6ab4030fe8296248df163f44952");
896
897 do_KAT_HMAC_hex_hex(&br_sha512_vtable,
898 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
899 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
900 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
901 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
902 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
903 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
904 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
905 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
906 "aaaaaa",
907 "54657374205573696e67204c61726765"
908 "72205468616e20426c6f636b2d53697a"
909 "65204b6579202d2048617368204b6579"
910 "204669727374",
911 "80b24263c7c1a3ebb71493c1dd7be8b4"
912 "9b46d1f41b4aeec1121b013783f8f352"
913 "6b56d037e05f2598bd0fd2215d6a1e52"
914 "95e64f73f63f0aec8b915a985d786598");
915
916 do_KAT_HMAC_hex_hex(&br_sha224_vtable,
917 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
918 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
919 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
920 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
921 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
922 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
923 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
924 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
925 "aaaaaa",
926 "54686973206973206120746573742075"
927 "73696e672061206c6172676572207468"
928 "616e20626c6f636b2d73697a65206b65"
929 "7920616e642061206c61726765722074"
930 "68616e20626c6f636b2d73697a652064"
931 "6174612e20546865206b6579206e6565"
932 "647320746f2062652068617368656420"
933 "6265666f7265206265696e6720757365"
934 "642062792074686520484d414320616c"
935 "676f726974686d2e",
936 "3a854166ac5d9f023f54d517d0b39dbd"
937 "946770db9c2b95c9f6f565d1");
938
939 do_KAT_HMAC_hex_hex(&br_sha256_vtable,
940 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
941 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
942 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
943 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
944 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
945 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
946 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
947 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
948 "aaaaaa",
949 "54686973206973206120746573742075"
950 "73696e672061206c6172676572207468"
951 "616e20626c6f636b2d73697a65206b65"
952 "7920616e642061206c61726765722074"
953 "68616e20626c6f636b2d73697a652064"
954 "6174612e20546865206b6579206e6565"
955 "647320746f2062652068617368656420"
956 "6265666f7265206265696e6720757365"
957 "642062792074686520484d414320616c"
958 "676f726974686d2e",
959 "9b09ffa71b942fcb27635fbcd5b0e944"
960 "bfdc63644f0713938a7f51535c3a35e2");
961
962 do_KAT_HMAC_hex_hex(&br_sha384_vtable,
963 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
964 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
965 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
966 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
967 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
968 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
969 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
970 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
971 "aaaaaa",
972 "54686973206973206120746573742075"
973 "73696e672061206c6172676572207468"
974 "616e20626c6f636b2d73697a65206b65"
975 "7920616e642061206c61726765722074"
976 "68616e20626c6f636b2d73697a652064"
977 "6174612e20546865206b6579206e6565"
978 "647320746f2062652068617368656420"
979 "6265666f7265206265696e6720757365"
980 "642062792074686520484d414320616c"
981 "676f726974686d2e",
982 "6617178e941f020d351e2f254e8fd32c"
983 "602420feb0b8fb9adccebb82461e99c5"
984 "a678cc31e799176d3860e6110c46523e");
985
986 do_KAT_HMAC_hex_hex(&br_sha512_vtable,
987 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
988 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
989 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
990 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
991 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
992 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
993 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
994 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
995 "aaaaaa",
996 "54686973206973206120746573742075"
997 "73696e672061206c6172676572207468"
998 "616e20626c6f636b2d73697a65206b65"
999 "7920616e642061206c61726765722074"
1000 "68616e20626c6f636b2d73697a652064"
1001 "6174612e20546865206b6579206e6565"
1002 "647320746f2062652068617368656420"
1003 "6265666f7265206265696e6720757365"
1004 "642062792074686520484d414320616c"
1005 "676f726974686d2e",
1006 "e37b6a775dc87dbaa4dfa9f96e5e3ffd"
1007 "debd71f8867289865df5a32d20cdc944"
1008 "b6022cac3c4982b10d5eeb55c3e4de15"
1009 "134676fb6de0446065c97440fa8c6a58");
1010
1011 for (x = 1, u = 0; u < sizeof data; u ++) {
1012 data[u] = x;
1013 x = (x * 45) % 257;
1014 }
1015 printf("(MD5) ");
1016 test_HMAC_CT(&br_md5_vtable, key, sizeof key, data);
1017 printf("(SHA-1) ");
1018 test_HMAC_CT(&br_sha1_vtable, key, sizeof key, data);
1019 printf("(SHA-224) ");
1020 test_HMAC_CT(&br_sha224_vtable, key, sizeof key, data);
1021 printf("(SHA-256) ");
1022 test_HMAC_CT(&br_sha256_vtable, key, sizeof key, data);
1023 printf("(SHA-384) ");
1024 test_HMAC_CT(&br_sha384_vtable, key, sizeof key, data);
1025 printf("(SHA-512) ");
1026 test_HMAC_CT(&br_sha512_vtable, key, sizeof key, data);
1027
1028 printf("done.\n");
1029 fflush(stdout);
1030 }
1031
1032 static void
1033 test_HKDF_inner(const br_hash_class *dig, const char *ikmhex,
1034 const char *salthex, const char *infohex, const char *okmhex)
1035 {
1036 unsigned char ikm[100], saltbuf[100], info[100], okm[100], tmp[107];
1037 const unsigned char *salt;
1038 size_t ikm_len, salt_len, info_len, okm_len;
1039 br_hkdf_context hc;
1040 size_t u;
1041
1042 ikm_len = hextobin(ikm, ikmhex);
1043 if (salthex == NULL) {
1044 salt = BR_HKDF_NO_SALT;
1045 salt_len = 0;
1046 } else {
1047 salt = saltbuf;
1048 salt_len = hextobin(saltbuf, salthex);
1049 }
1050 info_len = hextobin(info, infohex);
1051 okm_len = hextobin(okm, okmhex);
1052
1053 br_hkdf_init(&hc, dig, salt, salt_len);
1054 br_hkdf_inject(&hc, ikm, ikm_len);
1055 br_hkdf_flip(&hc);
1056 br_hkdf_produce(&hc, info, info_len, tmp, okm_len);
1057 check_equals("KAT HKDF 1", tmp, okm, okm_len);
1058
1059 br_hkdf_init(&hc, dig, salt, salt_len);
1060 for (u = 0; u < ikm_len; u ++) {
1061 br_hkdf_inject(&hc, &ikm[u], 1);
1062 }
1063 br_hkdf_flip(&hc);
1064 for (u = 0; u < okm_len; u ++) {
1065 br_hkdf_produce(&hc, info, info_len, &tmp[u], 1);
1066 }
1067 check_equals("KAT HKDF 2", tmp, okm, okm_len);
1068
1069 br_hkdf_init(&hc, dig, salt, salt_len);
1070 br_hkdf_inject(&hc, ikm, ikm_len);
1071 br_hkdf_flip(&hc);
1072 for (u = 0; u < okm_len; u += 7) {
1073 br_hkdf_produce(&hc, info, info_len, &tmp[u], 7);
1074 }
1075 check_equals("KAT HKDF 3", tmp, okm, okm_len);
1076
1077 printf(".");
1078 fflush(stdout);
1079 }
1080
1081 static void
1082 test_HKDF(void)
1083 {
1084 printf("Test HKDF: ");
1085 fflush(stdout);
1086
1087 test_HKDF_inner(&br_sha256_vtable,
1088 "0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b",
1089 "000102030405060708090a0b0c",
1090 "f0f1f2f3f4f5f6f7f8f9",
1091 "3cb25f25faacd57a90434f64d0362f2a2d2d0a90cf1a5a4c5db02d56ecc4c5bf34007208d5b887185865");
1092
1093 test_HKDF_inner(&br_sha256_vtable,
1094 "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f",
1095 "606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeaf",
1096 "b0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff",
1097 "b11e398dc80327a1c8e7f78c596a49344f012eda2d4efad8a050cc4c19afa97c59045a99cac7827271cb41c65e590e09da3275600c2f09b8367793a9aca3db71cc30c58179ec3e87c14c01d5c1f3434f1d87");
1098
1099 test_HKDF_inner(&br_sha256_vtable,
1100 "0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b",
1101 "",
1102 "",
1103 "8da4e775a563c18f715f802a063c5a31b8a11f5c5ee1879ec3454e5f3c738d2d9d201395faa4b61a96c8");
1104
1105 test_HKDF_inner(&br_sha1_vtable,
1106 "0b0b0b0b0b0b0b0b0b0b0b",
1107 "000102030405060708090a0b0c",
1108 "f0f1f2f3f4f5f6f7f8f9",
1109 "085a01ea1b10f36933068b56efa5ad81a4f14b822f5b091568a9cdd4f155fda2c22e422478d305f3f896");
1110
1111 test_HKDF_inner(&br_sha1_vtable,
1112 "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f",
1113 "606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeaf",
1114 "b0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff",
1115 "0bd770a74d1160f7c9f12cd5912a06ebff6adcae899d92191fe4305673ba2ffe8fa3f1a4e5ad79f3f334b3b202b2173c486ea37ce3d397ed034c7f9dfeb15c5e927336d0441f4c4300e2cff0d0900b52d3b4");
1116
1117 test_HKDF_inner(&br_sha1_vtable,
1118 "0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b",
1119 "",
1120 "",
1121 "0ac1af7002b3d761d1e55298da9d0506b9ae52057220a306e07b6b87e8df21d0ea00033de03984d34918");
1122
1123 test_HKDF_inner(&br_sha1_vtable,
1124 "0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c",
1125 NULL,
1126 "",
1127 "2c91117204d745f3500d636a62f64f0ab3bae548aa53d423b0d1f27ebba6f5e5673a081d70cce7acfc48");
1128
1129 printf(" done.\n");
1130 fflush(stdout);
1131 }
1132
1133 /*
1134 * Known-answer test vectors for SHAKE128, from the NIST validation test
1135 * suite. Each vector is a pair (input,output).
1136 */
1137 static const char *const KAT_SHAKE128[] = {
1138
1139 "e4e932fc9907620ebebffd32b10fda7890a5bc20e5f41d5589882a18c2960e7aafd8730ee697469e5b0abb1d84de92ddba169802e31570374ef9939fde2b960e6b34ac7a65d36bacba4cd33bfa028cbbba486f32367548cb3a36dacf422924d0e0a7e3285ee158a2a42e4b765da3507b56e54998263b2c7b14e7078e35b74127d5d7220018e995e6e1572db5f3e8678357922f1cfd90a5afa6b420c600fd737b136c70e9dd14",
1140 "459ce4fa824ee1910a678abc77c1f769",
1141
1142 "18636f702f216b1b9302e59d82192f4e002f82d526c3f04cbd4f9b9f0bcd2535ed7a67d326da66bdf7fc821ef0fff1a905d56c81e4472856863908d104301133ad111e39552cd542ef78d9b35f20419b893f4a93aee848e9f86ae3fd53d27fea7fb1fc69631fa0f3a5ff51267785086ab4f682d42baf394b3b6992e9a0bb58a38ce0692df9bbaf183e18523ee1352c5fad817e0c04a3e1c476be7f5e92f482a6fb29cd4bbf09ea",
1143 "b7b9db481898f888e5ee4ed629859844",
1144
1145 "5d9ff9fe63c328ddbe0c865ac6ba605c52a14ee8e4870ba320ce849283532f2551959e74cf1a54c8b30ed75dd92e076637e4ad5213b3574e73d6640bd6245bc121378174dccdaa769e6e4f2dc650e1166c775d0a982021c0b160fe9438098e86b6cdc786f2a6d1ef68751551f7e99773daa28598d9961002c0b47ab511c8707df69f9b32796b723bf7685251d2c0d08567ad4e8540ddcc1b8a1a01f6c92aaaadcaf42301d9e53463",
1146 "f50af2684408915871948779a14c147c",
1147
1148 "38c0be76e7b60f262f1499e328e0519f864bbb9d134d00345d8942d0ab762c3936c0cd1896eca6b77b3c01089dd285e9f61708a62e5ea4bf57c50decda5c215fb18ac149d7ace09ffdfed91e7fbf068d96908e42cf1e7ee7bc001c7ee9e378a311e44311923de4681f24c92eb5f0fb13d07ef679ded3b733f402168dc050568dbf97fb79afe8db994874783e27ad8d040ba8e75343c6762c6793a42247eee5a6216b908817f5edbbdf",
1149 "e4786ad8f2ea9c8e420a6f50b5feec9a",
1150
1151 "ec586d52ad2ced1f96bd9458a5a1f64bc1b4cce1fa52517513c9ebe63d0d0eeb26ae5da73208137e08baa22651599a01bc65cbaa467baeceb8cd013d71d0b2406534fe2e6619da3aa380928f6effb09f42ba1fb7048e90d7898f1dc259b52c51b2d2970cd0c70afb6cf8acba83fd01cc589b0f31bcf2bf3b8df7879d7d2546c514706f6cf97b6a6b6d0a37d018ba553108f0e240f70f03a0ccee86f76589c64594f6cf74679bc330ad9f",
1152 "191a3710c72d11da7a2410bc73ba9d9f",
1153
1154 "c201dfe59e03574476e3c220c971c1685ea96ea137daed2ac10845c54d8e6e53c307acdf956f1bdef3868ab53e758c7cbeb4cd02972ba311f998e5f3983000345c8947aa59b78bb301b6ecbe9808ee0de99ed0b938fc19f677997398bd84bcd6f34d5b4ed123d04a093a8f42c1700fa2472f1ecc00957761a2d296bda3d2cbc0f21d8ed4e4fb122b71db1d49a0f516c3402f6046d93de6dae20df7683462557abfbf88437c8678dfa2613b",
1155 "464121895e5c9d85190bcee0437453dd",
1156
1157 "bd34acd613e0e0da6bebc45ba73fefa0bd8aa8ebba34040a07944f29eb63adea527101b8cd960e58d9ecddc0643b5e2d8db55170ace4678892e0a57612c50a4dc0647189f839b9a1229e22e0353dfa707acb7ab893f4ebe8bb910cd14f21b8fb8e77c4f19db027e0cd685d60212e0d920b34e96b774bd54f0a0f4ce2ac5f001b4411c19ac2e3a03b63b454eb30f4ddbac959673260d370e708c32d5030682ad56a99322972ba6eda6be9d027",
1158 "8e167ceae101ea0b3b98175f66e46b0e",
1159
1160 "166b4fec6967c2a25f80c0075379978124833b84894c3cb3a538f649dcee08b8e41707901f6273a128cce964ac1e9b977bb7fe28de8bc2542c6c07109889cea84d34ada6bde8c8f5358afc46b5ef5db3009fe3a2efd860ed0ad6b540595246c27849abf7eafea9e5af42607519f3c51ddbc353bc633afec56aff69a0c953584d8ede684b4faefeb8be7d7db97e32bc1c35abb73ce3ba8425726d89f98e93ed93b67b4c6993ffafb789c1bbda8d",
1161 "eb2fa0e8e04e698ca511d6abf7de84fb",
1162
1163 "62c625d31a400c5ff092d6fd638f1ea911ad912f2aabffea2377b1d2af4efeb6eb2519c5d8482d530f41acdab0fbe43f9c27d357e4df3caa8189fa7745ff95f811ed13e6497a1040852a1149890216d078ee6eb34461cfa6693ba631dbefacf83ce5ba3f531ddeadba16ae50d6eedce20cca0b4b3278e16644535e0859676c3fd5d6b7d7df7bbe2316cc2bfa7f055fffc2835225976d9a737b9ac905a7affc544288b1b7d6dad92901162f4c6d90",
1164 "bb0acc4423c1d8cfc788e748ade8d5fd",
1165
1166 "8af63bbe701b84ff9b0c9d2fd830e28b7d557af3fcf4874bb7b69f2116388090d70bff64a600427eeea22f7bee0324900fbce9b8752fe312d40f8a8485231da5d94694daadb3d6bf3e7f2cc83f67f52829cc9cf1d3fcc87d42b3d20ec2e27cb135aee068acbca68734ac7a5ff3e3bd1a738e7be63de39e56aaaa6104f6fd077c964ccc55cba41ca1783003883100e52f94096fdfdc6dcd63b3fd1db148fc24cda22640eb34f19ed4b113ad8a2144d3",
1167 "4a824cae0f236eab147bd6ebf66eafc2",
1168
1169 "a8c0f0e4afcda47e02afaaa2357c589e6b94168a6f6f142b019938186efa5b1b645bb4da032694b7376d54f4462e8c1ba5d6869d1003f3b9d98edc9f81c9dbd685058adb7a583c0b5c9debc224bb72c5982bfcdd67b4bdc57579e0467436c0a1b4c75a2d3cea034119455654f6ab7163ed9b61949d09da187d612b556fca724599a80c1970645023156f7df2e584f0bf4c2e9b08d98bb27a984fa7149c0b598adbb089e73f4f8d77f92248e419d0599f",
1170 "4800f8f5e598a26ee05a0ea141f849d0",
1171
1172 "a035c12af3fb705602540bd0f4a00395e1625edf2d44af4a145b463585aba46b34ee3203eb9132842000f54dcd234e347c28486ea18414af2d3445916049403adfa3ed3906fdb3b27f2aa4bb149df405c12fb0bf0e1dacb79c50bec3fde2295fc8dd5c97ed46dd28475a80e27017dc50d9feff9b1a1861ac86371791037e49221923e6e44874962d9f18f1898a98ee5dec1e9eca6d7c1ad4166fbac41b2587caf7fef3e7be90c80aafed5f7a0928127321",
1173 "2d124d81a4a45ad9c0b91cca23cc2991",
1174
1175 "d41739834414a0792470d53dee0f3f6c5a197314d3a14d75278440048294eab69df6eb7a33c9f807b5082bd93eb29d76c92837f6a2d6c5c21a154c9c7f509ee04b662b099c501a76e404996fe2997163d1abdd73df019c35e06d45b144f4dbb0462fa13767f12f4e1b2bc605c20ce1b9d96c0c94726af953e154d14cb9c8c8aff719f40c7cf45f15c1445ba6c65215024b316d60435905a686929874c6148e64c4eccd90c3a1d1553d18ff57d6b536c58ec3",
1176 "551fc7eceeee151523be716538258e2e",
1177
1178 "5bbb333460ffac345e4d2bc2dba303ef75b85c57233590fabd22d547bf9e1d7a4ad43a286b2a4618a0bb42559808fd813bea376ceacc07e608167ad1b9ec7d7ae919fd2991464cf63570c7dfb299b61836bd73a29007cf1faa45b1e5539a00514272c35d58bb877526530187afbcf55a6f1757209c50af4eab96c2ab160e6ea75dc8d6ef4bf2bf3e7a4b3a7619db84efede22a0f960e701b14f0f44c89b18f2640017c05ef51bcf93942b8d3775d2980b80435",
1179 "2c98dce5b1ec5f1f23554a755fac7700",
1180
1181 "8040a7296d7553886e5b25c7cf1f64a6a0a143185a83abf5c5813bef18008ec762e9bcc12ab7235552cf67274210b73942ac525f26364af431fc88cc34961169f6bf8872d864f360b9fbc27b18160d0578381db509e72e678402731157555bf9026b1325c1a34c136b863eab9a58ec720cedaa0049bfddb4863d03a6ca65f3dd4f9465c32b9db4d52f19e39f10ffdfe8c475032a2fe5e145ff524073d5ed617fa5e387325f7ab50fcf5cba40c2326bcf6a753019",
1182 "c0bb8427ef0ca4e457d2887878d91310",
1183
1184 "cbaceb762e6c2f5f96052d4a681b899b84de459d198b3624bd35b471bdc59655b1405e9a5448b09e93e60941e486ad01d943e164f5655b97be28f75413c0ab08c099bd3650e33316234e8c83c012ad146b331e88fb037667e6e814e69e5f100b20417113c946a1116cc71ed7a3c87119623564d0d26c70dd5cfc75ef03acaea6f8c0e3f96877e0d599d8270635aee25be6d21b0522a82f4149ec8037edaf6b21709c7aafd580daaad00a0fd91fcfe6211d90abef95",
1185 "626bd9eb0982b6db884d38e8c234854e",
1186
1187 "1bbee570394bc18d0f8713c7149cabb84e0567dd184510e922d97f5fb96b045f494808c02014f06074bd45b8a8ad12b4cb448ec16285fb27670fce99914f100ad6f504c32fa40ab39beec306667f76f9ab98b3ec18c036b8f1b60d4457a9fe53cbab23a0ee64d72d8a03d6d8d67a9f2ff6eb1d85c25d8746c8b4858794e094e12f54ab80e5ba1f774be5c456810755ffb52415b5e8c6b776f5f37b8bcf5c9b5d0ad7e58a9d0fa938e67ad5aaee8c5f11ef2be3a41362",
1188 "a489ab3eb43f65ffbd4d4c34169ee762",
1189
1190 "aeacffca0e87bfdb2e6e74bfb67c9c90a8b6fb918b9be164cafcab7d570d8cd693bd8ee47243d3cbdaf921ce4d6e9e09c8b6d762eb0507bd597d976f6243e1f5e0d839e75ea72e2780da0d5e9f72a7a9b397548f762c3837c6a7c5d74b2081705ba70ab91adb5758e6b94058f2b141d830ff7b007538fb3ad8233f9e5bcbf6adcdd20843ee08d6c7d53cc3a58f53f3fe0997539e2f51d92e56990daad76dc816fd013b6d225634db140e9d2bbe7f45830406e44fee9d59",
1191 "4eaa27b085d08fc6a7473e672ea2ca1b",
1192
1193 "a22314d2173ca4d53897924c4b395f0ae52c7fff4880525cee9055f866879af35f22759903b779898676a216feefd4ed75d484f83c00b58383b9279e2732cbc2cb5479b72abee5b4ab0bd0c937537b7a47f461ad419225c6045cca10c191225f0e4389f3355cd3a0d2de822c9d6f3cf984147de3fd3d8a6c9a02a617ddac87114f770b16cc96289321782108d94a00b153bd40651809cabe6c32237a2389e321b67769e89676cdd6c060162592ecadebdd7512fa3bfece04",
1194 "eea88229becc3608df892998b80cf57b",
1195
1196 "f99bba3e3b14c8de38c8edecd9c983aa641320a251130f45596a00d2cfeefe7933f1a2c105c78627d782fd07a60001c06a286d14ec706dcdd8a232a613e1ea684ee7ef54dc903ec1c09c2c060bb0549a659fd47ae9e8b9cb3680b7c1c2d11ebf720209c06879d8f51d9ee1afafe263807c01bb9def83db879a89f7eb85c681c6c6cc58cc52893d0b131186cc3b9e16bad7d48c46a74abb492d475beb04c9fdc573cc454242c8534bcc7c822356ea558f9fa3ae3bb844415916",
1197 "5109746cb7a61482e6e28de02db1a4a5",
1198
1199 "564da8460dc0c3d20b1fda3628349a399ba52446b5d3626fd0039ab282bc437b166f186b3c5e6c58ffb6bd95f8fe8b73c1b56a07ad37572eb6e148cfb7750760dcc03fac567ad7d3536d80922dda8ac4e118fc29c47ee3677183ea4e06242b6090864591c3ddaf4bef8c4cb52f8e3f35e4140034616faf21e831a9b8d68f5a841a0a52a2eb4f9ac9bb5b488766e251cdb0f29faeeed463640333ad948e7f3ad362948c68379740539f219d8f3ba069952efa0021d273a738aad0",
1200 "f43552da8b2623a130196e70a770230d",
1201
1202 "8a54e8bf30eeb2e098955f2eef10af3c0a32391656fdff82120e4785bb35a629c8635e7e98c9eadfa93ed6760ae1d40313000dd85339b528cadfe28258a09e9976643a462477e6d022eb7f6a6338a8fdbf261c28e8ed43869f9a032f28b4d881fb202720bc42cf3b6d650211e35d53b4766a0f0dfd60d121fa05519211bb7d69bf5fcb124870cda8f17406747097fcb0a1968e907adb888341ea75b6fcfbb4d92ae8ce27b04a07a016df3399f330cb77a67040b847a68f33de0f16",
1203 "c51c6e34cef091a05dfcf30d45b21536",
1204
1205 "2a64753a74d768b82c5638a0b24ef0da181bc7d6e2c4ffdb0ae50d9c48ecfa0d90880974db5f9ac32a004e25c8186cd7d0e88439f0f652256c03e47f663eff0d5cb7c089f2167ff5f28df82f910badc5f4b3860af28cbb6a1c7af3fafa6dae5398d8e0a14165def78be77ee6948f7a4d8a64167271ed0352203082368de1cd874bd3b2e351b28170fdf42871590d9d179ce27c99f481f287820fd95ba60124517e907e78a9662e09519e3ef868ebdcca311700a603b04fae4afe4090",
1206 "2d2ee67938422ae12f8cfa8b2e744577",
1207
1208 "a7d645b70f27f01617e76abc2ae514164f18d6fd4f3464e71a7fc05a67e101a79b3b52d4ecfa3ddac6ec2a116d5222e8e536d9d90fffec9c1442679b06db8aa7c53dcde92006211b3dd779f83b6289f015c4cd21ca16ce83bb3ea162540bb012ee82bddef4722341454f5f59da3cd098a96abbbdc9a19202d61c7697979afa50deb22a9bb067ccb4a6fce51c930a7f4767cfaa9454c9c1832f83ee2318b0f0c95d761c079c0ca2dc28871229aef11f64199ca290b2b5e26d8c1c12ec1f",
1209 "ec989e0290fc737952de37dd1ebc01c6",
1210
1211 "3436fe321f2a41478164b8b408a7a8f54ff2a79cb2020bf36118a2e3b3fca414bd42e55624cc4f402f909016209b10f0c55626194a098bb6519d0fa844a68ab3eaa116df39797b1e6c51eb30557df0c4f3d1a2e0471f1d8264fb3288c6c15dcde4daf795083aad2b5f2d31c84c542fb702ea83b7524ca9a1c1b9754ade5604abd375f23f3916cdad31aecaa7b028b7121a2a316713991759925f3fb8366c6795defa6ea77416c4ed095c1f9527026f1d621815b8310d4ff3fc76f798760b",
1212 "bb5e48212442ad7ae83697092024c22b",
1213
1214 "01bdb4f89f84b728a9d6b3a03f60709900571c1a2a0f912702cad73677ceeae202babde3d0197e3e23381cb9f6350792e05937703aa76f9a84b5c36705bb58f6b2ea6b1e51ff94a8de174cbc2ec5ae9ad2627a8b3ea45f162b727a7639f71a4cd9f6c6926a5d81d0a21c4c923037ed199f1aef517e2eea03bea9044c5baab84e3f85d625635bcb1c37ef232144b44c770f2b9dab416b96c906016acfb3fbba62ab40a4c08323fcf66437d953b164541cea3a8c81d186eed0cb23b3e98813a9",
1215 "8bb7ffa4572616f3bc7c33bd70bbcd59",
1216
1217 "9ae51ed483306c9a5a6db027f03cd4472cf3a71df5f1e11852306123d01ab81c259eeb88128275858efb8cff207ba5278dca3a21b358cbfdb5d223e958f3dca5ad9d2537f128c3dfb1fa564d3157de120f7b7d5524e67fc7abf897d9a5bd6b2c7c0a5348e6c95e920c919778ec7a86effb2ff91f0f44045c7dca46597e216e98d80efe25ba0d4f84e7e9d5e81689a5a6990d34e83e1a62a67371b7d2adc7ecd30ad1ad35359e9d9f8a299b057a2f441e313eb819770fa18cd41572adf856edc4",
1218 "e7f66f49f70d506a9b5508cc50f65cf2",
1219
1220 "899c81ea1162514ea7a2d3487d0efcc4648a3067f891131918d59cc19a266b4f3c955c00ddd95cddedf27b86220c432d6ca548e52cf2011da17fd667a2177a7f93e37b8892d51898f1485277e9e046a48cb8b999fcbcf550db53d40602421a3f76cd070a971e2d869beb80a53b54ac30ac0aab0cd1b696bbaf99bb25216ff199cd9a280f567c44b0d4252c98812e1ddab4e445c414aa8d650598b64d6768a7948093051e36b7051c823c7ed6213743a98d8eaf4b2b5e8157c699ea053cf4e53877",
1221 "52173b139c76a744b7a4d2221d4178c4",
1222
1223 "e50422869373abac1c26e738fb3ccb577b65975a7998ba096b04ef3aa148ada2cbe6beeabcf52d056d1766c245ab999d97445fdb6d59a0d6843eb4959752c89fe07b8411ddcfebef509482b8896bb43de7c875b29da52606b278b8704c62154b2da9bb237e68aa10cb85814250e4e4de73da200991e51241fd9a45f446de5a4bb959ad4727283510e9d2ac8a207ef0284163aa05d27f2d316e8ca1480f30604a8d74a0a661775398af644bb584a1a2c55c4959d0e7dd3f7c0c3614962fbeefeeafe0",
1224 "f4c517a82c850c3c4c96d23a8f3106b8",
1225
1226 "066febbe205ea342cde69fd4c72889442e14a5977d886252bdbc2ff5f8dd8fc5f1f870ce121ab929a6b6227b484648be9b3501443cfdecf8f58d4de834ed1800bb244c18985a8232583ac6fc789aa59d1c5e87ad03994085bbf6e1ba1157d4e4ccbb28a49b6529e54b3b34613d6cc9671855e2dcbba6838176c093737962eaf88c85ab780184d4cae78013b28103dca7f7e3b8d94a6ae0728db30a1c535783c4644a7e9eb4ffac6a95d30cf52ba805e220d0b2aa9a2e7de26a97efbd877ec6d1bad148",
1227 "bac7162dc8328911fa639f26ba952ab0",
1228
1229 "ccf92b17b9cf0d8577c1f3db9c19d3c86f16bab4058611f6aa97204783ebd07671eab55e375c4b16e03780675bb5738369aa7cf3b9156cd250f516392f5e0efa30cbb09132b66457756621f947093029e10233938c846513086023252d1bac9dd3442598f004e0b200f7dd79aa3a9122a0c6e77bc7fc8521988050f3c64b32c620fc1b5bba6f458e4791bdcfca731fd66e9da093b1a45264c8ffa48b3f1628dfe19c9ac1d71f1d5214ddc7e4f0da60ae122f67c394a55645628228d5e3a3174fdccbaab4",
1230 "19a9eadf9c7c000fe340603f27bd830b",
1231
1232 "a37dcfab50a317e6a7cc51524b5d611a53652b59fc7df0229af3dac4d527d54c1134a14b2ed325d9727d07d9c3d0797f1a34561034be6de98b551dc384132235eaedae7a9b97bb7581a2a0f2c4e8e32f3e294f9b30f646dd33ce58187188146e14f01dc3ffb581c3bc834726b66c4732a98c3f8256ed22077ba8b34c024d53fe798517abc2f61eca0c6722fc02254c9141a54d4e106aaa6d4b2957e6a12c88ed00f4c4bc4c223b92579859fc0edb9b53f0bba286c53786198c9b6c6eb5eb5b4490844b7d06",
1233 "b9e1455d06233d14b8d3020441351a76",
1234
1235 "0248b909e1f31ee855a03b6c81366757aa3732d2eca0b06a2b1015584c2d8205a4431fcdb02f6a03077ccf368ecb78b3eb78664b3c7ac157088b6cf9758adda4bc1d2cdedb9a69448a2833cf6f21865795bbd5551be859ed297aa82c288b898e331c07c3c8fcc4b2c4ec90bf8e003a499248a677f1b020357625f079cdf92fcbef89d904e11d23569e0f0e8c52303c93c867023a269bc036d8d36d69ca9c7664daacc92a8dc42c3600dbd4c02278333d216011252271def835ce4783883c0760dbcc00bc33bb",
1236 "ea4606777e21f27d4ae860b3c25283b7",
1237
1238 "ce283768aa91488c75c71ee80a4df9495377b6a9ae3351a5962aa8317f08818a0117cf6c391331866d3abc2beea2fa4a43cf32a08385ea2c03dbabe3319104a6c0a3d171061ebed5a23306a8618a81fb63d9dd4c79b42bfdd2a79e05d78290e653f4c6dfd75bf5625ddb85c82bad9444faba3e1558691c004bb50afe37822e320131361d7572e015e559c0f313b53e0d529dde64e74bc41eb52e77361a3ae5721483a795a80a87d684d63f92e347843eb1a8439fef032b3d5a396b154751bd8ed211a3ae37cbf0",
1239 "dca4d5f9f9b7f8011f4c2f547ce42847",
1240
1241 "19265f48c1ea240990847dc15d8198785d55ea6243ef7012ac903beabbdc2bd60032fb3a9f397d28aebb27d7deb7cf505eb1b36bfc4dbcfa8e1c044490b695b50e0974d3c5f0de748508d12ed9bfce10eaadde8fa128d3c30c12d0d403f60baf0b53d2fd7a38cc55dc1182b096c11d1ec9f171b879a73bd6ef1aa7825bc5162cbeba1d9f0739d1337c8142445ce645e4c32477cdcdf37e99fedb9236e24a3d94f0e45ea0b41a74762efe19d27555cdc89feef5b6e533237603fe98d8deae084f69799deac9043e86",
1242 "688e532e15bde53b0b652291edfb7681",
1243
1244 "1080391fa810c50c7437ec058459d3a8cd23c33071c187474151151c809871b6eaf4cf88f592f84557e1eef5c847d3490912072b25b1919af724c0b5ecb111150bd95460328a0b1ba29613c0bd6486110fe6dfab8cca5fde18f5b0bc4d2dc970781511d2e45fc7385c3da18eeb18b3a9e68593d82c75bbbcadab2e5a29745f6f3a924e039579f4418dbee186d9cc24b896d96bd990186bdcbd3082b70aee9bb95a36531ecc405ae13d011bd10fe69fe728c8aed73d1d38e5506bf4fa770347f7e0eb6749121cc0be75",
1245 "cbf8ee5d477630dac9457a9a0659497d",
1246
1247 "0a13ad2c7a239b4ba73ea6592ae84ea9",
1248 "5feaf99c15f48851943ff9baa6e5055d8377f0dd347aa4dbece51ad3a6d9ce0c01aee9fe2260b80a4673a909b532adcdd1e421c32d6460535b5fe392a58d2634979a5a104d6c470aa3306c400b061db91c463b2848297bca2bc26d1864ba49d7ff949ebca50fbf79a5e63716dc82b600bd52ca7437ed774d169f6bf02e46487956fba2230f34cd2a0485484d",
1249
1250 NULL
1251 };
1252
1253 /*
1254 * Known-answer test vectors for SHAKE256, from the NIST validation test
1255 * suite. Each vector is a pair (input,output).
1256 */
1257 static const char *const KAT_SHAKE256[] = {
1258 "389fe2a4eecdab928818c1aa6f14fabd41b8ff1a246247b05b1b4672171ce1008f922683529f3ad8dca192f268b66679068063b7ed25a1b5129ad4a1fa22c673cc1105d1aad6d82f4138783a9fe07d77451897277ed27e6fefec2cb56eb2494d18a5e7559d7b6fdddf66db4cbc9926fe270901327e70c8241798b4761dd652d49ad434d8d4",
1259 "50717d9da0d528c3da799a3307ec74fc086a7d45acfb157774ac28e01ecc74f7",
1260
1261 "719effd45ed3a8394bf6c49b43f35879176a598601bd6f598867f966a38f512d21dc51b1488c162cbdc00301a41a09f2078a26937c652cfe02b8c4c92ddbb23583495ba825ae845eb2425c5b6856bda48c2cafae0c0c2e1764942d94be50da2b5d8b24a23b647a37f124d691d8cefbf76ef8fbc0fbdafb0a74a53aaf9f165075784ab485d4d4",
1262 "6881babbb48e9eea72eeb3524db56e4efc323f3350b6be3cdb1f9c6826e359da",
1263
1264 "362f1eb00b37a9613b1ae82b90452579d42f8b1f9ede95f86badc6cdf04c9b79af08be4bc94d7cac136979026b92a2d44d2b642ea1431b47d75fce61367919f171486a007cc271d19de0d1c4c6a11c7a2251fe3aee0bb8938a7dd043d0eb0758a4768c95cc9f6f1703075839487879b47c29c10b2c3e5326ac8f363c65aa4ef76f1b8bd363eb60",
1265 "c6ce60c1852ea780ed845aac4ca6a30e09f5c0064c9675865178717cfeb1dc97",
1266
1267 "d8f12b97f81d47aebbfb7314ff04172cf2be71c3778e238bcccdeecb691fbd542b00e5b7b1a0abb507f107f781fea700ea7e375fdea9e029754a0ea62216774bda3c59e8783d022360fe9625621c0d93e27f7bc03632942150716f019d048a752ccc0f93139c55df0f4aaa066a0550cf22e8c54e47d0475ba56b9842a392ffbc6bd98f1e4b64abd1",
1268 "e2e1c432dd07c2ee89a78f31211c92eeb5306c4fa4db93c4e5cd43080d6079e4",
1269
1270 "a10d05d7e51e75dc150f640ec4722837220b86df2a3580ca1c826ec22ea250977e8663634cc4f212663e6f22e3ffc2a81465e194b885a1356fcbcc0072e1738d80d285e21c70a1f4f5f3296ba6e298a69f3715ff63be4850f5be6cb68cdba5948e3b94dbbce82989aa75b97073e55139aac849a894a71c2294a2776ce6588fb59007b8d796f434da6e",
1271 "02f17bf86dc7b7f9c3fb96e4b3a10ca574cd0f8dedda50f3dda8008ce9e8fec9",
1272
1273 "152009657b680243c03af091d05cce6d1e0c3220a1f178ae1c521daba386694f5bab51cd819b9be1ae1c43a859571eb59d8cbd613c039462e5465ba0b28db544f57a10113406ccf772bc9fe5b02538e0b483225209c1eca447ab870e955befae6bf30dd89d92ddae9580ccf0dfac6415ec592a9a0f14c79acce9679f52d65fb8468012cbc225152d9ed2",
1274 "b341f4114eee547eddeb2e7363b11d1e31d5e1eb5c18ea702b9d96b404938bad",
1275
1276 "eaf4249b5347c2395104a96d39fbf5322c9af2f8ec6a8c45efdc06a2b246efb5502952ab53b52ed9ca8f25a29cd1789b1b5333eddc29a5fbc76c13456a3eae8c9208c1381d062ff60a061da5d26cec73fb7a6a43eace4953f92cd01bc97ed078da19da095842afd938f1f83f84d53703f397fec2bd635f94ada5a3eb78103ebf4de503e8ad7295cb7dd91e",
1277 "d14c7422c0832687786f1722f69c81fbe25b5889886bf85c7c7271bf7575517b",
1278
1279 "a03e55ee76150a6498634099ae418184228320bc838dbfe8276913761516ec9021226f4b597ba622a0823ca499618169c79eb44af2f182d1cc53caefd458a3ed7bbea0a5854653f2b3c20f659f70f23ae786238a8d0e59c29ef49d53125e50abf43b6f65c31f16bc174e43468717dddfcb63f5e21e8d4ba0e674140a97cffab1d5c165f1d9aef968154c60ad",
1280 "fa889888d3b984c1577fe7c38ca86f0df859291502fe0b2f6e82c778babff377",
1281
1282 "2fb4178a0af42b155a739e2910b004e0781c1bca697ca479bf8e71430aefc043883cc7a151779013d2ad07a47cd652b5bdfd604130a1c565115ac51ff3c0ae56b5886c1ab2f0572e385e4fc33c430b874b46aedec49f9b6f45c08be3633bdde99ee02d7e9325276b74cc9d0fb6bfd85e093f2c2a8d3dcfa24308ec18c229f2072b8b32545ee0a9d46e3f1a0f53",
1283 "254a115343d0ebd865e5d3ff6c61c3f9b65fe96ea92865a5681b1f1f0d1b00e9",
1284
1285 "dd344dd531f415a590a9c1838f242af8605bc0c29c1a71283ff5cd8af581683c94c48095e9e9e042b73804e0fd467ecb78699930696f3b6a9890108b99a0e4384e8a51bbadf99b53c358d8cef9fd545a97a13399861458f35a2e86309009c546136d086f058c0c7fbdf083750cb17250c5ebd8247c6f906c8db978a26123d30dec58ecdb7a0afd6face84efcbdca",
1286 "2d56bef53fde76ef9849f97be2ed22d3c3d10f23b049eca2a8aba0d1fec33119",
1287
1288 "353111e447fee6f0bd05d562f30626ab9fb06384a620c49034a5eb3c0bc6d1eb1b86015053e6041ab8ac1cd7b4633512b0a318bfe592e2da6eabb44aa2bead0ba238158c2ea5db56bd7342efccf9d7fe76b8a6af45e0ad594816915f65749054f1d1b7627e4355ecf4e3af72e4d0f5b51877751c6f110f57e86ce942fcef640c31d94e98ecc959238683cb28a3f178",
1289 "11b27034db724b46882a3086815a835947d19322885e08595be271c511ef783d",
1290
1291 "c4e5a5afa1c7d2edd5a21db8b4891ed53c926131f82c69d323b3f410114281fecbc9102bfa5f298e06d91fbd7e9b9661bbae43e7c013f3796557cf2db568de7c94a7cbf5a53ee9326ab4740cadbf1a0b1f59b92040156b977eb4c047a1f34a0c66a85f776a0d1ac34a5ca30b099cb0bbb2ba4c453edbd815b7f14fc69e8cce968bf453171374c428eef8342459db6359",
1292 "f1ebe75725c26b82ffb59c5a577edaa2f24e49c9070cb9ca007e65938f33dae4",
1293
1294 "3b79da982ac5f2a0646374472826361c9d2d2e481414db678e67e0967e5cf3cdd0c1f570293362207191ecd78fb063347350d8135a4f02614d1de12feb70a0046939c078d7d673fea589460265290334d217d6231274ae0d3891e6f50da725f710c983d9bb16ede20833caef34f9dec3c36a6f9fc4eaa71256ac3a136b6a494dcc5985ba5e5c9773a377c0c78387bc8a4d",
1295 "1fc7c4802141e2db7a9199c747d885a72d8f068262863843c9f4cbb19db38994",
1296
1297 "cf9552db2edd8947fd7fbbb2f7189a578343e742891ae6fb85fa0f64da8706e468f0cdc5607539db5726a2679aeddf3ac2ce711e886eff71dad203132e6ac283164e814414c7f686b011fd02c95f8c262920e9725c811a22c1339e0de16e5acd0036d620f2dda98e30c9324c2b778961e0c0b507ad5b205463a448199c9bb60b4f303420a1be3b3cfed5ab0d693cbe331036",
1298 "b51adb0c2375c9d302ba61859040fa4bfa0091275eec1053fc13950aae706c25",
1299
1300 "4ebc9225da5f168c07ef62f621d742cd7c71bbd063269f5e51d65ef164791fe90e070f8b0e96f9499ec21843ee52290fd219c3b5b719ebfedcefe4efbf6b4490d57e4df27d59796f37d35734110b96fd634f5f20bc3de9cd1c28479464be84270ae7f16211f0be8839e8c8d0734ab22097dd371859d9be527a4b2fe83bba0637170ba6e3b1a2ef1c0cca121ffa57a4ffd78af2",
1301 "54a3fd90ae00dfc77644ca16b4964c3b32a4641c5305704ee25d9f8fdbfb5c7f",
1302
1303 "a83f74dcbb48d679db402433020e33dacfa2c37f1e39b2d9dcdc70e81a2ab3d75f586c274376f90a39f49c0dad642cfa4f810afdae7157050847646d60cc6adcd27f7c6a24dab9049dd7c6111ab37c555ef2dd16aaa34d7e8de5ff41feaaad80a8bb8cec85fd7f2eaef28a8772828ab3a5fc24143a58fc0c15bf27ab1a4de28a8a1584f68f65b151154cd1b6dc5ac0dccba7c73d",
1304 "5d084841c35b1cd9c43082746960ff5bb2d3de78f9bfdd80dc9ca4f5eae2a66d",
1305
1306 "734f872c431ab145706b7517e496a3be98bca885fca0105a99b54980f47caa84b60cb3720bf29748483cf7abd0d1f1d9380459dfa968460c86e5d1a54f0b19dac6a78bf9509460e29dd466bb8bdf04e5483b782eb74d6448166f897add43d295e946942ad9a814fab95b4aaede6ae4c8108c8edaeff971f58f7cf96566c9dc9b6812586b70d5bc78e2f829ec8e179a6cd81d224b16",
1307 "14ec5a3c2ad919aa0f0492f206710347e742e7a58d6fdfd4b2c93dc2183b7b6f",
1308
1309 "10112498600da6e925d54d3e8cb0cdc90d0488b243d404b9fb879d1c8beb77bb6579b77aebdbf3e785abe61df17e69e8db219f29ae226f7ca9923719350abef876ec6b3920ebb5c28ccedb2a0b70d5d67a0c8a6116b74341922e60a867d24aa96cf1a89ca647d6c361c5922e7f91f9db114db322249c6a50dde28093c94c01166e11d66c26f73c322d1875f0f8e6bd41c86d803480d8",
1310 "c9a88a3f221a857cc994a858f7cb4567979ada7834a265278e55de04c1fe496a",
1311
1312 "6969a27ad5d0aae6479b2b044bb4b043642375ff503ccb538e17be2f1e41f6aa88b1db991ffefd6087cfb20875920192b671be8b7381f7e1b33d8ff5213429f110fe475cbc74b3ecd2211f9b33f308fcf536e0d0abc36bd5e7756adefddd7728093730ec339c97313179b9e40e3f8e2a2a5c21f5836bf0d632a7961239a6a7f77b44dc700cdd70d8abbfc90c8dde5bc45dcaca2380df4e",
1313 "bcdec7a8776380df27a4613cb50b7221995d3f752fa55691798ac2dfa0b15599",
1314
1315 "163cf8e89b260a81a3d6e4787587a304b35eab8b84faebcef14c626290a9e15f601d135cf503bc9ad5d23e7f213a6146787053f618c6ee90467e3a8df1e03387928acc375608339f7fa45788077fa82f87e11d3c58ce7cf3f8dad6aeaf3e508b722a2a62075df9fa6af4377c707ffe27aa5a11468c3b1c5fce073dae13eac2d1c9a635c5502b96115e69e741a262ee96a78336fcfc34573c",
1316 "181d10fa5a58ca57077be52eda53910135087312ca7711084e4a5213c81cb4a2",
1317
1318 "3a023141ab4db8b08c5cb6792ad97abdf0116d512ea8f4141a8b987f1527657d2fd98f7deca55cc6492a3d0bfad53e40f656a1ac3550c63eb8554f24cb11819a87c5ec009af84e304b69b50eb847e46162a4f8e1ec284b902002994e332461a84ab08ef23cad57959aff64a9ed9632c73ee5b818dc964bb2597cbf25d6c9cf508081be7a5b2e3f9e3fd69305202af11a92002a7b8b038d4c6b",
1319 "b75b698857675f8aff2b482ac437925af3ea86198484cbc87b60e6dacb13e7e8",
1320
1321 "2fd7ed70c6946b11c819775fd45bc0924c02e131ab6d4a3618f67e6d3b77801d4f0d87ea781bf9fa57929757dc70f5945c872eb4e480d547cc1f2fd68fc99f81da4361e7e2bc7b46fb0ef1e3674139ad6b50ee1da830c960a90fccb8b9dac020f701e22fac7eda3edb14eccd1ad47223a1e68a35a1860cc9d74dbfdb60b2cc40cfd072897d6afc2a202cf0dc9f338a3f25d068c4758987ca7d61",
1322 "85c9275ec610ffbcd7f785c0ad24b7700b32ee352e6720f1ea2305bdb7f45277",
1323
1324 "cecb838187223873bab25205a54dadb1ab5a633958cbef3aa04f930467c8f7a947ff12548d964ddc843fe699f72c9377f1c76948c7a2fb5f58b1c65a94b7cd3f3bfe80cbe74be2064d11eb1bc0e52b67f732b1d00f2e2b58d30c4ff13c7479943430958d9f283f199c9029320860bdaa450404773955c74e99c9f47367e642cfb9fd1843bd14ac3cfa246887d885916763a62ae54c011668304e7e",
1325 "3a5dd05e009e7f985a2668885dd0ea30c5502a1b5c575db6a4c1149c2e6229c1",
1326
1327 "283dfdb2e1dc081e3c2b377ba5bc6491cc4af08c40fbfa5e3fe2d45fcdc8b736032cb5fdaa88f0a008d60a86fa53dc7443836bae2475175f2d48163a52ee216241306d87f3f2dd5281b976043a6a135af2555ab39c71ee741ce9e6ac56d87ff48b510d9ae5a338fe50db643b8c8a710a80c8a5e4d278e667b4ce2dfb010f37b588987e7ca822676a1d44bd7419395e4e96e43489eb1167ff9efed170",
1328 "5643c4252210fd45a2a67cd0a97d37e80d1b4a3c2fc86b0c3a3b4d3c1723b9ec",
1329
1330 "f32d2e50e8d5df7ce59a9d60255a19f48bffe790e3b1e0ba6b4bc53d920b257bff8d8003d5faac66367d784706f690b2f1f3a0afafdcbc16866d00a41169734f418d31d7a1c3ca9ede99e5b986f1294710fa5d011d5fcd13fdbef02b755b49cfbf168bf3d39a00cbe5d82bde2fb4ad5cf0fd65b1b5a3db5ad724dff745486da2830ed480f3e61795542094dd88a5e3989ae501e5ff10ae921c89133309",
1331 "1ead94e30440b647d4cb4d7b3ed6b87ac07e8d72b3e5f28352bf14a78232ff1d",
1332
1333 "8bbc18eab6bcd9a3d6b90ec56d3be949e02a8866d69c7808e1ec787e600c7f72a41c001f513b6cbe079df94142dda2447f956e41a12df60392f0215d2d65331b5cdc06397d4796530b4bc45d7a975394627537b4e09e0f6c3a53f00fc1a9648cfc25b2a00288604a28ecf780dc100620d1f169295d9acb2b1f3c6afce4811aadcb1e8dbca8a8d18ba7a81a1132f1c2d014318e07dec7332889d4198c5e95",
1334 "429f15c653f92734bfe4d1749e84da8c28861b70c5158bf59809ece810221774",
1335
1336 "a3d0eecfeff88df1cdd1e86df7bd2ec3ba60bcedfc9c42ef7dc021b05dfc1808df19201a6c6694e4dbf69514ef08ad1d21c7b28ba034ee9397607cefaedef5e9d3784db53a21f703a22b50d5dbba3a8e8579074c1a8b9a782fc5c89cf61a047408563c476110fe77acd9df58c2ba1d3e6dde83da718b8dc6cd57cd5e3e988dd2051cb679ea1af16881690b44acf09e54615eeedaad1b11a4f97e53de8d40d8",
1337 "afccfd3b18f6d292d2e125884b721b3e3099c4dac8aef05ab0fba26799043d02",
1338
1339 "2ecb657808b29574b020545fb7f94071406047ef4de20c003cf08cbd91930187f55b079d7f99fded33cdae2bc8623021af990d4650c4a19197b4c38faf74a8b40d3803efb1907180a8e1150ed6167ff4f293d3ddd26a2790e9d22c0d0ed511d87e48a4952500bbd51943d230687df5941334e1dc5a3e66a43a320f5c351c059c517531b76352a1938ddb2db806ff5aa619667e6c71a7257693bcb4a7acb34ca8",
1340 "c994acd17e08e8efd3ba83915245781e3727bac445672c44e6335e4f7deaf90b",
1341
1342 "e649888592d192c5fb59f10560f5f5a7b0ac21739c35dd80f1fe6b5825731c572f7cc4549c476b84e049459aea7fe533fbfaad72b79a89e77d1addb6f44cbbf5e6a65a5552fec305bc92ced3c84b4d95074387c71184e875d413f65c2b2d874cb3d031d0da7d0311383d72f823e296937d8f97bad17a62f29ef1a091f39be8233c01330d5c4c9170fc501b5022ca29f605e6c59220055f2585bcc29e742046432c",
1343 "88a9aa4b4ffac981d1ef0e8b233cb309695f89211cd4e94d50760909e3cb919c",
1344
1345 "816b0bffd99b0f7821e6093ef152723a9cb45f7a082ef8d6bdf72cd33b5aa3c79102f43e2b74199decdd20057d0e227ae4c57945582e2e9653a9b16eeacecdbc5aaedac7e35c35cbd9adede7f83bbf36f8b0453d61416a85a17821885b3757d203fa2560a85c4b4c10dddaac0ae230b700fd2929cc6f94e9ccebe4e9399d284eb46b3ed2227b4366baf54d1b5c0a5d4225358fd240c0940bff8b62592a092a7b978b",
1346 "c593f3d663c48426ce892f22584d49a3335cce3456194b7b5ee4814fab477fcb",
1347
1348 "a10918880cf31a8551af80bcb0d1a6ed71ca42c71e533967ef0fb71c866b7e6ddcca7e5d7cdfa6edef59fbe377c6e7ca00b1d33a530ef8598dd971a2cff995e5386a858f109b012c4615802a1d5e7fe0221d19cf617ed827d8d8cb8d2c8ed81b9b3354a832f1d14a402b371a0a611737c0543b0eb06b82d8ba56eb6304f1ef16ef6b143049a7bf50c4e2493aa69756d8c39f627fa89d9d741a99f9afbfeb81de1a5bec",
1349 "d557aed03eb7c4c4c8091efdee992c9ad7f8d2e79e9296b40a08acae37868d48",
1350
1351 "de7ba70e45c879ad6c90ada6fda071c2b692840f7893eeca9b69ef8285b4357b7b735151b6cb6cddba04365ce3d520ce41e1cb9da681c07ffcc4619ddcb420f55ddbeefd2a06f689d8498cee7643606865a3f8b96aeb5d1301751438f4b34fe02dba655bc80280776d6795a4dd749a56cae1f3abec5a2d4e5183ee9bf5382c0492199eb3b946707022673bc641f0346119a3a4bb555698f895f6d90e06cc1e2835ff814d",
1352 "06cfdd9cd7ce04abcdbf3121a9ba379505dbbb52f148c9d28ad9b50facf573ab",
1353
1354 "6e9a5752ff8ae7c385b088e651ef2543daae1624562052f787c9e0f5d83e8f01a82ce7d3e69b5f55de74d14d52412a3dcd356687346cbcd59e7315b8650bc3907e2a70ab054354b11cc7ac3ff6ec67d22fad22e75f125660eeb1d02a2a75621d969ed92385092e9de8b20102657742c9a91f328afe9a8a60208af9914c03d4719b8f0a838e7656e2ea3cb8dfc66a25ece2927eb93a8dbf9cdb077936f63e82543306ea1347",
1355 "cb1e8082bb94629f162f20d815bcf3b212007bc049951a29ddb18a1f556bf3d1",
1356
1357 "b05007119789d382fa750d2087dde79b37a5459c24522b649ac976b07059cbdf99fcce56f6da94246e0f5ae241ae77dd99068f7863240acb5c99c4906f7d06403eb3b679ff6fcaa389f602d3aea5d7efcc35af149f3d523459f8a104f5498615c8fc2740594f5f4872b16ebb77c9ef19f7ba0b3881a6ede7b97175d2aac731a65e608975ac82395b52c805624423a7a3431e0daeb066c12ca389a9c338fef03a296644dea211",
1358 "9021fefc1a020cd0c579e3dd67a66dacfabedde9cd36ddfc7d5c5c7c47be2721",
1359
1360 "a19909e14ddf9b3c470df6bb604604ad767c38c83b2b747937472b791173c3a10a733dffcae417295f2a71d183ab709a1d3be02a0bd61d811f95338967db44eeb2cf2a2f4f105ef618a418a5b031b831086f653328ddf43c2cb30b698c188638a196199a65cb374a7b61335c6f40a6193e01100a19a6c2536689fb4308935128e0ae5268937d6ccd8e4a0a21484000fbc7da29d8669b4e6dd5004a3c61b36c6676011dc0628ec3",
1361 "7dcbf4dd9c27fd8340f51c553898502cec53d3bc83198352fc58465625c076a2",
1362
1363 "b0dffe4a5f64f612359397e4e070a8fa01296c1d8cee25177104d76a7c154e4279cb62a99d9d7afa21e84f983041f3df030a115b4b437638cfa3d0fa56e7b66fc76be9e18ff7da8f43db6c5f863efacd2eb39c27a20da6fc867572d29bb96017e0e71a5afe1b1dbbe29575a0ac0ec7aac84c95e85af5be4ae0a14458133252230d687e7cb1b04b65483df2c5685a62601aff85053ba2c509234fcff585fb967c96169bb0725f6d75",
1364 "8e7023d18902a9184a0191f1c7a2b79030e833800baeeb33e2d0673500245dfa",
1365
1366 "dda3625c78f733c7df0b5f4987cd30d7207afa40ca07f3b686c0458aea2f62371a3f98a2f3a1e5a0896f0cb9d40fe82ca65b0132e0fe5d87e621992750483855e3763ae2bf98f0acd9201065acf105962c7b88e3fc277490e0f5d6447563440d209271a544a4fef4b86892d578392c1d9a23b8da8448e1d85d82276ac14a3166b9d96472ea8cb47e0c8dba929eb007cad89bb99fe22a4c674312b21f9cc4a56996943cd1191abc54bf",
1367 "ad83957a387225aad811b0737f582dbe7eb616187a8ba8e09b00db5d0bee4a7b",
1368
1369 "5cd623be5b6bf6d1bcb414c826d0f4ce60793791b6d82dae9f9e9b699e50bba266e2850541882d80b2c9edfa59d504421818ff45740f37853e5b9bc67214af0a5f5fd5c00843cc39cbb8765b4001de99643c7923f738ac5922868f865dd3f1cb90759c597843d9e34daa3754a2fd89bd8c0d2e9106fa95149448ff11273587cb414a603759315f6881c6b94b46700d94d8b2a5f86bfdf99ddcc974cf98e47bf4ba09acc273b463afaf35",
1370 "f754a71e3439760aec2d763751e160d05d3de0809dd4fd6aeef588da8b86a517",
1371
1372 "42c0a452e83840ae858c094c044961d5f2195ddb34a21cd1f5ab575be3803ac99b9872dd617688d515cd6da562e756853947c9ab7e8ef85a019b4f1baff6494b0a6f87d5d602234115fe42ee3667e89b8a98112cf72cfdabf01fcb8ea4314938768b0bc2aea5bafa6e67aface78fc021cc525ae60746d1ceac7ff33a2bf8e398c935252a5127f5090650dd69dd28861ee9becf6017a21ccb1b03f0a9aa15bf74eab5fd9727507b75c701f3",
1373 "d5980482d666dde4f2c3a99b45e523fd6410be999a96ba8c5df397c950605e70",
1374
1375 "fece673103322483b85340e991e478c2c15e2d795a98adb5b697b4cf17a733898aaa4ffd11b1add300c9edb7a818740a33286fd8cf82140b0f7f2bde8d5bce94d58b6d697e5015c99a8df1c051d611b2c8c96a4c48a11eba9c08fe1aba2d4d31a617c75d9439e2cb4d4654ead346d52048ea26bb0c1c522a26db346de54639cac6f668c299919f43e09c1f1f78914abd7b32ac0f641c39c3749fd5be55cd1ac6fed1557ed683d1981c395946",
1376 "17f4b2f60cb364da5e8a62db58e07eb1c44b888c433adc1e62461879cd271463",
1377
1378 "a542b2bdf8e04ec2a004cccd2f89e7bfd17ace1ad285c91360ac20e9913e3976a806000494c28b61b9d7ff36f342ad94d8d281d03e949d91fe8f4127f7b2ee1e550bcb13133a47c7be2400727cece45a4e1f95a3922e1269cc22950ca58bb7cb34b9da957d2fc81b3755982ad36dd238b9c8d33dd53a72c452cbe341a5afdca5ce79f730da8b5886add18f06feafbf57a33700430fa003c919f3f56dff08a5d3aab1e88c33353d30a700adad07",
1379 "50cf700b5b6c802e20da4c1f9b75bd0a6632678212bd0e2418201f3a10389994",
1380
1381 "8fa67f49db80f22bc267a70e5636dfbc8a21c83d9691fe4b9c3051068b3fc9e94430e7fdfb712e4ce086e299ff5a104e65d7ceb685b4c46cda8eeb14cd3b9548d85baed5ec2f412810af3d034cd67a75c541f70829f8663c4d8cea3415621fb0954e5b3b756333a69a0a41b402522517f087ca9b4a06eba23f4fd5d02c5c6e07c132769660b50dadc5c07515ec751a1d2fd2cfd8b0855b85f602344fdbd28a37a52e874e73ccd627dbf9628cd1e8",
1382 "3379265620eb781d6b59e331cc525e60e8c063e19f96cfabb2fda9aa83cdeba5",
1383
1384 "23ae9cd31da25c0187c0247be19e089872742d772f73d0efde5889c97b40d12ddbbec35b8f2b1f9c0b3d947708db3f2726306f4dd6ffabe37736f671bfc551835db0825adc6314e2cb479fe41b92497dc8638dcfbc0e3bf6f0b4c03dd418a892f1ad6138ccf442bc0e04cb2ae36a2f80a0340f63a849891190fc719781e0de44dedde95d2783b1121e9fa3b1280cf81af5cc7e7363579c1da03390e68fc5fc806e67a132b5bb6acd413eace2b120ac",
1385 "a17a00ac106c0af50c4f449d3cdcc2cdbb9848d2d85a36ff434099162e25606c",
1386
1387 "3bfa57a5f9f60203059defd501977628908ee42116e4674dc0a52a32c5bac02aeb60c6714cd9c47c5a61558c21648884ccee85f76b637486f3709a698641c54bf5f5eb5b844f0ea0edae628ca73fb2d567710080e8a96c3fe83857fc738ac7b6639f0d8c28bfa617c56a60fd1b8fbdc36afe9ce3151e161fa5e3a71411fb8e123d48762bc093558aea7f950706bb72f8dc7ca3497a2b3ccf345ad3d9eafde10889d76c61d432e3a165d34ad0ee2d9619",
1388 "1a2cfebf3483c33a5eba84121737d892cf8bd6c3ba324fd4ae4c2db42872e54f",
1389
1390 "e9b9525afd5634cf8d16df4ae7e12e8ae206c6ed6e7d4dd96f6fd75accf7a10cc22b023c7f569e4aec88dd51ca519c0a00c922ee33d3559b98a32d79067e6a9d50c182eed125de864841455be751991ea635c163ddbde6031223e2be0fd9f5253885bab81c4b5a4b4a4a00ae66698d8c7c538c9493c068d786f7dc710f90ac6c257f93e1884e7c609aaaf5927021e01d292a6bc87e6643e09b2505da2d2cf639bdb6f3b33cb8ab8fdf690b512d02fa9956",
1391 "3ff47b4bf4f908aace95b0468a54b7e6644fe07df69ae327c0ff2e45325b97b9",
1392
1393 "13ec10c6b27a6ce6fdd5e2314e8626a28a69f313ec62f29b044cde1aff32e61228c252b9affe6a4ca93593a55932bc10aeb3f85b0c1d6c2c506d6c970e72e1f01c3aeede55cad3b1971111f60e1fcf48b5937c691952b691617f6a058ba73decf83b2b5e2b446ebfce52a24bf5b526f1a7f0c5659b6b96713f68208cfe38c2adc3af5361b9d5051c56de8fcc975d8bb48db41c7818cfd574f312d652f08f38dc857dac0e88e55e70379f20a37b7dc4396ec6",
1394 "9703a69f279ef15b843b355f86b3f7098a46eafcad625920d93e0e3fb136fc5f",
1395
1396 "3d8263a177af8c5beabc76a4388e0816ab1bf1f5856e985791f15688feebe4ac6d480fa64999b339575be66d8e7c7435281b8c4ef990b86a00ac128e3c41b6b9c0e573c60af4c69391d408639d7de6815b38122731a6389d4f0534a587af82175ee3f5c963c8acb1bfaf434e0e9946436df9eb46d4bb0038a7842295873c300f6ecaff76fb1e4fdb0a75fef588d87cc486e67f738bd4f8832fb24526e5f0a8e91920f8967bfd96599aada321b4437049cc8836",
1397 "e82d636a61c7657029699374a2da3dfabfae366e7708c7e4ba2dacd8b786a36f",
1398
1399 "01f793fa05548645f644a64ee1b5ff7fd38eaa233f874cd59f3ddf385e86b5e9f601b9b256f2f901864d61988d11c98593d7335543ab4d85731a3e39078c9e3012d5c6f83f064b5e7089c529a46dd5081efe66c8c49932cac5be88b57e674d689f98423389388446fb1f5969ee7029eebd29cbe489f8038edc5148148cbdca77e375b3cafc2fada07038a5c133c3cf21b881eb125c71c6b801fa03bdf9371b472792a3276094ce5417fb32973a0dcf87572d4db8",
1400 "98bf0fd777137c94300ab5b1bff7b3f487a03a788e6bb96c715ba6f10ba1922b",
1401
1402 "71a986d2f662bf36dcbadbba0657f4e2797b569610e2d82271ee6d813f01f6db922a5a4ca405d9e7cddc9dfbb1129294b8c27845bea337250c2f721887045e50288ad513acd6a6be8dce300a308e2f8e600bd585fbf61dd2ebe45c4158ab18101c0f1eae789ecfc205d8bb6fed9371d65a9e94dd2fa5322ff75452851abfcc2357025ea56e24fbfb1d4266b34ee900768fc3dfd6c2761f4716c97d6a36092192c0abbc81f832d372be535b5dbd578576e6c2dbf61d",
1403 "27255d504a38296857b8d382dc8ad4f1ca03ef3a8d1983e54bc01ef97b04e581",
1404
1405 "69ee06f5f53f74c76674751f8fa80efb42f43e71132ae0fc5ec6d2148c21570191e8baf0b9cd3547a57c103690d10d8ed84804d7b9b5cb9d5b35580a0f642abad5d0e5ca23ae3c32e1cc1355b8c7e5d78c7e64af47c6607dd960ea1d7d28b97c3d8ecdaab84a5131234cc6a68ef25e7d687ea62146c76845e02fd0745cd4cdf0d00bbab9020a3eec72e4714e9abb4029743012573d1fac9c798a513937d22ebd962df61f8854ca0ad67c5b7864885282b77df076b436",
1406 "600b41954a9398ee66ea0e603c8c80d936fbc8be98c74f44ae13b0aa4b50b8d5",
1407
1408 "2a74e9800ce49aac07af3df2e451f245d4ffa5304c318574135eb7f39a064bcc8bf66fc8a4c8e2f5c6a9ac90495f0d28938ab301e9292fb78461aa23e87ad482712b1ed42f172983f4977e45aaba7f43ea8a9e7bcb91cc63f89c34cf06bf2a1404995e6e53d9569fb8011bd9af6b32de0289cd669b7043c19698bebd9bdd33ca6bca985cb81751913a70eb14ff790c41030eaa8a00cf7c1987dcaeb650ddd9eccf46326707d902a1a36c56be43ecf7b414a29caea3b55f",
1409 "4e549f206099a8b3183fa3b86af220b1b6554ac3d8d52c54d093e68f60597256",
1410
1411 "5b2e2f2fd3ecc733a6198d34e5d143c176b60c3cc3dac6deafdf99fbce5cd088d583e8da4f01e7b09226f074f24613be345f691a46fb610b2d5855503ec761659152744db3a1a78f9b1fce7fdf584dbe28a52e04e40c701d3a62a13243b2af4a77e3fb106594afd7a84b52db16cf99ca3ad2808305d39a1dc043a52b45e7623e6f7da4accfa2a690a0f3a112fd739ee9522d891e111a8812a6448bc2ac2c234a616997a8579335c36d5fe6acfe0b052358fd715d70a7e104",
1412 "24a3de94be98126ce95cfd3140754230b6880c71cfe4ec215c3f451bdc8bb690",
1413
1414 "013944b7958b6b3686b14bdb042f2f5b42768edc20fdd6a90894692b15f6e5157b9da9de23da95749524102f1bb150032343d6fbe64537e247162243fea59f95f53e95aff2a38f82775fbf06e7574475e9a2a8b8119aad1ebe3349543e8cef9239c410124c0fe2c6f409604aae4a92185c3a0efbeb26bfc63394e5451ed45d740dd823ef774615aad3caf9e2b9b1c25344b40facba11f5406fe1fefee6a571a33a22d42ebc6fb094de4c94b650b55c9068b7b3b3c783d7f53a",
1415 "009661924d01ad811d4c598580eb954362b8554c5e9cd13686acbe41ac8c3940",
1416
1417 "72c2880163482bbe822cf72ff0e02be7081d271b366fd94c0cf37926925f76a9de44b086e590e7cc915773c314d336187ba9d03b866d1106b769b49fa99a4a9fa3fc74746d085504627a4792c757cde65b2fcaa82f9ff00eb81b7ab723ea1ed6e8723d92a2b65ead1e1dda64b275d897d0377c2ada0d5cab38913435a958da94d62f74a92da4e810ecc994017c344074014a50892fbe3e265f5448e2e2eb662295ba7f81b5dadc76f504dd31ce9debc517efad8cd5ba7fc754eb",
1418 "77cf32d62a3d0622cd90f7c858ce1ae3bda60f9edc9cf50f7ecc9d7253d8d18d",
1419
1420 "c6dad2ff2cba3ed8873955178068b5704cbccf1e8c62eed472d275f726a7670a68ae2d6a763d943b30c616a27aab5a34e254feaf838093e828d8e905b5ca8decc39491fc8b9f8bfa050fe04e5198436f5593789ca8515ecdaeaf2ce905eafb3920b5851d32892cfd4e3d3e83ccd67707eea0c74bc47e56694c7ec609deb0b8d7c739913535a37e2c5377b5a9b40efee6f5a472269eae83a54a6d3dcf08c4ccb000473dac5a9489705be6cf28d1e7e1f2b2c60293008aee6aefa61b",
1421 "8708b77ac39005607b179857c037f64860540e80ed7c7a4240e09ae62c88f87e",
1422
1423 "02553a2117e654ac28d948a6f67a83daf2089a95ff6631ff78131baa755cc36c4ad0ca6a51f5f176ea393a9bbf2b4af54deb12c6a0dfaec75da88dbc0655d34b7ad6fb0ebbb3c1e7f4fe3f94bb865683934d4fe7b53cc20b1016b7e68eab0cf1994e1735de888ba8500ea0b970f16e2acc159a1ec6e435739743e15194c53603af1f640640dd19600653a53368d55c92012b3b935c3fcfa6fc195325a00d192cc5332baa6b1831b81cb3952a2b9be6643a777a70feb5584d477f5489",
1424 "376b551c1e8f908d7e1979efa436ab69013d2e85c34430dc826179b4f94480ae",
1425
1426 "9945c4f0e067b943986b6841b8fd21109e91d2f2549c711a11039abf03d37a6e4b34eba44a98e09c1b38046660c19e39424ab80ab38a805df648ee5c6212a72663322269c1de093325afe205d955ee2acf885146e5417432672ba807d5540c79e729b067cfa1faafbeb84947a91fd98a4d32e7cf712a15406b940feae5026f10e100dec5fb497cbaee3b83545a892701c530c0cddfac2a300a6b6c2a19829992589ff4accd3e57f9be20d65374f99f393e6a2467b82e7da94c9807f2fa",
1427 "a4ab2e8f96b69097d84596b628e7bb76f460c001043ce5fa6e379fd29d1eabba",
1428
1429 "a4d7897eaf5c49979b361c39a67f47e26c2f75e5ffe0645539d4de245138eb8cadaa45aef7fa0c7a732dbbce90c85be2bd4bf6e37dfb4fdebee4d0e0671fc45c3051c6ccb674799bcfda7a431a6e93b3db3e32f30636190a9a2e5620302876e0d4d2f6201353fac4554341df6efb591c6f100f5dc21a2aa176ba592bd7db69e14237bbf2371df6bbb072f9ecb1f714e621c97768d82eea6bf98ebf4a82c005262188ff894a5dd549866f88b00ee82bd99872515d71fac230ccb472c55a60",
1430 "9510ff5231813a865918badd0011f05915364165492ef17b85929a63e4951589",
1431
1432 "22813ee9edc5c2a90d8b3f07b48d9534e60f08312dc296d68fe78719bdb7478d8d037129aa182c4b8ae5bafca1604e76d5251ee43160ba68ddee9c624ebf00f0ba7ff6b1cf75b5cfa4ab323cf04ff13b7a591b23d06ed25f3c04c1baf4c8f7da913cf509c2a5053c4224ce4d0723268cbdf2277672b285c493731ea81799d353fa8497baed70c59a4c99b7b950a39470863a69667ff67c9ec981ddb41ffb3d63dd9d034bb79d9df1a95214083199e4efbd770a7a5f005ef5c877236674b6dd",
1433 "44f8a8b05fc643566f1f53a93a122f7902d2cab68bb02267c0479339371a7304",
1434
1435 "eebfa2629596f61a926c4cd472ecb03eb2ecaf7f7650b12f7d2b8aa755284b7ccb295e46a62dd2a69577f38765ed1ea377bed34972470c5e3538cda310f2fd353334745a66f7557afb969e6c0132fdf4bb55e68951d5e25bc4fc2a9427e574de0d290d263ebc28a0ae11760caf85f63765fa0fc47ac2dc2c14c0c70404c9597f415050339443f2209430a2eed5acb1765df5768457d6a1db0ccbcc7a0e66531eb6f16608d1555c00973b4a9add70d5b88b8e44504fd9da709367627fad840bc5",
1436 "9949d3ac3c05b4a08b85fa371811fd3f0b50c71950fef50acbb59c450ab1c587",
1437
1438 "ddf38f51b732aea3fdf1fe4c756d17961262163d737f407fad17e9724a19959a92425cbb099193ec38fca8edb0614eba4dbfda60b8a6ed102fec547289a22c3b74464a02023ada50647545f6f57959a37a85a4b5a70b2050e66416ad55c33cb50d6820cfaa16caf608c69d0e4a9d7f78211c3ae44b97216659e8f6cdb6640b30e50ea8c90a0bad06ac5678deb9b50962caec6494a930377b11debd77b46de2d382a2a8992902c9aad88d9e0d49a93f88fe5dec6dcbbfacb794b0335558c609c66e",
1439 "954473b4965a57c4cbb20e199b8730487eb621f5fd694a1eb1667940da0d6728",
1440
1441 "184e1b9ccec71f837dca25838db073d51cacc26246fda091a468135d12e67faab69ac9d93e05bd9a687dad01c8db5bddc6751a45e64c2f734c867dd67f1e62626ddadc2baf7df0320f3e4c7e477a2b6f0ca679504b87372bb3a522e173fd8f7945f69ab9ab967ff378f6482293f3a936f82728abff188060e1ae48a778ebd09846d64cacb9b83487ad8bea1433b09ed791e06f7f8a65d2bbdf8a384f1550eb677962392b624bd593b6e77a7daf17d1fddfb995f472d8f5e4b41f3a02d394a98de583",
1442 "0a7506e1b6cc43acdb4f2ec456e069e6e4b7608deb70dbe7ccb88578658be9da",
1443
1444 "c436d19f05550b6979bdc69bfd27ea4cd80c1a60f00a8b093e89178c7f9e8d492c304cf6ad59102bca0e0b23620338c15fc9ecd1e939ae91da16486f72ee1e154d41bfa391e6ba3b6ca9b3c3be39b5e61242ca5cd3d6c96cbd1170af91fdb2160db3522e1bc3b1a349d6e50479920ac5d9bedd8a16a787a3cdc2b6d24392f25555cc2f20b2ba9e6b47ddc96cfbd6df669d874ce21a758d3cf4704362ef7786d90ed67b01bd91299950058885accddbcf44e340ed4807864218653ee7ff7215aa1e1761",
1445 "206be726fc681367387ff0a15303533058070f9655438ad8142cf39a0523b2ce",
1446
1447 "daf7c7526cdb85127df59220fbcb67dc5069ef58dc069a18a2e4ad164178dc0927cb1ae70120b0a975d78c4e1491dc228a95dc401873ec5645e7e6a8d0ffae58e8800be49f87b5f09d6caf4611ebd61bee86bb945325ae884a001b88b6be1a1c87de41503057bc6f5b7ba00fdb217d4de203335a746506371bf8f4bcddfd45df6bad65339bd9efaf18ce0ab1587bf842cfd6ec9c637b1cea1f96184e2b045a28fcb51e96c85574373d2b9335724170821ec58f6108af1929bea430458a1a7f80a2be1580",
1448 "742389244ad26d7a16d1f2b01e9c83e987a283bbf3aa2907a556746fe8c98c38",
1449
1450 "597dadb776945e01c564f17eed4b5c1bbb34eebb13bce37d2d93363efe24b660f3785cc9e557dc2e4ab17a91a83d1f085060acc148508e43897993f66a20fbe65d46d3c4d9cf7e2e97e3952f0195f10ae8c20533753c719f6228d53d69a5e3c5fdafb9b039426d8716c2e961e09af9a8eb24a21b82c9b6192069a51ce3fc96843d7ab696edf9d0c42d151f2e2d95606ac14c2a80563c82392b02ab9abe6e3bab8471747ddc3cd06a46a6de9fd0ce4dd8d202466bdbe00088ebbb8ebfe341fbc2395a986df0",
1451 "892985bdf2379f8ae138aac016894ee23408955d627cfa699fa5fa1439340a91",
1452
1453 "0efc14917a94f5320eb734c2b9e45f659d06c9f5c454deff0e76b30f6ee9e22e56a494a870fcdf138fc5538ce5bacf44761f993ccca4ae4ced8d576a8a10fd2979fe3e8066a641cdc5f746190ae4819e1d0d2886089bcbf6f36be44b5370afa45e523ba0c25bc169969436f1912b1c7b7a189d5edf00da050a5a813b31d09da5ede8b390ede30aeeece64a9ae05749e4758a2149b99d868219a056c18cf972370e07cdd95006c264ae33ab9e6130afdff6a9dbd1fe38747408868c65ccb4d45fa9f9b102528c",
1454 "73088e0551c89477bcb675245c5c6347b4230390285832c7d723bf668c8061fb",
1455
1456 "9ac34ec974d28b18b7bcf6982eac60ebc670b0674e2acd697b49bfeb2fb81159fa5579a1e2a5bb8a5fc6ca46aaa5304a3771b15d804f2bef054fc1ad919e3852befea1c0bb74394f4d408d651412e247107bd32e64a23c9e593857f3a5ae253deea5104d8aa6ce108913881cf55d3c89587860027f8cc81b7eeec9e5f44e9fc190320c71d4a3427519250394d4ed07b9174f9e005b7696117c575fad05e76d86ae8cde5423d25d25076046f4392a0a7e56e8d6517fc66f265c5d617060e258354f9dce1dfe9de6",
1457 "17cba68f47a0615b3513d28a44feda6ad36b6e6eb1ead7232f4e2a4e1a64bf50",
1458
1459 "d00df64c4bb9e2fd16fb6f9ca746d6cf162015ec7326e41a5d51e9b3d0792fed3f17d5bae34f03ec522e229d53304dcef105024ece941edeba410892846b2c7a1039ab82aa9750979a7bc70bf96d093bc3461b6f2d38f801380eccc286b562996cfce06d4a98b245176bc4ae4006f45eb36cc71636185acdfe429c0a7d5fbb927be7dc43685a0f40f185824ed102f57eeafe6d0d943e2d883564e233126f1eac648207ccafe651ce4f5169b35369f3e48f84771aedb2577b04fd0506ecef72305055cacfc4435e38",
1460 "67302648e0082254d8d342b4eb8070ef9a44e0fc55c3d9a3f20613e4824aff21",
1461
1462 "fff5deb2bc7f43bd2db44ceff874e9c3b7c1a2f54cc6889f74186ca2a03d5047006b1b26e0919147379c81887df3403ebe43571fed8279607a2eb81a26d6f8f217dca3f927799ed182017c127069f2eb6f068b0d85979dc4d4867c676f6bedf36cd2def33b3e54a3366ea45478dee612f391a785bd0ede15aba921512103199228d434dbc1e899047a6861183e5b04fb716c11503dee2399261d10a0e5a76317736b0d7b6480573e76791b246ae734ee12203336ac3f539a6e6cb01c625eb3c9741dd199ca0d759753",
1463 "bf64c9ab7042245fb2d8054edd699086dbe27a1ce904174d28bc0831ed9acf97",
1464
1465 "8d8001e2c096f1b88e7c9224a086efd4797fbf74a8033a2d422a2b6b8f6747e4",
1466 "2e975f6a8a14f0704d51b13667d8195c219f71e6345696c49fa4b9d08e9225d3d39393425152c97e71dd24601c11abcfa0f12f53c680bd3ae757b8134a9c10d429615869217fdd5885c4db174985703a6d6de94a667eac3023443a8337ae1bc601b76d7d38ec3c34463105f0d3949d78e562a039e4469548b609395de5a4fd43c46ca9fd6ee29ada5efc07d84d553249450dab4a49c483ded250c9338f85cd937ae66bb436f3b4026e859fda1ca571432f3bfc09e7c03ca4d183b741111ca0483d0edabc03feb23b17ee48e844ba2408d9dcfd0139d2e8c7310125aee801c61ab7900d1efc47c078281766f361c5e6111346235e1dc38325666c",
1467
1468 NULL
1469 };
1470
1471 static void
1472 test_SHAKE_KAT(int security_level, const char *const *kat)
1473 {
1474 size_t u;
1475
1476 for (u = 0; kat[u] != NULL; u += 2) {
1477 unsigned char msg[250], out[250], ref[250];
1478 size_t msg_len, out_len, v;
1479 br_shake_context sc;
1480
1481 msg_len = hextobin(msg, kat[u]);
1482 out_len = hextobin(ref, kat[u + 1]);
1483 br_shake_init(&sc, security_level);
1484 br_shake_inject(&sc, msg, msg_len);
1485 br_shake_flip(&sc);
1486 br_shake_produce(&sc, out, out_len);
1487 check_equals("KAT 1", out, ref, out_len);
1488
1489 br_shake_init(&sc, security_level);
1490 for (v = 0; v < msg_len; v ++) {
1491 br_shake_inject(&sc, msg + v, 1);
1492 }
1493 br_shake_flip(&sc);
1494 br_shake_produce(&sc, out, out_len);
1495 check_equals("KAT 2", out, ref, out_len);
1496
1497 br_shake_init(&sc, security_level);
1498 br_shake_inject(&sc, msg, msg_len);
1499 br_shake_flip(&sc);
1500 for (v = 0; v < out_len; v ++) {
1501 unsigned char x;
1502
1503 br_shake_produce(&sc, &x, 1);
1504 if (x != ref[v]) {
1505 fprintf(stderr, "KAT 3 (byte %u)\n",
1506 (unsigned)v);
1507 exit(EXIT_FAILURE);
1508 }
1509 }
1510
1511 printf(".");
1512 fflush(stdout);
1513 }
1514 }
1515
1516 static void
1517 test_SHAKE_MonteCarlo(int security_level,
1518 size_t minoutlen, size_t maxoutlen, const char *smsg, const char *sref)
1519 {
1520 unsigned char out[250], ref[250];
1521 size_t len, rlen, outlen, range;
1522 int i, j;
1523
1524 hextobin(out, smsg);
1525 outlen = maxoutlen;
1526 range = maxoutlen - minoutlen + 1;
1527 for (j = 0; j < 100; j ++) {
1528 for (i = 1; i < 1001; i ++) {
1529 br_shake_context sc;
1530
1531 len = outlen;
1532 br_shake_init(&sc, security_level);
1533 br_shake_inject(&sc, out, 16);
1534 br_shake_flip(&sc);
1535 br_shake_produce(&sc, out, len);
1536 if (len < 16) {
1537 memset(out + len, 0, 16 - len);
1538 }
1539 outlen = minoutlen
1540 + (br_dec16be(out + len - 2) % range);
1541 }
1542 printf(".");
1543 fflush(stdout);
1544 }
1545 rlen = hextobin(ref, sref);
1546 if (rlen != len) {
1547 fprintf(stderr, "MC: bad length (%u vs %u)\n",
1548 (unsigned)len, (unsigned)rlen);
1549 exit(EXIT_FAILURE);
1550 }
1551 check_equals("KAT MC", out, ref, len);
1552 }
1553
1554 static void
1555 test_SHAKE(void)
1556 {
1557 printf("Test SHAKE: ");
1558 fflush(stdout);
1559
1560 test_SHAKE_KAT(128, KAT_SHAKE128);
1561
1562 printf(" ");
1563 fflush(stdout);
1564
1565 test_SHAKE_MonteCarlo(128, 16, 140,
1566 "c8b310cb97efa3855434998fa81c7674",
1567 "4aa371f0099b04a909f9b1680e8b52a21c6510ea2640137d501ffa114bf84717b1f725d64bae4ae5d87a");
1568
1569 printf(" ");
1570 fflush(stdout);
1571
1572 test_SHAKE_KAT(256, KAT_SHAKE256);
1573
1574 printf(" ");
1575 fflush(stdout);
1576
1577 test_SHAKE_MonteCarlo(256, 2, 250,
1578 "48a0321b3653e4e86446d00f6a036efd",
1579 "d4c8c26ded38cca426d8d1c8f8aedb5c543541333839deca8713cfd8684480fe923f57c3a5c89cb61427c220c7");
1580
1581 printf(" done.\n");
1582 fflush(stdout);
1583 }
1584
1585 static void
1586 test_HMAC_DRBG(void)
1587 {
1588 br_hmac_drbg_context ctx;
1589 unsigned char seed[42], tmp[30];
1590 unsigned char ref1[30], ref2[30], ref3[30];
1591 size_t seed_len;
1592
1593 printf("Test HMAC_DRBG: ");
1594 fflush(stdout);
1595
1596 seed_len = hextobin(seed,
1597 "009A4D6792295A7F730FC3F2B49CBC0F62E862272F"
1598 "01795EDF0D54DB760F156D0DAC04C0322B3A204224");
1599 hextobin(ref1,
1600 "9305A46DE7FF8EB107194DEBD3FD48AA"
1601 "20D5E7656CBE0EA69D2A8D4E7C67");
1602 hextobin(ref2,
1603 "C70C78608A3B5BE9289BE90EF6E81A9E"
1604 "2C1516D5751D2F75F50033E45F73");
1605 hextobin(ref3,
1606 "475E80E992140567FCC3A50DAB90FE84"
1607 "BCD7BB03638E9C4656A06F37F650");
1608 br_hmac_drbg_init(&ctx, &br_sha256_vtable, seed, seed_len);
1609 br_hmac_drbg_generate(&ctx, tmp, sizeof tmp);
1610 check_equals("KAT HMAC_DRBG 1", tmp, ref1, sizeof tmp);
1611 br_hmac_drbg_generate(&ctx, tmp, sizeof tmp);
1612 check_equals("KAT HMAC_DRBG 2", tmp, ref2, sizeof tmp);
1613 br_hmac_drbg_generate(&ctx, tmp, sizeof tmp);
1614 check_equals("KAT HMAC_DRBG 3", tmp, ref3, sizeof tmp);
1615
1616 memset(&ctx, 0, sizeof ctx);
1617 br_hmac_drbg_vtable.init(&ctx.vtable,
1618 &br_sha256_vtable, seed, seed_len);
1619 ctx.vtable->generate(&ctx.vtable, tmp, sizeof tmp);
1620 check_equals("KAT HMAC_DRBG 4", tmp, ref1, sizeof tmp);
1621 ctx.vtable->generate(&ctx.vtable, tmp, sizeof tmp);
1622 check_equals("KAT HMAC_DRBG 5", tmp, ref2, sizeof tmp);
1623 ctx.vtable->generate(&ctx.vtable, tmp, sizeof tmp);
1624 check_equals("KAT HMAC_DRBG 6", tmp, ref3, sizeof tmp);
1625
1626 printf("done.\n");
1627 fflush(stdout);
1628 }
1629
1630 static void
1631 test_AESCTR_DRBG(void)
1632 {
1633 br_aesctr_drbg_context ctx;
1634 const br_block_ctr_class *ictr;
1635 unsigned char tmp1[64], tmp2[64];
1636
1637 printf("Test AESCTR_DRBG: ");
1638 fflush(stdout);
1639
1640 ictr = br_aes_x86ni_ctr_get_vtable();
1641 if (ictr == NULL) {
1642 ictr = br_aes_pwr8_ctr_get_vtable();
1643 if (ictr == NULL) {
1644 #if BR_64
1645 ictr = &br_aes_ct64_ctr_vtable;
1646 #else
1647 ictr = &br_aes_ct_ctr_vtable;
1648 #endif
1649 }
1650 }
1651 br_aesctr_drbg_init(&ctx, ictr, NULL, 0);
1652 ctx.vtable->generate(&ctx.vtable, tmp1, sizeof tmp1);
1653 ctx.vtable->update(&ctx.vtable, "new seed", 8);
1654 ctx.vtable->generate(&ctx.vtable, tmp2, sizeof tmp2);
1655
1656 if (memcmp(tmp1, tmp2, sizeof tmp1) == 0) {
1657 fprintf(stderr, "AESCTR_DRBG failure\n");
1658 exit(EXIT_FAILURE);
1659 }
1660
1661 printf("done.\n");
1662 fflush(stdout);
1663 }
1664
1665 static void
1666 do_KAT_PRF(br_tls_prf_impl prf,
1667 const char *ssecret, const char *label, const char *sseed,
1668 const char *sref)
1669 {
1670 unsigned char secret[100], seed[100], ref[500], out[500];
1671 size_t secret_len, seed_len, ref_len;
1672 br_tls_prf_seed_chunk chunks[2];
1673
1674 secret_len = hextobin(secret, ssecret);
1675 seed_len = hextobin(seed, sseed);
1676 ref_len = hextobin(ref, sref);
1677
1678 chunks[0].data = seed;
1679 chunks[0].len = seed_len;
1680 prf(out, ref_len, secret, secret_len, label, 1, chunks);
1681 check_equals("TLS PRF KAT 1", out, ref, ref_len);
1682
1683 chunks[0].data = seed;
1684 chunks[0].len = seed_len;
1685 chunks[1].data = NULL;
1686 chunks[1].len = 0;
1687 prf(out, ref_len, secret, secret_len, label, 2, chunks);
1688 check_equals("TLS PRF KAT 2", out, ref, ref_len);
1689
1690 chunks[0].data = NULL;
1691 chunks[0].len = 0;
1692 chunks[1].data = seed;
1693 chunks[1].len = seed_len;
1694 prf(out, ref_len, secret, secret_len, label, 2, chunks);
1695 check_equals("TLS PRF KAT 3", out, ref, ref_len);
1696
1697 chunks[0].data = seed;
1698 chunks[0].len = seed_len >> 1;
1699 chunks[1].data = seed + chunks[0].len;
1700 chunks[1].len = seed_len - chunks[0].len;
1701 prf(out, ref_len, secret, secret_len, label, 2, chunks);
1702 check_equals("TLS PRF KAT 4", out, ref, ref_len);
1703 }
1704
1705 static void
1706 test_PRF(void)
1707 {
1708 printf("Test TLS PRF: ");
1709 fflush(stdout);
1710
1711 /*
1712 * Test vector taken from an email that was on:
1713 * http://www.imc.org/ietf-tls/mail-archive/msg01589.html
1714 * but no longer exists there; a version archived in 2008
1715 * can be found on http://www.archive.org/
1716 */
1717 do_KAT_PRF(&br_tls10_prf,
1718 "abababababababababababababababababababababababababababababababababababababababababababababababab",
1719 "PRF Testvector",
1720 "cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd",
1721 "d3d4d1e349b5d515044666d51de32bab258cb521b6b053463e354832fd976754443bcf9a296519bc289abcbc1187e4ebd31e602353776c408aafb74cbc85eff69255f9788faa184cbb957a9819d84a5d7eb006eb459d3ae8de9810454b8b2d8f1afbc655a8c9a013");
1722
1723 /*
1724 * Test vectors are taken from:
1725 * https://www.ietf.org/mail-archive/web/tls/current/msg03416.html
1726 */
1727 do_KAT_PRF(&br_tls12_sha256_prf,
1728 "9bbe436ba940f017b17652849a71db35",
1729 "test label",
1730 "a0ba9f936cda311827a6f796ffd5198c",
1731 "e3f229ba727be17b8d122620557cd453c2aab21d07c3d495329b52d4e61edb5a6b301791e90d35c9c9a46b4e14baf9af0fa022f7077def17abfd3797c0564bab4fbc91666e9def9b97fce34f796789baa48082d122ee42c5a72e5a5110fff70187347b66");
1732 do_KAT_PRF(&br_tls12_sha384_prf,
1733 "b80b733d6ceefcdc71566ea48e5567df",
1734 "test label",
1735 "cd665cf6a8447dd6ff8b27555edb7465",
1736 "7b0c18e9ced410ed1804f2cfa34a336a1c14dffb4900bb5fd7942107e81c83cde9ca0faa60be9fe34f82b1233c9146a0e534cb400fed2700884f9dc236f80edd8bfa961144c9e8d792eca722a7b32fc3d416d473ebc2c5fd4abfdad05d9184259b5bf8cd4d90fa0d31e2dec479e4f1a26066f2eea9a69236a3e52655c9e9aee691c8f3a26854308d5eaa3be85e0990703d73e56f");
1737
1738 printf("done.\n");
1739 fflush(stdout);
1740 }
1741
1742 /*
1743 * AES known-answer tests. Order: key, plaintext, ciphertext.
1744 */
1745 static const char *const KAT_AES[] = {
1746 /*
1747 * From FIPS-197.
1748 */
1749 "000102030405060708090a0b0c0d0e0f",
1750 "00112233445566778899aabbccddeeff",
1751 "69c4e0d86a7b0430d8cdb78070b4c55a",
1752
1753 "000102030405060708090a0b0c0d0e0f1011121314151617",
1754 "00112233445566778899aabbccddeeff",
1755 "dda97ca4864cdfe06eaf70a0ec0d7191",
1756
1757 "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
1758 "00112233445566778899aabbccddeeff",
1759 "8ea2b7ca516745bfeafc49904b496089",
1760
1761 /*
1762 * From NIST validation suite (ECBVarTxt128.rsp).
1763 */
1764 "00000000000000000000000000000000",
1765 "80000000000000000000000000000000",
1766 "3ad78e726c1ec02b7ebfe92b23d9ec34",
1767
1768 "00000000000000000000000000000000",
1769 "c0000000000000000000000000000000",
1770 "aae5939c8efdf2f04e60b9fe7117b2c2",
1771
1772 "00000000000000000000000000000000",
1773 "e0000000000000000000000000000000",
1774 "f031d4d74f5dcbf39daaf8ca3af6e527",
1775
1776 "00000000000000000000000000000000",
1777 "f0000000000000000000000000000000",
1778 "96d9fd5cc4f07441727df0f33e401a36",
1779
1780 "00000000000000000000000000000000",
1781 "f8000000000000000000000000000000",
1782 "30ccdb044646d7e1f3ccea3dca08b8c0",
1783
1784 "00000000000000000000000000000000",
1785 "fc000000000000000000000000000000",
1786 "16ae4ce5042a67ee8e177b7c587ecc82",
1787
1788 "00000000000000000000000000000000",
1789 "fe000000000000000000000000000000",
1790 "b6da0bb11a23855d9c5cb1b4c6412e0a",
1791
1792 "00000000000000000000000000000000",
1793 "ff000000000000000000000000000000",
1794 "db4f1aa530967d6732ce4715eb0ee24b",
1795
1796 "00000000000000000000000000000000",
1797 "ff800000000000000000000000000000",
1798 "a81738252621dd180a34f3455b4baa2f",
1799
1800 "00000000000000000000000000000000",
1801 "ffc00000000000000000000000000000",
1802 "77e2b508db7fd89234caf7939ee5621a",
1803
1804 "00000000000000000000000000000000",
1805 "ffe00000000000000000000000000000",
1806 "b8499c251f8442ee13f0933b688fcd19",
1807
1808 "00000000000000000000000000000000",
1809 "fff00000000000000000000000000000",
1810 "965135f8a81f25c9d630b17502f68e53",
1811
1812 "00000000000000000000000000000000",
1813 "fff80000000000000000000000000000",
1814 "8b87145a01ad1c6cede995ea3670454f",
1815
1816 "00000000000000000000000000000000",
1817 "fffc0000000000000000000000000000",
1818 "8eae3b10a0c8ca6d1d3b0fa61e56b0b2",
1819
1820 "00000000000000000000000000000000",
1821 "fffe0000000000000000000000000000",
1822 "64b4d629810fda6bafdf08f3b0d8d2c5",
1823
1824 "00000000000000000000000000000000",
1825 "ffff0000000000000000000000000000",
1826 "d7e5dbd3324595f8fdc7d7c571da6c2a",
1827
1828 "00000000000000000000000000000000",
1829 "ffff8000000000000000000000000000",
1830 "f3f72375264e167fca9de2c1527d9606",
1831
1832 "00000000000000000000000000000000",
1833 "ffffc000000000000000000000000000",
1834 "8ee79dd4f401ff9b7ea945d86666c13b",
1835
1836 "00000000000000000000000000000000",
1837 "ffffe000000000000000000000000000",
1838 "dd35cea2799940b40db3f819cb94c08b",
1839
1840 "00000000000000000000000000000000",
1841 "fffff000000000000000000000000000",
1842 "6941cb6b3e08c2b7afa581ebdd607b87",
1843
1844 "00000000000000000000000000000000",
1845 "fffff800000000000000000000000000",
1846 "2c20f439f6bb097b29b8bd6d99aad799",
1847
1848 "00000000000000000000000000000000",
1849 "fffffc00000000000000000000000000",
1850 "625d01f058e565f77ae86378bd2c49b3",
1851
1852 "00000000000000000000000000000000",
1853 "fffffe00000000000000000000000000",
1854 "c0b5fd98190ef45fbb4301438d095950",
1855
1856 "00000000000000000000000000000000",
1857 "ffffff00000000000000000000000000",
1858 "13001ff5d99806efd25da34f56be854b",
1859
1860 "00000000000000000000000000000000",
1861 "ffffff80000000000000000000000000",
1862 "3b594c60f5c8277a5113677f94208d82",
1863
1864 "00000000000000000000000000000000",
1865 "ffffffc0000000000000000000000000",
1866 "e9c0fc1818e4aa46bd2e39d638f89e05",
1867
1868 "00000000000000000000000000000000",
1869 "ffffffe0000000000000000000000000",
1870 "f8023ee9c3fdc45a019b4e985c7e1a54",
1871
1872 "00000000000000000000000000000000",
1873 "fffffff0000000000000000000000000",
1874 "35f40182ab4662f3023baec1ee796b57",
1875
1876 "00000000000000000000000000000000",
1877 "fffffff8000000000000000000000000",
1878 "3aebbad7303649b4194a6945c6cc3694",
1879
1880 "00000000000000000000000000000000",
1881 "fffffffc000000000000000000000000",
1882 "a2124bea53ec2834279bed7f7eb0f938",
1883
1884 "00000000000000000000000000000000",
1885 "fffffffe000000000000000000000000",
1886 "b9fb4399fa4facc7309e14ec98360b0a",
1887
1888 "00000000000000000000000000000000",
1889 "ffffffff000000000000000000000000",
1890 "c26277437420c5d634f715aea81a9132",
1891
1892 "00000000000000000000000000000000",
1893 "ffffffff800000000000000000000000",
1894 "171a0e1b2dd424f0e089af2c4c10f32f",
1895
1896 "00000000000000000000000000000000",
1897 "ffffffffc00000000000000000000000",
1898 "7cadbe402d1b208fe735edce00aee7ce",
1899
1900 "00000000000000000000000000000000",
1901 "ffffffffe00000000000000000000000",
1902 "43b02ff929a1485af6f5c6d6558baa0f",
1903
1904 "00000000000000000000000000000000",
1905 "fffffffff00000000000000000000000",
1906 "092faacc9bf43508bf8fa8613ca75dea",
1907
1908 "00000000000000000000000000000000",
1909 "fffffffff80000000000000000000000",
1910 "cb2bf8280f3f9742c7ed513fe802629c",
1911
1912 "00000000000000000000000000000000",
1913 "fffffffffc0000000000000000000000",
1914 "215a41ee442fa992a6e323986ded3f68",
1915
1916 "00000000000000000000000000000000",
1917 "fffffffffe0000000000000000000000",
1918 "f21e99cf4f0f77cea836e11a2fe75fb1",
1919
1920 "00000000000000000000000000000000",
1921 "ffffffffff0000000000000000000000",
1922 "95e3a0ca9079e646331df8b4e70d2cd6",
1923
1924 "00000000000000000000000000000000",
1925 "ffffffffff8000000000000000000000",
1926 "4afe7f120ce7613f74fc12a01a828073",
1927
1928 "00000000000000000000000000000000",
1929 "ffffffffffc000000000000000000000",
1930 "827f000e75e2c8b9d479beed913fe678",
1931
1932 "00000000000000000000000000000000",
1933 "ffffffffffe000000000000000000000",
1934 "35830c8e7aaefe2d30310ef381cbf691",
1935
1936 "00000000000000000000000000000000",
1937 "fffffffffff000000000000000000000",
1938 "191aa0f2c8570144f38657ea4085ebe5",
1939
1940 "00000000000000000000000000000000",
1941 "fffffffffff800000000000000000000",
1942 "85062c2c909f15d9269b6c18ce99c4f0",
1943
1944 "00000000000000000000000000000000",
1945 "fffffffffffc00000000000000000000",
1946 "678034dc9e41b5a560ed239eeab1bc78",
1947
1948 "00000000000000000000000000000000",
1949 "fffffffffffe00000000000000000000",
1950 "c2f93a4ce5ab6d5d56f1b93cf19911c1",
1951
1952 "00000000000000000000000000000000",
1953 "ffffffffffff00000000000000000000",
1954 "1c3112bcb0c1dcc749d799743691bf82",
1955
1956 "00000000000000000000000000000000",
1957 "ffffffffffff80000000000000000000",
1958 "00c55bd75c7f9c881989d3ec1911c0d4",
1959
1960 "00000000000000000000000000000000",
1961 "ffffffffffffc0000000000000000000",
1962 "ea2e6b5ef182b7dff3629abd6a12045f",
1963
1964 "00000000000000000000000000000000",
1965 "ffffffffffffe0000000000000000000",
1966 "22322327e01780b17397f24087f8cc6f",
1967
1968 "00000000000000000000000000000000",
1969 "fffffffffffff0000000000000000000",
1970 "c9cacb5cd11692c373b2411768149ee7",
1971
1972 "00000000000000000000000000000000",
1973 "fffffffffffff8000000000000000000",
1974 "a18e3dbbca577860dab6b80da3139256",
1975
1976 "00000000000000000000000000000000",
1977 "fffffffffffffc000000000000000000",
1978 "79b61c37bf328ecca8d743265a3d425c",
1979
1980 "00000000000000000000000000000000",
1981 "fffffffffffffe000000000000000000",
1982 "d2d99c6bcc1f06fda8e27e8ae3f1ccc7",
1983
1984 "00000000000000000000000000000000",
1985 "ffffffffffffff000000000000000000",
1986 "1bfd4b91c701fd6b61b7f997829d663b",
1987
1988 "00000000000000000000000000000000",
1989 "ffffffffffffff800000000000000000",
1990 "11005d52f25f16bdc9545a876a63490a",
1991
1992 "00000000000000000000000000000000",
1993 "ffffffffffffffc00000000000000000",
1994 "3a4d354f02bb5a5e47d39666867f246a",
1995
1996 "00000000000000000000000000000000",
1997 "ffffffffffffffe00000000000000000",
1998 "d451b8d6e1e1a0ebb155fbbf6e7b7dc3",
1999
2000 "00000000000000000000000000000000",
2001 "fffffffffffffff00000000000000000",
2002 "6898d4f42fa7ba6a10ac05e87b9f2080",
2003
2004 "00000000000000000000000000000000",
2005 "fffffffffffffff80000000000000000",
2006 "b611295e739ca7d9b50f8e4c0e754a3f",
2007
2008 "00000000000000000000000000000000",
2009 "fffffffffffffffc0000000000000000",
2010 "7d33fc7d8abe3ca1936759f8f5deaf20",
2011
2012 "00000000000000000000000000000000",
2013 "fffffffffffffffe0000000000000000",
2014 "3b5e0f566dc96c298f0c12637539b25c",
2015
2016 "00000000000000000000000000000000",
2017 "ffffffffffffffff0000000000000000",
2018 "f807c3e7985fe0f5a50e2cdb25c5109e",
2019
2020 "00000000000000000000000000000000",
2021 "ffffffffffffffff8000000000000000",
2022 "41f992a856fb278b389a62f5d274d7e9",
2023
2024 "00000000000000000000000000000000",
2025 "ffffffffffffffffc000000000000000",
2026 "10d3ed7a6fe15ab4d91acbc7d0767ab1",
2027
2028 "00000000000000000000000000000000",
2029 "ffffffffffffffffe000000000000000",
2030 "21feecd45b2e675973ac33bf0c5424fc",
2031
2032 "00000000000000000000000000000000",
2033 "fffffffffffffffff000000000000000",
2034 "1480cb3955ba62d09eea668f7c708817",
2035
2036 "00000000000000000000000000000000",
2037 "fffffffffffffffff800000000000000",
2038 "66404033d6b72b609354d5496e7eb511",
2039
2040 "00000000000000000000000000000000",
2041 "fffffffffffffffffc00000000000000",
2042 "1c317a220a7d700da2b1e075b00266e1",
2043
2044 "00000000000000000000000000000000",
2045 "fffffffffffffffffe00000000000000",
2046 "ab3b89542233f1271bf8fd0c0f403545",
2047
2048 "00000000000000000000000000000000",
2049 "ffffffffffffffffff00000000000000",
2050 "d93eae966fac46dca927d6b114fa3f9e",
2051
2052 "00000000000000000000000000000000",
2053 "ffffffffffffffffff80000000000000",
2054 "1bdec521316503d9d5ee65df3ea94ddf",
2055
2056 "00000000000000000000000000000000",
2057 "ffffffffffffffffffc0000000000000",
2058 "eef456431dea8b4acf83bdae3717f75f",
2059
2060 "00000000000000000000000000000000",
2061 "ffffffffffffffffffe0000000000000",
2062 "06f2519a2fafaa596bfef5cfa15c21b9",
2063
2064 "00000000000000000000000000000000",
2065 "fffffffffffffffffff0000000000000",
2066 "251a7eac7e2fe809e4aa8d0d7012531a",
2067
2068 "00000000000000000000000000000000",
2069 "fffffffffffffffffff8000000000000",
2070 "3bffc16e4c49b268a20f8d96a60b4058",
2071
2072 "00000000000000000000000000000000",
2073 "fffffffffffffffffffc000000000000",
2074 "e886f9281999c5bb3b3e8862e2f7c988",
2075
2076 "00000000000000000000000000000000",
2077 "fffffffffffffffffffe000000000000",
2078 "563bf90d61beef39f48dd625fcef1361",
2079
2080 "00000000000000000000000000000000",
2081 "ffffffffffffffffffff000000000000",
2082 "4d37c850644563c69fd0acd9a049325b",
2083
2084 "00000000000000000000000000000000",
2085 "ffffffffffffffffffff800000000000",
2086 "b87c921b91829ef3b13ca541ee1130a6",
2087
2088 "00000000000000000000000000000000",
2089 "ffffffffffffffffffffc00000000000",
2090 "2e65eb6b6ea383e109accce8326b0393",
2091
2092 "00000000000000000000000000000000",
2093 "ffffffffffffffffffffe00000000000",
2094 "9ca547f7439edc3e255c0f4d49aa8990",
2095
2096 "00000000000000000000000000000000",
2097 "fffffffffffffffffffff00000000000",
2098 "a5e652614c9300f37816b1f9fd0c87f9",
2099
2100 "00000000000000000000000000000000",
2101 "fffffffffffffffffffff80000000000",
2102 "14954f0b4697776f44494fe458d814ed",
2103
2104 "00000000000000000000000000000000",
2105 "fffffffffffffffffffffc0000000000",
2106 "7c8d9ab6c2761723fe42f8bb506cbcf7",
2107
2108 "00000000000000000000000000000000",
2109 "fffffffffffffffffffffe0000000000",
2110 "db7e1932679fdd99742aab04aa0d5a80",
2111
2112 "00000000000000000000000000000000",
2113 "ffffffffffffffffffffff0000000000",
2114 "4c6a1c83e568cd10f27c2d73ded19c28",
2115
2116 "00000000000000000000000000000000",
2117 "ffffffffffffffffffffff8000000000",
2118 "90ecbe6177e674c98de412413f7ac915",
2119
2120 "00000000000000000000000000000000",
2121 "ffffffffffffffffffffffc000000000",
2122 "90684a2ac55fe1ec2b8ebd5622520b73",
2123
2124 "00000000000000000000000000000000",
2125 "ffffffffffffffffffffffe000000000",
2126 "7472f9a7988607ca79707795991035e6",
2127
2128 "00000000000000000000000000000000",
2129 "fffffffffffffffffffffff000000000",
2130 "56aff089878bf3352f8df172a3ae47d8",
2131
2132 "00000000000000000000000000000000",
2133 "fffffffffffffffffffffff800000000",
2134 "65c0526cbe40161b8019a2a3171abd23",
2135
2136 "00000000000000000000000000000000",
2137 "fffffffffffffffffffffffc00000000",
2138 "377be0be33b4e3e310b4aabda173f84f",
2139
2140 "00000000000000000000000000000000",
2141 "fffffffffffffffffffffffe00000000",
2142 "9402e9aa6f69de6504da8d20c4fcaa2f",
2143
2144 "00000000000000000000000000000000",
2145 "ffffffffffffffffffffffff00000000",
2146 "123c1f4af313ad8c2ce648b2e71fb6e1",
2147
2148 "00000000000000000000000000000000",
2149 "ffffffffffffffffffffffff80000000",
2150 "1ffc626d30203dcdb0019fb80f726cf4",
2151
2152 "00000000000000000000000000000000",
2153 "ffffffffffffffffffffffffc0000000",
2154 "76da1fbe3a50728c50fd2e621b5ad885",
2155
2156 "00000000000000000000000000000000",
2157 "ffffffffffffffffffffffffe0000000",
2158 "082eb8be35f442fb52668e16a591d1d6",
2159
2160 "00000000000000000000000000000000",
2161 "fffffffffffffffffffffffff0000000",
2162 "e656f9ecf5fe27ec3e4a73d00c282fb3",
2163
2164 "00000000000000000000000000000000",
2165 "fffffffffffffffffffffffff8000000",
2166 "2ca8209d63274cd9a29bb74bcd77683a",
2167
2168 "00000000000000000000000000000000",
2169 "fffffffffffffffffffffffffc000000",
2170 "79bf5dce14bb7dd73a8e3611de7ce026",
2171
2172 "00000000000000000000000000000000",
2173 "fffffffffffffffffffffffffe000000",
2174 "3c849939a5d29399f344c4a0eca8a576",
2175
2176 "00000000000000000000000000000000",
2177 "ffffffffffffffffffffffffff000000",
2178 "ed3c0a94d59bece98835da7aa4f07ca2",
2179
2180 "00000000000000000000000000000000",
2181 "ffffffffffffffffffffffffff800000",
2182 "63919ed4ce10196438b6ad09d99cd795",
2183
2184 "00000000000000000000000000000000",
2185 "ffffffffffffffffffffffffffc00000",
2186 "7678f3a833f19fea95f3c6029e2bc610",
2187
2188 "00000000000000000000000000000000",
2189 "ffffffffffffffffffffffffffe00000",
2190 "3aa426831067d36b92be7c5f81c13c56",
2191
2192 "00000000000000000000000000000000",
2193 "fffffffffffffffffffffffffff00000",
2194 "9272e2d2cdd11050998c845077a30ea0",
2195
2196 "00000000000000000000000000000000",
2197 "fffffffffffffffffffffffffff80000",
2198 "088c4b53f5ec0ff814c19adae7f6246c",
2199
2200 "00000000000000000000000000000000",
2201 "fffffffffffffffffffffffffffc0000",
2202 "4010a5e401fdf0a0354ddbcc0d012b17",
2203
2204 "00000000000000000000000000000000",
2205 "fffffffffffffffffffffffffffe0000",
2206 "a87a385736c0a6189bd6589bd8445a93",
2207
2208 "00000000000000000000000000000000",
2209 "ffffffffffffffffffffffffffff0000",
2210 "545f2b83d9616dccf60fa9830e9cd287",
2211
2212 "00000000000000000000000000000000",
2213 "ffffffffffffffffffffffffffff8000",
2214 "4b706f7f92406352394037a6d4f4688d",
2215
2216 "00000000000000000000000000000000",
2217 "ffffffffffffffffffffffffffffc000",
2218 "b7972b3941c44b90afa7b264bfba7387",
2219
2220 "00000000000000000000000000000000",
2221 "ffffffffffffffffffffffffffffe000",
2222 "6f45732cf10881546f0fd23896d2bb60",
2223
2224 "00000000000000000000000000000000",
2225 "fffffffffffffffffffffffffffff000",
2226 "2e3579ca15af27f64b3c955a5bfc30ba",
2227
2228 "00000000000000000000000000000000",
2229 "fffffffffffffffffffffffffffff800",
2230 "34a2c5a91ae2aec99b7d1b5fa6780447",
2231
2232 "00000000000000000000000000000000",
2233 "fffffffffffffffffffffffffffffc00",
2234 "a4d6616bd04f87335b0e53351227a9ee",
2235
2236 "00000000000000000000000000000000",
2237 "fffffffffffffffffffffffffffffe00",
2238 "7f692b03945867d16179a8cefc83ea3f",
2239
2240 "00000000000000000000000000000000",
2241 "ffffffffffffffffffffffffffffff00",
2242 "3bd141ee84a0e6414a26e7a4f281f8a2",
2243
2244 "00000000000000000000000000000000",
2245 "ffffffffffffffffffffffffffffff80",
2246 "d1788f572d98b2b16ec5d5f3922b99bc",
2247
2248 "00000000000000000000000000000000",
2249 "ffffffffffffffffffffffffffffffc0",
2250 "0833ff6f61d98a57b288e8c3586b85a6",
2251
2252 "00000000000000000000000000000000",
2253 "ffffffffffffffffffffffffffffffe0",
2254 "8568261797de176bf0b43becc6285afb",
2255
2256 "00000000000000000000000000000000",
2257 "fffffffffffffffffffffffffffffff0",
2258 "f9b0fda0c4a898f5b9e6f661c4ce4d07",
2259
2260 "00000000000000000000000000000000",
2261 "fffffffffffffffffffffffffffffff8",
2262 "8ade895913685c67c5269f8aae42983e",
2263
2264 "00000000000000000000000000000000",
2265 "fffffffffffffffffffffffffffffffc",
2266 "39bde67d5c8ed8a8b1c37eb8fa9f5ac0",
2267
2268 "00000000000000000000000000000000",
2269 "fffffffffffffffffffffffffffffffe",
2270 "5c005e72c1418c44f569f2ea33ba54f3",
2271
2272 "00000000000000000000000000000000",
2273 "ffffffffffffffffffffffffffffffff",
2274 "3f5b8cc9ea855a0afa7347d23e8d664e",
2275
2276 /*
2277 * From NIST validation suite (ECBVarTxt192.rsp).
2278 */
2279 "000000000000000000000000000000000000000000000000",
2280 "80000000000000000000000000000000",
2281 "6cd02513e8d4dc986b4afe087a60bd0c",
2282
2283 "000000000000000000000000000000000000000000000000",
2284 "c0000000000000000000000000000000",
2285 "2ce1f8b7e30627c1c4519eada44bc436",
2286
2287 "000000000000000000000000000000000000000000000000",
2288 "e0000000000000000000000000000000",
2289 "9946b5f87af446f5796c1fee63a2da24",
2290
2291 "000000000000000000000000000000000000000000000000",
2292 "f0000000000000000000000000000000",
2293 "2a560364ce529efc21788779568d5555",
2294
2295 "000000000000000000000000000000000000000000000000",
2296 "f8000000000000000000000000000000",
2297 "35c1471837af446153bce55d5ba72a0a",
2298
2299 "000000000000000000000000000000000000000000000000",
2300 "fc000000000000000000000000000000",
2301 "ce60bc52386234f158f84341e534cd9e",
2302
2303 "000000000000000000000000000000000000000000000000",
2304 "fe000000000000000000000000000000",
2305 "8c7c27ff32bcf8dc2dc57c90c2903961",
2306
2307 "000000000000000000000000000000000000000000000000",
2308 "ff000000000000000000000000000000",
2309 "32bb6a7ec84499e166f936003d55a5bb",
2310
2311 "000000000000000000000000000000000000000000000000",
2312 "ff800000000000000000000000000000",
2313 "a5c772e5c62631ef660ee1d5877f6d1b",
2314
2315 "000000000000000000000000000000000000000000000000",
2316 "ffc00000000000000000000000000000",
2317 "030d7e5b64f380a7e4ea5387b5cd7f49",
2318
2319 "000000000000000000000000000000000000000000000000",
2320 "ffe00000000000000000000000000000",
2321 "0dc9a2610037009b698f11bb7e86c83e",
2322
2323 "000000000000000000000000000000000000000000000000",
2324 "fff00000000000000000000000000000",
2325 "0046612c766d1840c226364f1fa7ed72",
2326
2327 "000000000000000000000000000000000000000000000000",
2328 "fff80000000000000000000000000000",
2329 "4880c7e08f27befe78590743c05e698b",
2330
2331 "000000000000000000000000000000000000000000000000",
2332 "fffc0000000000000000000000000000",
2333 "2520ce829a26577f0f4822c4ecc87401",
2334
2335 "000000000000000000000000000000000000000000000000",
2336 "fffe0000000000000000000000000000",
2337 "8765e8acc169758319cb46dc7bcf3dca",
2338
2339 "000000000000000000000000000000000000000000000000",
2340 "ffff0000000000000000000000000000",
2341 "e98f4ba4f073df4baa116d011dc24a28",
2342
2343 "000000000000000000000000000000000000000000000000",
2344 "ffff8000000000000000000000000000",
2345 "f378f68c5dbf59e211b3a659a7317d94",
2346
2347 "000000000000000000000000000000000000000000000000",
2348 "ffffc000000000000000000000000000",
2349 "283d3b069d8eb9fb432d74b96ca762b4",
2350
2351 "000000000000000000000000000000000000000000000000",
2352 "ffffe000000000000000000000000000",
2353 "a7e1842e8a87861c221a500883245c51",
2354
2355 "000000000000000000000000000000000000000000000000",
2356 "fffff000000000000000000000000000",
2357 "77aa270471881be070fb52c7067ce732",
2358
2359 "000000000000000000000000000000000000000000000000",
2360 "fffff800000000000000000000000000",
2361 "01b0f476d484f43f1aeb6efa9361a8ac",
2362
2363 "000000000000000000000000000000000000000000000000",
2364 "fffffc00000000000000000000000000",
2365 "1c3a94f1c052c55c2d8359aff2163b4f",
2366
2367 "000000000000000000000000000000000000000000000000",
2368 "fffffe00000000000000000000000000",
2369 "e8a067b604d5373d8b0f2e05a03b341b",
2370
2371 "000000000000000000000000000000000000000000000000",
2372 "ffffff00000000000000000000000000",
2373 "a7876ec87f5a09bfea42c77da30fd50e",
2374
2375 "000000000000000000000000000000000000000000000000",
2376 "ffffff80000000000000000000000000",
2377 "0cf3e9d3a42be5b854ca65b13f35f48d",
2378
2379 "000000000000000000000000000000000000000000000000",
2380 "ffffffc0000000000000000000000000",
2381 "6c62f6bbcab7c3e821c9290f08892dda",
2382
2383 "000000000000000000000000000000000000000000000000",
2384 "ffffffe0000000000000000000000000",
2385 "7f5e05bd2068738196fee79ace7e3aec",
2386
2387 "000000000000000000000000000000000000000000000000",
2388 "fffffff0000000000000000000000000",
2389 "440e0d733255cda92fb46e842fe58054",
2390
2391 "000000000000000000000000000000000000000000000000",
2392 "fffffff8000000000000000000000000",
2393 "aa5d5b1c4ea1b7a22e5583ac2e9ed8a7",
2394
2395 "000000000000000000000000000000000000000000000000",
2396 "fffffffc000000000000000000000000",
2397 "77e537e89e8491e8662aae3bc809421d",
2398
2399 "000000000000000000000000000000000000000000000000",
2400 "fffffffe000000000000000000000000",
2401 "997dd3e9f1598bfa73f75973f7e93b76",
2402
2403 "000000000000000000000000000000000000000000000000",
2404 "ffffffff000000000000000000000000",
2405 "1b38d4f7452afefcb7fc721244e4b72e",
2406
2407 "000000000000000000000000000000000000000000000000",
2408 "ffffffff800000000000000000000000",
2409 "0be2b18252e774dda30cdda02c6906e3",
2410
2411 "000000000000000000000000000000000000000000000000",
2412 "ffffffffc00000000000000000000000",
2413 "d2695e59c20361d82652d7d58b6f11b2",
2414
2415 "000000000000000000000000000000000000000000000000",
2416 "ffffffffe00000000000000000000000",
2417 "902d88d13eae52089abd6143cfe394e9",
2418
2419 "000000000000000000000000000000000000000000000000",
2420 "fffffffff00000000000000000000000",
2421 "d49bceb3b823fedd602c305345734bd2",
2422
2423 "000000000000000000000000000000000000000000000000",
2424 "fffffffff80000000000000000000000",
2425 "707b1dbb0ffa40ef7d95def421233fae",
2426
2427 "000000000000000000000000000000000000000000000000",
2428 "fffffffffc0000000000000000000000",
2429 "7ca0c1d93356d9eb8aa952084d75f913",
2430
2431 "000000000000000000000000000000000000000000000000",
2432 "fffffffffe0000000000000000000000",
2433 "f2cbf9cb186e270dd7bdb0c28febc57d",
2434
2435 "000000000000000000000000000000000000000000000000",
2436 "ffffffffff0000000000000000000000",
2437 "c94337c37c4e790ab45780bd9c3674a0",
2438
2439 "000000000000000000000000000000000000000000000000",
2440 "ffffffffff8000000000000000000000",
2441 "8e3558c135252fb9c9f367ed609467a1",
2442
2443 "000000000000000000000000000000000000000000000000",
2444 "ffffffffffc000000000000000000000",
2445 "1b72eeaee4899b443914e5b3a57fba92",
2446
2447 "000000000000000000000000000000000000000000000000",
2448 "ffffffffffe000000000000000000000",
2449 "011865f91bc56868d051e52c9efd59b7",
2450
2451 "000000000000000000000000000000000000000000000000",
2452 "fffffffffff000000000000000000000",
2453 "e4771318ad7a63dd680f6e583b7747ea",
2454
2455 "000000000000000000000000000000000000000000000000",
2456 "fffffffffff800000000000000000000",
2457 "61e3d194088dc8d97e9e6db37457eac5",
2458
2459 "000000000000000000000000000000000000000000000000",
2460 "fffffffffffc00000000000000000000",
2461 "36ff1ec9ccfbc349e5d356d063693ad6",
2462
2463 "000000000000000000000000000000000000000000000000",
2464 "fffffffffffe00000000000000000000",
2465 "3cc9e9a9be8cc3f6fb2ea24088e9bb19",
2466
2467 "000000000000000000000000000000000000000000000000",
2468 "ffffffffffff00000000000000000000",
2469 "1ee5ab003dc8722e74905d9a8fe3d350",
2470
2471 "000000000000000000000000000000000000000000000000",
2472 "ffffffffffff80000000000000000000",
2473 "245339319584b0a412412869d6c2eada",
2474
2475 "000000000000000000000000000000000000000000000000",
2476 "ffffffffffffc0000000000000000000",
2477 "7bd496918115d14ed5380852716c8814",
2478
2479 "000000000000000000000000000000000000000000000000",
2480 "ffffffffffffe0000000000000000000",
2481 "273ab2f2b4a366a57d582a339313c8b1",
2482
2483 "000000000000000000000000000000000000000000000000",
2484 "fffffffffffff0000000000000000000",
2485 "113365a9ffbe3b0ca61e98507554168b",
2486
2487 "000000000000000000000000000000000000000000000000",
2488 "fffffffffffff8000000000000000000",
2489 "afa99c997ac478a0dea4119c9e45f8b1",
2490
2491 "000000000000000000000000000000000000000000000000",
2492 "fffffffffffffc000000000000000000",
2493 "9216309a7842430b83ffb98638011512",
2494
2495 "000000000000000000000000000000000000000000000000",
2496 "fffffffffffffe000000000000000000",
2497 "62abc792288258492a7cb45145f4b759",
2498
2499 "000000000000000000000000000000000000000000000000",
2500 "ffffffffffffff000000000000000000",
2501 "534923c169d504d7519c15d30e756c50",
2502
2503 "000000000000000000000000000000000000000000000000",
2504 "ffffffffffffff800000000000000000",
2505 "fa75e05bcdc7e00c273fa33f6ee441d2",
2506
2507 "000000000000000000000000000000000000000000000000",
2508 "ffffffffffffffc00000000000000000",
2509 "7d350fa6057080f1086a56b17ec240db",
2510
2511 "000000000000000000000000000000000000000000000000",
2512 "ffffffffffffffe00000000000000000",
2513 "f34e4a6324ea4a5c39a661c8fe5ada8f",
2514
2515 "000000000000000000000000000000000000000000000000",
2516 "fffffffffffffff00000000000000000",
2517 "0882a16f44088d42447a29ac090ec17e",
2518
2519 "000000000000000000000000000000000000000000000000",
2520 "fffffffffffffff80000000000000000",
2521 "3a3c15bfc11a9537c130687004e136ee",
2522
2523 "000000000000000000000000000000000000000000000000",
2524 "fffffffffffffffc0000000000000000",
2525 "22c0a7678dc6d8cf5c8a6d5a9960767c",
2526
2527 "000000000000000000000000000000000000000000000000",
2528 "fffffffffffffffe0000000000000000",
2529 "b46b09809d68b9a456432a79bdc2e38c",
2530
2531 "000000000000000000000000000000000000000000000000",
2532 "ffffffffffffffff0000000000000000",
2533 "93baaffb35fbe739c17c6ac22eecf18f",
2534
2535 "000000000000000000000000000000000000000000000000",
2536 "ffffffffffffffff8000000000000000",
2537 "c8aa80a7850675bc007c46df06b49868",
2538
2539 "000000000000000000000000000000000000000000000000",
2540 "ffffffffffffffffc000000000000000",
2541 "12c6f3877af421a918a84b775858021d",
2542
2543 "000000000000000000000000000000000000000000000000",
2544 "ffffffffffffffffe000000000000000",
2545 "33f123282c5d633924f7d5ba3f3cab11",
2546
2547 "000000000000000000000000000000000000000000000000",
2548 "fffffffffffffffff000000000000000",
2549 "a8f161002733e93ca4527d22c1a0c5bb",
2550
2551 "000000000000000000000000000000000000000000000000",
2552 "fffffffffffffffff800000000000000",
2553 "b72f70ebf3e3fda23f508eec76b42c02",
2554
2555 "000000000000000000000000000000000000000000000000",
2556 "fffffffffffffffffc00000000000000",
2557 "6a9d965e6274143f25afdcfc88ffd77c",
2558
2559 "000000000000000000000000000000000000000000000000",
2560 "fffffffffffffffffe00000000000000",
2561 "a0c74fd0b9361764ce91c5200b095357",
2562
2563 "000000000000000000000000000000000000000000000000",
2564 "ffffffffffffffffff00000000000000",
2565 "091d1fdc2bd2c346cd5046a8c6209146",
2566
2567 "000000000000000000000000000000000000000000000000",
2568 "ffffffffffffffffff80000000000000",
2569 "e2a37580116cfb71856254496ab0aca8",
2570
2571 "000000000000000000000000000000000000000000000000",
2572 "ffffffffffffffffffc0000000000000",
2573 "e0b3a00785917c7efc9adba322813571",
2574
2575 "000000000000000000000000000000000000000000000000",
2576 "ffffffffffffffffffe0000000000000",
2577 "733d41f4727b5ef0df4af4cf3cffa0cb",
2578
2579 "000000000000000000000000000000000000000000000000",
2580 "fffffffffffffffffff0000000000000",
2581 "a99ebb030260826f981ad3e64490aa4f",
2582
2583 "000000000000000000000000000000000000000000000000",
2584 "fffffffffffffffffff8000000000000",
2585 "73f34c7d3eae5e80082c1647524308ee",
2586
2587 "000000000000000000000000000000000000000000000000",
2588 "fffffffffffffffffffc000000000000",
2589 "40ebd5ad082345b7a2097ccd3464da02",
2590
2591 "000000000000000000000000000000000000000000000000",
2592 "fffffffffffffffffffe000000000000",
2593 "7cc4ae9a424b2cec90c97153c2457ec5",
2594
2595 "000000000000000000000000000000000000000000000000",
2596 "ffffffffffffffffffff000000000000",
2597 "54d632d03aba0bd0f91877ebdd4d09cb",
2598
2599 "000000000000000000000000000000000000000000000000",
2600 "ffffffffffffffffffff800000000000",
2601 "d3427be7e4d27cd54f5fe37b03cf0897",
2602
2603 "000000000000000000000000000000000000000000000000",
2604 "ffffffffffffffffffffc00000000000",
2605 "b2099795e88cc158fd75ea133d7e7fbe",
2606
2607 "000000000000000000000000000000000000000000000000",
2608 "ffffffffffffffffffffe00000000000",
2609 "a6cae46fb6fadfe7a2c302a34242817b",
2610
2611 "000000000000000000000000000000000000000000000000",
2612 "fffffffffffffffffffff00000000000",
2613 "026a7024d6a902e0b3ffccbaa910cc3f",
2614
2615 "000000000000000000000000000000000000000000000000",
2616 "fffffffffffffffffffff80000000000",
2617 "156f07767a85a4312321f63968338a01",
2618
2619 "000000000000000000000000000000000000000000000000",
2620 "fffffffffffffffffffffc0000000000",
2621 "15eec9ebf42b9ca76897d2cd6c5a12e2",
2622
2623 "000000000000000000000000000000000000000000000000",
2624 "fffffffffffffffffffffe0000000000",
2625 "db0d3a6fdcc13f915e2b302ceeb70fd8",
2626
2627 "000000000000000000000000000000000000000000000000",
2628 "ffffffffffffffffffffff0000000000",
2629 "71dbf37e87a2e34d15b20e8f10e48924",
2630
2631 "000000000000000000000000000000000000000000000000",
2632 "ffffffffffffffffffffff8000000000",
2633 "c745c451e96ff3c045e4367c833e3b54",
2634
2635 "000000000000000000000000000000000000000000000000",
2636 "ffffffffffffffffffffffc000000000",
2637 "340da09c2dd11c3b679d08ccd27dd595",
2638
2639 "000000000000000000000000000000000000000000000000",
2640 "ffffffffffffffffffffffe000000000",
2641 "8279f7c0c2a03ee660c6d392db025d18",
2642
2643 "000000000000000000000000000000000000000000000000",
2644 "fffffffffffffffffffffff000000000",
2645 "a4b2c7d8eba531ff47c5041a55fbd1ec",
2646
2647 "000000000000000000000000000000000000000000000000",
2648 "fffffffffffffffffffffff800000000",
2649 "74569a2ca5a7bd5131ce8dc7cbfbf72f",
2650
2651 "000000000000000000000000000000000000000000000000",
2652 "fffffffffffffffffffffffc00000000",
2653 "3713da0c0219b63454035613b5a403dd",
2654
2655 "000000000000000000000000000000000000000000000000",
2656 "fffffffffffffffffffffffe00000000",
2657 "8827551ddcc9df23fa72a3de4e9f0b07",
2658
2659 "000000000000000000000000000000000000000000000000",
2660 "ffffffffffffffffffffffff00000000",
2661 "2e3febfd625bfcd0a2c06eb460da1732",
2662
2663 "000000000000000000000000000000000000000000000000",
2664 "ffffffffffffffffffffffff80000000",
2665 "ee82e6ba488156f76496311da6941deb",
2666
2667 "000000000000000000000000000000000000000000000000",
2668 "ffffffffffffffffffffffffc0000000",
2669 "4770446f01d1f391256e85a1b30d89d3",
2670
2671 "000000000000000000000000000000000000000000000000",
2672 "ffffffffffffffffffffffffe0000000",
2673 "af04b68f104f21ef2afb4767cf74143c",
2674
2675 "000000000000000000000000000000000000000000000000",
2676 "fffffffffffffffffffffffff0000000",
2677 "cf3579a9ba38c8e43653173e14f3a4c6",
2678
2679 "000000000000000000000000000000000000000000000000",
2680 "fffffffffffffffffffffffff8000000",
2681 "b3bba904f4953e09b54800af2f62e7d4",
2682
2683 "000000000000000000000000000000000000000000000000",
2684 "fffffffffffffffffffffffffc000000",
2685 "fc4249656e14b29eb9c44829b4c59a46",
2686
2687 "000000000000000000000000000000000000000000000000",
2688 "fffffffffffffffffffffffffe000000",
2689 "9b31568febe81cfc2e65af1c86d1a308",
2690
2691 "000000000000000000000000000000000000000000000000",
2692 "ffffffffffffffffffffffffff000000",
2693 "9ca09c25f273a766db98a480ce8dfedc",
2694
2695 "000000000000000000000000000000000000000000000000",
2696 "ffffffffffffffffffffffffff800000",
2697 "b909925786f34c3c92d971883c9fbedf",
2698
2699 "000000000000000000000000000000000000000000000000",
2700 "ffffffffffffffffffffffffffc00000",
2701 "82647f1332fe570a9d4d92b2ee771d3b",
2702
2703 "000000000000000000000000000000000000000000000000",
2704 "ffffffffffffffffffffffffffe00000",
2705 "3604a7e80832b3a99954bca6f5b9f501",
2706
2707 "000000000000000000000000000000000000000000000000",
2708 "fffffffffffffffffffffffffff00000",
2709 "884607b128c5de3ab39a529a1ef51bef",
2710
2711 "000000000000000000000000000000000000000000000000",
2712 "fffffffffffffffffffffffffff80000",
2713 "670cfa093d1dbdb2317041404102435e",
2714
2715 "000000000000000000000000000000000000000000000000",
2716 "fffffffffffffffffffffffffffc0000",
2717 "7a867195f3ce8769cbd336502fbb5130",
2718
2719 "000000000000000000000000000000000000000000000000",
2720 "fffffffffffffffffffffffffffe0000",
2721 "52efcf64c72b2f7ca5b3c836b1078c15",
2722
2723 "000000000000000000000000000000000000000000000000",
2724 "ffffffffffffffffffffffffffff0000",
2725 "4019250f6eefb2ac5ccbcae044e75c7e",
2726
2727 "000000000000000000000000000000000000000000000000",
2728 "ffffffffffffffffffffffffffff8000",
2729 "022c4f6f5a017d292785627667ddef24",
2730
2731 "000000000000000000000000000000000000000000000000",
2732 "ffffffffffffffffffffffffffffc000",
2733 "e9c21078a2eb7e03250f71000fa9e3ed",
2734
2735 "000000000000000000000000000000000000000000000000",
2736 "ffffffffffffffffffffffffffffe000",
2737 "a13eaeeb9cd391da4e2b09490b3e7fad",
2738
2739 "000000000000000000000000000000000000000000000000",
2740 "fffffffffffffffffffffffffffff000",
2741 "c958a171dca1d4ed53e1af1d380803a9",
2742
2743 "000000000000000000000000000000000000000000000000",
2744 "fffffffffffffffffffffffffffff800",
2745 "21442e07a110667f2583eaeeee44dc8c",
2746
2747 "000000000000000000000000000000000000000000000000",
2748 "fffffffffffffffffffffffffffffc00",
2749 "59bbb353cf1dd867a6e33737af655e99",
2750
2751 "000000000000000000000000000000000000000000000000",
2752 "fffffffffffffffffffffffffffffe00",
2753 "43cd3b25375d0ce41087ff9fe2829639",
2754
2755 "000000000000000000000000000000000000000000000000",
2756 "ffffffffffffffffffffffffffffff00",
2757 "6b98b17e80d1118e3516bd768b285a84",
2758
2759 "000000000000000000000000000000000000000000000000",
2760 "ffffffffffffffffffffffffffffff80",
2761 "ae47ed3676ca0c08deea02d95b81db58",
2762
2763 "000000000000000000000000000000000000000000000000",
2764 "ffffffffffffffffffffffffffffffc0",
2765 "34ec40dc20413795ed53628ea748720b",
2766
2767 "000000000000000000000000000000000000000000000000",
2768 "ffffffffffffffffffffffffffffffe0",
2769 "4dc68163f8e9835473253542c8a65d46",
2770
2771 "000000000000000000000000000000000000000000000000",
2772 "fffffffffffffffffffffffffffffff0",
2773 "2aabb999f43693175af65c6c612c46fb",
2774
2775 "000000000000000000000000000000000000000000000000",
2776 "fffffffffffffffffffffffffffffff8",
2777 "e01f94499dac3547515c5b1d756f0f58",
2778
2779 "000000000000000000000000000000000000000000000000",
2780 "fffffffffffffffffffffffffffffffc",
2781 "9d12435a46480ce00ea349f71799df9a",
2782
2783 "000000000000000000000000000000000000000000000000",
2784 "fffffffffffffffffffffffffffffffe",
2785 "cef41d16d266bdfe46938ad7884cc0cf",
2786
2787 "000000000000000000000000000000000000000000000000",
2788 "ffffffffffffffffffffffffffffffff",
2789 "b13db4da1f718bc6904797c82bcf2d32",
2790
2791 /*
2792 * From NIST validation suite (ECBVarTxt256.rsp).
2793 */
2794 "0000000000000000000000000000000000000000000000000000000000000000",
2795 "80000000000000000000000000000000",
2796 "ddc6bf790c15760d8d9aeb6f9a75fd4e",
2797
2798 "0000000000000000000000000000000000000000000000000000000000000000",
2799 "c0000000000000000000000000000000",
2800 "0a6bdc6d4c1e6280301fd8e97ddbe601",
2801
2802 "0000000000000000000000000000000000000000000000000000000000000000",
2803 "e0000000000000000000000000000000",
2804 "9b80eefb7ebe2d2b16247aa0efc72f5d",
2805
2806 "0000000000000000000000000000000000000000000000000000000000000000",
2807 "f0000000000000000000000000000000",
2808 "7f2c5ece07a98d8bee13c51177395ff7",
2809
2810 "0000000000000000000000000000000000000000000000000000000000000000",
2811 "f8000000000000000000000000000000",
2812 "7818d800dcf6f4be1e0e94f403d1e4c2",
2813
2814 "0000000000000000000000000000000000000000000000000000000000000000",
2815 "fc000000000000000000000000000000",
2816 "e74cd1c92f0919c35a0324123d6177d3",
2817
2818 "0000000000000000000000000000000000000000000000000000000000000000",
2819 "fe000000000000000000000000000000",
2820 "8092a4dcf2da7e77e93bdd371dfed82e",
2821
2822 "0000000000000000000000000000000000000000000000000000000000000000",
2823 "ff000000000000000000000000000000",
2824 "49af6b372135acef10132e548f217b17",
2825
2826 "0000000000000000000000000000000000000000000000000000000000000000",
2827 "ff800000000000000000000000000000",
2828 "8bcd40f94ebb63b9f7909676e667f1e7",
2829
2830 "0000000000000000000000000000000000000000000000000000000000000000",
2831 "ffc00000000000000000000000000000",
2832 "fe1cffb83f45dcfb38b29be438dbd3ab",
2833
2834 "0000000000000000000000000000000000000000000000000000000000000000",
2835 "ffe00000000000000000000000000000",
2836 "0dc58a8d886623705aec15cb1e70dc0e",
2837
2838 "0000000000000000000000000000000000000000000000000000000000000000",
2839 "fff00000000000000000000000000000",
2840 "c218faa16056bd0774c3e8d79c35a5e4",
2841
2842 "0000000000000000000000000000000000000000000000000000000000000000",
2843 "fff80000000000000000000000000000",
2844 "047bba83f7aa841731504e012208fc9e",
2845
2846 "0000000000000000000000000000000000000000000000000000000000000000",
2847 "fffc0000000000000000000000000000",
2848 "dc8f0e4915fd81ba70a331310882f6da",
2849
2850 "0000000000000000000000000000000000000000000000000000000000000000",
2851 "fffe0000000000000000000000000000",
2852 "1569859ea6b7206c30bf4fd0cbfac33c",
2853
2854 "0000000000000000000000000000000000000000000000000000000000000000",
2855 "ffff0000000000000000000000000000",
2856 "300ade92f88f48fa2df730ec16ef44cd",
2857
2858 "0000000000000000000000000000000000000000000000000000000000000000",
2859 "ffff8000000000000000000000000000",
2860 "1fe6cc3c05965dc08eb0590c95ac71d0",
2861
2862 "0000000000000000000000000000000000000000000000000000000000000000",
2863 "ffffc000000000000000000000000000",
2864 "59e858eaaa97fec38111275b6cf5abc0",
2865
2866 "0000000000000000000000000000000000000000000000000000000000000000",
2867 "ffffe000000000000000000000000000",
2868 "2239455e7afe3b0616100288cc5a723b",
2869
2870 "0000000000000000000000000000000000000000000000000000000000000000",
2871 "fffff000000000000000000000000000",
2872 "3ee500c5c8d63479717163e55c5c4522",
2873
2874 "0000000000000000000000000000000000000000000000000000000000000000",
2875 "fffff800000000000000000000000000",
2876 "d5e38bf15f16d90e3e214041d774daa8",
2877
2878 "0000000000000000000000000000000000000000000000000000000000000000",
2879 "fffffc00000000000000000000000000",
2880 "b1f4066e6f4f187dfe5f2ad1b17819d0",
2881
2882 "0000000000000000000000000000000000000000000000000000000000000000",
2883 "fffffe00000000000000000000000000",
2884 "6ef4cc4de49b11065d7af2909854794a",
2885
2886 "0000000000000000000000000000000000000000000000000000000000000000",
2887 "ffffff00000000000000000000000000",
2888 "ac86bc606b6640c309e782f232bf367f",
2889
2890 "0000000000000000000000000000000000000000000000000000000000000000",
2891 "ffffff80000000000000000000000000",
2892 "36aff0ef7bf3280772cf4cac80a0d2b2",
2893
2894 "0000000000000000000000000000000000000000000000000000000000000000",
2895 "ffffffc0000000000000000000000000",
2896 "1f8eedea0f62a1406d58cfc3ecea72cf",
2897
2898 "0000000000000000000000000000000000000000000000000000000000000000",
2899 "ffffffe0000000000000000000000000",
2900 "abf4154a3375a1d3e6b1d454438f95a6",
2901
2902 "0000000000000000000000000000000000000000000000000000000000000000",
2903 "fffffff0000000000000000000000000",
2904 "96f96e9d607f6615fc192061ee648b07",
2905
2906 "0000000000000000000000000000000000000000000000000000000000000000",
2907 "fffffff8000000000000000000000000",
2908 "cf37cdaaa0d2d536c71857634c792064",
2909
2910 "0000000000000000000000000000000000000000000000000000000000000000",
2911 "fffffffc000000000000000000000000",
2912 "fbd6640c80245c2b805373f130703127",
2913
2914 "0000000000000000000000000000000000000000000000000000000000000000",
2915 "fffffffe000000000000000000000000",
2916 "8d6a8afe55a6e481badae0d146f436db",
2917
2918 "0000000000000000000000000000000000000000000000000000000000000000",
2919 "ffffffff000000000000000000000000",
2920 "6a4981f2915e3e68af6c22385dd06756",
2921
2922 "0000000000000000000000000000000000000000000000000000000000000000",
2923 "ffffffff800000000000000000000000",
2924 "42a1136e5f8d8d21d3101998642d573b",
2925
2926 "0000000000000000000000000000000000000000000000000000000000000000",
2927 "ffffffffc00000000000000000000000",
2928 "9b471596dc69ae1586cee6158b0b0181",
2929
2930 "0000000000000000000000000000000000000000000000000000000000000000",
2931 "ffffffffe00000000000000000000000",
2932 "753665c4af1eff33aa8b628bf8741cfd",
2933
2934 "0000000000000000000000000000000000000000000000000000000000000000",
2935 "fffffffff00000000000000000000000",
2936 "9a682acf40be01f5b2a4193c9a82404d",
2937
2938 "0000000000000000000000000000000000000000000000000000000000000000",
2939 "fffffffff80000000000000000000000",
2940 "54fafe26e4287f17d1935f87eb9ade01",
2941
2942 "0000000000000000000000000000000000000000000000000000000000000000",
2943 "fffffffffc0000000000000000000000",
2944 "49d541b2e74cfe73e6a8e8225f7bd449",
2945
2946 "0000000000000000000000000000000000000000000000000000000000000000",
2947 "fffffffffe0000000000000000000000",
2948 "11a45530f624ff6f76a1b3826626ff7b",
2949
2950 "0000000000000000000000000000000000000000000000000000000000000000",
2951 "ffffffffff0000000000000000000000",
2952 "f96b0c4a8bc6c86130289f60b43b8fba",
2953
2954 "0000000000000000000000000000000000000000000000000000000000000000",
2955 "ffffffffff8000000000000000000000",
2956 "48c7d0e80834ebdc35b6735f76b46c8b",
2957
2958 "0000000000000000000000000000000000000000000000000000000000000000",
2959 "ffffffffffc000000000000000000000",
2960 "2463531ab54d66955e73edc4cb8eaa45",
2961
2962 "0000000000000000000000000000000000000000000000000000000000000000",
2963 "ffffffffffe000000000000000000000",
2964 "ac9bd8e2530469134b9d5b065d4f565b",
2965
2966 "0000000000000000000000000000000000000000000000000000000000000000",
2967 "fffffffffff000000000000000000000",
2968 "3f5f9106d0e52f973d4890e6f37e8a00",
2969
2970 "0000000000000000000000000000000000000000000000000000000000000000",
2971 "fffffffffff800000000000000000000",
2972 "20ebc86f1304d272e2e207e59db639f0",
2973
2974 "0000000000000000000000000000000000000000000000000000000000000000",
2975 "fffffffffffc00000000000000000000",
2976 "e67ae6426bf9526c972cff072b52252c",
2977
2978 "0000000000000000000000000000000000000000000000000000000000000000",
2979 "fffffffffffe00000000000000000000",
2980 "1a518dddaf9efa0d002cc58d107edfc8",
2981
2982 "0000000000000000000000000000000000000000000000000000000000000000",
2983 "ffffffffffff00000000000000000000",
2984 "ead731af4d3a2fe3b34bed047942a49f",
2985
2986 "0000000000000000000000000000000000000000000000000000000000000000",
2987 "ffffffffffff80000000000000000000",
2988 "b1d4efe40242f83e93b6c8d7efb5eae9",
2989
2990 "0000000000000000000000000000000000000000000000000000000000000000",
2991 "ffffffffffffc0000000000000000000",
2992 "cd2b1fec11fd906c5c7630099443610a",
2993
2994 "0000000000000000000000000000000000000000000000000000000000000000",
2995 "ffffffffffffe0000000000000000000",
2996 "a1853fe47fe29289d153161d06387d21",
2997
2998 "0000000000000000000000000000000000000000000000000000000000000000",
2999 "fffffffffffff0000000000000000000",
3000 "4632154179a555c17ea604d0889fab14",
3001
3002 "0000000000000000000000000000000000000000000000000000000000000000",
3003 "fffffffffffff8000000000000000000",
3004 "dd27cac6401a022e8f38f9f93e774417",
3005
3006 "0000000000000000000000000000000000000000000000000000000000000000",
3007 "fffffffffffffc000000000000000000",
3008 "c090313eb98674f35f3123385fb95d4d",
3009
3010 "0000000000000000000000000000000000000000000000000000000000000000",
3011 "fffffffffffffe000000000000000000",
3012 "cc3526262b92f02edce548f716b9f45c",
3013
3014 "0000000000000000000000000000000000000000000000000000000000000000",
3015 "ffffffffffffff000000000000000000",
3016 "c0838d1a2b16a7c7f0dfcc433c399c33",
3017
3018 "0000000000000000000000000000000000000000000000000000000000000000",
3019 "ffffffffffffff800000000000000000",
3020 "0d9ac756eb297695eed4d382eb126d26",
3021
3022 "0000000000000000000000000000000000000000000000000000000000000000",
3023 "ffffffffffffffc00000000000000000",
3024 "56ede9dda3f6f141bff1757fa689c3e1",
3025
3026 "0000000000000000000000000000000000000000000000000000000000000000",
3027 "ffffffffffffffe00000000000000000",
3028 "768f520efe0f23e61d3ec8ad9ce91774",
3029
3030 "0000000000000000000000000000000000000000000000000000000000000000",
3031 "fffffffffffffff00000000000000000",
3032 "b1144ddfa75755213390e7c596660490",
3033
3034 "0000000000000000000000000000000000000000000000000000000000000000",
3035 "fffffffffffffff80000000000000000",
3036 "1d7c0c4040b355b9d107a99325e3b050",
3037
3038 "0000000000000000000000000000000000000000000000000000000000000000",
3039 "fffffffffffffffc0000000000000000",
3040 "d8e2bb1ae8ee3dcf5bf7d6c38da82a1a",
3041
3042 "0000000000000000000000000000000000000000000000000000000000000000",
3043 "fffffffffffffffe0000000000000000",
3044 "faf82d178af25a9886a47e7f789b98d7",
3045
3046 "0000000000000000000000000000000000000000000000000000000000000000",
3047 "ffffffffffffffff0000000000000000",
3048 "9b58dbfd77fe5aca9cfc190cd1b82d19",
3049
3050 "0000000000000000000000000000000000000000000000000000000000000000",
3051 "ffffffffffffffff8000000000000000",
3052 "77f392089042e478ac16c0c86a0b5db5",
3053
3054 "0000000000000000000000000000000000000000000000000000000000000000",
3055 "ffffffffffffffffc000000000000000",
3056 "19f08e3420ee69b477ca1420281c4782",
3057
3058 "0000000000000000000000000000000000000000000000000000000000000000",
3059 "ffffffffffffffffe000000000000000",
3060 "a1b19beee4e117139f74b3c53fdcb875",
3061
3062 "0000000000000000000000000000000000000000000000000000000000000000",
3063 "fffffffffffffffff000000000000000",
3064 "a37a5869b218a9f3a0868d19aea0ad6a",
3065
3066 "0000000000000000000000000000000000000000000000000000000000000000",
3067 "fffffffffffffffff800000000000000",
3068 "bc3594e865bcd0261b13202731f33580",
3069
3070 "0000000000000000000000000000000000000000000000000000000000000000",
3071 "fffffffffffffffffc00000000000000",
3072 "811441ce1d309eee7185e8c752c07557",
3073
3074 "0000000000000000000000000000000000000000000000000000000000000000",
3075 "fffffffffffffffffe00000000000000",
3076 "959971ce4134190563518e700b9874d1",
3077
3078 "0000000000000000000000000000000000000000000000000000000000000000",
3079 "ffffffffffffffffff00000000000000",
3080 "76b5614a042707c98e2132e2e805fe63",
3081
3082 "0000000000000000000000000000000000000000000000000000000000000000",
3083 "ffffffffffffffffff80000000000000",
3084 "7d9fa6a57530d0f036fec31c230b0cc6",
3085
3086 "0000000000000000000000000000000000000000000000000000000000000000",
3087 "ffffffffffffffffffc0000000000000",
3088 "964153a83bf6989a4ba80daa91c3e081",
3089
3090 "0000000000000000000000000000000000000000000000000000000000000000",
3091 "ffffffffffffffffffe0000000000000",
3092 "a013014d4ce8054cf2591d06f6f2f176",
3093
3094 "0000000000000000000000000000000000000000000000000000000000000000",
3095 "fffffffffffffffffff0000000000000",
3096 "d1c5f6399bf382502e385eee1474a869",
3097
3098 "0000000000000000000000000000000000000000000000000000000000000000",
3099 "fffffffffffffffffff8000000000000",
3100 "0007e20b8298ec354f0f5fe7470f36bd",
3101
3102 "0000000000000000000000000000000000000000000000000000000000000000",
3103 "fffffffffffffffffffc000000000000",
3104 "b95ba05b332da61ef63a2b31fcad9879",
3105
3106 "0000000000000000000000000000000000000000000000000000000000000000",
3107 "fffffffffffffffffffe000000000000",
3108 "4620a49bd967491561669ab25dce45f4",
3109
3110 "0000000000000000000000000000000000000000000000000000000000000000",
3111 "ffffffffffffffffffff000000000000",
3112 "12e71214ae8e04f0bb63d7425c6f14d5",
3113
3114 "0000000000000000000000000000000000000000000000000000000000000000",
3115 "ffffffffffffffffffff800000000000",
3116 "4cc42fc1407b008fe350907c092e80ac",
3117
3118 "0000000000000000000000000000000000000000000000000000000000000000",
3119 "ffffffffffffffffffffc00000000000",
3120 "08b244ce7cbc8ee97fbba808cb146fda",
3121
3122 "0000000000000000000000000000000000000000000000000000000000000000",
3123 "ffffffffffffffffffffe00000000000",
3124 "39b333e8694f21546ad1edd9d87ed95b",
3125
3126 "0000000000000000000000000000000000000000000000000000000000000000",
3127 "fffffffffffffffffffff00000000000",
3128 "3b271f8ab2e6e4a20ba8090f43ba78f3",
3129
3130 "0000000000000000000000000000000000000000000000000000000000000000",
3131 "fffffffffffffffffffff80000000000",
3132 "9ad983f3bf651cd0393f0a73cccdea50",
3133
3134 "0000000000000000000000000000000000000000000000000000000000000000",
3135 "fffffffffffffffffffffc0000000000",
3136 "8f476cbff75c1f725ce18e4bbcd19b32",
3137
3138 "0000000000000000000000000000000000000000000000000000000000000000",
3139 "fffffffffffffffffffffe0000000000",
3140 "905b6267f1d6ab5320835a133f096f2a",
3141
3142 "0000000000000000000000000000000000000000000000000000000000000000",
3143 "ffffffffffffffffffffff0000000000",
3144 "145b60d6d0193c23f4221848a892d61a",
3145
3146 "0000000000000000000000000000000000000000000000000000000000000000",
3147 "ffffffffffffffffffffff8000000000",
3148 "55cfb3fb6d75cad0445bbc8dafa25b0f",
3149
3150 "0000000000000000000000000000000000000000000000000000000000000000",
3151 "ffffffffffffffffffffffc000000000",
3152 "7b8e7098e357ef71237d46d8b075b0f5",
3153
3154 "0000000000000000000000000000000000000000000000000000000000000000",
3155 "ffffffffffffffffffffffe000000000",
3156 "2bf27229901eb40f2df9d8398d1505ae",
3157
3158 "0000000000000000000000000000000000000000000000000000000000000000",
3159 "fffffffffffffffffffffff000000000",
3160 "83a63402a77f9ad5c1e931a931ecd706",
3161
3162 "0000000000000000000000000000000000000000000000000000000000000000",
3163 "fffffffffffffffffffffff800000000",
3164 "6f8ba6521152d31f2bada1843e26b973",
3165
3166 "0000000000000000000000000000000000000000000000000000000000000000",
3167 "fffffffffffffffffffffffc00000000",
3168 "e5c3b8e30fd2d8e6239b17b44bd23bbd",
3169
3170 "0000000000000000000000000000000000000000000000000000000000000000",
3171 "fffffffffffffffffffffffe00000000",
3172 "1ac1f7102c59933e8b2ddc3f14e94baa",
3173
3174 "0000000000000000000000000000000000000000000000000000000000000000",
3175 "ffffffffffffffffffffffff00000000",
3176 "21d9ba49f276b45f11af8fc71a088e3d",
3177
3178 "0000000000000000000000000000000000000000000000000000000000000000",
3179 "ffffffffffffffffffffffff80000000",
3180 "649f1cddc3792b4638635a392bc9bade",
3181
3182 "0000000000000000000000000000000000000000000000000000000000000000",
3183 "ffffffffffffffffffffffffc0000000",
3184 "e2775e4b59c1bc2e31a2078c11b5a08c",
3185
3186 "0000000000000000000000000000000000000000000000000000000000000000",
3187 "ffffffffffffffffffffffffe0000000",
3188 "2be1fae5048a25582a679ca10905eb80",
3189
3190 "0000000000000000000000000000000000000000000000000000000000000000",
3191 "fffffffffffffffffffffffff0000000",
3192 "da86f292c6f41ea34fb2068df75ecc29",
3193
3194 "0000000000000000000000000000000000000000000000000000000000000000",
3195 "fffffffffffffffffffffffff8000000",
3196 "220df19f85d69b1b562fa69a3c5beca5",
3197
3198 "0000000000000000000000000000000000000000000000000000000000000000",
3199 "fffffffffffffffffffffffffc000000",
3200 "1f11d5d0355e0b556ccdb6c7f5083b4d",
3201
3202 "0000000000000000000000000000000000000000000000000000000000000000",
3203 "fffffffffffffffffffffffffe000000",
3204 "62526b78be79cb384633c91f83b4151b",
3205
3206 "0000000000000000000000000000000000000000000000000000000000000000",
3207 "ffffffffffffffffffffffffff000000",
3208 "90ddbcb950843592dd47bbef00fdc876",
3209
3210 "0000000000000000000000000000000000000000000000000000000000000000",
3211 "ffffffffffffffffffffffffff800000",
3212 "2fd0e41c5b8402277354a7391d2618e2",
3213
3214 "0000000000000000000000000000000000000000000000000000000000000000",
3215 "ffffffffffffffffffffffffffc00000",
3216 "3cdf13e72dee4c581bafec70b85f9660",
3217
3218 "0000000000000000000000000000000000000000000000000000000000000000",
3219 "ffffffffffffffffffffffffffe00000",
3220 "afa2ffc137577092e2b654fa199d2c43",
3221
3222 "0000000000000000000000000000000000000000000000000000000000000000",
3223 "fffffffffffffffffffffffffff00000",
3224 "8d683ee63e60d208e343ce48dbc44cac",
3225
3226 "0000000000000000000000000000000000000000000000000000000000000000",
3227 "fffffffffffffffffffffffffff80000",
3228 "705a4ef8ba2133729c20185c3d3a4763",
3229
3230 "0000000000000000000000000000000000000000000000000000000000000000",
3231 "fffffffffffffffffffffffffffc0000",
3232 "0861a861c3db4e94194211b77ed761b9",
3233
3234 "0000000000000000000000000000000000000000000000000000000000000000",
3235 "fffffffffffffffffffffffffffe0000",
3236 "4b00c27e8b26da7eab9d3a88dec8b031",
3237
3238 "0000000000000000000000000000000000000000000000000000000000000000",
3239 "ffffffffffffffffffffffffffff0000",
3240 "5f397bf03084820cc8810d52e5b666e9",
3241
3242 "0000000000000000000000000000000000000000000000000000000000000000",
3243 "ffffffffffffffffffffffffffff8000",
3244 "63fafabb72c07bfbd3ddc9b1203104b8",
3245
3246 "0000000000000000000000000000000000000000000000000000000000000000",
3247 "ffffffffffffffffffffffffffffc000",
3248 "683e2140585b18452dd4ffbb93c95df9",
3249
3250 "0000000000000000000000000000000000000000000000000000000000000000",
3251 "ffffffffffffffffffffffffffffe000",
3252 "286894e48e537f8763b56707d7d155c8",
3253
3254 "0000000000000000000000000000000000000000000000000000000000000000",
3255 "fffffffffffffffffffffffffffff000",
3256 "a423deabc173dcf7e2c4c53e77d37cd1",
3257
3258 "0000000000000000000000000000000000000000000000000000000000000000",
3259 "fffffffffffffffffffffffffffff800",
3260 "eb8168313e1cfdfdb5e986d5429cf172",
3261
3262 "0000000000000000000000000000000000000000000000000000000000000000",
3263 "fffffffffffffffffffffffffffffc00",
3264 "27127daafc9accd2fb334ec3eba52323",
3265
3266 "0000000000000000000000000000000000000000000000000000000000000000",
3267 "fffffffffffffffffffffffffffffe00",
3268 "ee0715b96f72e3f7a22a5064fc592f4c",
3269
3270 "0000000000000000000000000000000000000000000000000000000000000000",
3271 "ffffffffffffffffffffffffffffff00",
3272 "29ee526770f2a11dcfa989d1ce88830f",
3273
3274 "0000000000000000000000000000000000000000000000000000000000000000",
3275 "ffffffffffffffffffffffffffffff80",
3276 "0493370e054b09871130fe49af730a5a",
3277
3278 "0000000000000000000000000000000000000000000000000000000000000000",
3279 "ffffffffffffffffffffffffffffffc0",
3280 "9b7b940f6c509f9e44a4ee140448ee46",
3281
3282 "0000000000000000000000000000000000000000000000000000000000000000",
3283 "ffffffffffffffffffffffffffffffe0",
3284 "2915be4a1ecfdcbe3e023811a12bb6c7",
3285
3286 "0000000000000000000000000000000000000000000000000000000000000000",
3287 "fffffffffffffffffffffffffffffff0",
3288 "7240e524bc51d8c4d440b1be55d1062c",
3289
3290 "0000000000000000000000000000000000000000000000000000000000000000",
3291 "fffffffffffffffffffffffffffffff8",
3292 "da63039d38cb4612b2dc36ba26684b93",
3293
3294 "0000000000000000000000000000000000000000000000000000000000000000",
3295 "fffffffffffffffffffffffffffffffc",
3296 "0f59cb5a4b522e2ac56c1a64f558ad9a",
3297
3298 "0000000000000000000000000000000000000000000000000000000000000000",
3299 "fffffffffffffffffffffffffffffffe",
3300 "7bfe9d876c6d63c1d035da8fe21c409d",
3301
3302 "0000000000000000000000000000000000000000000000000000000000000000",
3303 "ffffffffffffffffffffffffffffffff",
3304 "acdace8078a32b1a182bfa4987ca1347",
3305
3306 /*
3307 * Table end marker.
3308 */
3309 NULL
3310 };
3311
3312 /*
3313 * AES known-answer tests for CBC. Order: key, IV, plaintext, ciphertext.
3314 */
3315 static const char *const KAT_AES_CBC[] = {
3316 /*
3317 * From NIST validation suite "Multiblock Message Test"
3318 * (cbcmmt128.rsp).
3319 */
3320 "1f8e4973953f3fb0bd6b16662e9a3c17",
3321 "2fe2b333ceda8f98f4a99b40d2cd34a8",
3322 "45cf12964fc824ab76616ae2f4bf0822",
3323 "0f61c4d44c5147c03c195ad7e2cc12b2",
3324
3325 "0700d603a1c514e46b6191ba430a3a0c",
3326 "aad1583cd91365e3bb2f0c3430d065bb",
3327 "068b25c7bfb1f8bdd4cfc908f69dffc5ddc726a197f0e5f720f730393279be91",
3328 "c4dc61d9725967a3020104a9738f23868527ce839aab1752fd8bdb95a82c4d00",
3329
3330 "3348aa51e9a45c2dbe33ccc47f96e8de",
3331 "19153c673160df2b1d38c28060e59b96",
3332 "9b7cee827a26575afdbb7c7a329f887238052e3601a7917456ba61251c214763d5e1847a6ad5d54127a399ab07ee3599",
3333 "d5aed6c9622ec451a15db12819952b6752501cf05cdbf8cda34a457726ded97818e1f127a28d72db5652749f0c6afee5",
3334
3335 "b7f3c9576e12dd0db63e8f8fac2b9a39",
3336 "c80f095d8bb1a060699f7c19974a1aa0",
3337 "9ac19954ce1319b354d3220460f71c1e373f1cd336240881160cfde46ebfed2e791e8d5a1a136ebd1dc469dec00c4187722b841cdabcb22c1be8a14657da200e",
3338 "19b9609772c63f338608bf6eb52ca10be65097f89c1e0905c42401fd47791ae2c5440b2d473116ca78bd9ff2fb6015cfd316524eae7dcb95ae738ebeae84a467",
3339
3340 "b6f9afbfe5a1562bba1368fc72ac9d9c",
3341 "3f9d5ebe250ee7ce384b0d00ee849322",
3342 "db397ec22718dbffb9c9d13de0efcd4611bf792be4fce0dc5f25d4f577ed8cdbd4eb9208d593dda3d4653954ab64f05676caa3ce9bfa795b08b67ceebc923fdc89a8c431188e9e482d8553982cf304d1",
3343 "10ea27b19e16b93af169c4a88e06e35c99d8b420980b058e34b4b8f132b13766f72728202b089f428fecdb41c79f8aa0d0ef68f5786481cca29e2126f69bc14160f1ae2187878ba5c49cf3961e1b7ee9",
3344
3345 "bbe7b7ba07124ff1ae7c3416fe8b465e",
3346 "7f65b5ee3630bed6b84202d97fb97a1e",
3347 "2aad0c2c4306568bad7447460fd3dac054346d26feddbc9abd9110914011b4794be2a9a00a519a51a5b5124014f4ed2735480db21b434e99a911bb0b60fe0253763725b628d5739a5117b7ee3aefafc5b4c1bf446467e7bf5f78f31ff7caf187",
3348 "3b8611bfc4973c5cd8e982b073b33184cd26110159172e44988eb5ff5661a1e16fad67258fcbfee55469267a12dc374893b4e3533d36f5634c3095583596f135aa8cd1138dc898bc5651ee35a92ebf89ab6aeb5366653bc60a70e0074fc11efe",
3349
3350 "89a553730433f7e6d67d16d373bd5360",
3351 "f724558db3433a523f4e51a5bea70497",
3352 "807bc4ea684eedcfdcca30180680b0f1ae2814f35f36d053c5aea6595a386c1442770f4d7297d8b91825ee7237241da8925dd594ccf676aecd46ca2068e8d37a3a0ec8a7d5185a201e663b5ff36ae197110188a23503763b8218826d23ced74b31e9f6e2d7fbfa6cb43420c7807a8625",
3353 "406af1429a478c3d07e555c5287a60500d37fc39b68e5bbb9bafd6ddb223828561d6171a308d5b1a4551e8a5e7d572918d25c968d3871848d2f16635caa9847f38590b1df58ab5efb985f2c66cfaf86f61b3f9c0afad6c963c49cee9b8bc81a2ddb06c967f325515a4849eec37ce721a",
3354
3355 "c491ca31f91708458e29a925ec558d78",
3356 "9ef934946e5cd0ae97bd58532cb49381",
3357 "cb6a787e0dec56f9a165957f81af336ca6b40785d9e94093c6190e5152649f882e874d79ac5e167bd2a74ce5ae088d2ee854f6539e0a94796b1e1bd4c9fcdbc79acbef4d01eeb89776d18af71ae2a4fc47dd66df6c4dbe1d1850e466549a47b636bcc7c2b3a62495b56bb67b6d455f1eebd9bfefecbca6c7f335cfce9b45cb9d",
3358 "7b2931f5855f717145e00f152a9f4794359b1ffcb3e55f594e33098b51c23a6c74a06c1d94fded7fd2ae42c7db7acaef5844cb33aeddc6852585ed0020a6699d2cb53809cefd169148ce42292afab063443978306c582c18b9ce0da3d084ce4d3c482cfd8fcf1a85084e89fb88b40a084d5e972466d07666126fb761f84078f2",
3359
3360 "f6e87d71b0104d6eb06a68dc6a71f498",
3361 "1c245f26195b76ebebc2edcac412a2f8",
3362 "f82bef3c73a6f7f80db285726d691db6bf55eec25a859d3ba0e0445f26b9bb3b16a3161ed1866e4dd8f2e5f8ecb4e46d74a7a78c20cdfc7bcc9e479ba7a0caba9438238ad0c01651d5d98de37f03ddce6e6b4bd4ab03cf9e8ed818aedfa1cf963b932067b97d776dce1087196e7e913f7448e38244509f0caf36bd8217e15336d35c149fd4e41707893fdb84014f8729",
3363 "b09512f3eff9ed0d85890983a73dadbb7c3678d52581be64a8a8fc586f490f2521297a478a0598040ebd0f5509fafb0969f9d9e600eaef33b1b93eed99687b167f89a5065aac439ce46f3b8d22d30865e64e45ef8cd30b6984353a844a11c8cd60dba0e8866b3ee30d24b3fa8a643b328353e06010fa8273c8fd54ef0a2b6930e5520aae5cd5902f9b86a33592ca4365",
3364
3365 "2c14413751c31e2730570ba3361c786b",
3366 "1dbbeb2f19abb448af849796244a19d7",
3367 "40d930f9a05334d9816fe204999c3f82a03f6a0457a8c475c94553d1d116693adc618049f0a769a2eed6a6cb14c0143ec5cccdbc8dec4ce560cfd206225709326d4de7948e54d603d01b12d7fed752fb23f1aa4494fbb00130e9ded4e77e37c079042d828040c325b1a5efd15fc842e44014ca4374bf38f3c3fc3ee327733b0c8aee1abcd055772f18dc04603f7b2c1ea69ff662361f2be0a171bbdcea1e5d3f",
3368 "6be8a12800455a320538853e0cba31bd2d80ea0c85164a4c5c261ae485417d93effe2ebc0d0a0b51d6ea18633d210cf63c0c4ddbc27607f2e81ed9113191ef86d56f3b99be6c415a4150299fb846ce7160b40b63baf1179d19275a2e83698376d28b92548c68e06e6d994e2c1501ed297014e702cdefee2f656447706009614d801de1caaf73f8b7fa56cf1ba94b631933bbe577624380850f117435a0355b2b",
3369
3370 /*
3371 * From NIST validation suite "Multiblock Message Test"
3372 * (cbcmmt192.rsp).
3373 */
3374 "ba75f4d1d9d7cf7f551445d56cc1a8ab2a078e15e049dc2c",
3375 "531ce78176401666aa30db94ec4a30eb",
3376 "c51fc276774dad94bcdc1d2891ec8668",
3377 "70dd95a14ee975e239df36ff4aee1d5d",
3378
3379 "eab3b19c581aa873e1981c83ab8d83bbf8025111fb2e6b21",
3380 "f3d6667e8d4d791e60f7505ba383eb05",
3381 "9d4e4cccd1682321856df069e3f1c6fa391a083a9fb02d59db74c14081b3acc4",
3382 "51d44779f90d40a80048276c035cb49ca2a47bcb9b9cf7270b9144793787d53f",
3383
3384 "16c93bb398f1fc0cf6d68fc7a5673cdf431fa147852b4a2d",
3385 "eaaeca2e07ddedf562f94df63f0a650f",
3386 "c5ce958613bf741718c17444484ebaf1050ddcacb59b9590178cbe69d7ad7919608cb03af13bbe04f3506b718a301ea0",
3387 "ed6a50e0c6921d52d6647f75d67b4fd56ace1fedb8b5a6a997b4d131640547d22c5d884a75e6752b5846b5b33a5181f4",
3388
3389 "067bb17b4df785697eaccf961f98e212cb75e6797ce935cb",
3390 "8b59c9209c529ca8391c9fc0ce033c38",
3391 "db3785a889b4bd387754da222f0e4c2d2bfe0d79e05bc910fba941beea30f1239eacf0068f4619ec01c368e986fca6b7c58e490579d29611bd10087986eff54f",
3392 "d5f5589760bf9c762228fde236de1fa2dd2dad448db3fa9be0c4196efd46a35c84dd1ac77d9db58c95918cb317a6430a08d2fb6a8e8b0f1c9b72c7a344dc349f",
3393
3394 "0fd39de83e0be77a79c8a4a612e3dd9c8aae2ce35e7a2bf8",
3395 "7e1d629b84f93b079be51f9a5f5cb23c",
3396 "38fbda37e28fa86d9d83a4345e419dea95d28c7818ff25925db6ac3aedaf0a86154e20a4dfcc5b1b4192895393e5eb5846c88bdbd41ecf7af3104f410eaee470f5d9017ed460475f626953035a13db1f",
3397 "edadae2f9a45ff3473e02d904c94d94a30a4d92da4deb6bcb4b0774472694571842039f21c496ef93fd658842c735f8a81fcd0aa578442ab893b18f606aed1bab11f81452dd45e9b56adf2eccf4ea095",
3398
3399 "e3fecc75f0075a09b383dfd389a3d33cc9b854b3b254c0f4",
3400 "36eab883afef936cc38f63284619cd19",
3401 "931b2f5f3a5820d53a6beaaa6431083a3488f4eb03b0f5b57ef838e1579623103bd6e6800377538b2e51ef708f3c4956432e8a8ee6a34e190642b26ad8bdae6c2af9a6c7996f3b6004d2671e41f1c9f40ee03d1c4a52b0a0654a331f15f34dce",
3402 "75395974bd32b3665654a6c8e396b88ae34b123575872a7ab687d8e76b46df911a8a590cd01d2f5c330be3a6626e9dd3aa5e10ed14e8ff829811b6fed50f3f533ca4385a1cbca78f5c4744e50f2f8359165c2485d1324e76c3eae76a0ccac629",
3403
3404 "f9c27565eb07947c8cb51b79248430f7b1066c3d2fdc3d13",
3405 "2bd67cc89ab7948d644a49672843cbd9",
3406 "6abcc270173cf114d44847e911a050db57ba7a2e2c161c6f37ccb6aaa4677bddcaf50cad0b5f8758fcf7c0ebc650ceb5cd52cafb8f8dd3edcece55d9f1f08b9fa8f54365cf56e28b9596a7e1dd1d3418e4444a7724add4cf79d527b183ec88de4be4eeff29c80a97e54f85351cb189ee",
3407 "ca282924a61187feb40520979106e5cc861957f23828dcb7285e0eaac8a0ca2a6b60503d63d6039f4693dba32fa1f73ae2e709ca94911f28a5edd1f30eaddd54680c43acc9c74cd90d8bb648b4e544275f47e514daa20697f66c738eb30337f017fca1a26da4d1a0cc0a0e98e2463070",
3408
3409 "fb09cf9e00dbf883689d079c920077c0073c31890b55bab5",
3410 "e3c89bd097c3abddf64f4881db6dbfe2",
3411 "c1a37683fb289467dd1b2c89efba16bbd2ee24cf18d19d44596ded2682c79a2f711c7a32bf6a24badd32a4ee637c73b7a41da6258635650f91fb9ffa45bdfc3cb122136241b3deced8996aa51ea8d3e81c9d70e006a44bc0571ed48623a0d622a93fa9da290baaedf5d9e876c94620945ff8ecc83f27379ed55cf490c5790f27",
3412 "8158e21420f25b59d6ae943fa1cbf21f02e979f419dab0126a721b7eef55bee9ad97f5ccff7d239057bbc19a8c378142f7672f1d5e7e17d7bebcb0070e8355cace6660171a53b61816ae824a6ef69ce470b6ffd3b5bb4b438874d91d27854d3b6f25860d3868958de3307d62b1339bdddb8a318c0ce0f33c17caf0e9f6040820",
3413
3414 "bca6fa3c67fd294e958f66fe8bd64f45f428f5bc8e9733a7",
3415 "92a47f2833f1450d1da41717bdc6e83c",
3416 "5becbc31d8bead6d36ae014a5863d14a431e6b55d29ea6baaa417271716db3a33b2e506b452086dfe690834ac2de30bc41254ec5401ec47d064237c7792fdcd7914d8af20eb114756642d519021a8c75a92f6bc53d326ae9a5b7e1b10a9756574692934d9939fc399e0c203f7edf8e7e6482eadd31a0400770e897b48c6bca2b404593045080e93377358c42a0f4dede",
3417 "926db248cc1ba20f0c57631a7c8aef094f791937b905949e3460240e8bfa6fa483115a1b310b6e4369caebc5262888377b1ddaa5800ea496a2bdff0f9a1031e7129c9a20e35621e7f0b8baca0d87030f2ae7ca8593c8599677a06fd4b26009ead08fecac24caa9cf2cad3b470c8227415a7b1e0f2eab3fad96d70a209c8bb26c627677e2531b9435ca6e3c444d195b5f",
3418
3419 "162ad50ee64a0702aa551f571dedc16b2c1b6a1e4d4b5eee",
3420 "24408038161a2ccae07b029bb66355c1",
3421 "be8abf00901363987a82cc77d0ec91697ba3857f9e4f84bd79406c138d02698f003276d0449120bef4578d78fecabe8e070e11710b3f0a2744bd52434ec70015884c181ebdfd51c604a71c52e4c0e110bc408cd462b248a80b8a8ac06bb952ac1d7faed144807f1a731b7febcaf7835762defe92eccfc7a9944e1c702cffe6bc86733ed321423121085ac02df8962bcbc1937092eebf0e90a8b20e3dd8c244ae",
3422 "c82cf2c476dea8cb6a6e607a40d2f0391be82ea9ec84a537a6820f9afb997b76397d005424faa6a74dc4e8c7aa4a8900690f894b6d1dca80675393d2243adac762f159301e357e98b724762310cd5a7bafe1c2a030dba46fd93a9fdb89cc132ca9c17dc72031ec6822ee5a9d99dbca66c784c01b0885cbb62e29d97801927ec415a5d215158d325f9ee689437ad1b7684ad33c0d92739451ac87f39ff8c31b84",
3423
3424 /*
3425 * From NIST validation suite "Multiblock Message Test"
3426 * (cbcmmt256.rsp).
3427 */
3428 "6ed76d2d97c69fd1339589523931f2a6cff554b15f738f21ec72dd97a7330907",
3429 "851e8764776e6796aab722dbb644ace8",
3430 "6282b8c05c5c1530b97d4816ca434762",
3431 "6acc04142e100a65f51b97adf5172c41",
3432
3433 "dce26c6b4cfb286510da4eecd2cffe6cdf430f33db9b5f77b460679bd49d13ae",
3434 "fdeaa134c8d7379d457175fd1a57d3fc",
3435 "50e9eee1ac528009e8cbcd356975881f957254b13f91d7c6662d10312052eb00",
3436 "2fa0df722a9fd3b64cb18fb2b3db55ff2267422757289413f8f657507412a64c",
3437
3438 "fe8901fecd3ccd2ec5fdc7c7a0b50519c245b42d611a5ef9e90268d59f3edf33",
3439 "bd416cb3b9892228d8f1df575692e4d0",
3440 "8d3aa196ec3d7c9b5bb122e7fe77fb1295a6da75abe5d3a510194d3a8a4157d5c89d40619716619859da3ec9b247ced9",
3441 "608e82c7ab04007adb22e389a44797fed7de090c8c03ca8a2c5acd9e84df37fbc58ce8edb293e98f02b640d6d1d72464",
3442
3443 "0493ff637108af6a5b8e90ac1fdf035a3d4bafd1afb573be7ade9e8682e663e5",
3444 "c0cd2bebccbb6c49920bd5482ac756e8",
3445 "8b37f9148df4bb25956be6310c73c8dc58ea9714ff49b643107b34c9bff096a94fedd6823526abc27a8e0b16616eee254ab4567dd68e8ccd4c38ac563b13639c",
3446 "05d5c77729421b08b737e41119fa4438d1f570cc772a4d6c3df7ffeda0384ef84288ce37fc4c4c7d1125a499b051364c389fd639bdda647daa3bdadab2eb5594",
3447
3448 "9adc8fbd506e032af7fa20cf5343719de6d1288c158c63d6878aaf64ce26ca85",
3449 "11958dc6ab81e1c7f01631e9944e620f",
3450 "c7917f84f747cd8c4b4fedc2219bdbc5f4d07588389d8248854cf2c2f89667a2d7bcf53e73d32684535f42318e24cd45793950b3825e5d5c5c8fcd3e5dda4ce9246d18337ef3052d8b21c5561c8b660e",
3451 "9c99e68236bb2e929db1089c7750f1b356d39ab9d0c40c3e2f05108ae9d0c30b04832ccdbdc08ebfa426b7f5efde986ed05784ce368193bb3699bc691065ac62e258b9aa4cc557e2b45b49ce05511e65",
3452
3453 "73b8faf00b3302ac99855cf6f9e9e48518690a5906a4869d4dcf48d282faae2a",
3454 "b3cb97a80a539912b8c21f450d3b9395",
3455 "3adea6e06e42c4f041021491f2775ef6378cb08824165edc4f6448e232175b60d0345b9f9c78df6596ec9d22b7b9e76e8f3c76b32d5d67273f1d83fe7a6fc3dd3c49139170fa5701b3beac61b490f0a9e13f844640c4500f9ad3087adfb0ae10",
3456 "ac3d6dbafe2e0f740632fd9e820bf6044cd5b1551cbb9cc03c0b25c39ccb7f33b83aacfca40a3265f2bbff879153448acacb88fcfb3bb7b10fe463a68c0109f028382e3e557b1adf02ed648ab6bb895df0205d26ebbfa9a5fd8cebd8e4bee3dc",
3457
3458 "9ddf3745896504ff360a51a3eb49c01b79fccebc71c3abcb94a949408b05b2c9",
3459 "e79026639d4aa230b5ccffb0b29d79bc",
3460 "cf52e5c3954c51b94c9e38acb8c9a7c76aebdaa9943eae0a1ce155a2efdb4d46985d935511471452d9ee64d2461cb2991d59fc0060697f9a671672163230f367fed1422316e52d29eceacb8768f56d9b80f6d278093c9a8acd3cfd7edd8ebd5c293859f64d2f8486ae1bd593c65bc014",
3461 "34df561bd2cfebbcb7af3b4b8d21ca5258312e7e2e4e538e35ad2490b6112f0d7f148f6aa8d522a7f3c61d785bd667db0e1dc4606c318ea4f26af4fe7d11d4dcff0456511b4aed1a0d91ba4a1fd6cd9029187bc5881a5a07fe02049d39368e83139b12825bae2c7be81e6f12c61bb5c5",
3462
3463 "458b67bf212d20f3a57fce392065582dcefbf381aa22949f8338ab9052260e1d",
3464 "4c12effc5963d40459602675153e9649",
3465 "256fd73ce35ae3ea9c25dd2a9454493e96d8633fe633b56176dce8785ce5dbbb84dbf2c8a2eeb1e96b51899605e4f13bbc11b93bf6f39b3469be14858b5b720d4a522d36feed7a329c9b1e852c9280c47db8039c17c4921571a07d1864128330e09c308ddea1694e95c84500f1a61e614197e86a30ecc28df64ccb3ccf5437aa",
3466 "90b7b9630a2378f53f501ab7beff039155008071bc8438e789932cfd3eb1299195465e6633849463fdb44375278e2fdb1310821e6492cf80ff15cb772509fb426f3aeee27bd4938882fd2ae6b5bd9d91fa4a43b17bb439ebbe59c042310163a82a5fe5388796eee35a181a1271f00be29b852d8fa759bad01ff4678f010594cd",
3467
3468 "d2412db0845d84e5732b8bbd642957473b81fb99ca8bff70e7920d16c1dbec89",
3469 "51c619fcf0b23f0c7925f400a6cacb6d",
3470 "026006c4a71a180c9929824d9d095b8faaa86fc4fa25ecac61d85ff6de92dfa8702688c02a282c1b8af4449707f22d75e91991015db22374c95f8f195d5bb0afeb03040ff8965e0e1339dba5653e174f8aa5a1b39fe3ac839ce307a4e44b4f8f1b0063f738ec18acdbff2ebfe07383e734558723e741f0a1836dafdf9de82210a9248bc113b3c1bc8b4e252ca01bd803",
3471 "0254b23463bcabec5a395eb74c8fb0eb137a07bc6f5e9f61ec0b057de305714f8fa294221c91a159c315939b81e300ee902192ec5f15254428d8772f79324ec43298ca21c00b370273ee5e5ed90e43efa1e05a5d171209fe34f9f29237dba2a6726650fd3b1321747d1208863c6c3c6b3e2d879ab5f25782f08ba8f2abbe63e0bedb4a227e81afb36bb6645508356d34",
3472
3473 "48be597e632c16772324c8d3fa1d9c5a9ecd010f14ec5d110d3bfec376c5532b",
3474 "d6d581b8cf04ebd3b6eaa1b53f047ee1",
3475 "0c63d413d3864570e70bb6618bf8a4b9585586688c32bba0a5ecc1362fada74ada32c52acfd1aa7444ba567b4e7daaecf7cc1cb29182af164ae5232b002868695635599807a9a7f07a1f137e97b1e1c9dabc89b6a5e4afa9db5855edaa575056a8f4f8242216242bb0c256310d9d329826ac353d715fa39f80cec144d6424558f9f70b98c920096e0f2c855d594885a00625880e9dfb734163cecef72cf030b8",
3476 "fc5873e50de8faf4c6b84ba707b0854e9db9ab2e9f7d707fbba338c6843a18fc6facebaf663d26296fb329b4d26f18494c79e09e779647f9bafa87489630d79f4301610c2300c19dbf3148b7cac8c4f4944102754f332e92b6f7c5e75bc6179eb877a078d4719009021744c14f13fd2a55a2b9c44d18000685a845a4f632c7c56a77306efa66a24d05d088dcd7c13fe24fc447275965db9e4d37fbc9304448cd",
3477
3478 /*
3479 * End-of-table marker.
3480 */
3481 NULL
3482 };
3483
3484 /*
3485 * AES known-answer tests for CTR. Order: key, IV, plaintext, ciphertext.
3486 */
3487 static const char *const KAT_AES_CTR[] = {
3488 /*
3489 * From RFC 3686.
3490 */
3491 "ae6852f8121067cc4bf7a5765577f39e",
3492 "000000300000000000000000",
3493 "53696e676c6520626c6f636b206d7367",
3494 "e4095d4fb7a7b3792d6175a3261311b8",
3495
3496 "7e24067817fae0d743d6ce1f32539163",
3497 "006cb6dbc0543b59da48d90b",
3498 "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
3499 "5104a106168a72d9790d41ee8edad388eb2e1efc46da57c8fce630df9141be28",
3500
3501 "7691be035e5020a8ac6e618529f9a0dc",
3502 "00e0017b27777f3f4a1786f0",
3503 "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20212223",
3504 "c1cf48a89f2ffdd9cf4652e9efdb72d74540a42bde6d7836d59a5ceaaef3105325b2072f",
3505
3506 "16af5b145fc9f579c175f93e3bfb0eed863d06ccfdb78515",
3507 "0000004836733c147d6d93cb",
3508 "53696e676c6520626c6f636b206d7367",
3509 "4b55384fe259c9c84e7935a003cbe928",
3510
3511 "7c5cb2401b3dc33c19e7340819e0f69c678c3db8e6f6a91a",
3512 "0096b03b020c6eadc2cb500d",
3513 "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
3514 "453243fc609b23327edfaafa7131cd9f8490701c5ad4a79cfc1fe0ff42f4fb00",
3515
3516 "02bf391ee8ecb159b959617b0965279bf59b60a786d3e0fe",
3517 "0007bdfd5cbd60278dcc0912",
3518 "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20212223",
3519 "96893fc55e5c722f540b7dd1ddf7e758d288bc95c69165884536c811662f2188abee0935",
3520
3521 "776beff2851db06f4c8a0542c8696f6c6a81af1eec96b4d37fc1d689e6c1c104",
3522 "00000060db5672c97aa8f0b2",
3523 "53696e676c6520626c6f636b206d7367",
3524 "145ad01dbf824ec7560863dc71e3e0c0",
3525
3526 "f6d66d6bd52d59bb0796365879eff886c66dd51a5b6a99744b50590c87a23884",
3527 "00faac24c1585ef15a43d875",
3528 "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
3529 "f05e231b3894612c49ee000b804eb2a9b8306b508f839d6a5530831d9344af1c",
3530
3531 "ff7a617ce69148e4f1726e2f43581de2aa62d9f805532edff1eed687fb54153d",
3532 "001cc5b751a51d70a1c11148",
3533 "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20212223",
3534 "eb6c52821d0bbbf7ce7594462aca4faab407df866569fd07f48cc0b583d6071f1ec0e6b8",
3535
3536 /*
3537 * End-of-table marker.
3538 */
3539 NULL
3540 };
3541
3542 static void
3543 monte_carlo_AES_encrypt(const br_block_cbcenc_class *ve,
3544 char *skey, char *splain, char *scipher)
3545 {
3546 unsigned char key[32];
3547 unsigned char buf[16];
3548 unsigned char pbuf[16];
3549 unsigned char cipher[16];
3550 size_t key_len;
3551 int i, j, k;
3552 br_aes_gen_cbcenc_keys v_ec;
3553 const br_block_cbcenc_class **ec;
3554
3555 ec = &v_ec.vtable;
3556 key_len = hextobin(key, skey);
3557 hextobin(buf, splain);
3558 hextobin(cipher, scipher);
3559 for (i = 0; i < 100; i ++) {
3560 ve->init(ec, key, key_len);
3561 for (j = 0; j < 1000; j ++) {
3562 unsigned char iv[16];
3563
3564 memcpy(pbuf, buf, sizeof buf);
3565 memset(iv, 0, sizeof iv);
3566 ve->run(ec, iv, buf, sizeof buf);
3567 }
3568 switch (key_len) {
3569 case 16:
3570 for (k = 0; k < 16; k ++) {
3571 key[k] ^= buf[k];
3572 }
3573 break;
3574 case 24:
3575 for (k = 0; k < 8; k ++) {
3576 key[k] ^= pbuf[8 + k];
3577 }
3578 for (k = 0; k < 16; k ++) {
3579 key[8 + k] ^= buf[k];
3580 }
3581 break;
3582 default:
3583 for (k = 0; k < 16; k ++) {
3584 key[k] ^= pbuf[k];
3585 key[16 + k] ^= buf[k];
3586 }
3587 break;
3588 }
3589 printf(".");
3590 fflush(stdout);
3591 }
3592 printf(" ");
3593 fflush(stdout);
3594 check_equals("MC AES encrypt", buf, cipher, sizeof buf);
3595 }
3596
3597 static void
3598 monte_carlo_AES_decrypt(const br_block_cbcdec_class *vd,
3599 char *skey, char *scipher, char *splain)
3600 {
3601 unsigned char key[32];
3602 unsigned char buf[16];
3603 unsigned char pbuf[16];
3604 unsigned char plain[16];
3605 size_t key_len;
3606 int i, j, k;
3607 br_aes_gen_cbcdec_keys v_dc;
3608 const br_block_cbcdec_class **dc;
3609
3610 dc = &v_dc.vtable;
3611 key_len = hextobin(key, skey);
3612 hextobin(buf, scipher);
3613 hextobin(plain, splain);
3614 for (i = 0; i < 100; i ++) {
3615 vd->init(dc, key, key_len);
3616 for (j = 0; j < 1000; j ++) {
3617 unsigned char iv[16];
3618
3619 memcpy(pbuf, buf, sizeof buf);
3620 memset(iv, 0, sizeof iv);
3621 vd->run(dc, iv, buf, sizeof buf);
3622 }
3623 switch (key_len) {
3624 case 16:
3625 for (k = 0; k < 16; k ++) {
3626 key[k] ^= buf[k];
3627 }
3628 break;
3629 case 24:
3630 for (k = 0; k < 8; k ++) {
3631 key[k] ^= pbuf[8 + k];
3632 }
3633 for (k = 0; k < 16; k ++) {
3634 key[8 + k] ^= buf[k];
3635 }
3636 break;
3637 default:
3638 for (k = 0; k < 16; k ++) {
3639 key[k] ^= pbuf[k];
3640 key[16 + k] ^= buf[k];
3641 }
3642 break;
3643 }
3644 printf(".");
3645 fflush(stdout);
3646 }
3647 printf(" ");
3648 fflush(stdout);
3649 check_equals("MC AES decrypt", buf, plain, sizeof buf);
3650 }
3651
3652 static void
3653 test_AES_generic(char *name,
3654 const br_block_cbcenc_class *ve,
3655 const br_block_cbcdec_class *vd,
3656 const br_block_ctr_class *vc,
3657 int with_MC, int with_CBC)
3658 {
3659 size_t u;
3660
3661 printf("Test %s: ", name);
3662 fflush(stdout);
3663
3664 if (ve->block_size != 16 || vd->block_size != 16
3665 || ve->log_block_size != 4 || vd->log_block_size != 4)
3666 {
3667 fprintf(stderr, "%s failed: wrong block size\n", name);
3668 exit(EXIT_FAILURE);
3669 }
3670
3671 for (u = 0; KAT_AES[u]; u += 3) {
3672 unsigned char key[32];
3673 unsigned char plain[16];
3674 unsigned char cipher[16];
3675 unsigned char buf[16];
3676 unsigned char iv[16];
3677 size_t key_len;
3678 br_aes_gen_cbcenc_keys v_ec;
3679 br_aes_gen_cbcdec_keys v_dc;
3680 const br_block_cbcenc_class **ec;
3681 const br_block_cbcdec_class **dc;
3682
3683 ec = &v_ec.vtable;
3684 dc = &v_dc.vtable;
3685 key_len = hextobin(key, KAT_AES[u]);
3686 hextobin(plain, KAT_AES[u + 1]);
3687 hextobin(cipher, KAT_AES[u + 2]);
3688 ve->init(ec, key, key_len);
3689 memcpy(buf, plain, sizeof plain);
3690 memset(iv, 0, sizeof iv);
3691 ve->run(ec, iv, buf, sizeof buf);
3692 check_equals("KAT AES encrypt", buf, cipher, sizeof cipher);
3693 vd->init(dc, key, key_len);
3694 memset(iv, 0, sizeof iv);
3695 vd->run(dc, iv, buf, sizeof buf);
3696 check_equals("KAT AES decrypt", buf, plain, sizeof plain);
3697 }
3698
3699 if (with_CBC) {
3700 for (u = 0; KAT_AES_CBC[u]; u += 4) {
3701 unsigned char key[32];
3702 unsigned char ivref[16];
3703 unsigned char plain[200];
3704 unsigned char cipher[200];
3705 unsigned char buf[200];
3706 unsigned char iv[16];
3707 size_t key_len, data_len, v;
3708 br_aes_gen_cbcenc_keys v_ec;
3709 br_aes_gen_cbcdec_keys v_dc;
3710 const br_block_cbcenc_class **ec;
3711 const br_block_cbcdec_class **dc;
3712
3713 ec = &v_ec.vtable;
3714 dc = &v_dc.vtable;
3715 key_len = hextobin(key, KAT_AES_CBC[u]);
3716 hextobin(ivref, KAT_AES_CBC[u + 1]);
3717 data_len = hextobin(plain, KAT_AES_CBC[u + 2]);
3718 hextobin(cipher, KAT_AES_CBC[u + 3]);
3719 ve->init(ec, key, key_len);
3720
3721 memcpy(buf, plain, data_len);
3722 memcpy(iv, ivref, 16);
3723 ve->run(ec, iv, buf, data_len);
3724 check_equals("KAT CBC AES encrypt",
3725 buf, cipher, data_len);
3726 vd->init(dc, key, key_len);
3727 memcpy(iv, ivref, 16);
3728 vd->run(dc, iv, buf, data_len);
3729 check_equals("KAT CBC AES decrypt",
3730 buf, plain, data_len);
3731
3732 memcpy(buf, plain, data_len);
3733 memcpy(iv, ivref, 16);
3734 for (v = 0; v < data_len; v += 16) {
3735 ve->run(ec, iv, buf + v, 16);
3736 }
3737 check_equals("KAT CBC AES encrypt (2)",
3738 buf, cipher, data_len);
3739 memcpy(iv, ivref, 16);
3740 for (v = 0; v < data_len; v += 16) {
3741 vd->run(dc, iv, buf + v, 16);
3742 }
3743 check_equals("KAT CBC AES decrypt (2)",
3744 buf, plain, data_len);
3745 }
3746
3747 /*
3748 * We want to check proper IV management for CBC:
3749 * encryption and decryption must properly copy the _last_
3750 * encrypted block as new IV, for all sizes.
3751 */
3752 for (u = 1; u <= 35; u ++) {
3753 br_hmac_drbg_context rng;
3754 unsigned char x;
3755 size_t key_len, data_len;
3756 size_t v;
3757
3758 br_hmac_drbg_init(&rng, &br_sha256_vtable,
3759 "seed for AES/CBC", 16);
3760 x = u;
3761 br_hmac_drbg_update(&rng, &x, 1);
3762 data_len = u << 4;
3763 for (key_len = 16; key_len <= 32; key_len += 16) {
3764 unsigned char key[32];
3765 unsigned char iv[16], iv1[16], iv2[16];
3766 unsigned char plain[35 * 16];
3767 unsigned char tmp1[sizeof plain];
3768 unsigned char tmp2[sizeof plain];
3769 br_aes_gen_cbcenc_keys v_ec;
3770 br_aes_gen_cbcdec_keys v_dc;
3771 const br_block_cbcenc_class **ec;
3772 const br_block_cbcdec_class **dc;
3773
3774 br_hmac_drbg_generate(&rng, key, key_len);
3775 br_hmac_drbg_generate(&rng, iv, sizeof iv);
3776 br_hmac_drbg_generate(&rng, plain, data_len);
3777
3778 ec = &v_ec.vtable;
3779 ve->init(ec, key, key_len);
3780 memcpy(iv1, iv, sizeof iv);
3781 memcpy(tmp1, plain, data_len);
3782 ve->run(ec, iv1, tmp1, data_len);
3783 check_equals("IV CBC AES (1)",
3784 tmp1 + data_len - 16, iv1, 16);
3785 memcpy(iv2, iv, sizeof iv);
3786 memcpy(tmp2, plain, data_len);
3787 for (v = 0; v < data_len; v += 16) {
3788 ve->run(ec, iv2, tmp2 + v, 16);
3789 }
3790 check_equals("IV CBC AES (2)",
3791 tmp2 + data_len - 16, iv2, 16);
3792 check_equals("IV CBC AES (3)",
3793 tmp1, tmp2, data_len);
3794
3795 dc = &v_dc.vtable;
3796 vd->init(dc, key, key_len);
3797 memcpy(iv1, iv, sizeof iv);
3798 vd->run(dc, iv1, tmp1, data_len);
3799 check_equals("IV CBC AES (4)", iv1, iv2, 16);
3800 check_equals("IV CBC AES (5)",
3801 tmp1, plain, data_len);
3802 memcpy(iv2, iv, sizeof iv);
3803 for (v = 0; v < data_len; v += 16) {
3804 vd->run(dc, iv2, tmp2 + v, 16);
3805 }
3806 check_equals("IV CBC AES (6)", iv1, iv2, 16);
3807 check_equals("IV CBC AES (7)",
3808 tmp2, plain, data_len);
3809 }
3810 }
3811 }
3812
3813 if (vc != NULL) {
3814 if (vc->block_size != 16 || vc->log_block_size != 4) {
3815 fprintf(stderr, "%s failed: wrong block size\n", name);
3816 exit(EXIT_FAILURE);
3817 }
3818 for (u = 0; KAT_AES_CTR[u]; u += 4) {
3819 unsigned char key[32];
3820 unsigned char iv[12];
3821 unsigned char plain[200];
3822 unsigned char cipher[200];
3823 unsigned char buf[200];
3824 size_t key_len, data_len, v;
3825 uint32_t c;
3826 br_aes_gen_ctr_keys v_xc;
3827 const br_block_ctr_class **xc;
3828
3829 xc = &v_xc.vtable;
3830 key_len = hextobin(key, KAT_AES_CTR[u]);
3831 hextobin(iv, KAT_AES_CTR[u + 1]);
3832 data_len = hextobin(plain, KAT_AES_CTR[u + 2]);
3833 hextobin(cipher, KAT_AES_CTR[u + 3]);
3834 vc->init(xc, key, key_len);
3835 memcpy(buf, plain, data_len);
3836 vc->run(xc, iv, 1, buf, data_len);
3837 check_equals("KAT CTR AES (1)", buf, cipher, data_len);
3838 vc->run(xc, iv, 1, buf, data_len);
3839 check_equals("KAT CTR AES (2)", buf, plain, data_len);
3840
3841 memcpy(buf, plain, data_len);
3842 c = 1;
3843 for (v = 0; v < data_len; v += 32) {
3844 size_t clen;
3845
3846 clen = data_len - v;
3847 if (clen > 32) {
3848 clen = 32;
3849 }
3850 c = vc->run(xc, iv, c, buf + v, clen);
3851 }
3852 check_equals("KAT CTR AES (3)", buf, cipher, data_len);
3853
3854 memcpy(buf, plain, data_len);
3855 c = 1;
3856 for (v = 0; v < data_len; v += 16) {
3857 size_t clen;
3858
3859 clen = data_len - v;
3860 if (clen > 16) {
3861 clen = 16;
3862 }
3863 c = vc->run(xc, iv, c, buf + v, clen);
3864 }
3865 check_equals("KAT CTR AES (4)", buf, cipher, data_len);
3866 }
3867 }
3868
3869 if (with_MC) {
3870 monte_carlo_AES_encrypt(
3871 ve,
3872 "139a35422f1d61de3c91787fe0507afd",
3873 "b9145a768b7dc489a096b546f43b231f",
3874 "fb2649694783b551eacd9d5db6126d47");
3875 monte_carlo_AES_decrypt(
3876 vd,
3877 "0c60e7bf20ada9baa9e1ddf0d1540726",
3878 "b08a29b11a500ea3aca42c36675b9785",
3879 "d1d2bfdc58ffcad2341b095bce55221e");
3880
3881 monte_carlo_AES_encrypt(
3882 ve,
3883 "b9a63e09e1dfc42e93a90d9bad739e5967aef672eedd5da9",
3884 "85a1f7a58167b389cddc8a9ff175ee26",
3885 "5d1196da8f184975e240949a25104554");
3886 monte_carlo_AES_decrypt(
3887 vd,
3888 "4b97585701c03fbebdfa8555024f589f1482c58a00fdd9fd",
3889 "d0bd0e02ded155e4516be83f42d347a4",
3890 "b63ef1b79507a62eba3dafcec54a6328");
3891
3892 monte_carlo_AES_encrypt(
3893 ve,
3894 "f9e8389f5b80712e3886cc1fa2d28a3b8c9cd88a2d4a54c6aa86ce0fef944be0",
3895 "b379777f9050e2a818f2940cbbd9aba4",
3896 "c5d2cb3d5b7ff0e23e308967ee074825");
3897 monte_carlo_AES_decrypt(
3898 vd,
3899 "2b09ba39b834062b9e93f48373b8dd018dedf1e5ba1b8af831ebbacbc92a2643",
3900 "89649bd0115f30bd878567610223a59d",
3901 "e3d3868f578caf34e36445bf14cefc68");
3902 }
3903
3904 printf("done.\n");
3905 fflush(stdout);
3906 }
3907
3908 static void
3909 test_AES_big(void)
3910 {
3911 test_AES_generic("AES_big",
3912 &br_aes_big_cbcenc_vtable,
3913 &br_aes_big_cbcdec_vtable,
3914 &br_aes_big_ctr_vtable,
3915 1, 1);
3916 }
3917
3918 static void
3919 test_AES_small(void)
3920 {
3921 test_AES_generic("AES_small",
3922 &br_aes_small_cbcenc_vtable,
3923 &br_aes_small_cbcdec_vtable,
3924 &br_aes_small_ctr_vtable,
3925 1, 1);
3926 }
3927
3928 static void
3929 test_AES_ct(void)
3930 {
3931 test_AES_generic("AES_ct",
3932 &br_aes_ct_cbcenc_vtable,
3933 &br_aes_ct_cbcdec_vtable,
3934 &br_aes_ct_ctr_vtable,
3935 1, 1);
3936 }
3937
3938 static void
3939 test_AES_ct64(void)
3940 {
3941 test_AES_generic("AES_ct64",
3942 &br_aes_ct64_cbcenc_vtable,
3943 &br_aes_ct64_cbcdec_vtable,
3944 &br_aes_ct64_ctr_vtable,
3945 1, 1);
3946 }
3947
3948 static void
3949 test_AES_x86ni(void)
3950 {
3951 const br_block_cbcenc_class *x_cbcenc;
3952 const br_block_cbcdec_class *x_cbcdec;
3953 const br_block_ctr_class *x_ctr;
3954 int hcbcenc, hcbcdec, hctr;
3955
3956 x_cbcenc = br_aes_x86ni_cbcenc_get_vtable();
3957 x_cbcdec = br_aes_x86ni_cbcdec_get_vtable();
3958 x_ctr = br_aes_x86ni_ctr_get_vtable();
3959 hcbcenc = (x_cbcenc != NULL);
3960 hcbcdec = (x_cbcdec != NULL);
3961 hctr = (x_ctr != NULL);
3962 if (hcbcenc != hctr || hcbcdec != hctr) {
3963 fprintf(stderr, "AES_x86ni availability mismatch (%d/%d/%d)\n",
3964 hcbcenc, hcbcdec, hctr);
3965 exit(EXIT_FAILURE);
3966 }
3967 if (hctr) {
3968 test_AES_generic("AES_x86ni",
3969 x_cbcenc, x_cbcdec, x_ctr, 1, 1);
3970 } else {
3971 printf("Test AES_x86ni: UNAVAILABLE\n");
3972 }
3973 }
3974
3975 static void
3976 test_AES_pwr8(void)
3977 {
3978 const br_block_cbcenc_class *x_cbcenc;
3979 const br_block_cbcdec_class *x_cbcdec;
3980 const br_block_ctr_class *x_ctr;
3981 int hcbcenc, hcbcdec, hctr;
3982
3983 x_cbcenc = br_aes_pwr8_cbcenc_get_vtable();
3984 x_cbcdec = br_aes_pwr8_cbcdec_get_vtable();
3985 x_ctr = br_aes_pwr8_ctr_get_vtable();
3986 hcbcenc = (x_cbcenc != NULL);
3987 hcbcdec = (x_cbcdec != NULL);
3988 hctr = (x_ctr != NULL);
3989 if (hcbcenc != hctr || hcbcdec != hctr) {
3990 fprintf(stderr, "AES_pwr8 availability mismatch (%d/%d/%d)\n",
3991 hcbcenc, hcbcdec, hctr);
3992 exit(EXIT_FAILURE);
3993 }
3994 if (hctr) {
3995 test_AES_generic("AES_pwr8",
3996 x_cbcenc, x_cbcdec, x_ctr, 1, 1);
3997 } else {
3998 printf("Test AES_pwr8: UNAVAILABLE\n");
3999 }
4000 }
4001
4002 /*
4003 * Custom CTR + CBC-MAC AES implementation. Can also do CTR-only, and
4004 * CBC-MAC-only. The 'aes_big' implementation (CTR) is used. This is
4005 * meant for comparisons.
4006 *
4007 * If 'ctr' is NULL then no encryption/decryption is done; otherwise,
4008 * CTR encryption/decryption is performed (full-block counter) and the
4009 * 'ctr' array is updated with the new counter value.
4010 *
4011 * If 'cbcmac' is NULL then no CBC-MAC is done; otherwise, CBC-MAC is
4012 * applied on the encrypted data, with 'cbcmac' as IV and destination
4013 * buffer for the output. If 'ctr' is not NULL and 'encrypt' is non-zero,
4014 * then CBC-MAC is computed over the result of CTR processing; otherwise,
4015 * CBC-MAC is computed over the input data itself.
4016 */
4017 static void
4018 do_aes_ctrcbc(const void *key, size_t key_len, int encrypt,
4019 void *ctr, void *cbcmac, unsigned char *data, size_t len)
4020 {
4021 br_aes_big_ctr_keys bc;
4022 int i;
4023
4024 br_aes_big_ctr_init(&bc, key, key_len);
4025 for (i = 0; i < 2; i ++) {
4026 /*
4027 * CBC-MAC is computed on the encrypted data, so in
4028 * first pass if decrypting, second pass if encrypting.
4029 */
4030 if (cbcmac != NULL
4031 && ((encrypt && i == 1) || (!encrypt && i == 0)))
4032 {
4033 unsigned char zz[16];
4034 size_t u;
4035
4036 memcpy(zz, cbcmac, sizeof zz);
4037 for (u = 0; u < len; u += 16) {
4038 unsigned char tmp[16];
4039 size_t v;
4040
4041 for (v = 0; v < 16; v ++) {
4042 tmp[v] = zz[v] ^ data[u + v];
4043 }
4044 memset(zz, 0, sizeof zz);
4045 br_aes_big_ctr_run(&bc,
4046 tmp, br_dec32be(tmp + 12), zz, 16);
4047 }
4048 memcpy(cbcmac, zz, sizeof zz);
4049 }
4050
4051 /*
4052 * CTR encryption/decryption is done only in the first pass.
4053 * We process data block per block, because the CTR-only
4054 * class uses a 32-bit counter, while the CTR+CBC-MAC
4055 * class uses a 128-bit counter.
4056 */
4057 if (ctr != NULL && i == 0) {
4058 unsigned char zz[16];
4059 size_t u;
4060
4061 memcpy(zz, ctr, sizeof zz);
4062 for (u = 0; u < len; u += 16) {
4063 int i;
4064
4065 br_aes_big_ctr_run(&bc,
4066 zz, br_dec32be(zz + 12), data + u, 16);
4067 for (i = 15; i >= 0; i --) {
4068 zz[i] = (zz[i] + 1) & 0xFF;
4069 if (zz[i] != 0) {
4070 break;
4071 }
4072 }
4073 }
4074 memcpy(ctr, zz, sizeof zz);
4075 }
4076 }
4077 }
4078
4079 static void
4080 test_AES_CTRCBC_inner(const char *name, const br_block_ctrcbc_class *vt)
4081 {
4082 br_hmac_drbg_context rng;
4083 size_t key_len;
4084
4085 printf("Test AES CTR/CBC-MAC %s: ", name);
4086 fflush(stdout);
4087
4088 br_hmac_drbg_init(&rng, &br_sha256_vtable, name, strlen(name));
4089 for (key_len = 16; key_len <= 32; key_len += 8) {
4090 br_aes_gen_ctrcbc_keys bc;
4091 unsigned char key[32];
4092 size_t data_len;
4093
4094 br_hmac_drbg_generate(&rng, key, key_len);
4095 vt->init(&bc.vtable, key, key_len);
4096 for (data_len = 0; data_len <= 512; data_len += 16) {
4097 unsigned char plain[512];
4098 unsigned char data1[sizeof plain];
4099 unsigned char data2[sizeof plain];
4100 unsigned char ctr[16], cbcmac[16];
4101 unsigned char ctr1[16], cbcmac1[16];
4102 unsigned char ctr2[16], cbcmac2[16];
4103 int i;
4104
4105 br_hmac_drbg_generate(&rng, plain, data_len);
4106
4107 for (i = 0; i <= 16; i ++) {
4108 if (i == 0) {
4109 br_hmac_drbg_generate(&rng, ctr, 16);
4110 } else {
4111 memset(ctr, 0, i - 1);
4112 memset(ctr + i - 1, 0xFF, 17 - i);
4113 }
4114 br_hmac_drbg_generate(&rng, cbcmac, 16);
4115
4116 memcpy(data1, plain, data_len);
4117 memcpy(ctr1, ctr, 16);
4118 vt->ctr(&bc.vtable, ctr1, data1, data_len);
4119 memcpy(data2, plain, data_len);
4120 memcpy(ctr2, ctr, 16);
4121 do_aes_ctrcbc(key, key_len, 1,
4122 ctr2, NULL, data2, data_len);
4123 check_equals("CTR-only data",
4124 data1, data2, data_len);
4125 check_equals("CTR-only counter",
4126 ctr1, ctr2, 16);
4127
4128 memcpy(data1, plain, data_len);
4129 memcpy(cbcmac1, cbcmac, 16);
4130 vt->mac(&bc.vtable, cbcmac1, data1, data_len);
4131 memcpy(data2, plain, data_len);
4132 memcpy(cbcmac2, cbcmac, 16);
4133 do_aes_ctrcbc(key, key_len, 1,
4134 NULL, cbcmac2, data2, data_len);
4135 check_equals("CBC-MAC-only",
4136 cbcmac1, cbcmac2, 16);
4137
4138 memcpy(data1, plain, data_len);
4139 memcpy(ctr1, ctr, 16);
4140 memcpy(cbcmac1, cbcmac, 16);
4141 vt->encrypt(&bc.vtable,
4142 ctr1, cbcmac1, data1, data_len);
4143 memcpy(data2, plain, data_len);
4144 memcpy(ctr2, ctr, 16);
4145 memcpy(cbcmac2, cbcmac, 16);
4146 do_aes_ctrcbc(key, key_len, 1,
4147 ctr2, cbcmac2, data2, data_len);
4148 check_equals("encrypt: combined data",
4149 data1, data2, data_len);
4150 check_equals("encrypt: combined counter",
4151 ctr1, ctr2, 16);
4152 check_equals("encrypt: combined CBC-MAC",
4153 cbcmac1, cbcmac2, 16);
4154
4155 memcpy(ctr1, ctr, 16);
4156 memcpy(cbcmac1, cbcmac, 16);
4157 vt->decrypt(&bc.vtable,
4158 ctr1, cbcmac1, data1, data_len);
4159 memcpy(ctr2, ctr, 16);
4160 memcpy(cbcmac2, cbcmac, 16);
4161 do_aes_ctrcbc(key, key_len, 0,
4162 ctr2, cbcmac2, data2, data_len);
4163 check_equals("decrypt: combined data",
4164 data1, data2, data_len);
4165 check_equals("decrypt: combined counter",
4166 ctr1, ctr2, 16);
4167 check_equals("decrypt: combined CBC-MAC",
4168 cbcmac1, cbcmac2, 16);
4169 }
4170
4171 printf(".");
4172 fflush(stdout);
4173 }
4174
4175 printf(" ");
4176 fflush(stdout);
4177 }
4178
4179 printf("done.\n");
4180 fflush(stdout);
4181 }
4182
4183 static void
4184 test_AES_CTRCBC_big(void)
4185 {
4186 test_AES_CTRCBC_inner("big", &br_aes_big_ctrcbc_vtable);
4187 }
4188
4189 static void
4190 test_AES_CTRCBC_small(void)
4191 {
4192 test_AES_CTRCBC_inner("small", &br_aes_small_ctrcbc_vtable);
4193 }
4194
4195 static void
4196 test_AES_CTRCBC_ct(void)
4197 {
4198 test_AES_CTRCBC_inner("ct", &br_aes_ct_ctrcbc_vtable);
4199 }
4200
4201 static void
4202 test_AES_CTRCBC_ct64(void)
4203 {
4204 test_AES_CTRCBC_inner("ct64", &br_aes_ct64_ctrcbc_vtable);
4205 }
4206
4207 static void
4208 test_AES_CTRCBC_x86ni(void)
4209 {
4210 const br_block_ctrcbc_class *vt;
4211
4212 vt = br_aes_x86ni_ctrcbc_get_vtable();
4213 if (vt != NULL) {
4214 test_AES_CTRCBC_inner("x86ni", vt);
4215 } else {
4216 printf("Test AES CTR/CBC-MAC x86ni: UNAVAILABLE\n");
4217 }
4218 }
4219
4220 static void
4221 test_AES_CTRCBC_pwr8(void)
4222 {
4223 const br_block_ctrcbc_class *vt;
4224
4225 vt = br_aes_pwr8_ctrcbc_get_vtable();
4226 if (vt != NULL) {
4227 test_AES_CTRCBC_inner("pwr8", vt);
4228 } else {
4229 printf("Test AES CTR/CBC-MAC pwr8: UNAVAILABLE\n");
4230 }
4231 }
4232
4233 /*
4234 * DES known-answer tests. Order: plaintext, key, ciphertext.
4235 * (mostly from NIST SP 800-20).
4236 */
4237 static const char *const KAT_DES[] = {
4238 "10316E028C8F3B4A", "0000000000000000", "82DCBAFBDEAB6602",
4239 "8000000000000000", "0000000000000000", "95A8D72813DAA94D",
4240 "4000000000000000", "0000000000000000", "0EEC1487DD8C26D5",
4241 "2000000000000000", "0000000000000000", "7AD16FFB79C45926",
4242 "1000000000000000", "0000000000000000", "D3746294CA6A6CF3",
4243 "0800000000000000", "0000000000000000", "809F5F873C1FD761",
4244 "0400000000000000", "0000000000000000", "C02FAFFEC989D1FC",
4245 "0200000000000000", "0000000000000000", "4615AA1D33E72F10",
4246 "0100000000000000", "0000000000000000", "8CA64DE9C1B123A7",
4247 "0080000000000000", "0000000000000000", "2055123350C00858",
4248 "0040000000000000", "0000000000000000", "DF3B99D6577397C8",
4249 "0020000000000000", "0000000000000000", "31FE17369B5288C9",
4250 "0010000000000000", "0000000000000000", "DFDD3CC64DAE1642",
4251 "0008000000000000", "0000000000000000", "178C83CE2B399D94",
4252 "0004000000000000", "0000000000000000", "50F636324A9B7F80",
4253 "0002000000000000", "0000000000000000", "A8468EE3BC18F06D",
4254 "0001000000000000", "0000000000000000", "8CA64DE9C1B123A7",
4255 "0000800000000000", "0000000000000000", "A2DC9E92FD3CDE92",
4256 "0000400000000000", "0000000000000000", "CAC09F797D031287",
4257 "0000200000000000", "0000000000000000", "90BA680B22AEB525",
4258 "0000100000000000", "0000000000000000", "CE7A24F350E280B6",
4259 "0000080000000000", "0000000000000000", "882BFF0AA01A0B87",
4260 "0000040000000000", "0000000000000000", "25610288924511C2",
4261 "0000020000000000", "0000000000000000", "C71516C29C75D170",
4262 "0000010000000000", "0000000000000000", "8CA64DE9C1B123A7",