1 /* basic.c - basic regression tests
2 * Copyright (C) 2001, 2002, 2003, 2005, 2008,
3 * 2009 Free Software Foundation, Inc.
4 * Copyright (C) 2013 g10 Code GmbH
5 *
6 * This file is part of Libgcrypt.
7 *
8 * Libgcrypt is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU Lesser General Public License as
10 * published by the Free Software Foundation; either version 2.1 of
11 * the License, or (at your option) any later version.
12 *
13 * Libgcrypt is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this program; if not, see <http://www.gnu.org/licenses/>.
20 */
21
22 #ifdef HAVE_CONFIG_H
23 #include <config.h>
24 #endif
25 #include <stdio.h>
26 #include <stdlib.h>
27 #include <string.h>
28 #include <stdarg.h>
29 #include <assert.h>
30
31 #include "../src/gcrypt-int.h"
32
33 #define PGM "basic"
34 #include "t-common.h"
35
36 #if __GNUC__ >= 4
37 # define ALWAYS_INLINE __attribute__((always_inline))
38 #else
39 # define ALWAYS_INLINE
40 #endif
41
42 typedef struct test_spec_pubkey_key
43 {
44 const char *secret;
45 const char *public;
46 const char *grip;
47 }
48 test_spec_pubkey_key_t;
49
50 typedef struct test_spec_pubkey
51 {
52 int id;
53 int flags;
54 test_spec_pubkey_key_t key;
55 }
56 test_spec_pubkey_t;
57
58 #define FLAG_CRYPT (1 << 0)
59 #define FLAG_SIGN (1 << 1)
60 #define FLAG_GRIP (1 << 2)
61
62 static int in_fips_mode;
63
64 #define MAX_DATA_LEN 1040
65
66
67 static void
mismatch(const void * expected,size_t expectedlen,const void * computed,size_t computedlen)68 mismatch (const void *expected, size_t expectedlen,
69 const void *computed, size_t computedlen)
70 {
71 const unsigned char *p;
72
73 fprintf (stderr, "expected:");
74 for (p = expected; expectedlen; p++, expectedlen--)
75 fprintf (stderr, " %02x", *p);
76 fprintf (stderr, "\ncomputed:");
77 for (p = computed; computedlen; p++, computedlen--)
78 fprintf (stderr, " %02x", *p);
79 fprintf (stderr, "\n");
80 }
81
82
83 /* Convert STRING consisting of hex characters into its binary
84 representation and return it as an allocated buffer. The valid
85 length of the buffer is returned at R_LENGTH. The string is
86 delimited by end of string. The function terminates on error. */
87 static void *
hex2buffer(const char * string,size_t * r_length)88 hex2buffer (const char *string, size_t *r_length)
89 {
90 const char *s;
91 unsigned char *buffer;
92 size_t length;
93
94 buffer = xmalloc (strlen(string)/2+1);
95 length = 0;
96 for (s=string; *s; s +=2 )
97 {
98 if (!hexdigitp (s) || !hexdigitp (s+1))
99 die ("invalid hex digits in \"%s\"\n", string);
100 ((unsigned char*)buffer)[length++] = xtoi_2 (s);
101 }
102 *r_length = length;
103 return buffer;
104 }
105
106
107 static void
show_sexp(const char * prefix,gcry_sexp_t a)108 show_sexp (const char *prefix, gcry_sexp_t a)
109 {
110 char *buf;
111 size_t size;
112
113 if (prefix)
114 fputs (prefix, stderr);
115 size = gcry_sexp_sprint (a, GCRYSEXP_FMT_ADVANCED, NULL, 0);
116 buf = gcry_xmalloc (size);
117
118 gcry_sexp_sprint (a, GCRYSEXP_FMT_ADVANCED, buf, size);
119 fprintf (stderr, "%.*s", (int)size, buf);
120 gcry_free (buf);
121 }
122
123
124 static void
show_note(const char * format,...)125 show_note (const char *format, ...)
126 {
127 va_list arg_ptr;
128
129 if (!verbose && getenv ("srcdir"))
130 fputs (" ", stderr); /* To align above "PASS: ". */
131 else
132 fprintf (stderr, "%s: ", PGM);
133 va_start (arg_ptr, format);
134 vfprintf (stderr, format, arg_ptr);
135 if (*format && format[strlen(format)-1] != '\n')
136 putc ('\n', stderr);
137 va_end (arg_ptr);
138 }
139
140
141 static void
show_md_not_available(int algo)142 show_md_not_available (int algo)
143 {
144 static int list[100];
145 static int listlen;
146 int i;
147
148 if (!verbose && algo == GCRY_MD_MD2)
149 return; /* Do not print the diagnostic for that one. */
150
151 for (i=0; i < listlen; i++)
152 if (algo == list[i])
153 return; /* Note already printed. */
154 if (listlen < DIM (list))
155 list[listlen++] = algo;
156 show_note ("hash algorithm %d not available - skipping tests", algo);
157 }
158
159
160 static void
show_old_hmac_not_available(int algo)161 show_old_hmac_not_available (int algo)
162 {
163 static int list[100];
164 static int listlen;
165 int i;
166
167 if (!verbose && algo == GCRY_MD_MD2)
168 return; /* Do not print the diagnostic for that one. */
169
170 for (i=0; i < listlen; i++)
171 if (algo == list[i])
172 return; /* Note already printed. */
173 if (listlen < DIM (list))
174 list[listlen++] = algo;
175 show_note ("hash algorithm %d for old HMAC API not available "
176 "- skipping tests", algo);
177 }
178
179
180 static void
show_mac_not_available(int algo)181 show_mac_not_available (int algo)
182 {
183 static int list[100];
184 static int listlen;
185 int i;
186
187 if (!verbose && algo == GCRY_MD_MD2)
188 return; /* Do not print the diagnostic for that one. */
189
190 for (i=0; i < listlen; i++)
191 if (algo == list[i])
192 return; /* Note already printed. */
193 if (listlen < DIM (list))
194 list[listlen++] = algo;
195 show_note ("MAC algorithm %d not available - skipping tests", algo);
196 }
197
198
199
200 static void
progress_handler(void * cb_data,const char * what,int printchar,int current,int total)201 progress_handler (void *cb_data, const char *what, int printchar,
202 int current, int total)
203 {
204 (void)cb_data;
205 (void)what;
206 (void)current;
207 (void)total;
208
209 if (printchar == '\n')
210 fputs ( "<LF>", stdout);
211 else
212 putchar (printchar);
213 fflush (stdout);
214 }
215
216
217 #if defined(__x86_64__) && defined(HAVE_GCC_INLINE_ASM_SSSE3) && \
218 (defined(HAVE_COMPATIBLE_GCC_AMD64_PLATFORM_AS) || \
219 defined(HAVE_COMPATIBLE_GCC_WIN64_PLATFORM_AS))
220 # define CLUTTER_VECTOR_REGISTER_AMD64 1
221 # define CLUTTER_VECTOR_REGISTER_COUNT 16
222 #elif defined(__i386__) && SIZEOF_UNSIGNED_LONG == 4 && __GNUC__ >= 4 && \
223 defined(HAVE_GCC_INLINE_ASM_SSSE3)
224 # define CLUTTER_VECTOR_REGISTER_I386 1
225 # define CLUTTER_VECTOR_REGISTER_COUNT 8
226 #elif defined(HAVE_COMPATIBLE_GCC_AARCH64_PLATFORM_AS) && \
227 defined(HAVE_GCC_INLINE_ASM_AARCH64_NEON) && \
228 defined(__ARM_NEON)
229 # define CLUTTER_VECTOR_REGISTER_AARCH64 1
230 # define CLUTTER_VECTOR_REGISTER_COUNT 32
231 #elif defined(HAVE_COMPATIBLE_GCC_ARM_PLATFORM_AS) && \
232 defined(HAVE_GCC_INLINE_ASM_NEON) && \
233 defined(__ARM_NEON)
234 # define CLUTTER_VECTOR_REGISTER_NEON 1
235 # define CLUTTER_VECTOR_REGISTER_COUNT 16
236 #endif
237
238
239 #ifdef CLUTTER_VECTOR_REGISTER_COUNT
240 static void
prepare_vector_data(unsigned char data[CLUTTER_VECTOR_REGISTER_COUNT][16])241 prepare_vector_data(unsigned char data[CLUTTER_VECTOR_REGISTER_COUNT][16])
242 {
243 static unsigned char basedata[16] =
244 {
245 0xd7, 0xfe, 0x5c, 0x4b, 0x58, 0xfe, 0xf4, 0xb6,
246 0xed, 0x2f, 0x31, 0xc9, 0x1d, 0xd3, 0x62, 0x8d
247 };
248 int j, i;
249
250 for (i = 0; i < CLUTTER_VECTOR_REGISTER_COUNT; i++)
251 {
252 for (j = 0; j < 16; j++)
253 {
254 data[i][j] = basedata[(i + j) % 16];
255 }
256
257 for (j = 0; j < 16; j++)
258 {
259 basedata[j] -= j;
260 }
261 }
262 }
263 #endif
264
265
266 static inline ALWAYS_INLINE void
clutter_vector_registers(void)267 clutter_vector_registers(void)
268 {
269 #ifdef CLUTTER_VECTOR_REGISTER_COUNT
270 unsigned char data[CLUTTER_VECTOR_REGISTER_COUNT][16];
271 #if defined(CLUTTER_VECTOR_REGISTER_AARCH64) || \
272 defined(CLUTTER_VECTOR_REGISTER_NEON)
273 static int init;
274 static int have_neon;
275
276 if (!init)
277 {
278 char *string;
279
280 string = gcry_get_config (0, "hwflist");
281 if (string)
282 {
283 have_neon = (strstr(string, "arm-neon:") != NULL);
284 xfree(string);
285 }
286 init = 1;
287 }
288
289 if (!have_neon)
290 return;
291 #elif defined(CLUTTER_VECTOR_REGISTER_I386)
292 static int init;
293 static int have_ssse3;
294
295 if (!init)
296 {
297 char *string;
298
299 string = gcry_get_config (0, "hwflist");
300 if (string)
301 {
302 have_ssse3 = (strstr(string, "intel-ssse3:") != NULL);
303 xfree(string);
304 }
305 init = 1;
306 }
307
308 if (!have_ssse3)
309 return;
310 #endif
311
312 prepare_vector_data(data);
313
314 #if defined(CLUTTER_VECTOR_REGISTER_AMD64)
315 asm volatile("movdqu %[data0], %%xmm0\n"
316 "movdqu %[data1], %%xmm1\n"
317 "movdqu %[data2], %%xmm2\n"
318 "movdqu %[data3], %%xmm3\n"
319 "movdqu %[data4], %%xmm4\n"
320 "movdqu %[data5], %%xmm5\n"
321 "movdqu %[data6], %%xmm6\n"
322 "movdqu %[data7], %%xmm7\n"
323 "movdqu %[data8], %%xmm8\n"
324 "movdqu %[data9], %%xmm9\n"
325 "movdqu %[data10], %%xmm10\n"
326 "movdqu %[data11], %%xmm11\n"
327 "movdqu %[data12], %%xmm12\n"
328 "movdqu %[data13], %%xmm13\n"
329 "movdqu %[data14], %%xmm14\n"
330 "movdqu %[data15], %%xmm15\n"
331 :
332 : [data0] "m" (*data[0]),
333 [data1] "m" (*data[1]),
334 [data2] "m" (*data[2]),
335 [data3] "m" (*data[3]),
336 [data4] "m" (*data[4]),
337 [data5] "m" (*data[5]),
338 [data6] "m" (*data[6]),
339 [data7] "m" (*data[7]),
340 [data8] "m" (*data[8]),
341 [data9] "m" (*data[9]),
342 [data10] "m" (*data[10]),
343 [data11] "m" (*data[11]),
344 [data12] "m" (*data[12]),
345 [data13] "m" (*data[13]),
346 [data14] "m" (*data[14]),
347 [data15] "m" (*data[15])
348 : "memory"
349 #ifdef __SSE2__
350 ,"xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7",
351 "xmm8", "xmm9", "xmm10", "xmm11", "xmm12", "xmm13", "xmm14",
352 "xmm15"
353 #endif
354 );
355 #elif defined(CLUTTER_VECTOR_REGISTER_I386)
356 asm volatile("movdqu %[data0], %%xmm0\n"
357 "movdqu %[data1], %%xmm1\n"
358 "movdqu %[data2], %%xmm2\n"
359 "movdqu %[data3], %%xmm3\n"
360 "movdqu %[data4], %%xmm4\n"
361 "movdqu %[data5], %%xmm5\n"
362 "movdqu %[data6], %%xmm6\n"
363 "movdqu %[data7], %%xmm7\n"
364 :
365 : [data0] "m" (*data[0]),
366 [data1] "m" (*data[1]),
367 [data2] "m" (*data[2]),
368 [data3] "m" (*data[3]),
369 [data4] "m" (*data[4]),
370 [data5] "m" (*data[5]),
371 [data6] "m" (*data[6]),
372 [data7] "m" (*data[7])
373 : "memory"
374 #ifdef __SSE2__
375 ,"xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7"
376 #endif
377 );
378 #elif defined(CLUTTER_VECTOR_REGISTER_AARCH64)
379 asm volatile("mov x0, %[ptr]\n"
380 "ld1 {v0.16b}, [x0], #16\n"
381 "ld1 {v1.16b}, [x0], #16\n"
382 "ld1 {v2.16b}, [x0], #16\n"
383 "ld1 {v3.16b}, [x0], #16\n"
384 "ld1 {v4.16b}, [x0], #16\n"
385 "ld1 {v5.16b}, [x0], #16\n"
386 "ld1 {v6.16b}, [x0], #16\n"
387 "ld1 {v7.16b}, [x0], #16\n"
388 "ld1 {v8.16b}, [x0], #16\n"
389 "ld1 {v9.16b}, [x0], #16\n"
390 "ld1 {v10.16b}, [x0], #16\n"
391 "ld1 {v11.16b}, [x0], #16\n"
392 "ld1 {v12.16b}, [x0], #16\n"
393 "ld1 {v13.16b}, [x0], #16\n"
394 "ld1 {v14.16b}, [x0], #16\n"
395 "ld1 {v15.16b}, [x0], #16\n"
396 "ld1 {v16.16b}, [x0], #16\n"
397 "ld1 {v17.16b}, [x0], #16\n"
398 "ld1 {v18.16b}, [x0], #16\n"
399 "ld1 {v19.16b}, [x0], #16\n"
400 "ld1 {v20.16b}, [x0], #16\n"
401 "ld1 {v21.16b}, [x0], #16\n"
402 "ld1 {v22.16b}, [x0], #16\n"
403 "ld1 {v23.16b}, [x0], #16\n"
404 "ld1 {v24.16b}, [x0], #16\n"
405 "ld1 {v25.16b}, [x0], #16\n"
406 "ld1 {v26.16b}, [x0], #16\n"
407 "ld1 {v27.16b}, [x0], #16\n"
408 "ld1 {v28.16b}, [x0], #16\n"
409 "ld1 {v29.16b}, [x0], #16\n"
410 "ld1 {v30.16b}, [x0], #16\n"
411 "ld1 {v31.16b}, [x0], #16\n"
412 :
413 : [ptr] "r" (data)
414 : "x0", "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7",
415 "v8", "v9", "v10", "v11", "v12", "v13", "v14", "v15",
416 "v16", "v17", "v18", "v19", "v20", "v21", "v22", "v23",
417 "v24", "v25", "v26", "v27", "v28", "v29", "v30", "v31",
418 "memory");
419 #elif defined(CLUTTER_VECTOR_REGISTER_NEON)
420 asm volatile("mov r0, %[ptr]\n"
421 "vld1.64 {q0}, [r0]!\n"
422 "vld1.64 {q1}, [r0]!\n"
423 "vld1.64 {q2}, [r0]!\n"
424 "vld1.64 {q3}, [r0]!\n"
425 "vld1.64 {q4}, [r0]!\n"
426 "vld1.64 {q5}, [r0]!\n"
427 "vld1.64 {q6}, [r0]!\n"
428 "vld1.64 {q7}, [r0]!\n"
429 "vld1.64 {q8}, [r0]!\n"
430 "vld1.64 {q9}, [r0]!\n"
431 "vld1.64 {q10}, [r0]!\n"
432 "vld1.64 {q11}, [r0]!\n"
433 "vld1.64 {q12}, [r0]!\n"
434 "vld1.64 {q13}, [r0]!\n"
435 "vld1.64 {q14}, [r0]!\n"
436 "vld1.64 {q15}, [r0]!\n"
437 :
438 : [ptr] "r" (data)
439 : "r0", "q0", "q1", "q2", "q3", "q4", "q5", "q6", "q7",
440 "q8", "q9", "q10", "q11", "q12", "q13", "q14", "q15",
441 "memory");
442 #endif
443
444 #endif /* CLUTTER_VECTOR_REGISTER_COUNT */
445 }
446
447
448
449 static void
check_cbc_mac_cipher(void)450 check_cbc_mac_cipher (void)
451 {
452 static const struct tv
453 {
454 int algo;
455 char key[MAX_DATA_LEN];
456 unsigned char plaintext[MAX_DATA_LEN];
457 size_t plaintextlen;
458 char mac[MAX_DATA_LEN];
459 }
460 tv[] =
461 {
462 { GCRY_CIPHER_AES,
463 "chicken teriyaki",
464 "This is a sample plaintext for CBC MAC of sixtyfour bytes.......",
465 0, "\x23\x8f\x6d\xc7\x53\x6a\x62\x97\x11\xc4\xa5\x16\x43\xea\xb0\xb6" },
466 { GCRY_CIPHER_3DES,
467 "abcdefghABCDEFGH01234567",
468 "This is a sample plaintext for CBC MAC of sixtyfour bytes.......",
469 0, "\x5c\x11\xf0\x01\x47\xbd\x3d\x3a" },
470 { GCRY_CIPHER_DES,
471 "abcdefgh",
472 "This is a sample plaintext for CBC MAC of sixtyfour bytes.......",
473 0, "\xfa\x4b\xdf\x9d\xfa\xab\x01\x70" }
474 };
475 gcry_cipher_hd_t hd;
476 unsigned char out[MAX_DATA_LEN];
477 int i, blklen, keylen;
478 gcry_error_t err = 0;
479
480 if (verbose)
481 fprintf (stderr, " Starting CBC MAC checks.\n");
482
483 for (i = 0; i < sizeof (tv) / sizeof (tv[0]); i++)
484 {
485 if (gcry_cipher_test_algo (tv[i].algo) && in_fips_mode)
486 {
487 if (verbose)
488 fprintf (stderr, " algorithm %d not available in fips mode\n",
489 tv[i].algo);
490 continue;
491 }
492
493 err = gcry_cipher_open (&hd,
494 tv[i].algo,
495 GCRY_CIPHER_MODE_CBC, GCRY_CIPHER_CBC_MAC);
496 if (!hd)
497 {
498 fail ("cbc-mac algo %d, gcry_cipher_open failed: %s\n",
499 tv[i].algo, gpg_strerror (err));
500 return;
501 }
502
503 blklen = gcry_cipher_get_algo_blklen(tv[i].algo);
504 if (!blklen)
505 {
506 fail ("cbc-mac algo %d, gcry_cipher_get_algo_blklen failed\n",
507 tv[i].algo);
508 gcry_cipher_close (hd);
509 return;
510 }
511
512 keylen = gcry_cipher_get_algo_keylen (tv[i].algo);
513 if (!keylen)
514 {
515 fail ("cbc-mac algo %d, gcry_cipher_get_algo_keylen failed\n",
516 tv[i].algo);
517 return;
518 }
519
520 err = gcry_cipher_setkey (hd, tv[i].key, keylen);
521 if (err)
522 {
523 fail ("cbc-mac algo %d, gcry_cipher_setkey failed: %s\n",
524 tv[i].algo, gpg_strerror (err));
525 gcry_cipher_close (hd);
526 return;
527 }
528
529 err = gcry_cipher_setiv (hd, NULL, 0);
530 if (err)
531 {
532 fail ("cbc-mac algo %d, gcry_cipher_setiv failed: %s\n",
533 tv[i].algo, gpg_strerror (err));
534 gcry_cipher_close (hd);
535 return;
536 }
537
538 if (verbose)
539 fprintf (stderr, " checking CBC MAC for %s [%i]\n",
540 gcry_cipher_algo_name (tv[i].algo),
541 tv[i].algo);
542 err = gcry_cipher_encrypt (hd,
543 out, blklen,
544 tv[i].plaintext,
545 tv[i].plaintextlen ?
546 tv[i].plaintextlen :
547 strlen ((char*)tv[i].plaintext));
548 if (err)
549 {
550 fail ("cbc-mac algo %d, gcry_cipher_encrypt failed: %s\n",
551 tv[i].algo, gpg_strerror (err));
552 gcry_cipher_close (hd);
553 return;
554 }
555
556 #if 0
557 {
558 int j;
559 for (j = 0; j < gcry_cipher_get_algo_blklen (tv[i].algo); j++)
560 printf ("\\x%02x", out[j] & 0xFF);
561 printf ("\n");
562 }
563 #endif
564
565 if (memcmp (tv[i].mac, out, blklen))
566 fail ("cbc-mac algo %d, encrypt mismatch entry %d\n", tv[i].algo, i);
567
568 gcry_cipher_close (hd);
569 }
570 if (verbose)
571 fprintf (stderr, " Completed CBC MAC checks.\n");
572 }
573
574 static void
check_aes128_cbc_cts_cipher(void)575 check_aes128_cbc_cts_cipher (void)
576 {
577 static const char key[128 / 8] = "chicken teriyaki";
578 static const unsigned char plaintext[] =
579 "I would like the General Gau's Chicken, please, and wonton soup.";
580 static const struct tv
581 {
582 unsigned char out[MAX_DATA_LEN];
583 int inlen;
584 } tv[] =
585 {
586 { "\xc6\x35\x35\x68\xf2\xbf\x8c\xb4\xd8\xa5\x80\x36\x2d\xa7\xff\x7f"
587 "\x97",
588 17 },
589 { "\xfc\x00\x78\x3e\x0e\xfd\xb2\xc1\xd4\x45\xd4\xc8\xef\xf7\xed\x22"
590 "\x97\x68\x72\x68\xd6\xec\xcc\xc0\xc0\x7b\x25\xe2\x5e\xcf\xe5",
591 31 },
592 { "\x39\x31\x25\x23\xa7\x86\x62\xd5\xbe\x7f\xcb\xcc\x98\xeb\xf5\xa8"
593 "\x97\x68\x72\x68\xd6\xec\xcc\xc0\xc0\x7b\x25\xe2\x5e\xcf\xe5\x84",
594 32 },
595 { "\x97\x68\x72\x68\xd6\xec\xcc\xc0\xc0\x7b\x25\xe2\x5e\xcf\xe5\x84"
596 "\xb3\xff\xfd\x94\x0c\x16\xa1\x8c\x1b\x55\x49\xd2\xf8\x38\x02\x9e"
597 "\x39\x31\x25\x23\xa7\x86\x62\xd5\xbe\x7f\xcb\xcc\x98\xeb\xf5",
598 47 },
599 { "\x97\x68\x72\x68\xd6\xec\xcc\xc0\xc0\x7b\x25\xe2\x5e\xcf\xe5\x84"
600 "\x9d\xad\x8b\xbb\x96\xc4\xcd\xc0\x3b\xc1\x03\xe1\xa1\x94\xbb\xd8"
601 "\x39\x31\x25\x23\xa7\x86\x62\xd5\xbe\x7f\xcb\xcc\x98\xeb\xf5\xa8",
602 48 },
603 { "\x97\x68\x72\x68\xd6\xec\xcc\xc0\xc0\x7b\x25\xe2\x5e\xcf\xe5\x84"
604 "\x39\x31\x25\x23\xa7\x86\x62\xd5\xbe\x7f\xcb\xcc\x98\xeb\xf5\xa8"
605 "\x48\x07\xef\xe8\x36\xee\x89\xa5\x26\x73\x0d\xbc\x2f\x7b\xc8\x40"
606 "\x9d\xad\x8b\xbb\x96\xc4\xcd\xc0\x3b\xc1\x03\xe1\xa1\x94\xbb\xd8",
607 64 },
608 };
609 gcry_cipher_hd_t hd;
610 unsigned char out[MAX_DATA_LEN];
611 int i;
612 gcry_error_t err = 0;
613
614 if (verbose)
615 fprintf (stderr, " Starting AES128 CBC CTS checks.\n");
616 err = gcry_cipher_open (&hd,
617 GCRY_CIPHER_AES,
618 GCRY_CIPHER_MODE_CBC, GCRY_CIPHER_CBC_CTS);
619 if (err)
620 {
621 fail ("aes-cbc-cts, gcry_cipher_open failed: %s\n", gpg_strerror (err));
622 return;
623 }
624
625 err = gcry_cipher_setkey (hd, key, 128 / 8);
626 if (err)
627 {
628 fail ("aes-cbc-cts, gcry_cipher_setkey failed: %s\n",
629 gpg_strerror (err));
630 gcry_cipher_close (hd);
631 return;
632 }
633
634 for (i = 0; i < sizeof (tv) / sizeof (tv[0]); i++)
635 {
636 err = gcry_cipher_setiv (hd, NULL, 0);
637 if (err)
638 {
639 fail ("aes-cbc-cts, gcry_cipher_setiv failed: %s\n",
640 gpg_strerror (err));
641 gcry_cipher_close (hd);
642 return;
643 }
644
645 if (verbose)
646 fprintf (stderr, " checking encryption for length %i\n", tv[i].inlen);
647 err = gcry_cipher_encrypt (hd, out, MAX_DATA_LEN,
648 plaintext, tv[i].inlen);
649 if (err)
650 {
651 fail ("aes-cbc-cts, gcry_cipher_encrypt failed: %s\n",
652 gpg_strerror (err));
653 gcry_cipher_close (hd);
654 return;
655 }
656
657 if (memcmp (tv[i].out, out, tv[i].inlen))
658 fail ("aes-cbc-cts, encrypt mismatch entry %d\n", i);
659
660 err = gcry_cipher_setiv (hd, NULL, 0);
661 if (err)
662 {
663 fail ("aes-cbc-cts, gcry_cipher_setiv failed: %s\n",
664 gpg_strerror (err));
665 gcry_cipher_close (hd);
666 return;
667 }
668 if (verbose)
669 fprintf (stderr, " checking decryption for length %i\n", tv[i].inlen);
670 err = gcry_cipher_decrypt (hd, out, tv[i].inlen, NULL, 0);
671 if (err)
672 {
673 fail ("aes-cbc-cts, gcry_cipher_decrypt failed: %s\n",
674 gpg_strerror (err));
675 gcry_cipher_close (hd);
676 return;
677 }
678
679 if (memcmp (plaintext, out, tv[i].inlen))
680 fail ("aes-cbc-cts, decrypt mismatch entry %d\n", i);
681 }
682
683 gcry_cipher_close (hd);
684 if (verbose)
685 fprintf (stderr, " Completed AES128 CBC CTS checks.\n");
686 }
687
688 static void
check_ecb_cipher(void)689 check_ecb_cipher (void)
690 {
691 /* ECB cipher check. Mainly for testing underlying block cipher. */
692 static const struct tv
693 {
694 int algo;
695 const char *key;
696 int is_weak_key;
697 struct
698 {
699 const char *plaintext;
700 int keylen;
701 int inlen;
702 const char *out;
703 } data[MAX_DATA_LEN];
704 } tv[] =
705 {
706 /* Test vectors from OpenSSL for key lengths of 8 to 200 bits */
707 { GCRY_CIPHER_BLOWFISH,
708 "\xf0\xe1\xd2\xc3\xb4\xa5\x96\x87\x78\x69\x5a\x4b\x3c\x2d\x1e\x0f"
709 "\x00\x11\x22\x33\x44\x55\x66\x77\x88",
710 0,
711 { { "\xfe\xdc\xba\x98\x76\x54\x32\x10",
712 1,
713 8,
714 "\xf9\xad\x59\x7c\x49\xdb\x00\x5e" },
715 { "\xfe\xdc\xba\x98\x76\x54\x32\x10",
716 2,
717 8,
718 "\xe9\x1d\x21\xc1\xd9\x61\xa6\xd6" },
719 { "\xfe\xdc\xba\x98\x76\x54\x32\x10",
720 3,
721 8,
722 "\xe9\xc2\xb7\x0a\x1b\xc6\x5c\xf3" },
723 { "\xfe\xdc\xba\x98\x76\x54\x32\x10",
724 4,
725 8,
726 "\xbe\x1e\x63\x94\x08\x64\x0f\x05" },
727 { "\xfe\xdc\xba\x98\x76\x54\x32\x10",
728 5,
729 8,
730 "\xb3\x9e\x44\x48\x1b\xdb\x1e\x6e" },
731 { "\xfe\xdc\xba\x98\x76\x54\x32\x10",
732 6,
733 8,
734 "\x94\x57\xaa\x83\xb1\x92\x8c\x0d" },
735 { "\xfe\xdc\xba\x98\x76\x54\x32\x10",
736 7,
737 8,
738 "\x8b\xb7\x70\x32\xf9\x60\x62\x9d" },
739 { "\xfe\xdc\xba\x98\x76\x54\x32\x10",
740 8,
741 8,
742 "\xe8\x7a\x24\x4e\x2c\xc8\x5e\x82" },
743 { "\xfe\xdc\xba\x98\x76\x54\x32\x10",
744 9,
745 8,
746 "\x15\x75\x0e\x7a\x4f\x4e\xc5\x77" },
747 { "\xfe\xdc\xba\x98\x76\x54\x32\x10",
748 10,
749 8,
750 "\x12\x2b\xa7\x0b\x3a\xb6\x4a\xe0" },
751 { "\xfe\xdc\xba\x98\x76\x54\x32\x10",
752 11,
753 8,
754 "\x3a\x83\x3c\x9a\xff\xc5\x37\xf6" },
755 { "\xfe\xdc\xba\x98\x76\x54\x32\x10",
756 12,
757 8,
758 "\x94\x09\xda\x87\xa9\x0f\x6b\xf2" },
759 { "\xfe\xdc\xba\x98\x76\x54\x32\x10",
760 13,
761 8,
762 "\x88\x4f\x80\x62\x50\x60\xb8\xb4" },
763 { "\xfe\xdc\xba\x98\x76\x54\x32\x10",
764 14,
765 8,
766 "\x1f\x85\x03\x1c\x19\xe1\x19\x68" },
767 { "\xfe\xdc\xba\x98\x76\x54\x32\x10",
768 15,
769 8,
770 "\x79\xd9\x37\x3a\x71\x4c\xa3\x4f" },
771 { "\xfe\xdc\xba\x98\x76\x54\x32\x10",
772 16,
773 8,
774 "\x93\x14\x28\x87\xee\x3b\xe1\x5c" },
775 { "\xfe\xdc\xba\x98\x76\x54\x32\x10",
776 17,
777 8,
778 "\x03\x42\x9e\x83\x8c\xe2\xd1\x4b" },
779 { "\xfe\xdc\xba\x98\x76\x54\x32\x10",
780 18,
781 8,
782 "\xa4\x29\x9e\x27\x46\x9f\xf6\x7b" },
783 { "\xfe\xdc\xba\x98\x76\x54\x32\x10",
784 19,
785 8,
786 "\xaf\xd5\xae\xd1\xc1\xbc\x96\xa8" },
787 { "\xfe\xdc\xba\x98\x76\x54\x32\x10",
788 20,
789 8,
790 "\x10\x85\x1c\x0e\x38\x58\xda\x9f" },
791 { "\xfe\xdc\xba\x98\x76\x54\x32\x10",
792 21,
793 8,
794 "\xe6\xf5\x1e\xd7\x9b\x9d\xb2\x1f" },
795 { "\xfe\xdc\xba\x98\x76\x54\x32\x10",
796 22,
797 8,
798 "\x64\xa6\xe1\x4a\xfd\x36\xb4\x6f" },
799 { "\xfe\xdc\xba\x98\x76\x54\x32\x10",
800 23,
801 8,
802 "\x80\xc7\xd7\xd4\x5a\x54\x79\xad" },
803 { "\xfe\xdc\xba\x98\x76\x54\x32\x10",
804 24,
805 8,
806 "\x05\x04\x4b\x62\xfa\x52\xd0\x80" },
807 { "\xfe\xdc\xba\x98\x76\x54\x32\x10",
808 0, /* test default key length of 128-bits */
809 8,
810 "\x93\x14\x28\x87\xee\x3b\xe1\x5c" },
811 { }
812 }
813 },
814 /* Test vector from Linux kernel for key length of 448 bits */
815 { GCRY_CIPHER_BLOWFISH,
816 "\xf0\xe1\xd2\xc3\xb4\xa5\x96\x87\x78\x69\x5a\x4b\x3c\x2d\x1e\x0f"
817 "\x00\x11\x22\x33\x44\x55\x66\x77\x04\x68\x91\x04\xc2\xfd\x3b\x2f"
818 "\x58\x40\x23\x64\x1a\xba\x61\x76\x1f\x1f\x1f\x1f\x0e\x0e\x0e\x0e"
819 "\xff\xff\xff\xff\xff\xff\xff\xff",
820 0,
821 { { "\xfe\xdc\xba\x98\x76\x54\x32\x10",
822 56,
823 8,
824 "\xc0\x45\x04\x01\x2e\x4e\x1f\x53" },
825 { }
826 }
827 },
828 /* Weak-key testing */
829 { GCRY_CIPHER_DES,
830 "\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe",
831 1,
832 { { "\x00\x00\x00\x00\x00\x00\x00\x00",
833 8,
834 8,
835 "\xca\xaa\xaf\x4d\xea\xf1\xdb\xae" },
836 { }
837 }
838 },
839 /* Weak-key testing */
840 { GCRY_CIPHER_DES,
841 "\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe\xfe",
842 2,
843 { { "\x00\x00\x00\x00\x00\x00\x00\x00",
844 8,
845 8,
846 "\xca\xaa\xaf\x4d\xea\xf1\xdb\xae" },
847 { }
848 }
849 },
850 { GCRY_CIPHER_SM4,
851 "\x01\x23\x45\x67\x89\xab\xcd\xef\xfe\xdc\xba\x98\x76\x54\x32\x10",
852 0,
853 { { "\xaa\xaa\xaa\xaa\xbb\xbb\xbb\xbb\xcc\xcc\xcc\xcc\xdd\xdd\xdd\xdd"
854 "\xee\xee\xee\xee\xff\xff\xff\xff\xaa\xaa\xaa\xaa\xbb\xbb\xbb\xbb",
855 16,
856 32,
857 "\x5e\xc8\x14\x3d\xe5\x09\xcf\xf7\xb5\x17\x9f\x8f\x47\x4b\x86\x19"
858 "\x2f\x1d\x30\x5a\x7f\xb1\x7d\xf9\x85\xf8\x1c\x84\x82\x19\x23\x04" },
859 { }
860 }
861 },
862 { GCRY_CIPHER_SM4,
863 "\xfe\xdc\xba\x98\x76\x54\x32\x10\x01\x23\x45\x67\x89\xab\xcd\xef",
864 0,
865 { { "\xaa\xaa\xaa\xaa\xbb\xbb\xbb\xbb\xcc\xcc\xcc\xcc\xdd\xdd\xdd\xdd"
866 "\xee\xee\xee\xee\xff\xff\xff\xff\xaa\xaa\xaa\xaa\xbb\xbb\xbb\xbb",
867 16,
868 32,
869 "\xc5\x87\x68\x97\xe4\xa5\x9b\xbb\xa7\x2a\x10\xc8\x38\x72\x24\x5b"
870 "\x12\xdd\x90\xbc\x2d\x20\x06\x92\xb5\x29\xa4\x15\x5a\xc9\xe6\x00" },
871 { }
872 }
873 },
874 };
875 gcry_cipher_hd_t hde, hdd;
876 unsigned char out[MAX_DATA_LEN];
877 int i, j, keylen, algo;
878 gcry_error_t err = 0;
879 gcry_error_t err2 = 0;
880
881 if (verbose)
882 fprintf (stderr, " Starting ECB checks.\n");
883
884 for (i = 0; i < sizeof (tv) / sizeof (tv[0]); i++)
885 {
886 algo = tv[i].algo;
887
888 if (gcry_cipher_test_algo (algo) && in_fips_mode)
889 {
890 if (verbose)
891 fprintf (stderr, " algorithm %d not available in fips mode\n",
892 algo);
893 continue;
894 }
895
896 if (verbose)
897 fprintf (stderr, " checking ECB mode for %s [%i]\n",
898 gcry_cipher_algo_name (algo),
899 algo);
900 err = gcry_cipher_open (&hde, algo, GCRY_CIPHER_MODE_ECB, 0);
901 if (!err)
902 err2 = gcry_cipher_open (&hdd, algo, GCRY_CIPHER_MODE_ECB, 0);
903 if (err || err2)
904 {
905 fail ("ecb-algo:%d-tv:%d, gcry_cipher_open failed: %s\n", algo, i,
906 gpg_strerror (err ? err : err2));
907 if (err2)
908 gcry_cipher_close (hde);
909 return;
910 }
911
912 if (tv[i].is_weak_key == 2)
913 {
914 err = gcry_cipher_ctl(hde, GCRYCTL_SET_ALLOW_WEAK_KEY, NULL, 1);
915 if (!err)
916 err = gcry_cipher_ctl(hdd, GCRYCTL_SET_ALLOW_WEAK_KEY, NULL, 1);
917 if (err)
918 {
919 fail ("ecb-algo:%d-tv:%d, gcry_cipher_ctl failed: %s\n",
920 algo, i, gpg_strerror (err));
921 gcry_cipher_close (hde);
922 gcry_cipher_close (hdd);
923 return;
924 }
925 }
926
927 for (j = 0; tv[i].data[j].inlen; j++)
928 {
929 keylen = tv[i].data[j].keylen;
930 if (!keylen)
931 {
932 keylen = gcry_cipher_get_algo_keylen(algo);
933 if (!keylen)
934 {
935 fail ("ecb-algo:%d-tv:%d-data:%d, gcry_cipher_get_algo_keylen failed\n",
936 algo, i, j);
937 gcry_cipher_close (hde);
938 gcry_cipher_close (hdd);
939 return;
940 }
941 }
942
943 err = gcry_cipher_setkey (hde, tv[i].key, keylen);
944 if (!err || (gcry_err_code(err) == GPG_ERR_WEAK_KEY
945 && tv[i].is_weak_key == 2))
946 err = gcry_cipher_setkey (hdd, tv[i].key, keylen);
947 if (tv[i].is_weak_key == 1)
948 {
949 if (gcry_err_code(err) != GPG_ERR_WEAK_KEY)
950 {
951 fail ("ecb-algo:%d-tv:%d-data:%d, expected gcry_cipher_setkey to fail, but got: %s\n",
952 algo, i, j, gpg_strerror (err));
953 gcry_cipher_close (hde);
954 gcry_cipher_close (hdd);
955 return;
956 }
957 else
958 {
959 continue;
960 }
961 }
962 else if (tv[i].is_weak_key == 2)
963 {
964 if (gcry_err_code(err) != GPG_ERR_WEAK_KEY)
965 {
966 fail ("ecb-algo:%d-tv:%d-data:%d, expected gcry_cipher_setkey to fail, but got: %s\n",
967 algo, i, j, gpg_strerror (err));
968 gcry_cipher_close (hde);
969 gcry_cipher_close (hdd);
970 return;
971 }
972 }
973 else if (err)
974 {
975 fail ("ecb-algo:%d-tv:%d-data:%d, gcry_cipher_setkey failed: %s\n",
976 algo, i, j, gpg_strerror (err));
977 gcry_cipher_close (hde);
978 gcry_cipher_close (hdd);
979 return;
980 }
981
982 err = gcry_cipher_encrypt (hde, out, MAX_DATA_LEN,
983 tv[i].data[j].plaintext,
984 tv[i].data[j].inlen);
985 if (err)
986 {
987 fail ("ecb-algo:%d-tv:%d-data:%d, gcry_cipher_encrypt failed: %s\n",
988 algo, i, j, gpg_strerror (err));
989 gcry_cipher_close (hde);
990 gcry_cipher_close (hdd);
991 return;
992 }
993
994 if (memcmp (tv[i].data[j].out, out, tv[i].data[j].inlen))
995 {
996 fail ("ecb-algo:%d-tv:%d-data:%d, encrypt mismatch entry\n",
997 algo, i, j);
998 }
999
1000 err = gcry_cipher_decrypt (hdd, out, tv[i].data[j].inlen, NULL, 0);
1001 if (err)
1002 {
1003 fail ("ecb-algo:%d-tv:%d-data:%d, gcry_cipher_decrypt failed: %s\n",
1004 algo, i, j, gpg_strerror (err));
1005 gcry_cipher_close (hde);
1006 gcry_cipher_close (hdd);
1007 return;
1008 }
1009
1010 if (memcmp (tv[i].data[j].plaintext, out, tv[i].data[j].inlen))
1011 {
1012 fail ("ecb-algo:%d-tv:%d-data:%d, decrypt mismatch entry\n",
1013 algo, i, j);
1014 }
1015 }
1016
1017 gcry_cipher_close (hde);
1018 gcry_cipher_close (hdd);
1019 }
1020 if (verbose)
1021 fprintf (stderr, " Completed ECB checks.\n");
1022 }
1023
1024 static void
check_ctr_cipher(void)1025 check_ctr_cipher (void)
1026 {
1027 static const struct tv
1028 {
1029 int algo;
1030 char key[MAX_DATA_LEN];
1031 char ctr[MAX_DATA_LEN];
1032 struct data
1033 {
1034 const char *plaintext;
1035 int inlen;
1036 const char *out;
1037 } data[8];
1038 } tv[] =
1039 {
1040 /* http://csrc.nist.gov/publications/nistpubs/800-38a/sp800-38a.pdf */
1041 { GCRY_CIPHER_AES,
1042 "\x2b\x7e\x15\x16\x28\xae\xd2\xa6\xab\xf7\x15\x88\x09\xcf\x4f\x3c",
1043 "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
1044 { { "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96\xe9\x3d\x7e\x11\x73\x93\x17\x2a",
1045 16,
1046 "\x87\x4d\x61\x91\xb6\x20\xe3\x26\x1b\xef\x68\x64\x99\x0d\xb6\xce" },
1047 { "\xae\x2d\x8a\x57\x1e\x03\xac\x9c\x9e\xb7\x6f\xac\x45\xaf\x8e\x51",
1048 16,
1049 "\x98\x06\xf6\x6b\x79\x70\xfd\xff\x86\x17\x18\x7b\xb9\xff\xfd\xff" },
1050 { "\x30\xc8\x1c\x46\xa3\x5c\xe4\x11\xe5\xfb\xc1\x19\x1a\x0a\x52\xef",
1051 16,
1052 "\x5a\xe4\xdf\x3e\xdb\xd5\xd3\x5e\x5b\x4f\x09\x02\x0d\xb0\x3e\xab" },
1053 { "\xf6\x9f\x24\x45\xdf\x4f\x9b\x17\xad\x2b\x41\x7b\xe6\x6c\x37\x10",
1054 16,
1055 "\x1e\x03\x1d\xda\x2f\xbe\x03\xd1\x79\x21\x70\xa0\xf3\x00\x9c\xee" },
1056
1057 { "", 0, "" }
1058 }
1059 },
1060 { GCRY_CIPHER_AES192,
1061 "\x8e\x73\xb0\xf7\xda\x0e\x64\x52\xc8\x10\xf3\x2b"
1062 "\x80\x90\x79\xe5\x62\xf8\xea\xd2\x52\x2c\x6b\x7b",
1063 "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
1064 { { "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96\xe9\x3d\x7e\x11\x73\x93\x17\x2a",
1065 16,
1066 "\x1a\xbc\x93\x24\x17\x52\x1c\xa2\x4f\x2b\x04\x59\xfe\x7e\x6e\x0b" },
1067 { "\xae\x2d\x8a\x57\x1e\x03\xac\x9c\x9e\xb7\x6f\xac\x45\xaf\x8e\x51",
1068 16,
1069 "\x09\x03\x39\xec\x0a\xa6\xfa\xef\xd5\xcc\xc2\xc6\xf4\xce\x8e\x94" },
1070 { "\x30\xc8\x1c\x46\xa3\x5c\xe4\x11\xe5\xfb\xc1\x19\x1a\x0a\x52\xef",
1071 16,
1072 "\x1e\x36\xb2\x6b\xd1\xeb\xc6\x70\xd1\xbd\x1d\x66\x56\x20\xab\xf7" },
1073 { "\xf6\x9f\x24\x45\xdf\x4f\x9b\x17\xad\x2b\x41\x7b\xe6\x6c\x37\x10",
1074 16,
1075 "\x4f\x78\xa7\xf6\xd2\x98\x09\x58\x5a\x97\xda\xec\x58\xc6\xb0\x50" },
1076 { "", 0, "" }
1077 }
1078 },
1079 { GCRY_CIPHER_AES256,
1080 "\x60\x3d\xeb\x10\x15\xca\x71\xbe\x2b\x73\xae\xf0\x85\x7d\x77\x81"
1081 "\x1f\x35\x2c\x07\x3b\x61\x08\xd7\x2d\x98\x10\xa3\x09\x14\xdf\xf4",
1082 "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
1083 { { "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96\xe9\x3d\x7e\x11\x73\x93\x17\x2a",
1084 16,
1085 "\x60\x1e\xc3\x13\x77\x57\x89\xa5\xb7\xa7\xf5\x04\xbb\xf3\xd2\x28" },
1086 { "\xae\x2d\x8a\x57\x1e\x03\xac\x9c\x9e\xb7\x6f\xac\x45\xaf\x8e\x51",
1087 16,
1088 "\xf4\x43\xe3\xca\x4d\x62\xb5\x9a\xca\x84\xe9\x90\xca\xca\xf5\xc5" },
1089 { "\x30\xc8\x1c\x46\xa3\x5c\xe4\x11\xe5\xfb\xc1\x19\x1a\x0a\x52\xef",
1090 16,
1091 "\x2b\x09\x30\xda\xa2\x3d\xe9\x4c\xe8\x70\x17\xba\x2d\x84\x98\x8d" },
1092 { "\xf6\x9f\x24\x45\xdf\x4f\x9b\x17\xad\x2b\x41\x7b\xe6\x6c\x37\x10",
1093 16,
1094 "\xdf\xc9\xc5\x8d\xb6\x7a\xad\xa6\x13\xc2\xdd\x08\x45\x79\x41\xa6" },
1095 { "", 0, "" }
1096 }
1097 },
1098 /* Some truncation tests. With a truncated second block and
1099 also with a single truncated block. */
1100 { GCRY_CIPHER_AES,
1101 "\x2b\x7e\x15\x16\x28\xae\xd2\xa6\xab\xf7\x15\x88\x09\xcf\x4f\x3c",
1102 "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
1103 {{"\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96\xe9\x3d\x7e\x11\x73\x93\x17\x2a",
1104 16,
1105 "\x87\x4d\x61\x91\xb6\x20\xe3\x26\x1b\xef\x68\x64\x99\x0d\xb6\xce" },
1106 {"\xae\x2d\x8a\x57\x1e\x03\xac\x9c\x9e\xb7\x6f\xac\x45\xaf\x8e",
1107 15,
1108 "\x98\x06\xf6\x6b\x79\x70\xfd\xff\x86\x17\x18\x7b\xb9\xff\xfd" },
1109 {"", 0, "" }
1110 }
1111 },
1112 { GCRY_CIPHER_AES,
1113 "\x2b\x7e\x15\x16\x28\xae\xd2\xa6\xab\xf7\x15\x88\x09\xcf\x4f\x3c",
1114 "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
1115 {{"\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96\xe9\x3d\x7e\x11\x73\x93\x17\x2a",
1116 16,
1117 "\x87\x4d\x61\x91\xb6\x20\xe3\x26\x1b\xef\x68\x64\x99\x0d\xb6\xce" },
1118 {"\xae",
1119 1,
1120 "\x98" },
1121 {"", 0, "" }
1122 }
1123 },
1124 { GCRY_CIPHER_AES,
1125 "\x2b\x7e\x15\x16\x28\xae\xd2\xa6\xab\xf7\x15\x88\x09\xcf\x4f\x3c",
1126 "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
1127 {{"\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96\xe9\x3d\x7e\x11\x73\x93\x17",
1128 15,
1129 "\x87\x4d\x61\x91\xb6\x20\xe3\x26\x1b\xef\x68\x64\x99\x0d\xb6" },
1130 {"", 0, "" }
1131 }
1132 },
1133 { GCRY_CIPHER_AES,
1134 "\x2b\x7e\x15\x16\x28\xae\xd2\xa6\xab\xf7\x15\x88\x09\xcf\x4f\x3c",
1135 "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
1136 {{"\x6b",
1137 1,
1138 "\x87" },
1139 {"", 0, "" }
1140 }
1141 },
1142 /* Tests to see whether it works correctly as a stream cipher. */
1143 { GCRY_CIPHER_AES,
1144 "\x2b\x7e\x15\x16\x28\xae\xd2\xa6\xab\xf7\x15\x88\x09\xcf\x4f\x3c",
1145 "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
1146 {{"\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96\xe9\x3d\x7e\x11\x73\x93\x17\x2a",
1147 16,
1148 "\x87\x4d\x61\x91\xb6\x20\xe3\x26\x1b\xef\x68\x64\x99\x0d\xb6\xce" },
1149 {"\xae\x2d\x8a\x57\x1e\x03\xac\x9c\x9e\xb7\x6f\xac\x45\xaf\x8e",
1150 15,
1151 "\x98\x06\xf6\x6b\x79\x70\xfd\xff\x86\x17\x18\x7b\xb9\xff\xfd" },
1152 {"\x51\x30\xc8\x1c\x46\xa3\x5c\xe4\x11\xe5\xfb\xc1\x19\x1a\x0a\x52\xef",
1153 17,
1154 "\xff\x5a\xe4\xdf\x3e\xdb\xd5\xd3\x5e\x5b\x4f\x09\x02\x0d\xb0\x3e\xab" },
1155 {"\xf6\x9f\x24\x45\xdf\x4f\x9b\x17\xad\x2b\x41\x7b\xe6\x6c\x37\x10",
1156 16,
1157 "\x1e\x03\x1d\xda\x2f\xbe\x03\xd1\x79\x21\x70\xa0\xf3\x00\x9c\xee" },
1158
1159 { "", 0, "" }
1160 }
1161 },
1162 { GCRY_CIPHER_AES,
1163 "\x2b\x7e\x15\x16\x28\xae\xd2\xa6\xab\xf7\x15\x88\x09\xcf\x4f\x3c",
1164 "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
1165 {{"\x6b",
1166 1,
1167 "\x87" },
1168 {"\xc1\xbe",
1169 2,
1170 "\x4d\x61" },
1171 {"\xe2\x2e\x40",
1172 3,
1173 "\x91\xb6\x20" },
1174 {"\x9f",
1175 1,
1176 "\xe3" },
1177 {"\x96\xe9\x3d\x7e\x11\x73\x93\x17\x2a",
1178 9,
1179 "\x26\x1b\xef\x68\x64\x99\x0d\xb6\xce" },
1180 {"\xae\x2d\x8a\x57\x1e\x03\xac\x9c\x9e\xb7\x6f\xac\x45\xaf\x8e",
1181 15,
1182 "\x98\x06\xf6\x6b\x79\x70\xfd\xff\x86\x17\x18\x7b\xb9\xff\xfd" },
1183 {"\x51\x30\xc8\x1c\x46\xa3\x5c\xe4\x11",
1184 9,
1185 "\xff\x5a\xe4\xdf\x3e\xdb\xd5\xd3\x5e" },
1186
1187 { "", 0, "" }
1188 }
1189 },
1190 /* Tests for counter overflow across 32-bit, 64-bit, 96-bit and 128-bit
1191 * boundaries. Large buffer sizes are used to allow these vectors to be
1192 * passed down to bulk CTR functions. */
1193 { GCRY_CIPHER_AES,
1194 "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
1195 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xfa",
1196 { { "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1197 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1198 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1199 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1200 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1201 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1202 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1203 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1204 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1205 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1206 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1207 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1208 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1209 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1210 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1211 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1212 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1213 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1214 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1215 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1216 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1217 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1218 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1219 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1220 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1221 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1222 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1223 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1224 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1225 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1226 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1227 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
1228 32 * 16,
1229 "\x74\x54\x1d\x36\x3b\x1f\x40\xb7\x96\xec\x54\xdf\x37\xe1\xd1\x38"
1230 "\xfe\xdf\x13\x08\xdc\xf4\xc6\xeb\x10\xff\x0c\xc9\x2a\x1d\xd0\xb2"
1231 "\x38\xdd\xa8\x86\xbb\x58\x72\x2a\xd1\x3a\x4b\x74\x99\x98\x1c\xf9"
1232 "\xf5\xe7\x71\x0d\xcc\x44\x40\x76\x26\xe2\xe9\xa5\x3b\xe7\xee\x63"
1233 "\x0b\x30\x76\x75\x21\x14\xf7\xd0\xec\x5b\x82\x83\x03\x66\x68\xd1"
1234 "\x57\x94\x1f\xf3\x41\x58\x81\xa0\xb2\xa7\x91\x7a\xc5\xfa\x33\xb8"
1235 "\x42\x6c\x76\x8f\xaa\x41\x0b\x72\xab\x10\x39\x51\x25\x9b\xa1\x4a"
1236 "\xd4\x82\x67\x74\xd1\x18\xc5\x35\x1a\xa4\x81\x13\x69\x0c\x39\x73"
1237 "\xba\xd5\xaf\x63\xcd\xe9\xca\x2e\x4e\x44\x44\xfc\x23\xa5\x0e\x24"
1238 "\xdc\xb7\x69\x3b\xf7\x57\x07\xd7\xbe\xd0\x19\xca\x2a\xd2\xa5\x32"
1239 "\x49\xa3\xb6\xd7\x3f\x02\xbc\xbb\x41\x63\x4a\xc5\x8f\x5c\x51\x0a"
1240 "\x59\x16\x2f\x9a\xd7\x58\x88\x1b\x51\x46\xe6\xe3\x37\xd6\x36\xbb"
1241 "\x1e\xc9\x89\x8f\xd0\x8d\xa8\x77\xa2\xee\xfc\x4c\x65\xc2\x8a\x3c"
1242 "\xf4\xad\x0d\x6b\x80\x04\x32\xc9\x39\x9e\x24\xd9\x99\xf7\x26\x93"
1243 "\xe3\x8f\x97\x38\xb6\x2e\xa6\xf1\xe3\x8a\x7c\xfe\x4f\xed\xfe\xcb"
1244 "\xff\x4e\x4a\x7a\x34\xc3\x1a\x92\x7c\x35\xdd\xd4\xc0\xf3\x1c\x51"
1245 "\x4c\x52\x08\xe3\x78\xa3\x6a\x6b\x98\x40\xae\x3c\xf9\xcb\xa3\x85"
1246 "\x0d\xbf\xdb\xf0\x6e\x53\xb2\xcc\xf7\x77\x37\xa9\x33\x1a\x1c\xed"
1247 "\x26\x3f\x79\x30\x3f\x82\x9c\x3f\xd8\x72\x98\x17\x4b\x57\xa9\xd1"
1248 "\xbd\x74\xa7\xab\x18\x85\xc6\x4c\x5a\x29\x9a\x41\xad\xae\x52\x87"
1249 "\x8d\x72\x77\xfe\x91\xd9\x1f\xca\x02\x1e\x30\xa5\x4c\x8f\x74\xd6"
1250 "\x71\xeb\x4d\xd9\x63\xaa\x90\xbf\x08\xa0\x38\x3c\x98\x46\x7a\x82"
1251 "\xfd\x0d\xb3\x78\xbf\xf5\xcd\x25\xfb\x05\x4d\x39\x9c\x53\x35\xb4"
1252 "\x34\x1b\x4b\x44\xf8\xfb\xb0\xf4\x56\xaa\xbd\x16\xba\xd1\x2b\x8d"
1253 "\x62\x4b\x56\x70\x91\x1a\x77\x0f\x2b\x6a\x0e\xf4\x4b\x83\x8f\x89"
1254 "\xa3\xe1\x5d\x3d\x0b\x1e\xb2\x43\xc6\x36\x98\x7a\xd7\xd4\x00\x09"
1255 "\xa1\x09\x0b\x49\xa2\x72\xeb\x24\x16\x70\x15\x21\x82\x17\x48\x11"
1256 "\x81\x93\xc9\x5a\x86\x2f\xd2\x96\x42\xb4\xb4\x08\x81\x85\xe5\x76"
1257 "\xa6\xc5\x10\x15\xfe\x4e\x84\x00\x64\xb5\xeb\x92\x22\x40\x97\xbb"
1258 "\xcf\xab\xc2\xf1\xbf\x44\xee\xb7\x7a\xaa\xe2\x5d\x1b\xa4\xeb\x3d"
1259 "\x65\x5b\x84\xd8\xf4\xb6\x04\xf8\x62\xe3\x6b\xd9\xc6\xf3\x99\x89"
1260 "\x11\xa0\xd4\x3f\x64\x4d\xfd\xac\x17\x80\x8e\x0d\x96\x2f\x4d\x69"
1261 },
1262 { "", 0, "" }
1263 }
1264 },
1265 { GCRY_CIPHER_AES,
1266 "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
1267 "\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xfa",
1268 { { "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1269 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1270 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1271 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1272 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1273 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1274 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1275 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1276 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1277 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1278 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1279 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1280 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1281 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1282 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1283 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1284 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1285 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1286 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1287 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1288 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1289 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1290 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1291 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1292 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1293 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1294 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1295 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1296 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1297 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1298 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1299 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
1300 32 * 16,
1301 "\xe3\x4c\xbe\xd8\xfd\x49\x8d\x84\xfc\x35\xe1\x1c\x56\x88\x6a\xf3"
1302 "\x78\x22\x42\x79\xa5\xd5\x74\xb9\x19\xc3\x1b\x9a\x2e\x18\x57\xcc"
1303 "\x27\x91\x03\xa2\x5d\xb8\xf7\xb7\x3a\xe2\x32\x4a\x77\x4c\x9c\xf7"
1304 "\xfc\x54\xa5\x75\xec\xff\x99\x59\x73\x66\xf8\xd7\xe7\x46\xf9\xba"
1305 "\x36\xcb\xe8\xa7\x19\xcf\xc8\x0c\x71\xb2\x8f\x97\xa7\xbd\xbd\x05"
1306 "\x39\xa7\xef\x0a\x0a\x58\x52\xa8\xbf\xd2\x03\x23\x44\xbf\x94\x12"
1307 "\x13\x18\x9a\x6a\xe4\xab\x07\xae\x70\xa3\xaa\xbd\x30\xbe\x99\xde"
1308 "\x8f\x94\x29\x44\x4c\x8f\x4b\x35\x99\x42\x12\x35\xb5\x10\xdf\x3d"
1309 "\x94\x54\x46\x34\x1c\x6f\x59\x71\xfe\x0e\xb6\x62\xb1\xfb\x99\x50"
1310 "\xdd\xa6\x6f\x25\x1c\xfd\xb9\xdc\x9f\xce\xf7\xc9\x33\xba\x82\x8a"
1311 "\xb8\x82\xd4\xbc\x28\x56\xf6\x42\x71\x85\x7a\x6a\xb1\xcc\xa0\xa1"
1312 "\xa5\xe6\x36\xee\x73\xd7\x1c\x6c\xa0\x6c\xe2\x15\xa5\x82\x69\x46"
1313 "\x2d\x94\x7b\xb1\xc1\x5f\xbb\x96\x03\xb1\x33\x27\x8f\xe1\xc3\x7a"
1314 "\x62\x78\xad\x78\x11\x49\x93\x73\xce\xa1\xd8\xc5\x59\xe3\x54\x79"
1315 "\xca\xaf\xc9\xe2\xde\x11\x83\x6d\x66\x39\xe1\x06\xa7\x41\x74\xe9"
1316 "\x24\x54\xa5\x5b\x1c\x07\xdd\x2d\xf5\xc0\x27\xdc\x7e\x1d\xfa\x44"
1317 "\x21\xd3\xe9\x4c\x3a\x2a\xb7\xbe\x4f\x37\x9f\xbe\x3d\x1a\x41\x6f"
1318 "\xba\x4d\x0a\x72\xb2\x18\x83\x75\x17\x87\xf9\x22\x8a\x7c\x9d\x2a"
1319 "\x8b\xc8\xda\xde\xda\xa0\xda\x56\x60\x02\x11\x4b\xca\xe0\x4f\xa4"
1320 "\xbd\x71\x9a\x85\x7c\xd3\xf7\xbb\xc3\x4e\x10\x7d\x14\xbb\xa5\x10"
1321 "\x10\xea\x35\x59\xe3\x17\x0a\x8d\x6e\x22\xe4\xc2\x83\x3f\x60\x6a"
1322 "\x53\x19\xf2\xfa\xd8\x86\x5d\x44\xc3\xef\xd9\x2a\x0a\x71\xe0\x46"
1323 "\xee\xa5\xad\xd2\xba\x80\x7d\xb1\x35\x3f\xe7\x4f\x24\xe1\x6a\x6b"
1324 "\xe1\xc9\xe0\xc9\x2a\x27\x27\xa9\x63\x15\x1c\x01\xb1\x06\xaa\xca"
1325 "\x20\x15\xe5\xa9\xba\xab\xbf\xa9\x06\x02\xac\x09\x2a\x55\x8d\xc6"
1326 "\x22\x93\xfd\x50\x2f\xac\x02\x97\x0d\xea\xfc\xa0\x5a\x1a\x30\x9c"
1327 "\xf7\x77\x91\x46\xea\x5a\x94\x79\x5e\xad\xff\x91\x58\x6a\xed\x3f"
1328 "\xba\x48\xa9\x3b\xd7\xff\x63\x39\x1e\x67\x8e\x23\xe8\xe3\x62\x45"
1329 "\x08\xe0\xea\x64\xa2\x6a\x3d\x6c\xdf\x30\x0d\x00\xa1\x88\x13\x2b"
1330 "\x57\x30\x3e\xea\x6b\xb2\x57\xfb\x16\x65\xf1\x26\x81\x7c\xbf\xb6"
1331 "\x53\x90\xff\x75\xcb\x3e\xb5\x97\x1d\x52\xbe\x67\x58\xbe\x50\x45"
1332 "\x69\x3a\x29\x52\x1e\xb6\xb4\x70\x82\xb8\x1a\x0d\x6f\x3b\xbe\x14"
1333 },
1334 { "", 0, "" }
1335 }
1336 },
1337 { GCRY_CIPHER_AES,
1338 "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
1339 "\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfa",
1340 { { "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1341 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1342 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1343 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1344 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1345 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1346 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1347 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1348 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1349 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1350 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1351 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1352 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1353 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1354 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1355 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1356 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1357 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1358 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1359 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1360 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1361 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1362 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1363 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1364 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1365 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1366 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1367 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1368 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1369 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1370 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1371 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
1372 32 * 16,
1373 "\xf1\x51\x2c\xa5\xd9\x8a\xeb\xa2\xa9\xfc\xe2\x24\x73\x69\xaa\x7d"
1374 "\x1d\xae\xbf\xca\xae\xed\xf9\x2c\x97\x03\xa3\xef\x3f\x7c\xec\xeb"
1375 "\x45\x69\x4a\x66\x9b\xde\xbf\x46\x01\x28\xf1\xde\xed\xb2\xa4\x7e"
1376 "\xa3\x52\xe1\x85\x9c\x6b\xcf\x6b\x42\xba\xce\x02\x1c\xee\x35\x6a"
1377 "\xfa\x18\x46\xf0\x90\xc9\x80\x1a\xc6\xbe\x02\x65\xf1\x77\xe8\xcf"
1378 "\x5a\x4b\x94\xa8\x55\xcc\x21\x39\xe3\xae\xb7\x2a\xcc\x8d\xc7\x9f"
1379 "\x95\x03\xe3\xa2\x24\x5a\x2b\xe4\x3c\x98\x74\xed\xfe\x1b\xed\x9e"
1380 "\xfe\x1a\x92\xed\x86\xf1\x06\x6a\xf9\x79\x48\x5c\xd2\x5a\x98\x47"
1381 "\x63\x81\xfd\xfc\x9a\xef\xaf\xea\x3a\xff\x5c\xd8\xd7\xab\xef\x8c"
1382 "\x88\x91\x34\x5a\x2c\x05\x6a\xf2\x2e\xf6\xd0\x01\x59\x35\x28\x95"
1383 "\x61\x3a\x1a\x31\xb3\x64\xc4\x8c\xa3\x5d\xe0\xf9\x09\xed\x58\x47"
1384 "\xa0\x85\xe1\x06\x0b\xc0\xc0\x1e\x7f\x3f\x5e\x56\x71\x17\x8b\xa0"
1385 "\x95\x8f\x3d\x29\x16\x89\xd1\xfb\xe9\x49\xa5\x7d\xea\xe8\x50\xc1"
1386 "\x95\x2d\xbd\x6d\x80\x0c\x74\x8d\x6c\xcd\xc2\x75\x94\x40\xb7\x24"
1387 "\xf3\xf8\xe4\xf2\x1c\xeb\x1b\x58\x0c\x1a\x06\x0a\xad\x48\x4f\x13"
1388 "\x12\x94\x7a\xa0\x03\xa2\x4b\x0f\xbc\xd7\xd4\xa0\x8d\x45\xab\xf1"
1389 "\xd9\x1b\x1d\x1a\xa7\x9e\x5f\xe3\x07\xfd\xd4\xad\xa9\xf3\x95\xaa"
1390 "\x47\xf8\x25\x2e\xca\x60\x7c\x14\x35\x8e\xb6\x23\x15\xe4\x96\x3c"
1391 "\xdf\xb6\x86\xd8\x87\xe0\xf1\x7e\x04\x2a\xc2\xb7\x39\x74\x10\x52"
1392 "\x18\xe7\x2d\x63\xe2\x40\xe4\xfd\xe8\x1a\xee\xb9\xdf\xe2\xf5\xcb"
1393 "\x2d\x2d\x8f\x71\x38\x9e\x8a\x8b\xc9\xb3\xf8\xb0\x25\xaa\xb9\xf2"
1394 "\x08\x7c\xa2\x6b\x16\x75\x65\x98\x7c\x72\x7c\x86\x7f\xba\xe3\x2b"
1395 "\x68\x6e\x37\xf9\x4c\x17\xf3\xfe\xc8\xc5\xf7\x38\xfb\xe2\x33\xfd"
1396 "\x62\xb8\x59\x46\x65\xf6\xc3\x06\x56\x02\xb3\x93\x17\x37\xd6\x3e"
1397 "\x2d\x47\x96\x3e\xd8\x01\x97\x3a\x29\x5a\x39\x17\x58\xcb\x6b\x2e"
1398 "\xf4\x6a\xeb\x4c\xb1\xff\xde\xc6\x86\x9e\x7a\x2f\xe9\x63\x4e\x99"
1399 "\x58\x0d\xb3\x33\x38\x4c\xd0\xe6\x0f\x1b\x88\xe0\x87\x29\xf1\x4c"
1400 "\x25\x6a\x18\x62\x93\x58\xf1\x7e\xf9\xbf\x38\x1a\x7b\x41\xf3\xa7"
1401 "\xee\x39\x07\x4a\x1e\xf9\x57\x16\x41\x38\xe1\xc5\xce\x4c\x8c\xae"
1402 "\xf9\x74\xc2\x40\x76\x84\xa0\x86\xec\xd3\xe3\xd6\xcc\x64\xc8\x8a"
1403 "\x67\x06\x75\x54\x89\x32\xf2\x6e\xee\x96\x84\x38\xbd\xf3\xd7\xd7"
1404 "\x8a\x83\x7e\xee\x9d\xb5\xcf\xb6\x91\x0b\x98\xb5\xbf\xc0\x1d\x60"
1405 },
1406 { "", 0, "" }
1407 }
1408 },
1409 { GCRY_CIPHER_AES,
1410 "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
1411 "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff\xfa",
1412 { { "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1413 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1414 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1415 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1416 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1417 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1418 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1419 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1420 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1421 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1422 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1423 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1424 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1425 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1426 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1427 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1428 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1429 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1430 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1431 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1432 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1433 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1434 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1435 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1436 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1437 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1438 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1439 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1440 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1441 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1442 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1443 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
1444 32 * 16,
1445 "\x72\x93\xe9\x78\x6b\xd1\x11\x41\xd8\x52\x32\x0c\x8b\x5f\xc3\x93"
1446 "\x0a\xae\x0e\xdc\x96\x0a\xa5\x0a\x5b\x95\x7c\xc6\xad\x30\xd0\x98"
1447 "\xea\xd3\x71\xe6\x4b\x1b\x3e\xb6\xd0\xfb\x94\x23\x6b\x54\x40\xff"
1448 "\xf1\xc2\x60\xb3\x2d\x20\xf9\xae\xfb\x32\x86\xf8\xc2\x05\xa7\x12"
1449 "\x96\xe0\x3e\x48\x73\x56\x58\xc2\xa3\x99\x9e\xa2\xb4\x6f\xa9\x7a"
1450 "\x32\x6e\xe7\xf6\xb8\x1c\x58\x2f\x55\xc6\xcd\xb5\xe5\xd2\x2f\xc8"
1451 "\xff\x05\x59\x37\x75\x6c\xad\xce\x69\x74\xed\x4b\x8c\x98\x7d\xae"
1452 "\xc2\x81\x9b\x7a\x46\x14\x73\x72\x34\x85\x15\x64\x96\xed\xb8\xb9"
1453 "\xf1\xce\x2d\xd4\x8b\x7e\xd1\x81\xd5\x91\x9c\x10\x37\xe9\x98\x4d"
1454 "\xeb\x5d\x8a\x78\xf3\x85\x6f\xc0\xb0\x85\x0b\x75\xf6\x07\xa0\x11"
1455 "\xd2\x8e\x7b\x63\x23\xba\xdc\xc0\xec\x4d\xac\xeb\xde\x41\x29\x66"
1456 "\x6c\x5a\x9e\x88\x69\xba\x33\xb3\x3d\x5f\x78\xb3\x36\x8b\x2d\xf3"
1457 "\x37\x7e\x13\xe6\x93\x3e\xce\x00\xcf\x12\x47\x64\x55\xfe\xbd\xb6"
1458 "\xa6\xd9\x41\x50\x0a\x42\x1f\xfd\xc7\xea\x6c\xc3\xac\x0f\x3d\x91"
1459 "\xe5\xa1\x95\x5b\x4e\x24\xe5\x34\x1e\x03\x10\x3f\x9d\xa0\x89\x74"
1460 "\xea\x26\x5c\x23\x1b\x5b\x8b\x08\x49\xce\xd8\xa8\x10\xf3\x88\x37"
1461 "\x38\xc2\x9d\xba\x75\x2b\x5e\xec\xf1\xf1\x3c\x90\xab\xae\x88\xe2"
1462 "\x49\xf9\xb8\xad\x7b\x8e\x30\x96\xaf\x48\xec\x37\x11\x52\xef\x49"
1463 "\xea\xcb\x97\x16\x13\x7b\xf4\x03\x50\x61\x6a\xd4\x09\xfd\x66\x1d"
1464 "\x56\x13\x48\x9b\xe3\x5d\xfe\x60\x47\x0a\x62\xfd\xae\xbc\x15\xc2"
1465 "\x0f\xbd\xc0\xb8\x70\x4d\x89\x2d\x4e\xa5\x7b\x36\xfc\xda\xdc\xc3"
1466 "\x47\x45\x8e\x86\xa8\xa6\xd3\x51\x0e\xaa\x90\x30\xef\x02\x53\x04"
1467 "\x89\x92\xcc\x36\x33\x00\x9f\xdc\xa3\x7d\xbf\x0d\x10\x4f\x50\xe7"
1468 "\x84\x72\xfa\x76\x57\xa6\xbd\x65\x8f\xc7\x04\xef\x03\xaf\xff\xf0"
1469 "\x8c\x6f\x98\x58\xac\x95\xe7\x7e\xeb\x4d\x24\xfb\x37\xbc\x9b\x19"
1470 "\x1a\x48\x2b\x86\xe4\x21\x24\xf5\x1a\xb1\x8a\xcb\x0d\x14\x6e\x4e"
1471 "\x3d\x39\xed\x95\x73\xeb\xaa\x31\x56\xbe\x4d\x32\x02\x15\xf1\x24"
1472 "\x9f\x23\xa6\xd8\xf4\x52\x4b\xfd\x9c\xc0\x45\x5c\xc4\xb0\xae\x4b"
1473 "\x39\xca\x17\x7a\xfb\xc0\xdb\x8c\x92\x52\xd4\x37\x93\x29\x7c\x2e"
1474 "\x77\xcd\x8d\x2a\xbd\x6e\x4d\x23\xe2\xff\x84\xa5\x1a\x2a\xd2\x4a"
1475 "\x19\xd7\xef\x1d\xea\xcf\x79\x8f\x81\x48\x2d\x5d\x72\x58\x99\x11"
1476 "\xec\x95\xda\x65\x73\x35\x34\xb1\x28\x10\x07\x94\xe8\xc1\x1e\x17"
1477 },
1478 { "", 0, "" }
1479 }
1480 },
1481 { GCRY_CIPHER_AES256,
1482 "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
1483 "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f",
1484 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xfa",
1485 { { "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1486 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1487 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1488 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1489 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1490 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1491 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1492 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1493 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1494 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1495 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1496 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1497 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1498 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1499 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1500 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1501 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1502 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1503 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1504 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1505 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1506 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1507 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1508 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1509 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1510 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1511 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1512 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1513 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1514 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1515 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1516 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
1517 32 * 16,
1518 "\x0c\x39\xef\x9d\x9b\x85\x05\x78\x93\x92\x13\xc4\xe9\xc7\x0b\x12"
1519 "\x36\x73\x18\xfa\x58\x33\x09\x7f\xf4\xd2\xf8\x93\x46\x5a\xd0\xdd"
1520 "\x8d\x48\x2e\x6b\xb1\xf9\x9b\xc2\x0c\x66\x88\x48\x93\xaf\x0d\xac"
1521 "\x47\x3f\xbb\x84\xc5\xf8\x8d\xc1\x7c\xfe\xb8\xb9\x9f\xcc\x86\x3c"
1522 "\xfd\x9f\xa3\xf9\x2c\x22\xeb\xa1\x9a\x68\x6b\xb9\x24\xf6\xe6\x74"
1523 "\xb9\xc2\x73\x98\x10\xcb\xa1\x57\xa9\xfe\x6a\x10\x8c\x6e\x56\x9e"
1524 "\x64\x1d\x1a\x3a\x80\xbe\xcf\xf6\xf0\xf3\x8f\x97\x64\xfd\xcf\x96"
1525 "\x36\x7e\xf8\x28\x88\x31\x55\x74\x08\xe1\x02\x95\x0a\x16\xe2\x6a"
1526 "\x15\xd6\xbf\xfc\x44\xf4\x30\x1e\x0e\x2e\x51\x39\xec\xa6\x3a\xf7"
1527 "\x15\x9f\x1c\x54\x64\xb2\x54\x84\x73\x00\x03\xd9\x26\x30\x73\x5e"
1528 "\x3a\x96\x67\xf1\x28\x2c\x84\x3c\x59\xdf\xc3\x01\x6c\xe4\x07\x33"
1529 "\x2e\x16\x53\x92\xfd\xee\x1d\x47\xbe\x15\x1d\x65\x58\xb5\x9b\x08"
1530 "\x04\x71\x65\xfa\x11\x49\x9d\xc6\xca\xab\x34\xb1\x40\x39\x98\xe9"
1531 "\xd4\xa5\xda\x17\x74\x5e\x80\x18\xc3\xf9\xcd\x60\x34\x5c\x68\x09"
1532 "\x4c\xf7\xa1\x3a\x5c\xdb\xf6\xc5\x06\xe2\x70\x98\x3b\xea\x0f\x77"
1533 "\x43\x1a\x0b\x4f\x74\x54\xe8\x7c\xd6\xb2\x02\xcc\xc9\x11\x49\x65"
1534 "\x4c\xb2\x2b\x5a\x39\x13\xdb\xcf\x07\x77\x27\x69\x90\xa9\xe6\x7a"
1535 "\xd2\xa0\x3e\xd9\xa8\x4c\x6b\x8d\x2f\x39\x10\x67\xea\x4c\x10\xc7"
1536 "\xac\x70\xf9\x50\x1d\xe7\xfd\x88\x66\xf1\xed\x36\x5c\xa1\x5f\x92"
1537 "\xf6\xcb\xd2\xe1\xb0\x9d\x55\x45\xe4\x62\x3d\xec\x11\x33\x6e\x3e"
1538 "\x7f\x87\x06\x1b\x4c\x71\xf0\xe5\x0f\xed\xde\xa0\x47\x85\x59\xa5"
1539 "\xf4\x03\xde\x25\x8c\x23\x42\x47\x94\x1b\xa5\xbb\x2e\x09\x54\xe2"
1540 "\xf8\x75\x29\xb6\xa6\x3b\x86\x1d\xa0\x4d\xbc\x5c\x49\xf1\x38\x3f"
1541 "\x23\x12\x63\x98\x26\xa7\x7a\xe6\x48\x0a\x14\x1a\xcc\xd6\xf0\xc7"
1542 "\xd8\x69\x1e\x39\x0a\xf5\x79\xed\x82\x79\x43\x54\x65\x15\x90\x44"
1543 "\xb8\xcf\x52\x51\x7a\x9a\x32\x16\x2a\x36\xcb\x9c\xde\x48\x10\xdc"
1544 "\x97\x70\x72\xc8\x83\x0f\x66\xaf\x95\x59\xfb\xca\x06\x46\x6f\x8e"
1545 "\x49\xbd\x72\xcd\x8b\xa3\x69\xaa\xde\xc3\xaa\xf0\x4e\x65\x7c\x8b"
1546 "\x93\xa7\xa9\x85\xdb\xf9\x7d\xdf\x6a\x52\xda\xcf\x42\xb8\x9c\x17"
1547 "\x6c\xc4\xa1\x5e\x5c\x69\x76\x5d\x26\x95\x1e\x13\xdc\xa3\x57\x7a"
1548 "\xb7\x8a\x4c\xb8\x88\xaa\x74\x78\xbb\xd3\xee\xfd\xc3\xa4\xa9\xf1"
1549 "\x6b\x34\x1a\x79\x67\x9c\xb1\xfd\xd4\xd9\x8b\xf4\x28\xfe\xff\xc1"
1550 },
1551 { "", 0, "" }
1552 }
1553 },
1554 { GCRY_CIPHER_AES256,
1555 "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
1556 "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f",
1557 "\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xfa",
1558 { { "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1559 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1560 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1561 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1562 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1563 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1564 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1565 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1566 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1567 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1568 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1569 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1570 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1571 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1572 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1573 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1574 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1575 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1576 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1577 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1578 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1579 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1580 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1581 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1582 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1583 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1584 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1585 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1586 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1587 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1588 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1589 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
1590 32 * 16,
1591 "\x16\x2e\x03\x23\x3e\xa6\x2e\xd7\x51\xf9\x56\xfc\x19\xea\x01\xfe"
1592 "\x81\x26\x0e\xb3\x01\x39\xa7\xb7\x06\xda\x7c\x85\xbd\xed\x14\x3f"
1593 "\x1c\x01\xf4\x55\x76\x7d\xa7\x22\x15\xb4\xd8\x4d\x1d\x2c\x59\x6b"
1594 "\x52\x00\x85\x00\x35\xc4\x5a\x90\x9e\xb6\xc0\x6d\x61\xca\x6d\x1f"
1595 "\xed\xbd\x96\x2b\xd9\x87\xbc\xfd\xf6\x1d\xd6\x3c\xa8\x2d\x92\xb9"
1596 "\xa6\xfb\xdb\x5c\xfd\xe0\x7d\x1b\x58\xfd\x36\x21\x77\xbc\xff\xdf"
1597 "\x51\x1d\xd5\xef\x9a\x68\x2b\x7d\xa4\x9f\x91\xc8\x6c\x4f\x7a\xc3"
1598 "\x40\xc5\x3c\xef\x92\xef\x2d\x64\x3f\x63\x8b\x82\x22\xdb\x1e\x85"
1599 "\x31\x0b\x64\x7d\x31\x9d\xdc\x92\xe4\x53\x9e\x9b\xbe\x37\x07\x8d"
1600 "\xeb\xe3\xae\xfb\xff\xe3\xba\xcc\xa3\x4f\x42\x54\x3e\xbb\x9f\xb6"
1601 "\xa8\xf3\x6e\x76\x9a\x45\xa0\xf1\xbc\x19\x34\x26\xab\xad\x8c\x60"
1602 "\x3b\x9b\x31\x7f\xb5\xf1\xbb\x8c\xbc\x71\x43\xcb\xb8\xc6\xfb\xe6"
1603 "\x9c\x9b\xf0\x3f\x66\x65\xc2\xd9\x1a\x13\xd8\xea\x53\xa7\x24\xb9"
1604 "\xf8\x98\xce\x2c\xc8\xee\xe7\x18\x29\x91\xdf\x6e\x27\x1d\xc2\x46"
1605 "\xc2\x66\x3f\x2b\xcc\xbb\x57\xd8\xb9\x5c\xbe\xf3\x88\x4e\xa9\x99"
1606 "\x95\x50\x22\xa5\xbe\x51\xe4\x37\x1a\xfa\x20\x61\x25\x2c\x7c\xac"
1607 "\x42\x0e\xdb\xbd\x0f\x3c\x1a\x4f\xda\x57\x52\x61\x3a\x5a\x1e\x35"
1608 "\x1f\x6d\xb7\x26\x61\x5e\xa9\x23\xc3\x56\x47\xe9\xb1\xb8\x70\x1d"
1609 "\x0f\x67\xfd\x7e\x88\x15\xe2\x16\xd7\xdd\x32\x9f\x81\xfe\xe5\x97"
1610 "\x05\x19\x93\xc5\xd0\x88\x32\x62\x60\x82\xc7\xb8\x65\xa5\x75\x4c"
1611 "\xaf\x1e\x44\x0f\x03\x24\x09\xe2\x91\x87\xbd\xf8\xd1\x1f\x37\x77"
1612 "\x7e\xe3\xa8\xdb\x23\x8b\x49\xa1\x4b\xa7\xe6\x30\x36\x01\xcc\x69"
1613 "\xb4\x4a\x20\x20\x23\xdb\xcc\xcd\x57\x44\xd3\xfd\x88\xf8\xbe\x90"
1614 "\x08\xb3\xed\x2d\x6c\x7b\x3d\x3d\xaf\xc6\xf4\xe6\x2d\x31\x7f\xfc"
1615 "\x84\xc2\x4e\xa6\x04\xda\x96\x3a\x95\xf7\x7b\x31\x0c\x25\x1f\x0e"
1616 "\x9e\xbe\xf4\x78\xc1\xcb\x3a\x6d\xab\x60\x5d\xe5\x56\x1d\x4c\x1c"
1617 "\xed\xff\x40\x38\xed\xea\x89\x40\x46\x49\x47\x0a\x52\x93\x7a\x71"
1618 "\x0a\xba\x8d\x12\xbe\x8f\x0b\xc6\x31\x9f\x2d\x8a\x42\x66\x06\x66"
1619 "\x34\x93\xf0\x58\x1c\x9c\xc6\x41\xfc\x5e\x46\x2c\x7d\x85\x22\x82"
1620 "\x28\x03\x80\x89\xfc\x05\x8e\x18\x01\x85\x38\xe5\x6a\x90\xd9\x28"
1621 "\x0a\x25\xd2\xf7\xb5\x6d\x07\x21\x94\x11\x6f\xc1\xef\x9a\x89\xd9"
1622 "\x02\xce\xc6\x97\x43\x29\x9a\x1f\xfd\x29\x61\x04\xe2\x64\xf2\xca"
1623 },
1624 { "", 0, "" }
1625 }
1626 },
1627 { GCRY_CIPHER_AES256,
1628 "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
1629 "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f",
1630 "\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfa",
1631 { { "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1632 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1633 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1634 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1635 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1636 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1637 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1638 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1639 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1640 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1641 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1642 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1643 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1644 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1645 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1646 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1647 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1648 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1649 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1650 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1651 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1652 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1653 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1654 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1655 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1656 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1657 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1658 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1659 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1660 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1661 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1662 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
1663 32 * 16,
1664 "\xc8\x1a\x9c\x1e\xa9\x44\x9f\x3f\x3a\xf2\x34\x91\x8e\x41\x14\xea"
1665 "\xec\x88\x5e\xd0\x8c\x19\xe9\xa8\xef\x33\x0f\x43\xd8\x17\xe7\x02"
1666 "\x15\xed\xfe\x3b\xbc\x97\xcc\x1d\x61\xb0\x64\xa1\x87\x6f\x72\x0c"
1667 "\xed\x60\x0d\x75\x77\x12\x38\xb6\x2b\x31\xaf\x5a\x5e\x06\x2e\x85"
1668 "\x01\x75\x99\x06\xf8\x94\xf0\xb5\xb6\xe9\x78\xe4\x51\x6c\x42\x8b"
1669 "\x1f\xe1\x38\x68\xb5\x87\x1c\xa5\x5d\x2a\x84\xaa\xa4\xbf\x06\x8c"
1670 "\x9d\xba\x41\xa7\x77\xf3\xb4\x6a\x37\xb7\xaa\xae\x49\xd6\xdf\x8d"
1671 "\x19\x7b\x1d\x24\xed\x7a\xcc\x26\x78\x85\x9d\xf9\x22\xc3\xb5\xcb"
1672 "\x44\x36\xcd\xaa\x0c\x5a\xf4\xa8\x5f\x3c\x65\x90\xa9\xbd\x35\x80"
1673 "\x67\x3f\xc9\xc0\xde\xf4\x3c\x0e\xb1\x9c\x80\x96\x0e\x6d\x3e\xd0"
1674 "\xfc\xd6\x8a\x65\xc1\xe5\x2d\x96\x23\x5b\x08\x37\xd9\xde\x82\x87"
1675 "\xaa\x83\xb8\x8a\x1c\xae\xbd\x99\x24\x28\x7f\xc5\x99\x54\xff\xc0"
1676 "\x85\x28\xa5\xdf\xf3\xec\x77\x69\x22\xb8\x0f\xd7\x0e\xcf\xbd\x95"
1677 "\xff\xda\x89\x03\xaf\x14\x06\x47\x6e\x7a\xae\x2f\xb4\x97\x23\xae"
1678 "\x42\xc6\x31\x14\xa6\x8f\xc2\x4c\xcc\x4d\x1f\xc7\x2b\xb2\x93\x71"
1679 "\x80\x70\xa1\x6f\x92\xf9\xde\x5b\x1f\xb0\xc7\xa8\x8b\xe1\xeb\x3b"
1680 "\x51\x74\x02\xb2\x39\xfc\xf3\xe3\x68\x80\x7b\x73\x1d\x8e\x62\x99"
1681 "\x1c\xe8\x58\x18\xfa\x41\x9e\x21\x66\x9e\x24\xea\x53\xc1\x9d\x06"
1682 "\x20\x86\xd6\x78\x34\xef\x9c\xb1\x49\x11\xdf\x93\xe6\xc8\x8e\xde"
1683 "\xc8\x29\x99\x1a\x31\x6a\xb6\xd5\x7d\xfd\x4f\x1c\xab\xf4\x4d\xc9"
1684 "\xaa\x2a\x44\xf0\x0b\x5e\x35\x0c\xab\x51\xbb\xc3\xe4\xbd\x33\xe9"
1685 "\x25\xec\x7b\xf1\x04\x38\x3c\x3e\x4a\xd1\x59\x1e\x65\x20\x60\xdd"
1686 "\x66\x31\x7a\xbf\x7f\x8e\x5f\xfe\x5c\x45\xdc\xb4\xd6\x92\x59\x0c"
1687 "\xbf\xd6\x97\xf2\x7a\xfe\x77\x33\x40\x47\x1f\xe2\xb6\xac\x31\x8d"
1688 "\x68\xaa\x76\x7e\xdc\xc6\x02\x35\xf0\x94\xcd\xc7\xcf\xc3\x86\x17"
1689 "\x14\xcb\x70\x6d\x9c\x7a\x4c\xaf\xc5\xa5\xcd\x65\xb9\x7c\x1b\xd9"
1690 "\x89\x77\x69\x8a\xed\xec\x38\x29\xe2\xc9\x63\x42\x84\xad\x86\x7c"
1691 "\x55\x47\x84\x7a\x06\x99\x25\xaf\xef\x5a\xfd\x19\x69\x6c\x66\xd0"
1692 "\x19\x89\x2a\xd1\xff\xba\x51\xd9\x84\x1c\x52\xca\x50\x11\xe6\xd4"
1693 "\x73\x67\xc6\xc6\xe1\xc4\x34\x9f\x1d\x2c\x9f\x71\xa0\x42\xe9\x72"
1694 "\x9e\x28\x2a\x7c\xb7\x00\xb3\x71\xc8\x77\xd2\x94\x0a\x72\x39\x62"
1695 "\x7b\x2b\xaf\x8f\xd2\x17\xbc\x6a\x83\xb2\x8b\x22\xea\xf1\x2d\x98"
1696 },
1697 { "", 0, "" }
1698 }
1699 },
1700 { GCRY_CIPHER_AES256,
1701 "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
1702 "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f",
1703 "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff\xfa",
1704 { { "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1705 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1706 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1707 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1708 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1709 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1710 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1711 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1712 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1713 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1714 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1715 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1716 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1717 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1718 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1719 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1720 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1721 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1722 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1723 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1724 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1725 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1726 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1727 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1728 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1729 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1730 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1731 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1732 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1733 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1734 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1735 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
1736 32 * 16,
1737 "\xa0\x45\x6a\x19\xf3\x06\x20\x7f\x14\xce\x28\x0f\xe3\xdf\x44\x09"
1738 "\x15\x8d\xe1\xff\x64\x74\xfb\xdd\xb9\x96\x61\xd3\x57\xae\xaa\x46"
1739 "\x73\xa3\x98\x8d\x07\x66\xd7\xb2\xe8\xd9\xb5\xd8\xb5\xb5\x52\x72"
1740 "\x52\x33\x83\x4a\x9c\xc0\x06\x51\x38\x8c\x73\x67\xb9\xbe\x0c\x0b"
1741 "\x8f\xd1\xf4\xa7\xdb\xd0\x35\x96\xcb\xeb\x63\x80\x5c\x33\x7e\xa8"
1742 "\x5b\x4d\x10\x22\x33\x4b\x8c\x62\xb1\x9b\x3c\xc9\xf2\xf5\x45\x94"
1743 "\x80\xf8\x18\x12\xba\xb8\xc1\x19\xdb\x4c\x70\xda\x9d\x98\xc8\x89"
1744 "\xd8\x79\xe1\x25\x20\x52\xa1\x8e\xa1\x4f\x5e\x3d\xe6\xad\xe7\x35"
1745 "\x3a\x81\xef\xc9\x60\xbb\xde\xc6\x8b\x5e\xae\xd1\x2c\x2e\xa3\x4c"
1746 "\xb0\xd3\xe3\x12\xf7\x44\x3f\xe1\x34\x5c\xbf\xcd\xec\xa4\x1f\x45"
1747 "\x47\x13\x44\xec\xee\x4f\x7b\x7c\x53\x2f\xc4\x34\x3b\x6d\x70\x34"
1748 "\xd5\x9f\x61\xd5\xb4\x25\x07\xcc\x06\xfd\xc4\x34\x2a\x97\x16\xad"
1749 "\x24\xa3\xa0\xd0\x3a\xc4\xd3\xb4\x22\xa8\x73\xf5\xcd\x3f\x72\x9f"
1750 "\xae\x51\x6c\x7f\x3a\x5a\xfa\xdd\xdb\xbe\xcc\x09\xc8\xf8\x0a\x25"
1751 "\x87\x66\x8c\x90\xe1\xdf\xff\x37\xc5\x66\xc5\x26\xe1\x42\x5f\x8d"
1752 "\x18\x6a\x08\x54\xf2\x88\x2b\xc4\x12\x5f\x9d\x06\x9e\x3e\xbd\x44"
1753 "\x1e\xfb\x9a\x55\x53\xcc\x21\xef\x6c\x74\x60\x04\x64\x61\xc4\x86"
1754 "\x9d\x36\xdc\x2b\x68\x80\x0e\x8a\x99\x17\x07\xd3\x03\x7e\x44\x79"
1755 "\xd0\x30\xec\x72\x68\xef\x34\x72\x80\xee\xb8\x86\xc1\x4e\x51\x6f"
1756 "\xd3\xbd\xce\x04\x48\xbf\x0c\x40\xad\xa8\x7d\xd0\xfa\x12\xba\x64"
1757 "\x0c\xc3\x83\x37\xc1\xc1\xf7\x31\x7e\x59\x1f\x8e\xa3\x81\x64\xdd"
1758 "\x94\xef\xd6\xb1\xf6\xc3\x66\x58\x43\x4c\x25\xdc\x72\x6b\xf7\x37"
1759 "\x0b\x68\x85\x4d\x3b\x48\x1f\x04\x1e\x44\xff\x7a\xf0\x60\x89\xf7"
1760 "\xe8\x6e\x38\x9b\xa1\x63\x43\x47\xe1\x7e\x5c\xc0\xbe\x29\xb0\x75"
1761 "\xe7\xf3\x19\x22\x94\xf1\xa8\x4b\x05\xf4\xb2\x5b\xa4\x24\xdd\xbf"
1762 "\x19\xce\x7d\x1f\x13\x25\xde\xfa\xb9\x0b\x29\x49\x00\xa3\xfc\x13"
1763 "\xd2\x76\xf9\x98\x3b\x64\x30\xb6\xa3\xb3\xc0\xa2\x25\x70\xe0\x65"
1764 "\x25\x8e\xfd\xb1\x85\xd7\xd5\xc8\x4f\x52\xb5\x9e\x93\x84\xbf\xc9"
1765 "\x6f\x5c\xe5\xbd\x04\xe2\xfa\xa8\xea\xfe\xa6\x63\xb0\xa7\x75\x9c"
1766 "\x7c\xec\x3d\xbf\xb1\x28\xae\x1f\xd1\xdd\x57\x7b\x69\x36\xa9\xaf"
1767 "\xe6\x09\xf3\x46\x5e\x7d\xc6\x4e\x7b\xec\x3c\xc9\x26\x11\xae\x20"
1768 "\xe8\x6f\x27\xa8\x09\x60\xbe\xf0\xb0\xf7\x80\x71\x61\x57\x0b\xe2"
1769 },
1770 { "", 0, "" }
1771 }
1772 },
1773 #ifdef USE_CAMELLIA
1774 { GCRY_CIPHER_CAMELLIA256,
1775 "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
1776 "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f",
1777 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xfa",
1778 { { "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1779 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1780 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1781 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1782 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1783 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1784 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1785 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1786 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1787 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1788 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1789 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1790 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1791 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1792 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1793 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1794 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1795 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1796 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1797 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1798 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1799 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1800 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1801 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1802 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1803 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1804 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1805 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1806 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1807 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1808 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1809 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
1810 32 * 16,
1811 "\x6e\x85\xe1\x26\xf0\x1a\x70\x5b\x62\x4e\x94\xa3\x07\x70\xb8\xc7"
1812 "\x07\x20\x67\xc8\xd1\x30\xec\x82\x0c\x28\x0d\x01\x09\xd0\xef\x85"
1813 "\xf5\xea\x24\xee\x3d\xa6\x99\x00\x78\x19\xf5\x30\x57\x6f\x43\x52"
1814 "\xd2\xfc\xb5\x07\x0a\xe7\x6e\xd4\xd2\x76\x47\x6e\x5b\xb7\x28\x03"
1815 "\x62\x01\xe9\xaf\xe1\x29\xf9\x3c\x86\xc7\x50\xb1\xfb\xac\x76\xf8"
1816 "\x7b\x4a\x7b\x67\x63\xd8\xf1\xbc\xba\x9c\xfe\xaf\x7c\x00\xff\x51"
1817 "\x82\xd8\x3d\x99\xd6\xf9\x64\xfc\xcd\x97\x6c\x4e\x30\xa3\xd8\x66"
1818 "\x2d\x29\x38\x5f\x07\x67\x7e\x16\x6d\xd1\xe6\xd4\xcd\xaa\xe8\x0a"
1819 "\x1d\x5e\x47\x66\x9d\x28\xf6\xb0\xf4\x1e\xe6\xff\x1c\x2e\x03\x20"
1820 "\x31\x45\x24\x92\xcb\xd4\x59\xb9\xe8\x8a\xed\x3d\x01\xe2\xaa\x09"
1821 "\xa4\xb8\x78\x0d\x72\xa0\x5c\x4c\x48\x82\x20\xe1\xa4\xe9\xc1\xf9"
1822 "\x5c\xd5\x0d\xda\x2c\x01\x41\x94\xa3\x34\x2a\x22\xac\xf6\x1e\xc3"
1823 "\xfb\x92\x70\x7f\x12\xb1\x0a\x7e\xac\x61\xbe\xce\xc1\xa6\xb4\x17"
1824 "\xfd\x7e\xa7\x95\x97\xc1\x38\xc7\x20\x88\xe7\x64\x3a\xca\x90\x87"
1825 "\x5e\xa5\x71\x0d\xfc\x7d\x50\x91\x71\xa0\xb9\xc2\x9a\x34\xa9\x80"
1826 "\x05\x77\x30\xf5\x61\x15\x4b\x12\xa7\x6f\x19\x9a\xd3\x3a\x8c\xe9"
1827 "\x8c\xf7\x65\x5f\xde\x84\x18\x20\xe6\x35\x51\x32\xab\x4a\x85\x67"
1828 "\x29\xec\xb2\x82\xf4\x70\x9d\x77\x21\x0e\x4a\x80\x80\x67\x3c\x76"
1829 "\x70\x34\xa7\x00\x65\xaa\xcc\x54\x97\x46\x12\xd9\xfb\x1d\xef\x04"
1830 "\x58\xe3\x75\x0e\xf9\x24\x9d\xf2\x4e\xe1\x61\x7a\x7e\xc3\x32\xb2"
1831 "\xfb\x80\x5f\x77\x18\x4c\x8b\xc4\xd3\xe2\xe3\x13\xc4\xe3\x98\x9b"
1832 "\x86\xfe\xb2\x76\xc5\xbc\x18\xe2\xaa\x6d\x70\xe4\xfe\xf7\x10\x39"
1833 "\xdd\xc7\x9f\x34\x99\x3b\x46\xa5\xf1\xf7\x80\xab\x7a\x03\x33\xfb"
1834 "\x44\x74\x62\x84\xe5\x83\x05\x34\x13\x60\x1c\xfe\xc2\x34\xf5\x58"
1835 "\x0e\xdd\x33\x32\x3d\xab\x1a\xfe\x83\x33\x7c\x33\x84\x85\xaa\x8c"
1836 "\x69\x0c\xb0\x72\xdd\x4b\xd4\x6f\x03\x62\xf8\x59\x65\x4c\xe9\x07"
1837 "\x8b\xcc\x24\x04\x6c\x05\xc9\x1d\xb7\xd5\xea\xb8\x34\x83\x23\x29"
1838 "\x5e\x1f\xc9\xc8\xbf\xd9\x1e\xbf\x4d\x84\x41\x27\xf1\x51\xb3\x11"
1839 "\x2a\x40\x5b\xbe\xa1\x70\xd9\x47\x65\x35\xd3\xc8\xcf\xea\x96\xbf"
1840 "\xb2\x84\xda\x85\x72\xeb\x3d\xb9\x7d\xb0\x75\xfe\xdb\x6f\xa4\xe3"
1841 "\xce\xa9\xdb\xa3\x95\x7a\xa8\x2c\xbf\x94\x97\x89\x29\xd8\x1b\x4d"
1842 "\x44\xba\x92\x30\x80\x1c\x88\x06\xe8\xb7\x0c\xf4\x11\xfe\x66\xf2"
1843 },
1844 { "", 0, "" }
1845 }
1846 },
1847 { GCRY_CIPHER_CAMELLIA256,
1848 "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
1849 "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f",
1850 "\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xfa",
1851 { { "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1852 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1853 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1854 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1855 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1856 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1857 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1858 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1859 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1860 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1861 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1862 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1863 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1864 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1865 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1866 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1867 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1868 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1869 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1870 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1871 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1872 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1873 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1874 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1875 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1876 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1877 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1878 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1879 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1880 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1881 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1882 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
1883 32 * 16,
1884 "\xdf\xe6\x82\xe0\xec\x70\x2f\x6f\xd5\x61\xd8\x31\xe7\xf3\xfb\x18"
1885 "\x4f\xd3\x58\xb0\x5a\xa6\xf2\x2b\x3d\x6e\xdd\xb8\xfb\x9f\x02\x3c"
1886 "\xf5\xb7\xc5\xa1\x17\xd3\x07\x8b\x3f\x07\x56\x90\xbd\x9c\x24\xa4"
1887 "\x2c\x1f\x45\x93\x1e\x37\xf2\x04\xbc\x34\xae\x7d\x13\x57\xe9\xc0"
1888 "\x30\x48\xad\xc1\x81\x8e\xee\x9a\xed\x8e\x0f\x9b\x16\x20\x57\x72"
1889 "\xc6\x74\x40\x2e\x60\xde\x49\x40\xc2\x22\xa0\xd7\xb8\xfb\x3d\xd0"
1890 "\xfc\x25\x37\x4d\xd2\x8e\x7e\x96\xd9\xdc\x19\x32\xc1\xe7\x9c\xe5"
1891 "\x13\x8a\xa6\x15\xd9\x3c\xba\xa6\x8f\x80\x69\x75\x74\xaf\x91\xf3"
1892 "\xac\xd2\xdf\xcd\x78\xce\x49\xb0\x59\x29\x77\x68\x7c\x35\x35\x14"
1893 "\x7a\xf7\x5a\x46\x25\x9a\x1d\x6b\x97\x7c\xee\x9a\x45\x85\x05\xff"
1894 "\xfc\xc9\x0c\x12\x8a\xa7\xee\xec\xaa\x8a\x5e\x43\x04\x0d\x2d\xdb"
1895 "\x14\x54\xbe\x3d\x63\xe6\x90\x1e\x0c\x46\xb8\x1a\xe5\xd3\x0c\xae"
1896 "\xac\xb9\xdd\xec\xab\xb9\x2f\x8a\xf5\x27\xf0\xd0\xf6\x43\x80\x72"
1897 "\x04\x23\x5b\xc3\xdc\x97\xdd\x7d\x3e\xf1\x5b\xc7\xbc\xd1\x96\xfc"
1898 "\xcc\xf3\xa6\x20\x76\x34\x26\xb7\x18\x59\xa4\x3e\xb2\xd1\xe3\x82"
1899 "\x24\xe9\xf4\x9c\xaa\x0f\x63\xd2\xfc\x7b\x73\x35\x92\x4c\x14\x6f"
1900 "\x3f\x2a\x71\xf8\x50\xf2\xaa\x09\xb6\xb1\x0c\xf8\x7b\xe1\x9f\xce"
1901 "\x63\x2e\x58\x47\xdf\x9d\x58\xb0\x59\xd2\xe0\x12\x33\x00\xd9\x57"
1902 "\x75\xf8\x06\xba\x58\x87\xd0\x9d\x3d\x7a\x9e\x1b\x9c\x9c\xa1\x79"
1903 "\xdc\x96\x41\xff\x3a\xb6\x44\xda\x70\xad\xa3\x66\x2d\x9e\xad\xc5"
1904 "\xb1\xb1\x48\xdb\x02\xf1\x26\x74\x8f\x10\x36\x19\xcc\x3b\x56\x91"
1905 "\x7f\x00\x1d\x32\x79\xb3\xdd\x31\x84\x75\xf1\xf0\xb9\x6e\xcb\x09"
1906 "\x0e\x3c\xb1\xe8\x1d\x72\xf9\xdf\x91\xda\x79\x09\x18\xcb\x67\xde"
1907 "\xb4\x60\xea\x48\x0b\x45\xbf\x79\xeb\xc3\x86\x72\xc4\x44\x81\x51"
1908 "\xcd\x93\xb4\xce\xc3\x64\xef\xaa\x1f\x66\x39\x24\x2c\xc7\x5a\xcc"
1909 "\xee\x09\x9a\x60\xfb\xcc\xb2\x2e\x7a\x8b\x4f\x90\x67\x40\xba\x4c"
1910 "\x67\xa4\x2b\x40\xd0\x30\xb7\xb3\x66\x56\x63\xf4\x77\x1d\x5e\x59"
1911 "\xd5\x42\xec\x7a\x35\x01\xde\xf9\x50\x64\x84\x60\x06\x8c\x65\xf1"
1912 "\x64\xef\x4f\x2f\xc7\xc4\x0e\xb1\x3f\xcf\x7e\x4a\x4e\x12\x21\x9c"
1913 "\xc5\xe3\xc2\x9e\xa8\x4c\xee\x55\x2d\x87\xa3\x46\x20\x83\x79\x88"
1914 "\x37\x82\x13\x94\x4a\x22\xaf\x1e\x10\xc1\xba\x5c\xd3\xc8\x27\x48"
1915 "\x4e\x57\xb0\x3a\x22\xfc\xab\xc2\x4d\x7b\x30\xa5\xdb\x93\xb4\xe6"
1916 },
1917 { "", 0, "" }
1918 }
1919 },
1920 { GCRY_CIPHER_CAMELLIA256,
1921 "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
1922 "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f",
1923 "\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfa",
1924 { { "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1925 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1926 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1927 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1928 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1929 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1930 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1931 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1932 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1933 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1934 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1935 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1936 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1937 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1938 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1939 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1940 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1941 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1942 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1943 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1944 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1945 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1946 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1947 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1948 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1949 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1950 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1951 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1952 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1953 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1954 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1955 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
1956 32 * 16,
1957 "\xc0\x06\xd1\xed\x3e\xe9\x12\x44\xed\x8d\x15\xb2\x7a\x92\x95\x21"
1958 "\xa7\x86\x5c\x2f\xca\x3b\xa4\x1b\x0e\x7b\x96\xcd\xef\x2f\xf9\x1d"
1959 "\x9f\xd9\xeb\x5b\xa0\xec\x77\x2b\x20\x81\x99\xe6\x4a\xc6\x10\x0e"
1960 "\xd9\xff\x0e\xe1\x54\x5e\x28\xdc\xcf\xb2\xd1\xbb\x66\x37\x74\x3b"
1961 "\xa6\x3e\x85\x6b\xe1\x4f\xb3\xb2\x9a\xff\xba\x45\x02\xd0\xa6\x0b"
1962 "\x51\x9a\x15\x09\xf2\xb9\xfa\xe2\xc2\x11\x93\x09\xcf\xcb\x1e\x83"
1963 "\x9e\xd1\xfb\x92\xa5\xaa\x54\xcf\x26\xeb\x53\x60\xb0\xc2\x81\xe6"
1964 "\x09\x11\x18\x92\x62\xa6\x81\xce\xad\x4f\xe2\x10\x07\x40\xb0\xb2"
1965 "\x0b\x54\xd7\x6b\x71\xd1\xa9\x8c\x7e\x72\x1b\xe1\x65\x18\x47\x32"
1966 "\xdb\xc7\x95\xc7\x18\x22\xca\xb8\xc9\xd2\x91\xe7\x6f\xf4\x89\xe2"
1967 "\x20\xf5\xd9\x90\xe6\x32\x30\xd0\x4b\x69\x03\x35\x51\x82\x54\x9a"
1968 "\xde\x41\xbe\x3e\x68\x02\x9f\xa0\x82\x0b\xa6\x13\xa7\x3b\xfd\x87"
1969 "\xeb\x0b\xb9\x8e\x2b\x2b\x10\x84\x05\xeb\x6b\xde\x64\xcc\xda\xe9"
1970 "\x7b\x3c\x98\x4f\x0b\x22\x2e\xa2\x58\xce\xc2\xd3\x83\x23\x90\xb2"
1971 "\xf8\x2b\xfe\xb0\xa9\x83\xe7\x92\xb2\x7d\x40\x41\xc2\x03\xac\x3a"
1972 "\xc2\xa3\x62\x41\x10\x5c\x75\x39\xe1\x19\x7a\x41\xc9\x26\x5b\x37"
1973 "\x0c\x80\x39\x86\x56\xa1\x5c\xe8\x88\x20\x74\xed\x7e\xe3\xf2\x96"
1974 "\x73\x6e\xaf\x83\x7f\xea\x48\xb9\x2b\x8e\xb3\x0e\x38\xbb\xb6\x4c"
1975 "\xb8\xc4\x41\x57\xef\x19\x0e\x3d\x6b\xc1\xbf\x4e\xac\xd6\x8e\x54"
1976 "\xc2\xfa\x23\x4f\x74\x58\x58\xdd\xde\x66\x40\xea\xaf\xca\x8e\x2c"
1977 "\x08\xf8\x86\xb5\x7a\x98\x93\xa9\x16\x9d\xb2\x90\x1e\xcb\x74\x0e"
1978 "\x87\xae\xc3\xc3\x7b\xdf\xd4\x85\x52\xc5\x0c\xa5\x4e\xfc\xa4\x9d"
1979 "\xb2\x4e\xc3\xb1\xb1\xf9\xb4\x61\x13\x8c\x2c\xbf\x54\xc6\x30\x07"
1980 "\x2b\x68\xc1\x94\xc0\xe3\x2f\xdb\xe5\x8d\x11\x81\x32\xa6\x00\x29"
1981 "\x91\x05\x0e\x9b\x2d\xaf\x5f\x7c\x36\xac\x02\x35\xa0\x10\xea\xf2"
1982 "\x9a\x10\x73\xf0\xc6\xd2\x22\x0f\xc6\x41\xa0\xac\xbc\xc7\x98\x37"
1983 "\x7f\xb4\xfc\x4a\x34\xb2\x77\x12\x61\x58\x30\xc2\x9c\x96\x6e\xd9"
1984 "\xc2\x8d\xb0\x81\x7a\x68\x1e\xb0\x93\xf6\x4e\xeb\x2b\xa0\xcb\x44"
1985 "\x07\x85\x58\xe7\x57\x68\xfd\x0d\xd2\xf7\x01\x79\xbd\x86\x75\x09"
1986 "\x13\x96\xf3\x8c\xa9\x1b\x30\x06\x9d\x8a\x53\x84\x7d\x24\x02\xe2"
1987 "\x14\x7f\x76\x5f\x91\xad\x88\xe2\x53\xdc\xbe\x6a\x13\x78\xb7\xd5"
1988 "\xa9\x79\x56\xa8\x5b\x08\xce\xb6\x86\xd9\x1e\x0e\x26\x7f\x67\xf5"
1989 },
1990 { "", 0, "" }
1991 }
1992 },
1993 { GCRY_CIPHER_CAMELLIA256,
1994 "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
1995 "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f",
1996 "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff\xfa",
1997 { { "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1998 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
1999 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
2000 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
2001 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
2002 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
2003 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
2004 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
2005 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
2006 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
2007 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
2008 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
2009 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
2010 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
2011 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
2012 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
2013 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
2014 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
2015 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
2016 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
2017 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
2018 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
2019 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
2020 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
2021 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
2022 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
2023 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
2024 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
2025 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
2026 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
2027 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
2028 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
2029 32 * 16,
2030 "\xac\xc5\xeb\x09\x8b\x1c\x42\xa6\x46\x50\xeb\x19\xe9\x93\xbc\x39"
2031 "\x50\x93\xdb\x3d\x2c\x34\x92\xad\xba\x29\xf2\x03\x19\xb4\xda\xf4"
2032 "\xe0\x3f\x10\xb4\x07\x9e\xa4\x0a\xab\xd5\xd2\x46\x13\x79\x8b\xf9"
2033 "\xd0\x76\x6c\x3e\xb3\x39\x09\x68\x2c\x60\x87\x34\x3c\x66\x72\x06"
2034 "\x0d\xab\xb4\xf1\xe3\x8c\x05\xfb\x58\x73\xbe\x2b\x5e\x0f\x0d\xba"
2035 "\xa2\xeb\x21\x33\x22\x98\x24\x88\xd7\xf4\x4e\x9b\xa3\x81\xe5\xcb"
2036 "\xaa\x84\xd3\xa6\x29\x3f\x0e\x07\x2f\x2d\xea\x0a\xf1\x13\xaf\x5d"
2037 "\x5d\x62\x3d\x35\x8d\x50\xd4\x49\xf9\x39\x37\xea\x57\xc5\x2e\x35"
2038 "\x5b\xf9\xa7\xd9\x2e\xc0\x2d\x39\x27\xcb\x83\x03\x3f\x2b\x17\x18"
2039 "\xcd\xb4\x67\x63\xd3\xf5\x28\xfd\x00\xb9\x96\xb8\xa7\xaf\x94\x9f"
2040 "\x5e\xd7\xca\x26\x9b\xd3\x8e\x83\x65\x8f\xa0\xcb\x83\x86\xae\x70"
2041 "\xaa\x04\x76\x54\x79\xef\x89\x5e\x81\x78\x7f\x49\x05\xab\x45\x70"
2042 "\x01\x6f\x87\x9d\xdc\x2a\xb2\xd6\xd7\x00\xc7\x61\xea\xb7\xb5\xf5"
2043 "\x98\x56\x20\x70\xa5\x8d\x8d\x7f\x91\xd2\xee\xe5\xf0\x7c\xf7\xd0"
2044 "\x12\x27\x03\x8d\x24\x06\x54\x81\x5a\x6b\xe8\x2f\xf9\x4c\xd6\xa4"
2045 "\x03\x4f\xd8\xee\x18\x8b\xef\x27\x89\xb2\x2a\x51\xde\xa1\xa8\x55"
2046 "\xa6\x1e\xd7\x4c\xcd\x22\x65\x20\xac\xf1\x17\xaf\xf5\x0a\x50\x05"
2047 "\xaf\x93\x26\xb5\xa3\x37\xf6\x87\x83\x5f\xde\x4e\x18\xe2\x2f\xae"
2048 "\xc6\x57\x56\x4f\x33\x16\xbc\xdc\xad\x89\xf2\x9d\xe8\x7c\x6c\x33"
2049 "\x70\x51\xe2\x9c\x29\x16\x2e\x57\x47\x14\x8c\xc4\x98\x2a\x12\x92"
2050 "\xb8\xc0\x85\x70\xa2\xd8\x33\x80\x38\xb0\x95\xae\x47\x26\x40\x88"
2051 "\x48\x0a\xa8\xfe\x35\x29\x9a\xdb\x41\x1d\x5a\xdc\xf0\xa1\x9e\xaf"
2052 "\x44\xae\x53\xb7\xd9\xe8\x2c\xe9\x0a\xe7\x88\xb7\x95\x9e\x40\xd1"
2053 "\xf4\x48\x20\x2d\x93\xcf\x03\xc8\xa6\x22\x95\x35\x7a\xef\x80\xa5"
2054 "\x8c\x37\x23\x83\x97\x31\xea\xdf\x73\x63\xa8\xc6\xa2\x92\xd8\x92"
2055 "\x3f\x89\xaa\x90\x61\xef\x8c\x4b\x3d\xfe\x07\xb0\x9e\xf2\x0c\xee"
2056 "\x94\x1d\x53\x70\x54\xf9\xdf\x92\x78\x88\xe5\x27\x3f\x8c\x4f\x8c"
2057 "\xe3\xc6\x50\xe4\x94\x5b\x40\x9b\xc6\x92\x7f\x61\xa8\x17\xdf\x38"
2058 "\xc0\x7d\x6d\x65\x71\x53\xb9\xa6\xad\x43\x9d\xc0\x3b\x7b\xa2\xc6"
2059 "\x14\x82\xe3\x11\xce\x15\x5d\xc4\xa4\x0c\x1a\x29\xcd\x2b\x43\x8e"
2060 "\xb5\x80\x16\xe5\x0d\xed\x06\xc9\x4d\x03\x79\x93\x45\x13\xee\x37"
2061 "\xcf\x8d\x18\x7c\x19\xc0\x8c\x15\xa6\x2f\x64\xed\xa5\x6f\x5f\x61"
2062 },
2063 { "", 0, "" }
2064 }
2065 },
2066 #endif /*USE_CAMELLIA*/
2067 #if USE_CAST5
2068 /* A selfmade test vector using an 64 bit block cipher. */
2069 { GCRY_CIPHER_CAST5,
2070 "\x2b\x7e\x15\x16\x28\xae\xd2\xa6\xab\xf7\x15\x88\x09\xcf\x4f\x3c",
2071 "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8",
2072 {{"\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96\xe9\x3d\x7e\x11\x73\x93\x17\x2a",
2073 16,
2074 "\xe8\xa7\xac\x68\xca\xca\xa0\x20\x10\xcb\x1b\xcc\x79\x2c\xc4\x48" },
2075 {"\xae\x2d\x8a\x57\x1e\x03\xac\x9c",
2076 8,
2077 "\x16\xe8\x72\x77\xb0\x98\x29\x68" },
2078 {"\x9e\xb7\x6f\xac\x45\xaf\x8e\x51",
2079 8,
2080 "\x9a\xb3\xa8\x03\x3b\xb4\x14\xba" },
2081 {"\xae\x2d\x8a\x57\x1e\x03\xac\x9c\xa1\x00",
2082 10,
2083 "\x31\x5e\xd3\xfb\x1b\x8d\xd1\xf9\xb0\x83" },
2084 { "", 0, "" }
2085 }
2086 },
2087 #endif /*USE_CAST5*/
2088 { GCRY_CIPHER_SM4,
2089 "\x01\x23\x45\x67\x89\xab\xcd\xef\xfe\xdc\xba\x98\x76\x54\x32\x10",
2090 "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
2091 { { "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xbb\xbb\xbb\xbb\xbb\xbb\xbb\xbb"
2092 "\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
2093 "\xee\xee\xee\xee\xee\xee\xee\xee\xff\xff\xff\xff\xff\xff\xff\xff"
2094 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xbb\xbb\xbb\xbb\xbb\xbb\xbb\xbb",
2095 64,
2096 "\xac\x32\x36\xcb\x97\x0c\xc2\x07\x91\x36\x4c\x39\x5a\x13\x42\xd1"
2097 "\xa3\xcb\xc1\x87\x8c\x6f\x30\xcd\x07\x4c\xce\x38\x5c\xdd\x70\xc7"
2098 "\xf2\x34\xbc\x0e\x24\xc1\x19\x80\xfd\x12\x86\x31\x0c\xe3\x7b\x92"
2099 "\x6e\x02\xfc\xd0\xfa\xa0\xba\xf3\x8b\x29\x33\x85\x1d\x82\x45\x14" },
2100
2101 { "", 0, "" }
2102 }
2103 },
2104 { GCRY_CIPHER_SM4,
2105 "\xfe\xdc\xba\x98\x76\x54\x32\x10\x01\x23\x45\x67\x89\xab\xcd\xef",
2106 "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
2107 { { "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xbb\xbb\xbb\xbb\xbb\xbb\xbb\xbb"
2108 "\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xcc\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
2109 "\xee\xee\xee\xee\xee\xee\xee\xee\xff\xff\xff\xff\xff\xff\xff\xff"
2110 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xbb\xbb\xbb\xbb\xbb\xbb\xbb\xbb",
2111 64,
2112 "\x5d\xcc\xcd\x25\xb9\x5a\xb0\x74\x17\xa0\x85\x12\xee\x16\x0e\x2f"
2113 "\x8f\x66\x15\x21\xcb\xba\xb4\x4c\xc8\x71\x38\x44\x5b\xc2\x9e\x5c"
2114 "\x0a\xe0\x29\x72\x05\xd6\x27\x04\x17\x3b\x21\x23\x9b\x88\x7f\x6c"
2115 "\x8c\xb5\xb8\x00\x91\x7a\x24\x88\x28\x4b\xde\x9e\x16\xea\x29\x06" },
2116
2117 { "", 0, "" }
2118 }
2119 },
2120 { 0,
2121 "",
2122 "",
2123 {
2124 {"", 0, "" }
2125 }
2126 }
2127 };
2128 gcry_cipher_hd_t hde, hdd;
2129 unsigned char out[32 * 16];
2130 int i, j, keylen, blklen;
2131 gcry_error_t err = 0;
2132 size_t taglen2;
2133
2134 if (verbose)
2135 fprintf (stderr, " Starting CTR cipher checks.\n");
2136 for (i = 0; i < sizeof (tv) / sizeof (tv[0]); i++)
2137 {
2138 if (!tv[i].algo)
2139 continue;
2140
2141 if (gcry_cipher_test_algo (tv[i].algo) && in_fips_mode)
2142 {
2143 if (verbose)
2144 fprintf (stderr, " algorithm %d not available in fips mode\n",
2145 tv[i].algo);
2146 continue;
2147 }
2148
2149 err = gcry_cipher_open (&hde, tv[i].algo, GCRY_CIPHER_MODE_CTR, 0);
2150 if (!err)
2151 err = gcry_cipher_open (&hdd, tv[i].algo, GCRY_CIPHER_MODE_CTR, 0);
2152 if (err)
2153 {
2154 fail ("aes-ctr, gcry_cipher_open failed: %s\n", gpg_strerror (err));
2155 return;
2156 }
2157
2158 keylen = gcry_cipher_get_algo_keylen(tv[i].algo);
2159 if (!keylen)
2160 {
2161 fail ("aes-ctr, gcry_cipher_get_algo_keylen failed\n");
2162 return;
2163 }
2164
2165 err = gcry_cipher_setkey (hde, tv[i].key, keylen);
2166 if (!err)
2167 err = gcry_cipher_setkey (hdd, tv[i].key, keylen);
2168 if (err)
2169 {
2170 fail ("aes-ctr, gcry_cipher_setkey failed: %s\n",
2171 gpg_strerror (err));
2172 gcry_cipher_close (hde);
2173 gcry_cipher_close (hdd);
2174 return;
2175 }
2176
2177 blklen = gcry_cipher_get_algo_blklen(tv[i].algo);
2178 if (!blklen)
2179 {
2180 fail ("aes-ctr, gcry_cipher_get_algo_blklen failed\n");
2181 return;
2182 }
2183
2184 err = gcry_cipher_setctr (hde, tv[i].ctr, blklen);
2185 if (!err)
2186 err = gcry_cipher_setctr (hdd, tv[i].ctr, blklen);
2187 if (err)
2188 {
2189 fail ("aes-ctr, gcry_cipher_setctr failed: %s\n",
2190 gpg_strerror (err));
2191 gcry_cipher_close (hde);
2192 gcry_cipher_close (hdd);
2193 return;
2194 }
2195
2196
2197 err = gcry_cipher_info (hde, GCRYCTL_GET_TAGLEN, NULL, &taglen2);
2198 if (gpg_err_code (err) != GPG_ERR_INV_CIPHER_MODE)
2199 {
2200 fail ("aes-ctr, gcryctl_get_taglen failed to fail (tv %d): %s\n",
2201 i, gpg_strerror (err));
2202 gcry_cipher_close (hde);
2203 gcry_cipher_close (hdd);
2204 return;
2205 }
2206
2207 if (verbose)
2208 fprintf (stderr, " checking CTR mode for %s [%i]\n",
2209 gcry_cipher_algo_name (tv[i].algo),
2210 tv[i].algo);
2211 for (j = 0; tv[i].data[j].inlen; j++)
2212 {
2213 err = gcry_cipher_encrypt (hde, out, sizeof(out),
2214 tv[i].data[j].plaintext,
2215 tv[i].data[j].inlen == -1 ?
2216 strlen ((char*)tv[i].data[j].plaintext) :
2217 tv[i].data[j].inlen);
2218 if (err)
2219 {
2220 fail ("aes-ctr, gcry_cipher_encrypt (%d, %d) failed: %s\n",
2221 i, j, gpg_strerror (err));
2222 gcry_cipher_close (hde);
2223 gcry_cipher_close (hdd);
2224 return;
2225 }
2226
2227 if (memcmp (tv[i].data[j].out, out, tv[i].data[j].inlen))
2228 {
2229 fail ("aes-ctr, encrypt mismatch entry %d:%d\n", i, j);
2230 mismatch (tv[i].data[j].out, tv[i].data[j].inlen,
2231 out, tv[i].data[j].inlen);
2232 }
2233
2234 err = gcry_cipher_decrypt (hdd, out, tv[i].data[j].inlen, NULL, 0);
2235 if (err)
2236 {
2237 fail ("aes-ctr, gcry_cipher_decrypt (%d, %d) failed: %s\n",
2238 i, j, gpg_strerror (err));
2239 gcry_cipher_close (hde);
2240 gcry_cipher_close (hdd);
2241 return;
2242 }
2243
2244 if (memcmp (tv[i].data[j].plaintext, out, tv[i].data[j].inlen))
2245 {
2246 fail ("aes-ctr, decrypt mismatch entry %d:%d\n", i, j);
2247 mismatch (tv[i].data[j].plaintext, tv[i].data[j].inlen,
2248 out, tv[i].data[j].inlen);
2249 }
2250
2251 }
2252
2253 /* Now check that we get valid return codes back for good and
2254 bad inputs. */
2255 err = gcry_cipher_encrypt (hde, out, sizeof(out),
2256 "1234567890123456", 16);
2257 if (err)
2258 fail ("aes-ctr, encryption failed for valid input");
2259
2260 err = gcry_cipher_encrypt (hde, out, 15,
2261 "1234567890123456", 16);
2262 if (gpg_err_code (err) != GPG_ERR_BUFFER_TOO_SHORT)
2263 fail ("aes-ctr, too short output buffer returned wrong error: %s\n",
2264 gpg_strerror (err));
2265
2266 err = gcry_cipher_encrypt (hde, out, 0,
2267 "1234567890123456", 16);
2268 if (gpg_err_code (err) != GPG_ERR_BUFFER_TOO_SHORT)
2269 fail ("aes-ctr, 0 length output buffer returned wrong error: %s\n",
2270 gpg_strerror (err));
2271
2272 err = gcry_cipher_encrypt (hde, out, 16,
2273 "1234567890123456", 16);
2274 if (err)
2275 fail ("aes-ctr, correct length output buffer returned error: %s\n",
2276 gpg_strerror (err));
2277
2278 /* Again, now for decryption. */
2279 err = gcry_cipher_decrypt (hde, out, sizeof(out),
2280 "1234567890123456", 16);
2281 if (err)
2282 fail ("aes-ctr, decryption failed for valid input");
2283
2284 err = gcry_cipher_decrypt (hde, out, 15,
2285 "1234567890123456", 16);
2286 if (gpg_err_code (err) != GPG_ERR_BUFFER_TOO_SHORT)
2287 fail ("aes-ctr, too short output buffer returned wrong error: %s\n",
2288 gpg_strerror (err));
2289
2290 err = gcry_cipher_decrypt (hde, out, 0,
2291 "1234567890123456", 16);
2292 if (gpg_err_code (err) != GPG_ERR_BUFFER_TOO_SHORT)
2293 fail ("aes-ctr, 0 length output buffer returned wrong error: %s\n",
2294 gpg_strerror (err));
2295
2296 err = gcry_cipher_decrypt (hde, out, 16,
2297 "1234567890123456", 16);
2298 if (err)
2299 fail ("aes-ctr, correct length output buffer returned error: %s\n",
2300 gpg_strerror (err));
2301
2302 gcry_cipher_close (hde);
2303 gcry_cipher_close (hdd);
2304 }
2305 if (verbose)
2306 fprintf (stderr, " Completed CTR cipher checks.\n");
2307 }
2308
2309 static void
check_cfb_cipher(void)2310 check_cfb_cipher (void)
2311 {
2312 static const struct tv
2313 {
2314 int algo;
2315 int cfb8;
2316 char key[MAX_DATA_LEN];
2317 char iv[MAX_DATA_LEN];
2318 struct data
2319 {
2320 unsigned char plaintext[MAX_DATA_LEN];
2321 int inlen;
2322 char out[MAX_DATA_LEN];
2323 }
2324 data[MAX_DATA_LEN];
2325 const char *oid; /* For gost 28147 param sets */
2326 } tv[] =
2327 {
2328 /* http://csrc.nist.gov/publications/nistpubs/800-38a/sp800-38a.pdf */
2329 { GCRY_CIPHER_AES, 0,
2330 "\x2b\x7e\x15\x16\x28\xae\xd2\xa6\xab\xf7\x15\x88\x09\xcf\x4f\x3c",
2331 "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
2332 { { "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96\xe9\x3d\x7e\x11\x73\x93\x17\x2a",
2333 16,
2334 "\x3b\x3f\xd9\x2e\xb7\x2d\xad\x20\x33\x34\x49\xf8\xe8\x3c\xfb\x4a" },
2335 { "\xae\x2d\x8a\x57\x1e\x03\xac\x9c\x9e\xb7\x6f\xac\x45\xaf\x8e\x51",
2336 16,
2337 "\xc8\xa6\x45\x37\xa0\xb3\xa9\x3f\xcd\xe3\xcd\xad\x9f\x1c\xe5\x8b"},
2338 { "\x30\xc8\x1c\x46\xa3\x5c\xe4\x11\xe5\xfb\xc1\x19\x1a\x0a\x52\xef",
2339 16,
2340 "\x26\x75\x1f\x67\xa3\xcb\xb1\x40\xb1\x80\x8c\xf1\x87\xa4\xf4\xdf" },
2341 { "\xf6\x9f\x24\x45\xdf\x4f\x9b\x17\xad\x2b\x41\x7b\xe6\x6c\x37\x10",
2342 16,
2343 "\xc0\x4b\x05\x35\x7c\x5d\x1c\x0e\xea\xc4\xc6\x6f\x9f\xf7\xf2\xe6" },
2344 }
2345 },
2346 { GCRY_CIPHER_AES192, 0,
2347 "\x8e\x73\xb0\xf7\xda\x0e\x64\x52\xc8\x10\xf3\x2b"
2348 "\x80\x90\x79\xe5\x62\xf8\xea\xd2\x52\x2c\x6b\x7b",
2349 "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
2350 { { "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96\xe9\x3d\x7e\x11\x73\x93\x17\x2a",
2351 16,
2352 "\xcd\xc8\x0d\x6f\xdd\xf1\x8c\xab\x34\xc2\x59\x09\xc9\x9a\x41\x74" },
2353 { "\xae\x2d\x8a\x57\x1e\x03\xac\x9c\x9e\xb7\x6f\xac\x45\xaf\x8e\x51",
2354 16,
2355 "\x67\xce\x7f\x7f\x81\x17\x36\x21\x96\x1a\x2b\x70\x17\x1d\x3d\x7a" },
2356 { "\x30\xc8\x1c\x46\xa3\x5c\xe4\x11\xe5\xfb\xc1\x19\x1a\x0a\x52\xef",
2357 16,
2358 "\x2e\x1e\x8a\x1d\xd5\x9b\x88\xb1\xc8\xe6\x0f\xed\x1e\xfa\xc4\xc9" },
2359 { "\xf6\x9f\x24\x45\xdf\x4f\x9b\x17\xad\x2b\x41\x7b\xe6\x6c\x37\x10",
2360 16,
2361 "\xc0\x5f\x9f\x9c\xa9\x83\x4f\xa0\x42\xae\x8f\xba\x58\x4b\x09\xff" },
2362 }
2363 },
2364 { GCRY_CIPHER_AES256, 0,
2365 "\x60\x3d\xeb\x10\x15\xca\x71\xbe\x2b\x73\xae\xf0\x85\x7d\x77\x81"
2366 "\x1f\x35\x2c\x07\x3b\x61\x08\xd7\x2d\x98\x10\xa3\x09\x14\xdf\xf4",
2367 "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
2368 { { "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96\xe9\x3d\x7e\x11\x73\x93\x17\x2a",
2369 16,
2370 "\xdc\x7e\x84\xbf\xda\x79\x16\x4b\x7e\xcd\x84\x86\x98\x5d\x38\x60" },
2371 { "\xae\x2d\x8a\x57\x1e\x03\xac\x9c\x9e\xb7\x6f\xac\x45\xaf\x8e\x51",
2372 16,
2373 "\x39\xff\xed\x14\x3b\x28\xb1\xc8\x32\x11\x3c\x63\x31\xe5\x40\x7b" },
2374 { "\x30\xc8\x1c\x46\xa3\x5c\xe4\x11\xe5\xfb\xc1\x19\x1a\x0a\x52\xef",
2375 16,
2376 "\xdf\x10\x13\x24\x15\xe5\x4b\x92\xa1\x3e\xd0\xa8\x26\x7a\xe2\xf9" },
2377 { "\xf6\x9f\x24\x45\xdf\x4f\x9b\x17\xad\x2b\x41\x7b\xe6\x6c\x37\x10",
2378 16,
2379 "\x75\xa3\x85\x74\x1a\xb9\xce\xf8\x20\x31\x62\x3d\x55\xb1\xe4\x71" }
2380 }
2381 },
2382 { GCRY_CIPHER_AES, 1,
2383 "\x2b\x7e\x15\x16\x28\xae\xd2\xa6\xab\xf7\x15\x88\x09\xcf\x4f\x3c",
2384 "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
2385 { { "\x6b",
2386 1,
2387 "\x3b"},
2388 { "\xc1",
2389 1,
2390 "\x79"},
2391 { "\xbe",
2392 1,
2393 "\x42"},
2394 { "\xe2",
2395 1,
2396 "\x4c"},
2397 }
2398 },
2399 { GCRY_CIPHER_AES192, 1,
2400 "\x8e\x73\xb0\xf7\xda\x0e\x64\x52\xc8\x10\xf3\x2b\x80\x90\x79\xe5"
2401 "\x62\xf8\xea\xd2\x52\x2c\x6b\x7b",
2402 "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
2403 { { "\x6b",
2404 1,
2405 "\xcd"},
2406 { "\xc1",
2407 1,
2408 "\xa2"},
2409 { "\xbe",
2410 1,
2411 "\x52"},
2412 { "\xe2",
2413 1,
2414 "\x1e"},
2415 }
2416 },
2417 { GCRY_CIPHER_AES256, 1,
2418 "\x60\x3d\xeb\x10\x15\xca\x71\xbe\x2b\x73\xae\xf0\x85\x7d\x77\x81"
2419 "\x1f\x35\x2c\x07\x3b\x61\x08\xd7\x2d\x98\x10\xa3\x09\x14\xdf\xf4",
2420 "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
2421 { { "\x6b",
2422 1,
2423 "\xdc"},
2424 { "\xc1",
2425 1,
2426 "\x1f"},
2427 { "\xbe",
2428 1,
2429 "\x1a"},
2430 { "\xe2",
2431 1,
2432 "\x85"},
2433 }
2434 },
2435 { GCRY_CIPHER_AES, 1,
2436 "\x3a\x6f\x91\x59\x26\x3f\xa6\xce\xf2\xa0\x75\xca\xfa\xce\x58\x17",
2437 "\x0f\xc2\x36\x62\xb7\xdb\xf7\x38\x27\xf0\xc7\xde\x32\x1c\xa3\x6e",
2438 { { "\x87\xef\xeb\x8d\x55\x9e\xd3\x36\x77\x28",
2439 10,
2440 "\x8e\x9c\x50\x42\x56\x14\xd5\x40\xce\x11"},
2441 }
2442 },
2443 { GCRY_CIPHER_AES192, 1,
2444 "\x53\x7e\x7b\xf6\x61\xfd\x40\x24\xa0\x24\x61\x3f\x15\xb1\x36\x90"
2445 "\xf7\xd0\xc8\x47\xc1\xe1\x89\x65",
2446 "\x3a\x81\xf9\xd9\xd3\xc1\x55\xb0\xca\xad\x5d\x73\x34\x94\x76\xfc",
2447 { { "\xd3\xd8\xb9\xb9\x84\xad\xc2\x42\x37\xee",
2448 10,
2449 "\x38\x79\xfe\xa7\x2a\xc9\x99\x29\xe5\x3a"},
2450 }
2451 },
2452 { GCRY_CIPHER_AES256, 1,
2453 "\xeb\xbb\x45\x66\xb5\xe1\x82\xe0\xf0\x72\x46\x6b\x0b\x31\x1d\xf3"
2454 "\x8f\x91\x75\xbc\x02\x13\xa5\x53\x0b\xce\x2e\xc4\xd7\x4f\x40\x0d",
2455 "\x09\x56\xa4\x8e\x01\x00\x2c\x9e\x16\x37\x6d\x6e\x30\x8d\xba\xd1",
2456 { { "\xb0\xfe\x25\xac\x8d\x3d\x28\xa2\xf4\x71",
2457 10,
2458 "\x63\x8c\x68\x23\xe7\x25\x6f\xb5\x62\x6e"},
2459 }
2460 },
2461 { GCRY_CIPHER_3DES, 1,
2462 "\xe3\x34\x7a\x6b\x0b\xc1\x15\x2c\x64\x2a\x25\xcb\xd3\xbc\x31\xab"
2463 "\xfb\xa1\x62\xa8\x1f\x19\x7c\x15",
2464 "\xb7\x40\xcc\x21\xe9\x25\xe3\xc8",
2465 { { "\xdb\xe9\x15\xfc\xb3\x3b\xca\x18\xef\x14",
2466 10,
2467 "\xf4\x80\x1a\x8d\x03\x9d\xb4\xca\x8f\xf6"},
2468 }
2469 },
2470 { GCRY_CIPHER_3DES, 1,
2471 "\x7c\xa2\x89\x38\xba\x6b\xec\x1f\xfe\xc7\x8f\x7c\xd6\x97\x61\x94"
2472 "\x7c\xa2\x89\x38\xba\x6b\xec\x1f",
2473 "\x95\x38\x96\x58\x6e\x49\xd3\x8f",
2474 { { "\x2e\xa9\x56\xd4\xa2\x11\xdb\x68\x59\xb7",
2475 10,
2476 "\xf2\x0e\x53\x66\x74\xa6\x6f\xa7\x38\x05"},
2477 }
2478 },
2479 #ifdef USE_GOST28147
2480 { GCRY_CIPHER_GOST28147_MESH, 0,
2481 "\x48\x0c\x74\x1b\x02\x6b\x55\xd5\xb6\x6d\xd7\x1d\x40\x48\x05\x6b"
2482 "\x6d\xeb\x3c\x29\x0f\x84\x80\x23\xee\x0d\x47\x77\xe3\xfe\x61\xc9",
2483 "\x1f\x3f\x82\x1e\x0d\xd8\x1e\x22",
2484 { { "\x8c\x9c\x44\x35\xfb\xe9\xa5\xa3\xa0\xae\x28\x56\x91\x10\x8e\x1e"
2485 "\xd2\xbb\x18\x53\x81\x27\x0d\xa6\x68\x59\x36\xc5\x81\x62\x9a\x8e"
2486 "\x7d\x50\xf1\x6f\x97\x62\x29\xec\x80\x51\xe3\x7d\x6c\xc4\x07\x95"
2487 "\x28\x63\xdc\xb4\xb9\x2d\xb8\x13\xb1\x05\xb5\xf9\xeb\x75\x37\x4e"
2488 "\xf7\xbf\x51\xf1\x98\x86\x43\xc4\xe4\x3d\x3e\xa7\x62\xec\x41\x59"
2489 "\xe0\xbd\xfb\xb6\xfd\xec\xe0\x77\x13\xd2\x59\x90\xa1\xb8\x97\x6b"
2490 "\x3d\x8b\x7d\xfc\x9d\xca\x82\x73\x32\x70\x0a\x74\x03\xc6\x0c\x26"
2491 "\x7f\x56\xf0\x9d\xb2\xeb\x71\x40\xd7\xc3\xb1\xa7\xc5\x1e\x20\x17"
2492 "\xb3\x50\x1d\x8a\x6e\x19\xcb\xbe\x20\x86\x2b\xd6\x1c\xfd\xb4\xb7"
2493 "\x5d\x9a\xb3\xe3\x7d\x15\x7a\x35\x01\x9f\x5d\x65\x89\x4b\x34\xc6"
2494 "\xf4\x81\x3f\x78\x30\xcf\xe9\x15\x90\x9a\xf9\xde\xba\x63\xd0\x19"
2495 "\x14\x66\x3c\xb9\xa4\xb2\x84\x94\x02\xcf\xce\x20\xcf\x76\xe7\xc5"
2496 "\x48\xf7\x69\x3a\x5d\xec\xaf\x41\xa7\x12\x64\x83\xf5\x99\x1e\x9e"
2497 "\xb2\xab\x86\x16\x00\x23\x8e\xe6\xd9\x80\x0b\x6d\xc5\x93\xe2\x5c"
2498 "\x8c\xd8\x5e\x5a\xae\x4a\x85\xfd\x76\x01\xea\x30\xf3\x78\x34\x10"
2499 "\x72\x51\xbc\x9f\x76\xce\x1f\xd4\x8f\x33\x50\x34\xc7\x4d\x7b\xcf"
2500 "\x91\x63\x7d\x82\x9e\xa1\x23\x45\xf5\x45\xac\x98\x7a\x48\xff\x64"
2501 "\xd5\x59\x47\xde\x2b\x3f\xfa\xec\x50\xe0\x81\x60\x8b\xc3\xfc\x80"
2502 "\x98\x17\xc7\xa3\xc2\x57\x3d\xab\x91\x67\xf5\xc4\xab\x92\xc8\xd6"
2503 "\x3b\x6b\x3f\xff\x15\x6b\xcf\x53\x65\x02\xf1\x74\xca\xa9\xbe\x24"
2504 "\xd2\xf0\xb7\x26\xa8\xd7\x6d\xed\x90\x36\x7b\x3e\x41\xa9\x7f\xa3"
2505 "\x1b\xf4\x43\xc5\x51\xbe\x28\x59\xe9\x45\x26\x49\x38\x32\xf8\xf3"
2506 "\x92\x6e\x30\xcc\xb0\xa0\xf9\x01\x14\xc8\xba\xd9\xf0\x2a\x29\xe2"
2507 "\x52\x9a\x76\x95\x3a\x16\x32\xec\xf4\x10\xec\xee\x47\x00\x70\x19"
2508 "\xe4\x72\x35\x66\x44\x53\x2d\xa2\xf3\xaa\x7e\x8a\x33\x13\xcd\xc8"
2509 "\xbf\x0e\x40\x90\x00\xe4\x42\xc3\x09\x84\xe1\x66\x17\xa2\xaf\x03"
2510 "\xab\x6b\xa1\xec\xfb\x17\x72\x81\xfe\x9a\x9f\xf4\xb2\x33\x1f\xae"
2511 "\x0c\xd1\x6a\xae\x19\xb8\xaf\xec\xe3\xea\x00\xf8\xac\x87\x07\x5f"
2512 "\x6d\xb0\xac\x6b\x22\x48\x36\xbf\x22\x18\xb0\x03\x9f\x6c\x70\x45"
2513 "\x36\xf0\x6b\xc6\xc2\xa5\x72\x2c\xd8\xe0\x27\x3d\xec\x56\x07\x05"
2514 "\x7d\x83\xa1\x65\x7d\x41\x5b\xcd\x77\x24\xe5\xaa\x76\x47\xd0\x50"
2515 "\xf6\xe7\xb5\x59\x75\x31\x27\xef\xd8\xa6\x4e\x7f\xb8\x40\xb1\xdf"
2516 "\x53\x14\xed\xf1\x68\x5f\xfc\x3f\x02\xdb\x05\xeb\x31\xe4\x2c\x7f"
2517 "\x32\xb5\x70\x8e\x75\x85\xa4\x5c\x16\x23\x37\xf2\x10\x79\xcb\xdc"
2518 "\xf8\x1c\x25\xc2\xa1\x3d\x9c\x33\x6c\xed\xc3\xe7\xf3\x02\x87\x82"
2519 "\x4e\xfb\xac\xb3\x2d\xfc\xf8\x0d\x1d\x4a\x39\xd4\xb3\x09\xbb\xe9"
2520 "\x25\xc7\xec\x6a\x87\x72\x84\xed\x12\x60\x19\x64\xeb\x16\x2a\x5b"
2521 "\x10\x76\x27\xff\x7b\xe4\xae\xe5\xa4\x04\x02\x7f\xbb\x0a\xb5\xf4"
2522 "\x05\xa5\x56\x1c\x53\x31\x7a\x93\xba\x16\x15\xab\x62\x60\xfc\xde"
2523 "\x72\x36\x6e\x28\xaf\x98\x0d\xe6\xf4\xde\x60\xa7\x7e\x06\x07\x86"
2524 "\xf3\x94\xb6\x6d\x0d\x93\xa6\xbc\x60\x70\x33\xac\x3f\xa1\xa8\x4a"
2525 "\x20\x61\xb6\xb5\x43\xa3\x15\x5a\x00\xbe\x76\x98\x57\x72\xab\x7a"
2526 "\x0e\x18\x93\x82\x3a\x18\x78\x6e\x71\x7b\x78\x4f\x7e\x8c\xde\x7a"
2527 "\x62\xb5\x0a\x7c\x45\x1d\x16\xd5\xc3\x8c\x9b\x25\xb4\x50\x90\xcd"
2528 "\x96\x93\xad\x0f\xd4\x43\xcb\x49\x0f\xfc\x5a\x31\xf4\x19\xb7\xd4"
2529 "\xeb\x4d\x40\x58\xd0\x3b\xc8\xe0\x4a\x54\x2f\xdb\x22\xc3\x29\x7b"
2530 "\x40\x90\x61\x43\xd3\x7e\xe2\x30\x2b\x48\x3c\xce\x90\x93\xb1\x8b"
2531 "\x31\x96\x65\x6d\x57\x8b\x9d\x4d\x53\xf0\x83\x1c\xe5\xa1\x9d\x55"
2532 "\xe3\xbf\x7e\xca\x1a\x74\x66\x14\xcc\x47\x43\xd9\xbb\xef\x97\x7d"
2533 "\xb7\x6e\xff\xf1\x22\xf8\x10\x2d\x3f\xcd\x49\x96\xd9\x09\x11\xb8"
2534 "\x33\xd0\x23\x9a\xfa\x16\xcb\x50\x26\x57\x24\x5c\x0e\xba\xf0\x3f"
2535 "\x37\x2f\xa3\xf7\x18\x57\x48\x48\x95\xcf\xef\x87\x67\x2a\xe9\xb6"
2536 "\x8a\x21\x36\x7f\xff\x48\x6c\x46\x35\x57\xf2\xbc\x48\x67\x8f\x63"
2537 "\x23\x78\x11\x2b\xc2\x08\xde\x51\xe8\x8b\x92\x29\xf9\x9a\x9e\xad"
2538 "\xed\x0f\xeb\xa2\xd2\x40\x92\xd4\xde\x62\x95\x76\xfd\x6e\x3c\xbf"
2539 "\xc0\xd7\x0d\xe5\x1b\xa4\xc7\x18\xe1\x58\xa4\x56\xef\x2e\x17\x1b"
2540 "\x75\xcb\xbc\xf9\x2a\x95\x71\xa7\x1d\x7f\xe7\x73\x63\x05\x6b\x19"
2541 "\x4c\xf4\x22\x14\xc4\x59\x88\x66\x92\x86\x61\x5c\x6a\xae\xec\x58"
2542 "\xff\xc9\xf2\x44\xd4\xa2\xf5\x98\xeb\x5f\x09\xbc\x8a\xbf\x3c\xb4"
2543 "\x3e\xb1\x20\x05\x44\x96\x79\x0a\x40\x92\x7f\x9d\xd1\xaf\xbc\x90"
2544 "\x95\x0a\x81\xd4\xa7\xc6\xb8\xe0\xe4\x39\x30\x1d\x79\xc0\xe5\xfa"
2545 "\xb4\xe9\x63\xb4\x09\x72\x3b\x3e\xd9\xf6\xd9\x10\x21\x18\x7e\xe5"
2546 "\xad\x81\xd7\xd5\x82\xd0\x8c\x3b\x38\x95\xf8\x92\x01\xa9\x92\x00"
2547 "\x70\xd1\xa7\x88\x77\x1f\x3a\xeb\xb5\xe4\xf5\x9d\xc7\x37\x86\xb2"
2548 "\x12\x46\x34\x19\x72\x8c\xf5\x8c\xf6\x78\x98\xe0\x7c\xd3\xf4",
2549 1039,
2550 "\x23\xc6\x7f\x20\xa1\x23\x58\xbc\x7b\x05\xdb\x21\x15\xcf\x96\x41"
2551 "\xc7\x88\xef\x76\x5c\x49\xdb\x42\xbf\xf3\xc0\xf5\xbd\x5d\xd9\x8e"
2552 "\xaf\x3d\xf4\xe4\xda\x88\xbd\xbc\x47\x5d\x76\x07\xc9\x5f\x54\x1d"
2553 "\x1d\x6a\xa1\x2e\x18\xd6\x60\x84\x02\x18\x37\x92\x92\x15\xab\x21"
2554 "\xee\x21\xcc\x71\x6e\x51\xd9\x2b\xcc\x81\x97\x3f\xeb\x45\x99\xb8"
2555 "\x1b\xda\xff\x90\xd3\x41\x06\x9c\x3f\xfb\xe4\xb2\xdc\xc9\x03\x0d"
2556 "\xa7\xae\xd7\x7d\x02\xb8\x32\xab\xf3\x65\xa3\x65\x6c\x4e\xe4\xa2"
2557 "\x5e\x9e\xee\xcd\xde\x79\x36\x6b\x1b\xe1\x3c\xdf\x10\xad\x4f\x02"
2558 "\xe1\x14\xaa\x09\xb4\x0b\x76\xeb\x69\x38\x20\x02\xcb\x8e\xc0\xdf"
2559 "\xca\x48\x74\xc3\x31\xad\x42\x2c\x51\x9b\xd0\x6a\xc1\x36\xd7\x21"
2560 "\xdf\xb0\x45\xba\xca\x7f\x35\x20\x28\xbb\xc1\x76\xfd\x43\x5d\x23"
2561 "\x7d\x31\x84\x1a\x97\x4d\x83\xaa\x7e\xf1\xc4\xe6\x83\xac\x0d\xef"
2562 "\xef\x3c\xa4\x7c\x48\xe4\xc8\xca\x0d\x7d\xea\x7c\x45\xd7\x73\x50"
2563 "\x25\x1d\x01\xc4\x02\x1a\xcd\xe0\x38\x5b\xa8\x5a\x16\x9a\x10\x59"
2564 "\x74\xd7\x19\xc6\xf3\xb5\x17\xf6\x59\x8d\x62\xaf\x44\xe8\xdc\xe9"
2565 "\xc1\x76\xf1\xd0\xbd\x29\xd7\xec\x1d\xac\x57\xdb\x1a\x3f\xd8\xf6"
2566 "\x6e\xb6\xe6\xdf\x36\xe7\x89\xce\x56\x35\x43\x1c\x7d\x57\x79\x0e"
2567 "\xd8\xf4\xd7\xa7\x0d\xc6\x8f\x91\x66\x67\x82\x0f\x49\xc9\xc5\x65"
2568 "\x81\xa1\x39\x5a\x53\x9f\x02\xa5\xd5\x36\x22\xa8\xa8\x1c\x37\x0e"
2569 "\x76\x46\xdf\xbd\x6a\xdb\xfc\x1b\xbd\x10\xb8\xb1\xbc\x72\x4c\x58"
2570 "\x4a\xda\x6d\x66\x00\xda\x7a\x66\xa0\xe7\x3b\x39\xa3\xf7\x05\x07"
2571 "\xfa\x21\x4b\xc7\x94\xc0\xd3\x7b\x19\x02\x5d\x4a\x10\xf1\xc2\x0f"
2572 "\x19\x68\x27\xc7\x7d\xbf\x55\x03\x57\x7d\xaf\x77\xae\x80\x2f\x7a"
2573 "\xe6\x1f\x4b\xdc\x15\x18\xc0\x62\xa1\xe8\xd9\x1c\x9e\x8c\x96\x39"
2574 "\xc1\xc4\x88\xf7\x0c\xe1\x04\x84\x68\x51\xce\xf1\x90\xda\x7f\x76"
2575 "\xc8\xc0\x88\xef\x8e\x15\x25\x3e\x7b\xe4\x79\xb5\x66\x2d\x9c\xd1"
2576 "\x13\xda\xd0\xd5\x46\xd5\x8d\x46\x18\x07\xee\xd8\xc9\x64\xe3\xbe"
2577 "\x0e\x68\x27\x09\x96\x26\xf6\xe2\x19\x61\x3f\xf4\x58\x27\x0a\xeb"
2578 "\xce\x7c\xb6\x68\x92\xe7\x12\x3b\x31\xd4\x48\xdf\x35\x8d\xf4\x86"
2579 "\x42\x2a\x15\x4b\xe8\x19\x1f\x26\x65\x9b\xa8\xda\x4b\x79\x1f\x8e"
2580 "\xe6\x13\x7e\x49\x8f\xc1\xce\xdc\x5e\x64\x74\xce\x02\x78\xe0\xcf"
2581 "\xa0\xed\x5e\x31\x74\xd1\xd0\xb4\xee\x70\x19\x14\x3c\x8f\x16\xa6"
2582 "\xcf\x12\x93\x15\x88\xeb\x91\x65\x76\x98\xfd\xa1\x94\x30\xba\x43"
2583 "\x62\x65\x40\x04\x77\x9e\xd6\xab\x8b\x0d\x93\x80\x50\x5f\xa2\x76"
2584 "\x20\xa7\xd6\x9c\x27\x15\x27\xbc\xa5\x5a\xbf\xe9\x92\x82\x05\xa8"
2585 "\x41\xe9\xb5\x60\xd5\xc0\xd7\x4b\xad\x38\xb2\xe9\xd1\xe5\x51\x5f"
2586 "\x24\x78\x24\x9a\x23\xd2\xc2\x48\xbd\x0e\xf1\x37\x72\x91\x87\xb0"
2587 "\x4e\xbd\x99\x6b\x2c\x01\xb6\x79\x69\xec\x0c\xed\xe5\x3f\x50\x64"
2588 "\x7c\xb9\xdd\xe1\x92\x81\xb5\xd0\xcb\x17\x83\x86\x8b\xea\x4f\x93"
2589 "\x08\xbc\x22\x0c\xef\xe8\x0d\xf5\x9e\x23\xe1\xf9\xb7\x6b\x45\x0b"
2590 "\xcb\xa9\xb6\x4d\x28\x25\xba\x3e\x86\xf2\x75\x47\x5d\x9d\x6b\xf6"
2591 "\x8a\x05\x58\x73\x3d\x00\xde\xfd\x69\xb1\x61\x16\xf5\x2e\xb0\x9f"
2592 "\x31\x6a\x00\xb9\xef\x71\x63\x47\xa3\xca\xe0\x40\xa8\x7e\x02\x04"
2593 "\xfe\xe5\xce\x48\x73\xe3\x94\xcf\xe2\xff\x29\x7e\xf6\x32\xbb\xb7"
2594 "\x55\x12\x21\x7a\x9c\x75\x04\x0c\xb4\x7c\xb0\x3d\x40\xb3\x11\x9a"
2595 "\x7a\x9a\x13\xfb\x77\xa7\x51\x68\xf7\x05\x47\x3b\x0f\x52\x5c\xe6"
2596 "\xc2\x99\x3a\x37\x54\x5c\x4f\x2b\xa7\x01\x08\x74\xbc\x91\xe3\xe2"
2597 "\xfe\x65\x94\xfd\x3d\x18\xe0\xf0\x62\xed\xc2\x10\x82\x9c\x58\x7f"
2598 "\xb2\xa3\x87\x8a\x74\xd9\xc1\xfb\x84\x28\x17\xc7\x2b\xcb\x53\x1f"
2599 "\x4e\x8a\x82\xfc\xb4\x3f\xc1\x47\x25\xf3\x21\xdc\x4c\x2d\x08\xfa"
2600 "\xe7\x0f\x03\xa9\x68\xde\x6b\x41\xa0\xf9\x41\x6c\x57\x4d\x3a\x0e"
2601 "\xea\x51\xca\x9f\x97\x11\x7d\xf6\x8e\x88\x63\x67\xc9\x65\x13\xca"
2602 "\x38\xed\x35\xbe\xf4\x27\xa9\xfc\xa9\xe6\xc3\x40\x86\x08\x39\x72"
2603 "\x37\xee\xb2\x87\x09\x96\xb7\x40\x87\x36\x92\xc1\x5d\x6a\x2c\x43"
2604 "\xca\x25\xc8\x35\x37\x2d\xb5\xa9\x27\x44\x50\xf2\x6d\x22\x75\x41"
2605 "\x77\x2a\xdb\xb1\x8c\x6d\x05\xe8\xc9\x99\xc7\x08\xf9\x14\x8f\x78"
2606 "\xa9\x8f\xc2\x5a\x7a\x65\xc5\xd8\x86\xbb\x72\x69\x6b\x6b\x45\x83"
2607 "\x5b\xb1\xf7\xcd\x16\x73\xee\xe9\x80\x85\xfe\x8e\xe1\xae\x53\x8f"
2608 "\xde\xbe\x48\x8b\x59\xef\xf6\x7e\xd8\xb5\xa8\x47\xc0\x4e\x15\x58"
2609 "\xca\xd3\x2f\xf8\x6c\xa6\x3d\x78\x4d\x7a\x54\xd6\x10\xe5\xcc\x05"
2610 "\xe2\x29\xb5\x86\x07\x39\x7d\x78\x8e\x5a\x8f\x83\x4c\xe7\x3d\x68"
2611 "\x3e\xe5\x02\xe6\x64\x4f\x5e\xb4\x49\x77\xf0\xc0\xfa\x6f\xc8\xfb"
2612 "\x9f\x84\x6f\x55\xfb\x30\x5e\x89\x93\xa9\xf3\xa6\xa3\xd7\x26\xbb"
2613 "\xd8\xa8\xd9\x95\x1d\xfe\xfc\xd7\xa8\x93\x66\x2f\x04\x53\x06\x64"
2614 "\x7f\x31\x29\xae\xb7\x9f\xba\xc4\x6d\x68\xd1\x24\x32\xf4\x11",
2615 },
2616 },
2617 "1.2.643.2.2.31.2"
2618 },
2619 #endif
2620 { GCRY_CIPHER_SM4, 0,
2621 "\x01\x23\x45\x67\x89\xab\xcd\xef\xfe\xdc\xba\x98\x76\x54\x32\x10",
2622 "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
2623 { { "\xaa\xaa\xaa\xaa\xbb\xbb\xbb\xbb\xcc\xcc\xcc\xcc\xdd\xdd\xdd\xdd"
2624 "\xee\xee\xee\xee\xff\xff\xff\xff\xaa\xaa\xaa\xaa\xbb\xbb\xbb\xbb",
2625 32,
2626 "\xac\x32\x36\xcb\x86\x1d\xd3\x16\xe6\x41\x3b\x4e\x3c\x75\x24\xb7"
2627 "\x69\xd4\xc5\x4e\xd4\x33\xb9\xa0\x34\x60\x09\xbe\xb3\x7b\x2b\x3f" },
2628 }
2629 },
2630 { GCRY_CIPHER_SM4, 0,
2631 "\xfe\xdc\xba\x98\x76\x54\x32\x10\x01\x23\x45\x67\x89\xab\xcd\xef",
2632 "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
2633 { { "\xaa\xaa\xaa\xaa\xbb\xbb\xbb\xbb\xcc\xcc\xcc\xcc\xdd\xdd\xdd\xdd"
2634 "\xee\xee\xee\xee\xff\xff\xff\xff\xaa\xaa\xaa\xaa\xbb\xbb\xbb\xbb",
2635 32,
2636 "\x5d\xcc\xcd\x25\xa8\x4b\xa1\x65\x60\xd7\xf2\x65\x88\x70\x68\x49"
2637 "\x0d\x9b\x86\xff\x20\xc3\xbf\xe1\x15\xff\xa0\x2c\xa6\x19\x2c\xc5" },
2638 }
2639 },
2640 };
2641 gcry_cipher_hd_t hde, hdd;
2642 unsigned char out[MAX_DATA_LEN];
2643 int i, j, keylen, blklen, mode;
2644 gcry_error_t err = 0;
2645
2646 if (verbose)
2647 fprintf (stderr, " Starting CFB checks.\n");
2648
2649 for (i = 0; i < sizeof (tv) / sizeof (tv[0]); i++)
2650 {
2651 if (gcry_cipher_test_algo (tv[i].algo) && in_fips_mode)
2652 {
2653 if (verbose)
2654 fprintf (stderr, " algorithm %d not available in fips mode\n",
2655 tv[i].algo);
2656 continue;
2657 }
2658
2659 mode = tv[i].cfb8? GCRY_CIPHER_MODE_CFB8 : GCRY_CIPHER_MODE_CFB;
2660
2661 if (verbose)
2662 fprintf (stderr, " checking CFB mode for %s [%i]\n",
2663 gcry_cipher_algo_name (tv[i].algo),
2664 tv[i].algo);
2665 err = gcry_cipher_open (&hde, tv[i].algo, mode, 0);
2666 if (!err)
2667 err = gcry_cipher_open (&hdd, tv[i].algo, mode, 0);
2668 if (err)
2669 {
2670 fail ("aes-cfb, gcry_cipher_open failed: %s\n", gpg_strerror (err));
2671 return;
2672 }
2673
2674 if (tv[i].oid)
2675 {
2676 err = gcry_cipher_set_sbox (hde, tv[i].oid);
2677 if (!err)
2678 err = gcry_cipher_set_sbox (hdd, tv[i].oid);
2679 if (err)
2680 {
2681 fail ("cfb, gcry_cipher_set_sbox failed: %s\n",
2682 gpg_strerror (err));
2683 gcry_cipher_close (hde);
2684 gcry_cipher_close (hdd);
2685 return;
2686 }
2687 }
2688 keylen = gcry_cipher_get_algo_keylen(tv[i].algo);
2689 if (!keylen)
2690 {
2691 fail ("aes-cfb, gcry_cipher_get_algo_keylen failed\n");
2692 return;
2693 }
2694
2695 err = gcry_cipher_setkey (hde, tv[i].key, keylen);
2696 if (!err)
2697 err = gcry_cipher_setkey (hdd, tv[i].key, keylen);
2698 if (err)
2699 {
2700 fail ("aes-cfb, gcry_cipher_setkey failed: %s\n",
2701 gpg_strerror (err));
2702 gcry_cipher_close (hde);
2703 gcry_cipher_close (hdd);
2704 return;
2705 }
2706
2707 blklen = gcry_cipher_get_algo_blklen(tv[i].algo);
2708 if (!blklen)
2709 {
2710 fail ("aes-cfb, gcry_cipher_get_algo_blklen failed\n");
2711 return;
2712 }
2713
2714 err = gcry_cipher_setiv (hde, tv[i].iv, blklen);
2715 if (!err)
2716 err = gcry_cipher_setiv (hdd, tv[i].iv, blklen);
2717 if (err)
2718 {
2719 fail ("aes-cfb, gcry_cipher_setiv failed: %s\n",
2720 gpg_strerror (err));
2721 gcry_cipher_close (hde);
2722 gcry_cipher_close (hdd);
2723 return;
2724 }
2725
2726 for (j = 0; tv[i].data[j].inlen; j++)
2727 {
2728 err = gcry_cipher_encrypt (hde, out, MAX_DATA_LEN,
2729 tv[i].data[j].plaintext,
2730 tv[i].data[j].inlen);
2731 if (err)
2732 {
2733 fail ("aes-cfb, gcry_cipher_encrypt (%d, %d) failed: %s\n",
2734 i, j, gpg_strerror (err));
2735 gcry_cipher_close (hde);
2736 gcry_cipher_close (hdd);
2737 return;
2738 }
2739
2740 if (memcmp (tv[i].data[j].out, out, tv[i].data[j].inlen)) {
2741 fail ("aes-cfb, encrypt mismatch entry %d:%d\n", i, j);
2742 }
2743 err = gcry_cipher_decrypt (hdd, out, tv[i].data[j].inlen, NULL, 0);
2744 if (err)
2745 {
2746 fail ("aes-cfb, gcry_cipher_decrypt (%d, %d) failed: %s\n",
2747 i, j, gpg_strerror (err));
2748 gcry_cipher_close (hde);
2749 gcry_cipher_close (hdd);
2750 return;
2751 }
2752
2753 if (memcmp (tv[i].data[j].plaintext, out, tv[i].data[j].inlen))
2754 fail ("aes-cfb, decrypt mismatch entry %d:%d\n", i, j);
2755 }
2756
2757 gcry_cipher_close (hde);
2758 gcry_cipher_close (hdd);
2759 }
2760 if (verbose)
2761 fprintf (stderr, " Completed CFB checks.\n");
2762 }
2763
2764 static void
check_ofb_cipher(void)2765 check_ofb_cipher (void)
2766 {
2767 static const struct tv
2768 {
2769 int algo;
2770 char key[MAX_DATA_LEN];
2771 char iv[MAX_DATA_LEN];
2772 struct data
2773 {
2774 unsigned char plaintext[MAX_DATA_LEN];
2775 unsigned int inlen;
2776 char out[MAX_DATA_LEN];
2777 }
2778 data[MAX_DATA_LEN];
2779 } tv[] =
2780 {
2781 /* http://csrc.nist.gov/publications/nistpubs/800-38a/sp800-38a.pdf */
2782 { GCRY_CIPHER_AES,
2783 "\x2b\x7e\x15\x16\x28\xae\xd2\xa6\xab\xf7\x15\x88\x09\xcf\x4f\x3c",
2784 "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
2785 { { "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96\xe9\x3d\x7e\x11\x73\x93\x17\x2a",
2786 16,
2787 "\x3b\x3f\xd9\x2e\xb7\x2d\xad\x20\x33\x34\x49\xf8\xe8\x3c\xfb\x4a" },
2788 { "\xae\x2d\x8a\x57\x1e\x03\xac\x9c\x9e\xb7\x6f\xac\x45\xaf\x8e\x51",
2789 16,
2790 "\x77\x89\x50\x8d\x16\x91\x8f\x03\xf5\x3c\x52\xda\xc5\x4e\xd8\x25"},
2791 { "\x30\xc8\x1c\x46\xa3\x5c\xe4\x11\xe5\xfb\xc1\x19\x1a\x0a\x52\xef",
2792 16,
2793 "\x97\x40\x05\x1e\x9c\x5f\xec\xf6\x43\x44\xf7\xa8\x22\x60\xed\xcc" },
2794 { "\xf6\x9f\x24\x45\xdf\x4f\x9b\x17\xad\x2b\x41\x7b\xe6\x6c\x37\x10",
2795 16,
2796 "\x30\x4c\x65\x28\xf6\x59\xc7\x78\x66\xa5\x10\xd9\xc1\xd6\xae\x5e" },
2797 }
2798 },
2799 { GCRY_CIPHER_AES192,
2800 "\x8e\x73\xb0\xf7\xda\x0e\x64\x52\xc8\x10\xf3\x2b"
2801 "\x80\x90\x79\xe5\x62\xf8\xea\xd2\x52\x2c\x6b\x7b",
2802 "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
2803 { { "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96\xe9\x3d\x7e\x11\x73\x93\x17\x2a",
2804 16,
2805 "\xcd\xc8\x0d\x6f\xdd\xf1\x8c\xab\x34\xc2\x59\x09\xc9\x9a\x41\x74" },
2806 { "\xae\x2d\x8a\x57\x1e\x03\xac\x9c\x9e\xb7\x6f\xac\x45\xaf\x8e\x51",
2807 16,
2808 "\xfc\xc2\x8b\x8d\x4c\x63\x83\x7c\x09\xe8\x17\x00\xc1\x10\x04\x01" },
2809 { "\x30\xc8\x1c\x46\xa3\x5c\xe4\x11\xe5\xfb\xc1\x19\x1a\x0a\x52\xef",
2810 16,
2811 "\x8d\x9a\x9a\xea\xc0\xf6\x59\x6f\x55\x9c\x6d\x4d\xaf\x59\xa5\xf2" },
2812 { "\xf6\x9f\x24\x45\xdf\x4f\x9b\x17\xad\x2b\x41\x7b\xe6\x6c\x37\x10",
2813 16,
2814 "\x6d\x9f\x20\x08\x57\xca\x6c\x3e\x9c\xac\x52\x4b\xd9\xac\xc9\x2a" },
2815 }
2816 },
2817 { GCRY_CIPHER_AES256,
2818 "\x60\x3d\xeb\x10\x15\xca\x71\xbe\x2b\x73\xae\xf0\x85\x7d\x77\x81"
2819 "\x1f\x35\x2c\x07\x3b\x61\x08\xd7\x2d\x98\x10\xa3\x09\x14\xdf\xf4",
2820 "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
2821 { { "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96\xe9\x3d\x7e\x11\x73\x93\x17\x2a",
2822 16,
2823 "\xdc\x7e\x84\xbf\xda\x79\x16\x4b\x7e\xcd\x84\x86\x98\x5d\x38\x60" },
2824 { "\xae\x2d\x8a\x57\x1e\x03\xac\x9c\x9e\xb7\x6f\xac\x45\xaf\x8e\x51",
2825 16,
2826 "\x4f\xeb\xdc\x67\x40\xd2\x0b\x3a\xc8\x8f\x6a\xd8\x2a\x4f\xb0\x8d" },
2827 { "\x30\xc8\x1c\x46\xa3\x5c\xe4\x11\xe5\xfb\xc1\x19\x1a\x0a\x52\xef",
2828 16,
2829 "\x71\xab\x47\xa0\x86\xe8\x6e\xed\xf3\x9d\x1c\x5b\xba\x97\xc4\x08" },
2830 { "\xf6\x9f\x24\x45\xdf\x4f\x9b\x17\xad\x2b\x41\x7b\xe6\x6c\x37\x10",
2831 16,
2832 "\x01\x26\x14\x1d\x67\xf3\x7b\xe8\x53\x8f\x5a\x8b\xe7\x40\xe4\x84" }
2833 }
2834 },
2835 { GCRY_CIPHER_SM4,
2836 "\x01\x23\x45\x67\x89\xab\xcd\xef\xfe\xdc\xba\x98\x76\x54\x32\x10",
2837 "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
2838 { { "\xaa\xaa\xaa\xaa\xbb\xbb\xbb\xbb\xcc\xcc\xcc\xcc\xdd\xdd\xdd\xdd"
2839 "\xee\xee\xee\xee\xff\xff\xff\xff\xaa\xaa\xaa\xaa\xbb\xbb\xbb\xbb",
2840 32,
2841 "\xac\x32\x36\xcb\x86\x1d\xd3\x16\xe6\x41\x3b\x4e\x3c\x75\x24\xb7"
2842 "\x1d\x01\xac\xa2\x48\x7c\xa5\x82\xcb\xf5\x46\x3e\x66\x98\x53\x9b" },
2843 }
2844 },
2845 { GCRY_CIPHER_SM4,
2846 "\xfe\xdc\xba\x98\x76\x54\x32\x10\x01\x23\x45\x67\x89\xab\xcd\xef",
2847 "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
2848 { { "\xaa\xaa\xaa\xaa\xbb\xbb\xbb\xbb\xcc\xcc\xcc\xcc\xdd\xdd\xdd\xdd"
2849 "\xee\xee\xee\xee\xff\xff\xff\xff\xaa\xaa\xaa\xaa\xbb\xbb\xbb\xbb",
2850 32,
2851 "\x5d\xcc\xcd\x25\xa8\x4b\xa1\x65\x60\xd7\xf2\x65\x88\x70\x68\x49"
2852 "\x33\xfa\x16\xbd\x5c\xd9\xc8\x56\xca\xca\xa1\xe1\x01\x89\x7a\x97" },
2853 }
2854 }
2855 };
2856 gcry_cipher_hd_t hde, hdd;
2857 unsigned char out[MAX_DATA_LEN];
2858 int i, j, keylen, blklen;
2859 gcry_error_t err = 0;
2860
2861 if (verbose)
2862 fprintf (stderr, " Starting OFB checks.\n");
2863
2864 for (i = 0; i < sizeof (tv) / sizeof (tv[0]); i++)
2865 {
2866 if (gcry_cipher_test_algo (tv[i].algo) && in_fips_mode)
2867 {
2868 if (verbose)
2869 fprintf (stderr, " algorithm %d not available in fips mode\n",
2870 tv[i].algo);
2871 continue;
2872 }
2873
2874 if (verbose)
2875 fprintf (stderr, " checking OFB mode for %s [%i]\n",
2876 gcry_cipher_algo_name (tv[i].algo),
2877 tv[i].algo);
2878 err = gcry_cipher_open (&hde, tv[i].algo, GCRY_CIPHER_MODE_OFB, 0);
2879 if (!err)
2880 err = gcry_cipher_open (&hdd, tv[i].algo, GCRY_CIPHER_MODE_OFB, 0);
2881 if (err)
2882 {
2883 fail ("aes-ofb, gcry_cipher_open failed: %s\n", gpg_strerror (err));
2884 return;
2885 }
2886
2887 keylen = gcry_cipher_get_algo_keylen(tv[i].algo);
2888 if (!keylen)
2889 {
2890 fail ("aes-ofb, gcry_cipher_get_algo_keylen failed\n");
2891 return;
2892 }
2893
2894 err = gcry_cipher_setkey (hde, tv[i].key, keylen);
2895 if (!err)
2896 err = gcry_cipher_setkey (hdd, tv[i].key, keylen);
2897 if (err)
2898 {
2899 fail ("aes-ofb, gcry_cipher_setkey failed: %s\n",
2900 gpg_strerror (err));
2901 gcry_cipher_close (hde);
2902 gcry_cipher_close (hdd);
2903 return;
2904 }
2905
2906 blklen = gcry_cipher_get_algo_blklen(tv[i].algo);
2907 if (!blklen)
2908 {
2909 fail ("aes-ofb, gcry_cipher_get_algo_blklen failed\n");
2910 return;
2911 }
2912
2913 err = gcry_cipher_setiv (hde, tv[i].iv, blklen);
2914 if (!err)
2915 err = gcry_cipher_setiv (hdd, tv[i].iv, blklen);
2916 if (err)
2917 {
2918 fail ("aes-ofb, gcry_cipher_setiv failed: %s\n",
2919 gpg_strerror (err));
2920 gcry_cipher_close (hde);
2921 gcry_cipher_close (hdd);
2922 return;
2923 }
2924
2925 for (j = 0; tv[i].data[j].inlen; j++)
2926 {
2927 err = gcry_cipher_encrypt (hde, out, MAX_DATA_LEN,
2928 tv[i].data[j].plaintext,
2929 tv[i].data[j].inlen);
2930 if (err)
2931 {
2932 fail ("aes-ofb, gcry_cipher_encrypt (%d, %d) failed: %s\n",
2933 i, j, gpg_strerror (err));
2934 gcry_cipher_close (hde);
2935 gcry_cipher_close (hdd);
2936 return;
2937 }
2938
2939 if (memcmp (tv[i].data[j].out, out, tv[i].data[j].inlen))
2940 fail ("aes-ofb, encrypt mismatch entry %d:%d\n", i, j);
2941
2942 err = gcry_cipher_decrypt (hdd, out, tv[i].data[j].inlen, NULL, 0);
2943 if (err)
2944 {
2945 fail ("aes-ofb, gcry_cipher_decrypt (%d, %d) failed: %s\n",
2946 i, j, gpg_strerror (err));
2947 gcry_cipher_close (hde);
2948 gcry_cipher_close (hdd);
2949 return;
2950 }
2951
2952 if (memcmp (tv[i].data[j].plaintext, out, tv[i].data[j].inlen))
2953 fail ("aes-ofb, decrypt mismatch entry %d:%d\n", i, j);
2954 }
2955
2956 err = gcry_cipher_reset(hde);
2957 if (!err)
2958 err = gcry_cipher_reset(hdd);
2959 if (err)
2960 {
2961 fail ("aes-ofb, gcry_cipher_reset (%d, %d) failed: %s\n",
2962 i, j, gpg_strerror (err));
2963 gcry_cipher_close (hde);
2964 gcry_cipher_close (hdd);
2965 return;
2966 }
2967
2968 /* gcry_cipher_reset clears the IV */
2969 err = gcry_cipher_setiv (hde, tv[i].iv, blklen);
2970 if (!err)
2971 err = gcry_cipher_setiv (hdd, tv[i].iv, blklen);
2972 if (err)
2973 {
2974 fail ("aes-ofb, gcry_cipher_setiv failed: %s\n",
2975 gpg_strerror (err));
2976 gcry_cipher_close (hde);
2977 gcry_cipher_close (hdd);
2978 return;
2979 }
2980
2981 /* this time we encrypt and decrypt one byte at a time */
2982 for (j = 0; tv[i].data[j].inlen; j++)
2983 {
2984 int byteNum;
2985 for (byteNum = 0; byteNum < tv[i].data[j].inlen; ++byteNum)
2986 {
2987 err = gcry_cipher_encrypt (hde, out+byteNum, 1,
2988 (tv[i].data[j].plaintext) + byteNum,
2989 1);
2990 if (err)
2991 {
2992 fail ("aes-ofb, gcry_cipher_encrypt (%d, %d) failed: %s\n",
2993 i, j, gpg_strerror (err));
2994 gcry_cipher_close (hde);
2995 gcry_cipher_close (hdd);
2996 return;
2997 }
2998 }
2999
3000 if (memcmp (tv[i].data[j].out, out, tv[i].data[j].inlen))
3001 fail ("aes-ofb, encrypt mismatch entry %d:%d\n", i, j);
3002
3003 for (byteNum = 0; byteNum < tv[i].data[j].inlen; ++byteNum)
3004 {
3005 err = gcry_cipher_decrypt (hdd, out+byteNum, 1, NULL, 0);
3006 if (err)
3007 {
3008 fail ("aes-ofb, gcry_cipher_decrypt (%d, %d) failed: %s\n",
3009 i, j, gpg_strerror (err));
3010 gcry_cipher_close (hde);
3011 gcry_cipher_close (hdd);
3012 return;
3013 }
3014 }
3015
3016 if (memcmp (tv[i].data[j].plaintext, out, tv[i].data[j].inlen))
3017 fail ("aes-ofb, decrypt mismatch entry %d:%d\n", i, j);
3018 }
3019
3020 gcry_cipher_close (hde);
3021 gcry_cipher_close (hdd);
3022 }
3023 if (verbose)
3024 fprintf (stderr, " Completed OFB checks.\n");
3025 }
3026
3027 static void
_check_gcm_cipher(unsigned int step)3028 _check_gcm_cipher (unsigned int step)
3029 {
3030 #define MAX_GCM_DATA_LEN (256 + 32)
3031 static const struct tv
3032 {
3033 int algo;
3034 char key[MAX_DATA_LEN];
3035 char iv[MAX_DATA_LEN];
3036 int ivlen;
3037 unsigned char aad[MAX_DATA_LEN];
3038 int aadlen;
3039 unsigned char plaintext[MAX_GCM_DATA_LEN];
3040 int inlen;
3041 char out[MAX_GCM_DATA_LEN];
3042 char tag[MAX_DATA_LEN];
3043 int taglen;
3044 int should_fail;
3045 } tv[] =
3046 {
3047 /* http://csrc.nist.gov/groups/ST/toolkit/BCM/documents/proposedmodes/gcm/gcm-revised-spec.pdf */
3048 { GCRY_CIPHER_AES,
3049 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
3050 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 12,
3051 "", 0,
3052 "",
3053 0,
3054 "",
3055 "\x58\xe2\xfc\xce\xfa\x7e\x30\x61\x36\x7f\x1d\x57\xa4\xe7\x45\x5a" },
3056 { GCRY_CIPHER_AES,
3057 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
3058 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 12,
3059 "", 0,
3060 "",
3061 0,
3062 "",
3063 "\x58\xe2\xfc\xce\xfa\x7e\x30\x61\x36\x7f\x1d\x57\xa4\xe7\x45",
3064 15 },
3065 { GCRY_CIPHER_AES,
3066 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
3067 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 12,
3068 "", 0,
3069 "",
3070 0,
3071 "",
3072 "\x58\xe2\xfc\xce\xfa\x7e\x30\x61\x36\x7f\x1d\x57\xa4\xe7",
3073 14 },
3074 { GCRY_CIPHER_AES,
3075 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
3076 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 12,
3077 "", 0,
3078 "",
3079 0,
3080 "",
3081 "\x58\xe2\xfc\xce\xfa\x7e\x30\x61\x36\x7f\x1d\x57\xa4",
3082 13 },
3083 { GCRY_CIPHER_AES,
3084 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
3085 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 12,
3086 "", 0,
3087 "",
3088 0,
3089 "",
3090 "\x58\xe2\xfc\xce\xfa\x7e\x30\x61\x36\x7f\x1d\x57",
3091 12 },
3092 { GCRY_CIPHER_AES,
3093 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
3094 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 12,
3095 "", 0,
3096 "",
3097 0,
3098 "",
3099 "\x58\xe2\xfc\xce\xfa\x7e\x30\x61\x36\x7f\x1d",
3100 11, 1 },
3101 { GCRY_CIPHER_AES,
3102 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
3103 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 12,
3104 "", 0,
3105 "",
3106 0,
3107 "",
3108 "\x58\xe2\xfc\xce\xfa\x7e\x30\x61",
3109 8 },
3110 { GCRY_CIPHER_AES,
3111 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
3112 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 12,
3113 "", 0,
3114 "",
3115 0,
3116 "",
3117 "\x58\xe2\xfc\xce",
3118 4 },
3119 { GCRY_CIPHER_AES,
3120 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
3121 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 12,
3122 "", 0,
3123 "",
3124 0,
3125 "",
3126 "\x58",
3127 1, 1 },
3128 { GCRY_CIPHER_AES,
3129 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
3130 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 12,
3131 "", 0,
3132 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
3133 16,
3134 "\x03\x88\xda\xce\x60\xb6\xa3\x92\xf3\x28\xc2\xb9\x71\xb2\xfe\x78",
3135 "\xab\x6e\x47\xd4\x2c\xec\x13\xbd\xf5\x3a\x67\xb2\x12\x57\xbd\xdf" },
3136 { GCRY_CIPHER_AES,
3137 "\xfe\xff\xe9\x92\x86\x65\x73\x1c\x6d\x6a\x8f\x94\x67\x30\x83\x08",
3138 "\xca\xfe\xba\xbe\xfa\xce\xdb\xad\xde\xca\xf8\x88", 12,
3139 "", 0,
3140 "\xd9\x31\x32\x25\xf8\x84\x06\xe5\xa5\x59\x09\xc5\xaf\xf5\x26\x9a"
3141 "\x86\xa7\xa9\x53\x15\x34\xf7\xda\x2e\x4c\x30\x3d\x8a\x31\x8a\x72"
3142 "\x1c\x3c\x0c\x95\x95\x68\x09\x53\x2f\xcf\x0e\x24\x49\xa6\xb5\x25"
3143 "\xb1\x6a\xed\xf5\xaa\x0d\xe6\x57\xba\x63\x7b\x39\x1a\xaf\xd2\x55",
3144 64,
3145 "\x42\x83\x1e\xc2\x21\x77\x74\x24\x4b\x72\x21\xb7\x84\xd0\xd4\x9c"
3146 "\xe3\xaa\x21\x2f\x2c\x02\xa4\xe0\x35\xc1\x7e\x23\x29\xac\xa1\x2e"
3147 "\x21\xd5\x14\xb2\x54\x66\x93\x1c\x7d\x8f\x6a\x5a\xac\x84\xaa\x05"
3148 "\x1b\xa3\x0b\x39\x6a\x0a\xac\x97\x3d\x58\xe0\x91\x47\x3f\x59\x85",
3149 "\x4d\x5c\x2a\xf3\x27\xcd\x64\xa6\x2c\xf3\x5a\xbd\x2b\xa6\xfa\xb4" },
3150 { GCRY_CIPHER_AES,
3151 "\xfe\xff\xe9\x92\x86\x65\x73\x1c\x6d\x6a\x8f\x94\x67\x30\x83\x08",
3152 "\xca\xfe\xba\xbe\xfa\xce\xdb\xad\xde\xca\xf8\x88", 12,
3153 "\xfe\xed\xfa\xce\xde\xad\xbe\xef\xfe\xed\xfa\xce\xde\xad\xbe\xef"
3154 "\xab\xad\xda\xd2", 20,
3155 "\xd9\x31\x32\x25\xf8\x84\x06\xe5\xa5\x59\x09\xc5\xaf\xf5\x26\x9a"
3156 "\x86\xa7\xa9\x53\x15\x34\xf7\xda\x2e\x4c\x30\x3d\x8a\x31\x8a\x72"
3157 "\x1c\x3c\x0c\x95\x95\x68\x09\x53\x2f\xcf\x0e\x24\x49\xa6\xb5\x25"
3158 "\xb1\x6a\xed\xf5\xaa\x0d\xe6\x57\xba\x63\x7b\x39",
3159 60,
3160 "\x42\x83\x1e\xc2\x21\x77\x74\x24\x4b\x72\x21\xb7\x84\xd0\xd4\x9c"
3161 "\xe3\xaa\x21\x2f\x2c\x02\xa4\xe0\x35\xc1\x7e\x23\x29\xac\xa1\x2e"
3162 "\x21\xd5\x14\xb2\x54\x66\x93\x1c\x7d\x8f\x6a\x5a\xac\x84\xaa\x05"
3163 "\x1b\xa3\x0b\x39\x6a\x0a\xac\x97\x3d\x58\xe0\x91\x47\x3f\x59\x85",
3164 "\x5b\xc9\x4f\xbc\x32\x21\xa5\xdb\x94\xfa\xe9\x5a\xe7\x12\x1a\x47" },
3165 { GCRY_CIPHER_AES,
3166 "\xfe\xff\xe9\x92\x86\x65\x73\x1c\x6d\x6a\x8f\x94\x67\x30\x83\x08",
3167 "\xca\xfe\xba\xbe\xfa\xce\xdb\xad", 8,
3168 "\xfe\xed\xfa\xce\xde\xad\xbe\xef\xfe\xed\xfa\xce\xde\xad\xbe\xef"
3169 "\xab\xad\xda\xd2", 20,
3170 "\xd9\x31\x32\x25\xf8\x84\x06\xe5\xa5\x59\x09\xc5\xaf\xf5\x26\x9a"
3171 "\x86\xa7\xa9\x53\x15\x34\xf7\xda\x2e\x4c\x30\x3d\x8a\x31\x8a\x72"
3172 "\x1c\x3c\x0c\x95\x95\x68\x09\x53\x2f\xcf\x0e\x24\x49\xa6\xb5\x25"
3173 "\xb1\x6a\xed\xf5\xaa\x0d\xe6\x57\xba\x63\x7b\x39",
3174 60,
3175 "\x61\x35\x3b\x4c\x28\x06\x93\x4a\x77\x7f\xf5\x1f\xa2\x2a\x47\x55"
3176 "\x69\x9b\x2a\x71\x4f\xcd\xc6\xf8\x37\x66\xe5\xf9\x7b\x6c\x74\x23"
3177 "\x73\x80\x69\x00\xe4\x9f\x24\xb2\x2b\x09\x75\x44\xd4\x89\x6b\x42"
3178 "\x49\x89\xb5\xe1\xeb\xac\x0f\x07\xc2\x3f\x45\x98",
3179 "\x36\x12\xd2\xe7\x9e\x3b\x07\x85\x56\x1b\xe1\x4a\xac\xa2\xfc\xcb" },
3180 { GCRY_CIPHER_AES,
3181 "\xfe\xff\xe9\x92\x86\x65\x73\x1c\x6d\x6a\x8f\x94\x67\x30\x83\x08",
3182 "\x93\x13\x22\x5d\xf8\x84\x06\xe5\x55\x90\x9c\x5a\xff\x52\x69\xaa"
3183 "\x6a\x7a\x95\x38\x53\x4f\x7d\xa1\xe4\xc3\x03\xd2\xa3\x18\xa7\x28"
3184 "\xc3\xc0\xc9\x51\x56\x80\x95\x39\xfc\xf0\xe2\x42\x9a\x6b\x52\x54"
3185 "\x16\xae\xdb\xf5\xa0\xde\x6a\x57\xa6\x37\xb3\x9b", 60,
3186 "\xfe\xed\xfa\xce\xde\xad\xbe\xef\xfe\xed\xfa\xce\xde\xad\xbe\xef"
3187 "\xab\xad\xda\xd2", 20,
3188 "\xd9\x31\x32\x25\xf8\x84\x06\xe5\xa5\x59\x09\xc5\xaf\xf5\x26\x9a"
3189 "\x86\xa7\xa9\x53\x15\x34\xf7\xda\x2e\x4c\x30\x3d\x8a\x31\x8a\x72"
3190 "\x1c\x3c\x0c\x95\x95\x68\x09\x53\x2f\xcf\x0e\x24\x49\xa6\xb5\x25"
3191 "\xb1\x6a\xed\xf5\xaa\x0d\xe6\x57\xba\x63\x7b\x39",
3192 60,
3193 "\x8c\xe2\x49\x98\x62\x56\x15\xb6\x03\xa0\x33\xac\xa1\x3f\xb8\x94"
3194 "\xbe\x91\x12\xa5\xc3\xa2\x11\xa8\xba\x26\x2a\x3c\xca\x7e\x2c\xa7"
3195 "\x01\xe4\xa9\xa4\xfb\xa4\x3c\x90\xcc\xdc\xb2\x81\xd4\x8c\x7c\x6f"
3196 "\xd6\x28\x75\xd2\xac\xa4\x17\x03\x4c\x34\xae\xe5",
3197 "\x61\x9c\xc5\xae\xff\xfe\x0b\xfa\x46\x2a\xf4\x3c\x16\x99\xd0\x50" },
3198 { GCRY_CIPHER_AES192,
3199 "\xfe\xff\xe9\x92\x86\x65\x73\x1c\x6d\x6a\x8f\x94\x67\x30\x83\x08"
3200 "\xfe\xff\xe9\x92\x86\x65\x73\x1c",
3201 "\x93\x13\x22\x5d\xf8\x84\x06\xe5\x55\x90\x9c\x5a\xff\x52\x69\xaa"
3202 "\x6a\x7a\x95\x38\x53\x4f\x7d\xa1\xe4\xc3\x03\xd2\xa3\x18\xa7\x28"
3203 "\xc3\xc0\xc9\x51\x56\x80\x95\x39\xfc\xf0\xe2\x42\x9a\x6b\x52\x54"
3204 "\x16\xae\xdb\xf5\xa0\xde\x6a\x57\xa6\x37\xb3\x9b", 60,
3205 "\xfe\xed\xfa\xce\xde\xad\xbe\xef\xfe\xed\xfa\xce\xde\xad\xbe\xef"
3206 "\xab\xad\xda\xd2", 20,
3207 "\xd9\x31\x32\x25\xf8\x84\x06\xe5\xa5\x59\x09\xc5\xaf\xf5\x26\x9a"
3208 "\x86\xa7\xa9\x53\x15\x34\xf7\xda\x2e\x4c\x30\x3d\x8a\x31\x8a\x72"
3209 "\x1c\x3c\x0c\x95\x95\x68\x09\x53\x2f\xcf\x0e\x24\x49\xa6\xb5\x25"
3210 "\xb1\x6a\xed\xf5\xaa\x0d\xe6\x57\xba\x63\x7b\x39",
3211 60,
3212 "\xd2\x7e\x88\x68\x1c\xe3\x24\x3c\x48\x30\x16\x5a\x8f\xdc\xf9\xff"
3213 "\x1d\xe9\xa1\xd8\xe6\xb4\x47\xef\x6e\xf7\xb7\x98\x28\x66\x6e\x45"
3214 "\x81\xe7\x90\x12\xaf\x34\xdd\xd9\xe2\xf0\x37\x58\x9b\x29\x2d\xb3"
3215 "\xe6\x7c\x03\x67\x45\xfa\x22\xe7\xe9\xb7\x37\x3b",
3216 "\xdc\xf5\x66\xff\x29\x1c\x25\xbb\xb8\x56\x8f\xc3\xd3\x76\xa6\xd9" },
3217 { GCRY_CIPHER_AES256,
3218 "\xfe\xff\xe9\x92\x86\x65\x73\x1c\x6d\x6a\x8f\x94\x67\x30\x83\x08"
3219 "\xfe\xff\xe9\x92\x86\x65\x73\x1c\x6d\x6a\x8f\x94\x67\x30\x83\x08",
3220 "\x93\x13\x22\x5d\xf8\x84\x06\xe5\x55\x90\x9c\x5a\xff\x52\x69\xaa"
3221 "\x6a\x7a\x95\x38\x53\x4f\x7d\xa1\xe4\xc3\x03\xd2\xa3\x18\xa7\x28"
3222 "\xc3\xc0\xc9\x51\x56\x80\x95\x39\xfc\xf0\xe2\x42\x9a\x6b\x52\x54"
3223 "\x16\xae\xdb\xf5\xa0\xde\x6a\x57\xa6\x37\xb3\x9b", 60,
3224 "\xfe\xed\xfa\xce\xde\xad\xbe\xef\xfe\xed\xfa\xce\xde\xad\xbe\xef"
3225 "\xab\xad\xda\xd2", 20,
3226 "\xd9\x31\x32\x25\xf8\x84\x06\xe5\xa5\x59\x09\xc5\xaf\xf5\x26\x9a"
3227 "\x86\xa7\xa9\x53\x15\x34\xf7\xda\x2e\x4c\x30\x3d\x8a\x31\x8a\x72"
3228 "\x1c\x3c\x0c\x95\x95\x68\x09\x53\x2f\xcf\x0e\x24\x49\xa6\xb5\x25"
3229 "\xb1\x6a\xed\xf5\xaa\x0d\xe6\x57\xba\x63\x7b\x39",
3230 60,
3231 "\x5a\x8d\xef\x2f\x0c\x9e\x53\xf1\xf7\x5d\x78\x53\x65\x9e\x2a\x20"
3232 "\xee\xb2\xb2\x2a\xaf\xde\x64\x19\xa0\x58\xab\x4f\x6f\x74\x6b\xf4"
3233 "\x0f\xc0\xc3\xb7\x80\xf2\x44\x45\x2d\xa3\xeb\xf1\xc5\xd8\x2c\xde"
3234 "\xa2\x41\x89\x97\x20\x0e\xf8\x2e\x44\xae\x7e\x3f",
3235 "\xa4\x4a\x82\x66\xee\x1c\x8e\xb0\xc8\xb5\xd4\xcf\x5a\xe9\xf1\x9a" },
3236 { GCRY_CIPHER_AES256,
3237 "\xfe\xff\xe9\x92\x86\x65\x73\x1c\x6d\x6a\x8f\x94\x67\x30\x83\x08"
3238 "\xfe\xff\xe9\x92\x86\x65\x73\x1c\x6d\x6a\x8f\x94\x67\x30\x83\x08",
3239 "\xca\xfe\xba\xbe\xfa\xce\xdb\xad\xde\xca\xf8\x88", 12,
3240 "\xfe\xed\xfa\xce\xde\xad\xbe\xef\xfe\xed\xfa\xce\xde\xad\xbe\xef"
3241 "\xab\xad\xda\xd2", 20,
3242 "\xd9\x31\x32\x25\xf8\x84\x06\xe5\xa5\x59\x09\xc5\xaf\xf5\x26\x9a"
3243 "\x86\xa7\xa9\x53\x15\x34\xf7\xda\x2e\x4c\x30\x3d\x8a\x31\x8a\x72"
3244 "\x1c\x3c\x0c\x95\x95\x68\x09\x53\x2f\xcf\x0e\x24\x49\xa6\xb5\x25"
3245 "\xb1\x6a\xed\xf5\xaa\x0d\xe6\x57\xba\x63\x7b\x39",
3246 60,
3247 "\x52\x2d\xc1\xf0\x99\x56\x7d\x07\xf4\x7f\x37\xa3\x2a\x84\x42\x7d"
3248 "\x64\x3a\x8c\xdc\xbf\xe5\xc0\xc9\x75\x98\xa2\xbd\x25\x55\xd1\xaa"
3249 "\x8c\xb0\x8e\x48\x59\x0d\xbb\x3d\xa7\xb0\x8b\x10\x56\x82\x88\x38"
3250 "\xc5\xf6\x1e\x63\x93\xba\x7a\x0a\xbc\xc9\xf6\x62",
3251 "\x76\xfc\x6e\xce\x0f\x4e\x17\x68\xcd\xdf\x88\x53\xbb\x2d\x55\x1b" },
3252 /* Test vectors for overflowing CTR. */
3253 /* After setiv, ctr_low: 0xffffffff */
3254 { GCRY_CIPHER_AES256,
3255 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3256 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
3257 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x86\xdd\x40\xe7",
3258 16,
3259 "", 0,
3260 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3261 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3262 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3263 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3264 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3265 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3266 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3267 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3268 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3269 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3270 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3271 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3272 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3273 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3274 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3275 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3276 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3277 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
3278 288,
3279 "\x7d\x6e\x38\xfd\xd0\x04\x9d\x28\xdf\x4a\x10\x3f\xa3\x9e\xf8\xf8"
3280 "\x6c\x2c\x10\xa7\x91\xab\xc0\x86\xd4\x6d\x69\xea\x58\xc4\xf9\xc0"
3281 "\xd4\xee\xc2\xb0\x9d\x36\xae\xe7\xc9\xa9\x1f\x71\xa8\xee\xa2\x1d"
3282 "\x20\xfd\x79\xc7\xd9\xc4\x90\x51\x38\x97\xb6\x9f\x55\xea\xf3\xf0"
3283 "\x78\xb4\xd3\x8c\xa9\x9b\x32\x7d\x19\x36\x96\xbc\x8e\xab\x80\x9f"
3284 "\x61\x56\xcc\xbd\x3a\x80\xc6\x69\x37\x0a\x89\x89\x21\x82\xb7\x79"
3285 "\x6d\xe9\xb4\x34\xc4\x31\xe0\xbe\x71\xad\xf3\x50\x05\xb2\x61\xab"
3286 "\xb3\x1a\x80\x57\xcf\xe1\x11\x26\xcb\xa9\xd1\xf6\x58\x46\xf1\x69"
3287 "\xa2\xb8\x42\x3c\xe8\x28\x13\xca\x58\xd9\x28\x99\xf8\xc8\x17\x32"
3288 "\x4a\xf9\xb3\x4c\x7a\x47\xad\xe4\x77\x64\xec\x70\xa1\x01\x0b\x88"
3289 "\xe7\x30\x0b\xbd\x66\x25\x39\x1e\x51\x67\xee\xec\xdf\xb8\x24\x5d"
3290 "\x7f\xcb\xee\x7a\x4e\xa9\x93\xf0\xa1\x84\x7b\xfe\x5a\xe3\x86\xb2"
3291 "\xfb\xcd\x39\xe7\x1e\x5e\x48\x65\x4b\x50\x2b\x4a\x99\x46\x3f\x6f"
3292 "\xdb\xd9\x97\xdb\xe5\x6d\xa4\xdd\x6c\x18\x64\x5e\xae\x7e\x2c\xd3"
3293 "\xb4\xf3\x57\x5c\xb5\xf8\x7f\xe5\x87\xb5\x35\xdb\x80\x38\x6e\x2c"
3294 "\x5c\xdd\xeb\x7c\x63\xac\xe4\xb5\x5a\x6a\x40\x6d\x72\x69\x9a\xa9"
3295 "\x8f\x5e\x93\x91\x4d\xce\xeb\x87\xf5\x25\xed\x75\x6b\x3b\x1a\xf2"
3296 "\x0c\xd2\xa4\x10\x45\xd2\x87\xae\x29\x6d\xeb\xea\x66\x5f\xa0\xc2",
3297 "\x8c\x22\xe3\xda\x9d\x94\x8a\xbe\x8a\xbc\x55\x2c\x94\x63\x44\x40" },
3298 /* After setiv, ctr_low: 0xfffffffe */
3299 { GCRY_CIPHER_AES256,
3300 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3301 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
3302 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x8d\xd1\xc1\xdf",
3303 16,
3304 "", 0,
3305 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3306 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3307 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3308 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3309 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3310 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3311 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3312 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3313 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3314 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3315 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3316 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3317 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3318 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3319 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3320 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3321 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3322 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
3323 288,
3324 "\xac\x6a\x10\x3f\xe2\x8d\xed\x27\x55\x14\xca\x1f\x03\x67\x0a\xa8"
3325 "\xa1\x07\xbf\x00\x73\x5b\x64\xef\xac\x30\x83\x81\x48\x4c\xaa\xd5"
3326 "\xff\xca\xef\x2f\x77\xbe\xfe\x1b\x20\x5c\x86\x19\xc7\xf9\x11\x99"
3327 "\x27\xc5\x57\xa7\x0a\xc2\xa8\x05\xd9\x07\x2b\xb9\x38\xa4\xef\x58"
3328 "\x92\x74\xcf\x89\xc7\xba\xfc\xb9\x70\xac\x86\xe2\x31\xba\x7c\xf9"
3329 "\xc4\xe2\xe0\x4c\x1b\xe4\x3f\x75\x83\x5c\x40\x0e\xa4\x13\x8b\x04"
3330 "\x60\x78\x57\x29\xbb\xe6\x61\x93\xe3\x16\xf9\x58\x07\x75\xd0\x96"
3331 "\xfb\x8f\x6d\x1e\x49\x0f\xd5\x31\x9e\xee\x31\xe6\x0a\x85\x93\x49"
3332 "\x22\xcf\xd6\x1b\x40\x44\x63\x9c\x95\xaf\xf0\x44\x23\x51\x37\x92"
3333 "\x0d\xa0\x22\x37\xb9\x6d\x13\xf9\x78\xba\x27\x27\xed\x08\x7e\x35"
3334 "\xe4\xe2\x28\xeb\x0e\xbe\x3d\xce\x89\x93\x35\x84\x0f\xa0\xf9\x8d"
3335 "\x94\xe9\x5a\xec\xd4\x0d\x1f\x5c\xbe\x6f\x8e\x6a\x4d\x10\x65\xbb"
3336 "\xc7\x0b\xa0\xd5\x5c\x20\x80\x0b\x4a\x43\xa6\xe1\xb0\xe0\x56\x6a"
3337 "\xde\x90\xe0\x6a\x45\xe7\xc2\xd2\x69\x9b\xc6\x62\x11\xe3\x2b\xa5"
3338 "\x45\x98\xb0\x80\xd3\x57\x4d\x1f\x09\x83\x58\xd4\x4d\xa6\xc5\x95"
3339 "\x87\x59\xb0\x58\x6c\x81\x49\xc5\x95\x18\x23\x1b\x6f\x10\x86\xa2"
3340 "\xd9\x56\x19\x30\xec\xd3\x4a\x4b\xe8\x1c\x11\x37\xfb\x31\x60\x4d"
3341 "\x4f\x9b\xc4\x95\xba\xda\x49\x43\x6c\xc7\x3d\x5b\x13\xf9\x91\xf8",
3342 "\xcd\x2b\x83\xd5\x5b\x5a\x8e\x0b\x2e\x77\x0d\x97\xbf\xf7\xaa\xab" },
3343 /* After setiv, ctr_low: 0xfffffffd */
3344 { GCRY_CIPHER_AES256,
3345 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3346 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
3347 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x76\x8c\x18\x92",
3348 16,
3349 "", 0,
3350 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3351 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3352 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3353 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3354 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3355 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3356 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3357 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3358 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3359 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3360 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3361 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3362 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3363 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3364 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3365 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3366 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3367 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
3368 288,
3369 "\x3d\x6f\x4e\xf6\xd2\x6f\x4e\xce\xa6\xb4\x4a\x9e\xcb\x57\x13\x90"
3370 "\x51\x3b\xf6\xb2\x40\x55\x0c\x2c\xa2\x85\x44\x72\xf2\x90\xaf\x6b"
3371 "\x86\x8c\x75\x2a\x9c\xd6\x52\x50\xee\xc6\x5f\x59\xbc\x8d\x18\xd7"
3372 "\x87\xa5\x7f\xa0\x13\xd1\x5d\x54\x77\x30\xe2\x5d\x1b\x4f\x87\x9f"
3373 "\x3a\x41\xcb\x6a\xdf\x44\x4f\xa2\x1a\xbc\xfb\x4b\x16\x67\xed\x59"
3374 "\x65\xf0\x77\x48\xca\xfd\xf0\xb6\x90\x65\xca\x23\x09\xca\x83\x43"
3375 "\x8f\xf0\x78\xb4\x5f\x96\x2a\xfd\x29\xae\xda\x62\x85\xc5\x87\x4b"
3376 "\x2a\x3f\xba\xbe\x15\x5e\xb0\x4e\x8e\xe7\x66\xae\xb4\x80\x66\x90"
3377 "\x10\x9d\x81\xb9\x64\xd3\x36\x00\xb2\x95\xa8\x7d\xaf\x54\xf8\xbd"
3378 "\x8f\x7a\xb1\xa1\xde\x09\x0d\x10\xc8\x8e\x1e\x18\x2c\x1e\x73\x71"
3379 "\x2f\x1e\xfd\x16\x6e\xbe\xe1\x3e\xe5\xb4\xb5\xbf\x03\x63\xf4\x5a"
3380 "\x0d\xeb\xff\xe0\x61\x80\x67\x51\xb4\xa3\x1f\x18\xa5\xa9\xf1\x9a"
3381 "\xeb\x2a\x7f\x56\xb6\x01\x88\x82\x78\xdb\xec\xb7\x92\xfd\xef\x56"
3382 "\x55\xd3\x72\x35\xcd\xa4\x0d\x19\x6a\xb6\x79\x91\xd5\xcb\x0e\x3b"
3383 "\xfb\xea\xa3\x55\x9f\x77\xfb\x75\xc2\x3e\x09\x02\x73\x7a\xff\x0e"
3384 "\xa5\xf0\x83\x11\xeb\xe7\xff\x3b\xd0\xfd\x7a\x07\x53\x63\x43\x89"
3385 "\xf5\x7b\xc4\x7d\x3b\x2c\x9b\xca\x1c\xf6\xb2\xab\x13\xf5\xc4\x2a"
3386 "\xbf\x46\x77\x3b\x09\xdd\xd1\x80\xef\x55\x11\x3e\xd8\xe4\x42\x22",
3387 "\xa3\x86\xa1\x5f\xe3\x4f\x3b\xed\x12\x23\xeb\x5c\xb8\x0c\xad\x4a" },
3388 /* After setiv, ctr_low: 0xfffffffc */
3389 { GCRY_CIPHER_AES256,
3390 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3391 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
3392 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x9b\xc8\xc3\xaf",
3393 16,
3394 "", 0,
3395 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3396 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3397 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3398 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3399 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3400 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3401 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3402 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3403 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3404 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3405 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3406 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3407 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3408 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3409 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3410 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3411 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3412 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
3413 288,
3414 "\x33\x5f\xdc\x8d\x5d\x77\x7b\x78\xc1\x5b\x7b\xb3\xd9\x08\x9a\x0c"
3415 "\xce\x63\x4e\xef\x19\xf8\x8c\x7a\xcb\x31\x39\x93\x69\x7a\x2c\x97"
3416 "\x3a\xb4\x52\x45\x9e\x7b\x78\xbc\xa9\xad\x54\x7f\x88\xa6\xae\xd5"
3417 "\xc0\x8b\x7a\xe4\x23\x6b\xb2\x29\x98\xea\x25\x7a\xae\x11\x0c\xc9"
3418 "\xf3\x77\xa1\x74\x82\xde\x0c\xec\x68\xce\x94\xfd\xb0\xa0\xc5\x32"
3419 "\xd6\xbb\xc3\xe7\xed\x3c\x6f\x0b\x53\x9d\xf3\xc8\xeb\x4e\xee\x99"
3420 "\x19\xc7\x16\xd1\xa5\x59\x1d\xa9\xd3\xe6\x43\x52\x74\x61\x28\xe6"
3421 "\xac\xd8\x47\x63\xc2\xb7\x53\x39\xc1\x9a\xb0\xa3\xa4\x26\x14\xd0"
3422 "\x88\xa9\x8c\xc5\x6d\xe9\x21\x7c\xb9\xa5\xab\x67\xe3\x8d\xe9\x1d"
3423 "\xe3\x1c\x7b\xcd\xa4\x12\x0c\xd7\xa6\x5d\x41\xcf\xdd\x3d\xfc\xbc"
3424 "\x2a\xbb\xa2\x7a\x9c\x4b\x3a\x42\x6c\x98\x1d\x50\x99\x9c\xfb\xda"
3425 "\x21\x09\x2a\x31\xff\x05\xeb\xa5\xf1\xba\x65\x78\xbe\x15\x8e\x84"
3426 "\x35\xdd\x45\x29\xcc\xcd\x32\x2d\x27\xe9\xa8\x94\x4b\x16\x16\xcc"
3427 "\xab\xf2\xec\xfb\xa0\xb5\x9d\x39\x81\x3e\xec\x5e\x3d\x13\xd1\x83"
3428 "\x04\x79\x2d\xbb\x2c\x76\x76\x93\x28\x77\x27\x13\xdd\x1d\x3e\x89"
3429 "\x3e\x37\x46\x4c\xb8\x34\xbe\xbf\x9f\x4f\x9f\x37\xff\x0c\xe6\x14"
3430 "\x14\x66\x52\x41\x18\xa9\x39\x2b\x0c\xe5\x44\x04\xb0\x93\x06\x64"
3431 "\x67\xf7\xa0\x19\xa7\x61\xcf\x03\x7b\xcb\xc8\xb3\x88\x28\xe4\xe7",
3432 "\xe6\xe8\x0a\xe3\x72\xfc\xe0\x07\x69\x09\xf2\xeb\xbc\xc8\x6a\xf0" },
3433 /* After setiv, ctr_low: 0xfffffffb */
3434 { GCRY_CIPHER_AES256,
3435 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3436 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
3437 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x60\x95\x1a\xe2",
3438 16,
3439 "", 0,
3440 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3441 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3442 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3443 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3444 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3445 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3446 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3447 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3448 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3449 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3450 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3451 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3452 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3453 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3454 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3455 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3456 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3457 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
3458 288,
3459 "\xd8\x32\x5a\xe3\x55\x8e\xb3\xc2\x51\x84\x2b\x09\x01\x5e\x6c\xfb"
3460 "\x4a\xc4\x88\xa0\x33\xe7\x3e\xbf\xe5\x7c\xd2\x00\x4c\x1a\x85\x32"
3461 "\x34\xec\x38\x9d\x18\x5f\xf1\x50\x61\x82\xee\xf3\x84\x5a\x84\x4e"
3462 "\xeb\x29\x08\x4c\x7b\xb5\x27\xec\x7d\x79\x77\xd7\xa1\x68\x91\x32"
3463 "\x2d\xf3\x38\xa9\xd6\x27\x16\xfb\x7d\x8b\x09\x5e\xcf\x1b\x74\x6d"
3464 "\xcf\x51\x91\x91\xa1\xe7\x40\x19\x43\x7b\x0d\xa5\xa9\xa5\xf4\x2e"
3465 "\x7f\x1c\xc7\xba\xa2\xea\x00\xdd\x24\x01\xa8\x66\x1e\x88\xf1\xf6"
3466 "\x0c\x9a\xd6\x2b\xda\x3f\x3e\xb2\x98\xea\x89\xc7\xc6\x63\x27\xb7"
3467 "\x6a\x48\x9a\xee\x1e\x70\xa0\xc8\xec\x3d\xc3\x3e\xb5\xf0\xc2\xb1"
3468 "\xb9\x71\x1a\x69\x9d\xdd\x72\x1e\xfe\x72\xa0\x21\xb8\x9f\x18\x96"
3469 "\x26\xcf\x89\x2e\x92\xf1\x02\x65\xa5\xb4\x2e\xb7\x4e\x12\xbd\xa0"
3470 "\x48\xbe\xf6\x5c\xef\x7e\xf3\x0a\xcf\x9d\x1f\x1e\x14\x70\x3e\xa0"
3471 "\x01\x0f\x14\xbf\x38\x10\x3a\x3f\x3f\xc2\x76\xe0\xb0\xe0\x7c\xc6"
3472 "\x77\x6d\x7f\x69\x8e\xa0\x4b\x00\xc3\x9d\xf9\x0b\x7f\x8a\x8e\xd3"
3473 "\x17\x58\x40\xfe\xaf\xf4\x16\x3a\x65\xff\xce\x85\xbb\x80\xfa\xb8"
3474 "\x34\xc9\xef\x3a\xdd\x04\x46\xca\x8f\x70\x48\xbc\x1c\x71\x4d\x6a"
3475 "\x17\x30\x32\x87\x2e\x2e\x54\x9e\x3f\x15\xed\x17\xd7\xa1\xcf\x6c"
3476 "\x5d\x0f\x3c\xee\xf5\x96\xf1\x8f\x68\x1c\xbc\x27\xdc\x10\x3c\x3c",
3477 "\x8c\x31\x06\xbb\xf8\x18\x2d\x9d\xd1\x0d\x03\x56\x2b\x28\x25\x9b" },
3478 /* After setiv, ctr_low: 0xfffffffa */
3479 { GCRY_CIPHER_AES256,
3480 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3481 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
3482 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x6b\x99\x9b\xda",
3483 16,
3484 "", 0,
3485 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3486 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3487 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3488 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3489 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3490 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3491 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3492 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3493 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3494 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3495 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3496 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3497 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3498 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3499 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3500 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3501 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3502 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
3503 288,
3504 "\x7a\x74\x57\xe7\xc1\xb8\x7e\xcf\x91\x98\xf4\x1a\xa4\xdb\x4d\x2c"
3505 "\x6e\xdc\x05\x0b\xd1\x16\xdf\x25\xa8\x1e\x42\xa6\xf9\x09\x36\xfb"
3506 "\x02\x8a\x10\x7d\xa1\x07\x88\x40\xb7\x41\xfd\x64\xf6\xe3\x92\x20"
3507 "\xfd\xc9\xde\xbd\x88\x46\xd3\x1f\x20\x14\x73\x86\x09\xb6\x68\x61"
3508 "\x64\x90\xda\x24\xa8\x0f\x6a\x10\xc5\x01\xbf\x52\x8a\xee\x23\x44"
3509 "\xd5\xb0\xd8\x68\x5e\x77\xc3\x62\xed\xcb\x3c\x1b\x0c\x1f\x13\x92"
3510 "\x2c\x74\x6d\xee\x40\x1b\x6b\xfe\xbe\x3c\xb8\x02\xdd\x24\x9d\xd3"
3511 "\x3d\x4e\xd3\x9b\x18\xfd\xd6\x8f\x95\xef\xa3\xbf\xa9\x2f\x33\xa8"
3512 "\xc2\x37\x69\x58\x92\x42\x3a\x30\x46\x12\x1b\x2c\x04\xf0\xbf\xa9"
3513 "\x79\x55\xcd\xac\x45\x36\x79\xc0\xb4\xb2\x5f\x82\x88\x49\xe8\xa3"
3514 "\xbf\x33\x41\x7a\xcb\xc4\x11\x0e\xcc\x61\xed\xd1\x6b\x59\x5f\x9d"
3515 "\x20\x6f\x85\x01\xd0\x16\x2a\x51\x1b\x79\x35\x42\x5e\x49\xdf\x6f"
3516 "\x64\x68\x31\xac\x49\x34\xfb\x2b\xbd\xb1\xd9\x12\x4e\x4b\x16\xc5"
3517 "\xa6\xfe\x15\xd3\xaf\xac\x51\x08\x95\x1f\x8c\xd2\x52\x37\x8b\x88"
3518 "\xf3\x20\xe2\xf7\x09\x55\x82\x83\x1c\x38\x5f\x17\xfc\x37\x26\x21"
3519 "\xb8\xf1\xfe\xa9\xac\x54\x1e\x53\x83\x53\x3f\x43\xe4\x67\x22\xd5"
3520 "\x86\xec\xf2\xb6\x4a\x8b\x8a\x66\xea\xe0\x92\x50\x3b\x51\xe4\x00"
3521 "\x25\x2a\x7a\x64\x14\xd6\x09\xe1\x6c\x75\x32\x28\x53\x5e\xb3\xab",
3522 "\x5d\x4b\xb2\x8f\xfe\xa5\x7f\x01\x6d\x78\x6c\x13\x58\x08\xe4\x94" },
3523 /* After setiv, ctr_low: 0xfffffff9 */
3524 { GCRY_CIPHER_AES256,
3525 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3526 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
3527 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x90\xc4\x42\x97",
3528 16,
3529 "", 0,
3530 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3531 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3532 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3533 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3534 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3535 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3536 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3537 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3538 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3539 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3540 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3541 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3542 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3543 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3544 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3545 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3546 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3547 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
3548 288,
3549 "\xf5\xc1\xed\xb8\x7f\x55\x7b\xb5\x47\xed\xaa\x42\xd2\xda\x33\x41"
3550 "\x4a\xe0\x36\x6d\x51\x28\x40\x9c\x35\xfb\x11\x65\x18\x83\x9c\xb5"
3551 "\x02\xb2\xa7\xe5\x52\x27\xa4\xe8\x57\x3d\xb3\xf5\xea\xcb\x21\x07"
3552 "\x67\xbe\xbe\x0f\xf6\xaa\x32\xa1\x4b\x5e\x79\x4f\x50\x67\xcd\x80"
3553 "\xfc\xf1\x65\xf2\x6c\xd0\xdb\x17\xcc\xf9\x52\x93\xfd\x5e\xa6\xb9"
3554 "\x5c\x9f\xa8\xc6\x36\xb7\x80\x80\x6a\xea\x62\xdc\x61\x13\x45\xbe"
3555 "\xab\x8f\xd8\x99\x17\x51\x9b\x29\x04\x6e\xdb\x3e\x9f\x83\xc6\x35"
3556 "\xb3\x90\xce\xcc\x74\xec\xcb\x04\x41\xac\xb1\x92\xde\x20\xb1\x67"
3557 "\xb0\x38\x14\xaa\x7d\xee\x3c\xb2\xd3\xbb\x2f\x88\x0b\x73\xcf\x7b"
3558 "\x69\xc1\x55\x5b\x2b\xf2\xd4\x38\x2b\x3c\xef\x04\xc9\x14\x7c\x31"
3559 "\xd6\x61\x88\xa8\xb3\x8c\x69\xb4\xbc\xaa\x0d\x15\xd2\xd5\x27\x63"
3560 "\xc4\xa4\x80\xe9\x2b\xe9\xd2\x34\xc9\x0e\x3f\x7b\xd3\x43\x0d\x47"
3561 "\x5d\x37\x8e\x42\xa4\x4e\xef\xcd\xbb\x3a\x5b\xa4\xe1\xb0\x8d\x64"
3562 "\xb7\x0b\x58\x52\xec\x55\xd0\xef\x23\xfe\xf2\x8d\xe0\xd1\x6a\x2c"
3563 "\xaa\x1c\x03\xc7\x3e\x58\x4c\x61\x72\x07\xc6\xfd\x0e\xbc\xd4\x6b"
3564 "\x99\x4f\x91\xda\xff\x6f\xea\x81\x0c\x76\x85\x5d\x0c\x7f\x1c\xb8"
3565 "\x84\x8c\x2f\xe1\x36\x3e\x68\xa0\x57\xf5\xdf\x13\x0a\xd6\xe1\xcd"
3566 "\xae\x23\x99\x4e\xed\x7a\x72\x1b\x7c\xe5\x65\xd1\xb7\xcf\x2f\x73",
3567 "\x1e\x2f\xcf\x3c\x95\x9a\x29\xec\xd3\x37\x90\x8c\x84\x8a\xfb\x95" },
3568 /* After setiv, ctr_low: 0xfffffff8 */
3569 { GCRY_CIPHER_AES256,
3570 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3571 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
3572 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xb7\xfa\xc7\x4f",
3573 16,
3574 "", 0,
3575 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3576 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3577 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3578 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3579 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3580 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3581 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3582 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3583 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3584 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3585 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3586 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3587 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3588 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3589 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3590 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3591 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3592 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
3593 288,
3594 "\x14\x33\xc6\x9d\x04\xd3\x48\x29\x0c\x6a\x24\x27\xdf\x5f\x0a\xd2"
3595 "\x71\xd6\xd0\x18\x04\xc0\x9f\x72\x0a\x60\xb7\x10\x52\x56\xf7\xae"
3596 "\x64\xb0\x28\xd4\xfd\x25\x93\x8e\x67\x7e\xac\xc2\x93\xc7\x54\x2e"
3597 "\x82\x93\x88\x6a\xb9\x8b\x73\xbc\x88\xec\x27\xdd\x4f\x9b\x21\x9e"
3598 "\x77\x98\x70\x0b\xf4\xd8\x55\xfe\xf4\xc3\x3a\xcb\xca\x3a\xfb\xd4"
3599 "\x52\x72\x2f\xf8\xac\xa9\x6a\xf5\x13\xab\x7a\x2e\x9f\x52\x41\xbd"
3600 "\x87\x90\x68\xad\x17\xbd\x5a\xff\xc3\xc6\x10\x4d\xc1\xfe\xfc\x72"
3601 "\x21\xb5\x53\x4a\x3f\xe0\x15\x9f\x29\x36\x23\xc0\x9a\x31\xb2\x0f"
3602 "\xcd\x2f\xa6\xd0\xfc\xe6\x4d\xed\x68\xb3\x3d\x26\x67\xab\x40\xf0"
3603 "\xab\xcf\x72\xc0\x50\xb1\x1e\x86\x38\xe2\xe0\x46\x3a\x2e\x3e\x1d"
3604 "\x07\xd6\x9d\xe8\xfc\xa3\xe7\xac\xc9\xa0\xb3\x22\x05\xbc\xbf\xd2"
3605 "\x63\x44\x66\xfc\xb4\x7b\xb4\x70\x7e\x96\xa9\x16\x1b\xb2\x7d\x93"
3606 "\x44\x92\x5e\xbd\x16\x34\xa7\x11\xd0\xdf\x52\xad\x6f\xbd\x23\x3c"
3607 "\x3d\x58\x16\xaf\x99\x8b\xbb\xa0\xdc\x3a\xff\x17\xda\x56\xba\x77"
3608 "\xae\xc4\xb1\x51\xe2\x61\x4f\xf0\x66\x1b\x4c\xac\x79\x34\x1c\xfd"
3609 "\x6c\x5f\x9a\x2c\x60\xfc\x47\x00\x5f\x2d\x81\xcc\xa9\xdd\x2b\xf4"
3610 "\x5b\x53\x44\x61\xd4\x13\x5a\xf3\x93\xf0\xc9\x24\xd4\xe6\x60\x6f"
3611 "\x78\x02\x0c\x75\x9d\x0d\x23\x97\x35\xe2\x06\x8a\x49\x5e\xe5\xbe",
3612 "\x23\xc0\x4a\x2f\x98\x93\xca\xbd\x2e\x44\xde\x05\xcc\xe7\xf1\xf5" },
3613 /* After setiv, ctr_low: 0xfffffff7 */
3614 { GCRY_CIPHER_AES256,
3615 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3616 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
3617 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x4c\xa7\x1e\x02",
3618 16,
3619 "", 0,
3620 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3621 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3622 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3623 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3624 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3625 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3626 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3627 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3628 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3629 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3630 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3631 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3632 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3633 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3634 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3635 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3636 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3637 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
3638 288,
3639 "\x51\x51\x64\x89\xeb\x9f\xf9\xd6\xb1\xa6\x73\x5f\xf1\x62\xb5\xe4"
3640 "\x00\x80\xdb\x4c\x1c\xce\xe5\x00\xeb\xea\x6c\x57\xe4\x27\xfc\x71"
3641 "\x08\x8c\xa1\xfc\x59\x1d\x07\x45\x3c\xc9\x4e\x0f\xb6\xea\x96\x90"
3642 "\xae\xf7\x81\x1e\x7e\x6c\x5e\x50\xaf\x34\x3e\xa0\x55\x59\x8e\xe7"
3643 "\xc1\xba\x48\xfa\x9e\x07\xf6\x6a\x24\x54\x3e\x9b\xa5\xfe\x31\x16"
3644 "\x3d\x4d\x9c\xc4\xe1\xec\x26\xa0\x8b\x59\xa6\xf3\x94\xf8\x88\xda"
3645 "\x1f\x88\x23\x5f\xfb\xfd\x79\xa2\xd3\x62\x30\x66\x69\xd9\x0d\x05"
3646 "\xc0\x75\x4c\xb8\x48\x34\x1d\x97\xcf\x29\x6a\x12\x1c\x26\x54\x1d"
3647 "\x80\xa9\x06\x74\x86\xff\xc6\xb4\x72\xee\x34\xe2\x56\x06\x6c\xf5"
3648 "\x11\xe7\x26\x71\x47\x6b\x05\xbd\xe4\x0b\x40\x78\x84\x3c\xf9\xf2"
3649 "\x78\x34\x2b\x3c\x5f\x0e\x4c\xfb\x17\x39\xdc\x59\x6b\xd1\x56\xac"
3650 "\xe4\x1f\xb9\x19\xbc\xec\xb1\xd0\x6d\x47\x3b\x37\x4d\x0d\x6b\x65"
3651 "\x7c\x70\xe9\xec\x58\xcc\x09\xd4\xd9\xbf\x9f\xe0\x6c\x7f\x60\x28"
3652 "\xd8\xdf\x8e\xd1\x6a\x73\x42\xf3\x50\x01\x79\x68\x41\xc3\xba\x19"
3653 "\x1e\x2d\x30\xc2\x81\x2c\x9f\x11\x8b\xd0\xdc\x31\x3b\x01\xfe\x53"
3654 "\xa5\x11\x13\x22\x89\x40\xb9\x1b\x12\x89\xef\x9a\xcb\xa8\x03\x4f"
3655 "\x54\x1a\x15\x6d\x11\xba\x05\x09\xd3\xdb\xbf\x05\x42\x3a\x5a\x27"
3656 "\x3b\x34\x5c\x58\x8a\x5c\xa4\xc2\x28\xdc\xb2\x3a\xe9\x99\x01\xd6",
3657 "\x30\xb2\xb5\x11\x8a\x3a\x8d\x70\x67\x71\x14\xde\xed\xa7\x43\xb5" },
3658 /* After setiv, ctr_low: 0xfffffff6 */
3659 { GCRY_CIPHER_AES256,
3660 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3661 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
3662 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x47\xab\x9f\x3a",
3663 16,
3664 "", 0,
3665 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3666 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3667 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3668 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3669 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3670 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3671 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3672 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3673 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3674 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3675 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3676 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3677 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3678 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3679 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3680 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3681 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3682 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
3683 288,
3684 "\x05\x72\x44\xa0\x99\x11\x1d\x2c\x4b\x03\x4f\x20\x92\x88\xbe\x55"
3685 "\xee\x31\x2c\xd9\xc0\xc1\x64\x77\x79\xd7\x3e\xfa\x5a\x7d\xf0\x48"
3686 "\xf8\xc8\xfe\x81\x8f\x89\x92\xa6\xc2\x07\xdc\x9f\x3f\xb2\xc8\xf2"
3687 "\xf3\xe9\xe1\xd3\xed\x55\xb4\xab\xc3\x22\xed\x8f\x00\xde\x32\x95"
3688 "\x91\xc0\xc5\xf3\xd3\x93\xf0\xee\x56\x14\x8f\x96\xff\xd0\x6a\xbd"
3689 "\xfc\x57\xc2\xc3\x7b\xc1\x1d\x56\x48\x3f\xa6\xc7\x92\x47\xf7\x2f"
3690 "\x0b\x85\x1c\xff\x87\x29\xe1\xbb\x9b\x14\x6c\xac\x51\x0a\xc0\x7b"
3691 "\x22\x25\xb0\x48\x92\xad\x09\x09\x6e\x39\x8e\x96\x13\x05\x55\x92"
3692 "\xbd\xd7\x5d\x95\x35\xdd\x8a\x9d\x05\x59\x60\xae\xbb\xc0\x85\x92"
3693 "\x4c\x8b\xa0\x3f\xa2\x4a\xe5\x2e\xde\x85\x1a\x39\x10\x22\x11\x1b"
3694 "\xdd\xcc\x96\xf4\x93\x97\xf5\x81\x85\xf3\x33\xda\xa1\x9a\xba\xfd"
3695 "\xb8\xaf\x60\x81\x37\xf1\x02\x88\x54\x15\xeb\x21\xd1\x19\x1a\x1f"
3696 "\x28\x9f\x02\x27\xca\xce\x97\xda\xdc\xd2\x0f\xc5\x0e\x2e\xdd\x4f"
3697 "\x1d\x24\x62\xe4\x6e\x4a\xbe\x96\x95\x38\x0c\xe9\x26\x14\xf3\xf0"
3698 "\x92\xbc\x97\xdc\x38\xeb\x64\xc3\x04\xc1\xa2\x6c\xad\xbd\xf8\x03"
3699 "\xa0\xa4\x68\xaa\x9d\x1f\x09\xe6\x62\x95\xa2\x1c\x32\xef\x62\x28"
3700 "\x7e\x54\x6d\x4b\x6a\xcc\x4a\xd0\x82\x47\x46\x0d\x45\x3c\x36\x03"
3701 "\x86\x90\x44\x65\x18\xac\x19\x75\xe6\xba\xb1\x9a\xb4\x5d\x84\x9b",
3702 "\x31\x22\x2b\x11\x6e\x2b\x94\x56\x37\x9d\xc3\xa5\xde\xe7\x6e\xc9" },
3703 /* After setiv, ctr_low: 0xfffffff5 */
3704 { GCRY_CIPHER_AES256,
3705 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3706 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
3707 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xbc\xf6\x46\x77",
3708 16,
3709 "", 0,
3710 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3711 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3712 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3713 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3714 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3715 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3716 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3717 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3718 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3719 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3720 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3721 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3722 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3723 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3724 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3725 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3726 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3727 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
3728 288,
3729 "\x6e\x32\xdb\x04\x32\x57\x15\x78\x0e\x4c\x70\x66\x5c\x91\x43\x0c"
3730 "\x63\x73\xb8\x86\xad\xb0\xf1\x34\x0f\x0c\x7e\xd3\x4e\xcb\xc9\xea"
3731 "\x19\x3c\xb8\x14\xd0\xab\x9e\x9b\x22\xda\x7a\x96\xa7\xf5\xa2\x99"
3732 "\x58\xe3\xd6\x72\x0f\xf5\xdf\x88\xd1\x33\xb1\xe5\x03\x72\x62\x1c"
3733 "\xa7\xf2\x67\x50\x0e\x70\xc3\x7a\x6c\x4a\x90\xba\x78\x9e\xd2\x0b"
3734 "\x29\xd4\xc8\xa7\x57\x06\xf2\xf4\x01\x4b\x30\x53\xea\xf7\xde\xbf"
3735 "\x1c\x12\x03\xcf\x9f\xcf\x80\x8b\x77\xfd\x73\x48\x79\x19\xbe\x38"
3736 "\x75\x0b\x6d\x78\x7d\x79\x05\x98\x65\x3b\x35\x8f\x68\xff\x30\x7a"
3737 "\x6e\xf7\x10\x9e\x11\x25\xc4\x95\x97\x7d\x92\x0f\xbf\x38\x95\xbd"
3738 "\x5d\x2a\xf2\x06\x2c\xd9\x5a\x80\x91\x4e\x22\x7d\x5f\x69\x85\x03"
3739 "\xa7\x5d\xda\x22\x09\x2b\x8d\x29\x67\x7c\x8c\xf6\xb6\x49\x20\x63"
3740 "\xb9\xb6\x4d\xb6\x37\xa3\x7b\x19\xa4\x28\x90\x83\x55\x3d\x4e\x18"
3741 "\xc8\x65\xbc\xd1\xe7\xb5\xcf\x65\x28\xea\x19\x11\x5c\xea\x83\x8c"
3742 "\x44\x1f\xac\xc5\xf5\x3a\x4b\x1c\x2b\xbf\x76\xd8\x98\xdb\x50\xeb"
3743 "\x64\x45\xae\xa5\x39\xb7\xc8\xdf\x5a\x73\x6d\x2d\x0f\x4a\x5a\x17"
3744 "\x37\x66\x1c\x3d\x27\xd5\xd6\x7d\xe1\x08\x7f\xba\x4d\x43\xc2\x29"
3745 "\xf7\xbe\x83\xec\xd0\x3b\x2e\x19\x9e\xf7\xbf\x1b\x16\x34\xd8\xfa"
3746 "\x32\x17\x2a\x90\x55\x93\xd5\x3e\x14\x8d\xd6\xa1\x40\x45\x09\x52",
3747 "\x89\xf2\xae\x78\x38\x8e\xf2\xd2\x52\xa8\xba\xb6\xf2\x5d\x7c\xfc" },
3748 /* After setiv, ctr_low: 0xfffffff4 */
3749 { GCRY_CIPHER_AES256,
3750 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3751 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
3752 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x51\xb2\x9d\x4a",
3753 16,
3754 "", 0,
3755 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3756 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3757 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3758 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3759 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3760 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3761 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3762 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3763 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3764 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3765 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3766 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3767 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3768 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3769 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3770 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3771 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3772 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
3773 288,
3774 "\x1d\xb8\x77\xcd\xcd\xfe\xde\x07\x97\xcb\x97\x3a\x4f\xa0\xd0\xe6"
3775 "\xcc\xcf\x8b\x71\xd5\x65\x3d\xc4\x17\x52\xe7\x1d\x6a\x68\x4a\x77"
3776 "\xca\x04\x4a\xef\x8e\x7e\xce\x79\xa1\x80\x0d\x9e\xd5\xf4\xce\x66"
3777 "\x4d\x54\xb1\x09\xd1\xb6\xb0\x43\x28\xe8\x53\xe2\x24\x9c\x76\xc5"
3778 "\x4d\x22\xf3\x6e\x13\xf3\xd7\xe0\x85\xb8\x9e\x0b\x17\x22\xc0\x79"
3779 "\x2b\x72\x57\xaa\xbd\x43\xc3\xf7\xde\xce\x22\x41\x3c\x7e\x37\x1a"
3780 "\x55\x2e\x36\x0e\x7e\xdc\xb3\xde\xd7\x33\x36\xc9\xc8\x56\x93\x51"
3781 "\x68\x77\x9a\xb0\x08\x5c\x22\x35\xef\x5c\x9b\xbf\x3e\x20\x8a\x84"
3782 "\x3d\xb3\x60\x10\xe1\x97\x30\xd7\xb3\x6f\x40\x5a\x2c\xe0\xe5\x52"
3783 "\x19\xb6\x2b\xed\x6e\x8e\x18\xb4\x8d\x78\xbd\xc4\x9f\x4f\xbd\x82"
3784 "\x98\xd6\x71\x3d\x71\x5b\x78\x73\xee\x8e\x4b\x37\x88\x9e\x21\xca"
3785 "\x00\x6c\xc2\x96\x8d\xf0\xcd\x09\x58\x54\x5a\x58\x59\x8e\x9b\xf8"
3786 "\x72\x93\xd7\xa0\xf9\xc4\xdc\x48\x89\xaa\x31\x95\xda\x4e\x2f\x79"
3787 "\x1e\x37\x49\x92\x2e\x32\x2e\x76\x54\x2a\x64\xa8\x96\x67\xe9\x75"
3788 "\x10\xa6\xeb\xad\xc6\xa8\xec\xb7\x18\x0a\x32\x26\x8d\x6e\x03\x74"
3789 "\x0e\x1f\xfc\xde\x76\xff\x6e\x96\x42\x2d\x80\x0a\xc6\x78\x70\xc4"
3790 "\xd8\x56\x7b\xa6\x38\x2f\xf6\xc0\x9b\xd7\x21\x6e\x88\x5d\xc8\xe5"
3791 "\x02\x6a\x09\x1e\xb3\x46\x44\x80\x82\x5b\xd1\x66\x06\x61\x4f\xb8",
3792 "\x16\x0e\x73\xa3\x14\x43\xdb\x15\x9c\xb0\x0d\x30\x6d\x9b\xe1\xb1" },
3793 /* After setiv, ctr_low: 0xfffffff3 */
3794 { GCRY_CIPHER_AES256,
3795 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3796 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
3797 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xaa\xef\x44\x07",
3798 16,
3799 "", 0,
3800 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3801 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3802 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3803 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3804 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3805 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3806 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3807 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3808 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3809 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3810 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3811 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3812 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3813 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3814 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3815 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3816 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3817 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
3818 288,
3819 "\x42\x71\x54\xe2\xdb\x50\x5d\x3c\x10\xbd\xf8\x60\xbd\xdb\x26\x14"
3820 "\x7d\x13\x59\x98\x28\xfb\x43\x42\xca\x72\xe6\xd8\x58\x00\xa2\x1b"
3821 "\x6a\x61\xb4\x3a\x80\x6b\x9e\x14\xbd\x11\x33\xab\xe9\xb9\x91\x95"
3822 "\xd7\x5d\xc3\x98\x1f\x7f\xcb\xa8\xf0\xec\x31\x26\x51\xea\x2e\xdf"
3823 "\xd9\xde\x70\xf5\x84\x27\x3a\xac\x22\x05\xb9\xce\x2a\xfb\x2a\x83"
3824 "\x1e\xce\x0e\xb2\x31\x35\xc6\xe6\xc0\xd7\xb0\x5f\xf5\xca\xdb\x13"
3825 "\xa7\xfe\x4f\x85\xa3\x4f\x94\x5c\xc1\x04\x12\xde\x6f\xa1\xdb\x41"
3826 "\x59\x82\x22\x22\x65\x97\x6d\xc8\x67\xab\xf3\x90\xeb\xa4\x00\xb3"
3827 "\x7d\x94\x3d\x7b\x2a\xe2\x85\x36\x87\x16\xb8\x19\x92\x02\xe0\x43"
3828 "\x42\x85\xa1\xe6\xb8\x11\x30\xcc\x2c\xd8\x63\x09\x0e\x53\x5f\xa3"
3829 "\xe0\xd4\xee\x0e\x04\xee\x65\x61\x96\x84\x42\x0c\x68\x8d\xb7\x48"
3830 "\xa3\x02\xb4\x82\x69\xf2\x35\xe4\xce\x3b\xe3\x44\xce\xad\x49\x32"
3831 "\xab\xda\x04\xea\x06\x60\xa6\x2a\x7d\xee\x0f\xb8\x95\x90\x22\x62"
3832 "\x9c\x78\x59\xd3\x7b\x61\x02\x65\x63\x96\x9f\x67\x50\xa0\x61\x43"
3833 "\x53\xb2\x3f\x22\xed\x8c\x42\x39\x97\xd9\xbc\x6e\x81\xb9\x21\x97"
3834 "\xc6\x5b\x68\xd7\x7f\xd0\xc5\x4a\xfb\x74\xc4\xfd\x9a\x2a\xb8\x9b"
3835 "\x48\xe0\x00\xea\x6d\xf5\x30\x26\x61\x8f\xa5\x45\x70\xc9\x3a\xea"
3836 "\x6d\x19\x11\x57\x0f\x21\xe6\x0a\x53\x94\xe3\x0c\x99\xb0\x2f\xc5",
3837 "\x92\x92\x89\xcd\x4f\x3c\x6d\xbc\xe8\xb3\x70\x14\x5b\x3c\x12\xe4" },
3838 /* After setiv, ctr_low: 0xfffffff2 */
3839 { GCRY_CIPHER_AES256,
3840 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3841 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
3842 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa1\xe3\xc5\x3f",
3843 16,
3844 "", 0,
3845 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3846 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3847 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3848 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3849 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3850 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3851 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3852 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3853 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3854 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3855 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3856 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3857 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3858 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3859 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3860 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3861 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3862 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
3863 288,
3864 "\x41\xc3\xcb\xd7\x6e\xde\x2a\xc6\x15\x05\xc6\xba\x27\xae\xcd\x37"
3865 "\xc0\xe5\xbf\xb9\x5c\xdc\xd6\xad\x1a\xe1\x35\x7c\xc0\x85\x85\x51"
3866 "\x8c\x98\x06\xc0\x72\x43\x71\x7a\x2d\x7c\x81\x3c\xe7\xd6\x32\x8e"
3867 "\x22\x2b\x46\x95\x6a\xde\x45\x40\x56\xe9\x63\x32\x68\xbf\xb6\x78"
3868 "\xb7\x86\x00\x9d\x2c\x9e\xed\x67\xc1\x9b\x09\x9e\xd9\x0a\x56\xcb"
3869 "\x57\xc9\x48\x14\x23\x4e\x97\x04\xb5\x85\x25\x1d\xcb\x1a\x79\x9b"
3870 "\x54\x06\x95\xad\x16\x81\x84\x3a\x38\xec\x41\x90\x2a\xfa\x50\xe0"
3871 "\xb9\x20\xa6\xeb\xfe\x2e\x5c\xa1\xf6\x3c\x69\x4c\xce\xf8\x30\xe0"
3872 "\x87\x68\xa2\x3a\x9d\xad\x75\xd4\xa5\x6b\x0a\x90\x65\xa2\x27\x64"
3873 "\x9d\xf5\xa0\x6f\xd0\xd3\x62\xa5\x2d\xae\x02\x89\xb4\x1a\xfa\x32"
3874 "\x9b\xa0\x44\xdd\x50\xde\xaf\x41\xa9\x89\x1e\xb0\x41\xbc\x9c\x41"
3875 "\xb0\x35\x5e\xf1\x9a\xd9\xab\x57\x53\x21\xca\x39\xfc\x8b\xb4\xd4"
3876 "\xb2\x19\x8a\xe9\xb2\x24\x1e\xce\x2e\x19\xb0\xd2\x93\x30\xc4\x70"
3877 "\xe2\xf8\x6a\x8a\x99\x3b\xed\x71\x7e\x9e\x98\x99\x2a\xc6\xdd\xcf"
3878 "\x43\x32\xdb\xfb\x27\x22\x89\xa4\xc5\xe0\xa2\x94\xe9\xcf\x9d\x48"
3879 "\xab\x3f\xfa\x4f\x75\x63\x46\xdd\xfe\xfa\xf0\xbf\x6e\xa1\xf9\xca"
3880 "\xb1\x77\x79\x35\x6c\x33\xe1\x57\x68\x50\xe9\x78\x4e\xe4\xe2\xf0"
3881 "\xcf\xe4\x23\xde\xf4\xa7\x34\xb3\x44\x97\x38\xd2\xbd\x27\x44\x0e",
3882 "\x75\x0a\x41\x3b\x87\xe3\xc7\xf6\xd6\xe3\xab\xfa\x4b\xbe\x2e\x56" },
3883 /* After setiv, ctr_low: 0xfffffff1 */
3884 { GCRY_CIPHER_AES256,
3885 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3886 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
3887 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x5a\xbe\x1c\x72",
3888 16,
3889 "", 0,
3890 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3891 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3892 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3893 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3894 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3895 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3896 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3897 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3898 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3899 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3900 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3901 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3902 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3903 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3904 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3905 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3906 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
3907 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
3908 288,
3909 "\xf1\x3c\x7a\xa4\xa9\xaf\xe7\x49\x19\x7d\xad\x50\xc1\x6a\x84\x87"
3910 "\xf5\x69\xe4\xe5\xc2\x0a\x90\x33\xc3\xeb\x76\x63\x5f\x9b\x1d\xf9"
3911 "\x53\x4a\x2a\x6d\x6b\x61\xe0\x5d\xed\xcb\x98\x0d\xf2\x57\x33\x12"
3912 "\xd1\x44\xaa\x7a\x7e\x4e\x41\x0e\xe6\xa7\x9f\x17\x92\x28\x91\xad"
3913 "\xca\xce\xf2\xa8\x73\x4a\xad\x89\x62\x73\x0b\x9a\x68\x91\xa8\x11"
3914 "\x44\x01\xfd\x57\xe4\xf8\x84\x55\x2b\x66\xdb\xb9\xd6\xee\x83\xe5"
3915 "\x57\xea\x5c\x6a\x23\x87\xdd\x0a\x45\x63\xb4\x0c\x8f\xc5\x9f\x22"
3916 "\xf3\x4f\x4e\x6f\x7b\x14\x62\xf7\x80\x59\x4a\xc5\xc8\xae\x8a\x6f"
3917 "\x5e\xe3\x1e\xe6\xae\xec\x99\x77\x6b\x88\x14\xe3\x58\x88\x61\x74"
3918 "\x38\x91\xa1\x32\xb8\xd2\x39\x6b\xe2\xcb\x8e\x77\xde\x92\x36\x78"
3919 "\xad\x50\xcf\x08\xb8\xfa\x29\x59\xb4\x68\x1b\x23\x10\x57\x32\x92"
3920 "\xf8\xec\xe1\x97\xdb\x30\x85\x22\xb5\x68\x2f\xf2\x98\xda\x06\xee"
3921 "\x65\x02\xe7\xf9\xc8\xc1\xca\x8f\xd3\xed\x4a\x3c\x09\xdd\xde\x64"
3922 "\xd9\x85\x17\x2c\x62\x41\x35\x24\xed\x6b\x87\x78\x1e\xb5\x7a\x9b"
3923 "\xa3\x90\xa3\x99\xc7\x39\x51\x10\xb7\x6a\x12\x3b\x64\xfe\x32\x3c"
3924 "\xb6\x84\x9a\x3f\x95\xd3\xcb\x22\x69\x9c\xf9\xb7\xc2\x8b\xf4\x55"
3925 "\x68\x60\x11\x20\xc5\x3e\x0a\xc0\xba\x00\x0e\x88\x96\x66\xfa\xf0"
3926 "\x75\xbc\x2b\x9c\xff\xc5\x33\x7b\xaf\xb2\xa6\x34\x78\x44\x9c\xa7",
3927 "\x01\x24\x0e\x17\x17\xe5\xfc\x90\x07\xfa\x78\xd5\x5d\x66\xa3\xf5" },
3928 };
3929
3930 gcry_cipher_hd_t hde, hdd;
3931 unsigned char out[MAX_GCM_DATA_LEN];
3932 unsigned char tag[GCRY_GCM_BLOCK_LEN];
3933 int i, keylen;
3934 gcry_error_t err = 0;
3935 size_t pos, poslen, taglen2;
3936 int byteNum;
3937
3938 if (verbose)
3939 fprintf (stderr, " Starting GCM checks.\n");
3940
3941 for (i = 0; i < sizeof (tv) / sizeof (tv[0]); i++)
3942 {
3943 if (gcry_cipher_test_algo (tv[i].algo) && in_fips_mode)
3944 {
3945 if (verbose)
3946 fprintf (stderr, " algorithm %d not available in fips mode\n",
3947 tv[i].algo);
3948 continue;
3949 }
3950
3951 if (verbose)
3952 fprintf (stderr, " checking GCM mode for %s [%i]\n",
3953 gcry_cipher_algo_name (tv[i].algo),
3954 tv[i].algo);
3955 err = gcry_cipher_open (&hde, tv[i].algo, GCRY_CIPHER_MODE_GCM, 0);
3956 if (!err)
3957 err = gcry_cipher_open (&hdd, tv[i].algo, GCRY_CIPHER_MODE_GCM, 0);
3958 if (err)
3959 {
3960 fail ("aes-gcm, gcry_cipher_open failed: %s\n", gpg_strerror (err));
3961 return;
3962 }
3963
3964 keylen = gcry_cipher_get_algo_keylen(tv[i].algo);
3965 if (!keylen)
3966 {
3967 fail ("aes-gcm, gcry_cipher_get_algo_keylen failed\n");
3968 return;
3969 }
3970
3971 err = gcry_cipher_setkey (hde, tv[i].key, keylen);
3972 if (!err)
3973 err = gcry_cipher_setkey (hdd, tv[i].key, keylen);
3974 if (err)
3975 {
3976 fail ("aes-gcm, gcry_cipher_setkey failed: %s\n",
3977 gpg_strerror (err));
3978 gcry_cipher_close (hde);
3979 gcry_cipher_close (hdd);
3980 return;
3981 }
3982
3983 err = gcry_cipher_setiv (hde, tv[i].iv, tv[i].ivlen);
3984 if (!err)
3985 err = gcry_cipher_setiv (hdd, tv[i].iv, tv[i].ivlen);
3986 if (err)
3987 {
3988 fail ("aes-gcm, gcry_cipher_setiv failed: %s\n",
3989 gpg_strerror (err));
3990 gcry_cipher_close (hde);
3991 gcry_cipher_close (hdd);
3992 return;
3993 }
3994
3995 err = gcry_cipher_info (hde, GCRYCTL_GET_TAGLEN, NULL, &taglen2);
3996 if (err)
3997 {
3998 fail ("cipher-gcm, gcryctl_get_taglen failed (tv %d): %s\n",
3999 i, gpg_strerror (err));
4000 gcry_cipher_close (hde);
4001 gcry_cipher_close (hdd);
4002 return;
4003 }
4004 if (taglen2 != GCRY_GCM_BLOCK_LEN)
4005 {
4006 fail ("cipher-gcm, gcryctl_get_taglen returned bad length"
4007 " (tv %d): got=%zu want=%d\n",
4008 i, taglen2, GCRY_GCM_BLOCK_LEN);
4009 gcry_cipher_close (hde);
4010 gcry_cipher_close (hdd);
4011 return;
4012 }
4013
4014 for (pos = 0; pos < tv[i].aadlen; pos += step)
4015 {
4016 poslen = (pos + step < tv[i].aadlen) ? step : tv[i].aadlen - pos;
4017
4018 err = gcry_cipher_authenticate(hde, tv[i].aad + pos, poslen);
4019 if (err)
4020 {
4021 fail ("aes-gcm, gcry_cipher_authenticate (%d) (%lu:%d) failed: "
4022 "%s\n", i, (unsigned long) pos, step, gpg_strerror (err));
4023 gcry_cipher_close (hde);
4024 gcry_cipher_close (hdd);
4025 return;
4026 }
4027 err = gcry_cipher_authenticate(hdd, tv[i].aad + pos, poslen);
4028 if (err)
4029 {
4030 fail ("aes-gcm, de gcry_cipher_authenticate (%d) (%lu:%d) failed: "
4031 "%s\n", i, (unsigned long) pos, step, gpg_strerror (err));
4032 gcry_cipher_close (hde);
4033 gcry_cipher_close (hdd);
4034 return;
4035 }
4036 }
4037
4038 for (pos = 0; pos < tv[i].inlen; pos += step)
4039 {
4040 poslen = (pos + step < tv[i].inlen) ? step : tv[i].inlen - pos;
4041
4042 err = gcry_cipher_encrypt (hde, out + pos, poslen,
4043 tv[i].plaintext + pos, poslen);
4044 if (err)
4045 {
4046 fail ("aes-gcm, gcry_cipher_encrypt (%d) (%lu:%d) failed: %s\n",
4047 i, (unsigned long) pos, step, gpg_strerror (err));
4048 gcry_cipher_close (hde);
4049 gcry_cipher_close (hdd);
4050 return;
4051 }
4052 }
4053
4054 if (memcmp (tv[i].out, out, tv[i].inlen))
4055 fail ("aes-gcm, encrypt mismatch entry %d (step %d)\n", i, step);
4056
4057 for (pos = 0; pos < tv[i].inlen; pos += step)
4058 {
4059 poslen = (pos + step < tv[i].inlen) ? step : tv[i].inlen - pos;
4060
4061 err = gcry_cipher_decrypt (hdd, out + pos, poslen, NULL, 0);
4062 if (err)
4063 {
4064 fail ("aes-gcm, gcry_cipher_decrypt (%d) (%lu:%d) failed: %s\n",
4065 i, (unsigned long) pos, step, gpg_strerror (err));
4066 gcry_cipher_close (hde);
4067 gcry_cipher_close (hdd);
4068 return;
4069 }
4070 }
4071
4072 if (memcmp (tv[i].plaintext, out, tv[i].inlen))
4073 fail ("aes-gcm, decrypt mismatch entry %d (step %d)\n", i, step);
4074
4075 taglen2 = tv[i].taglen ? tv[i].taglen : GCRY_GCM_BLOCK_LEN;
4076
4077 err = gcry_cipher_gettag (hde, out, taglen2);
4078 if (err)
4079 {
4080 if (tv[i].should_fail)
4081 goto next_tv;
4082
4083 fail ("aes-gcm, gcry_cipher_gettag(%d) failed: %s\n",
4084 i, gpg_strerror (err));
4085 gcry_cipher_close (hde);
4086 gcry_cipher_close (hdd);
4087 return;
4088 }
4089
4090 if (memcmp (tv[i].tag, out, taglen2))
4091 fail ("aes-gcm, encrypt tag mismatch entry %d\n", i);
4092
4093 err = gcry_cipher_checktag (hdd, out, taglen2);
4094 if (err)
4095 {
4096 fail ("aes-gcm, gcry_cipher_checktag(%d) failed: %s\n",
4097 i, gpg_strerror (err));
4098 gcry_cipher_close (hde);
4099 gcry_cipher_close (hdd);
4100 return;
4101 }
4102
4103 err = gcry_cipher_reset(hde);
4104 if (!err)
4105 err = gcry_cipher_reset(hdd);
4106 if (err)
4107 {
4108 fail ("aes-gcm, gcry_cipher_reset (%d) failed: %s\n",
4109 i, gpg_strerror (err));
4110 gcry_cipher_close (hde);
4111 gcry_cipher_close (hdd);
4112 return;
4113 }
4114
4115 /* gcry_cipher_reset clears the IV */
4116 err = gcry_cipher_setiv (hde, tv[i].iv, tv[i].ivlen);
4117 if (!err)
4118 err = gcry_cipher_setiv (hdd, tv[i].iv, tv[i].ivlen);
4119 if (err)
4120 {
4121 fail ("aes-gcm, gcry_cipher_setiv failed: %s\n",
4122 gpg_strerror (err));
4123 gcry_cipher_close (hde);
4124 gcry_cipher_close (hdd);
4125 return;
4126 }
4127
4128 /* this time we authenticate, encrypt and decrypt one byte at a time */
4129 for (byteNum = 0; byteNum < tv[i].aadlen; ++byteNum)
4130 {
4131 err = gcry_cipher_authenticate(hde, tv[i].aad + byteNum, 1);
4132 if (err)
4133 {
4134 fail ("aes-gcm, gcry_cipher_authenticate (%d) (byte-buf) failed: "
4135 "%s\n", i, gpg_strerror (err));
4136 gcry_cipher_close (hde);
4137 gcry_cipher_close (hdd);
4138 return;
4139 }
4140 err = gcry_cipher_authenticate(hdd, tv[i].aad + byteNum, 1);
4141 if (err)
4142 {
4143 fail ("aes-gcm, de gcry_cipher_authenticate (%d) (byte-buf) "
4144 "failed: %s\n", i, gpg_strerror (err));
4145 gcry_cipher_close (hde);
4146 gcry_cipher_close (hdd);
4147 return;
4148 }
4149 }
4150
4151 for (byteNum = 0; byteNum < tv[i].inlen; ++byteNum)
4152 {
4153 err = gcry_cipher_encrypt (hde, out+byteNum, 1,
4154 (tv[i].plaintext) + byteNum,
4155 1);
4156 if (err)
4157 {
4158 fail ("aes-gcm, gcry_cipher_encrypt (%d) (byte-buf) failed: %s\n",
4159 i, gpg_strerror (err));
4160 gcry_cipher_close (hde);
4161 gcry_cipher_close (hdd);
4162 return;
4163 }
4164 }
4165
4166 if (memcmp (tv[i].out, out, tv[i].inlen))
4167 fail ("aes-gcm, encrypt mismatch entry %d, (byte-buf)\n", i);
4168
4169 /* Test output to larger than 16-byte buffer. */
4170 taglen2 = tv[i].taglen ? tv[i].taglen : GCRY_GCM_BLOCK_LEN + 1;
4171
4172 err = gcry_cipher_gettag (hde, tag, taglen2);
4173 if (err)
4174 {
4175 if (tv[i].should_fail)
4176 goto next_tv;
4177
4178 fail ("aes-gcm, gcry_cipher_gettag(%d, %lu) (byte-buf) failed: %s\n",
4179 i, (unsigned long) taglen2, gpg_strerror (err));
4180 gcry_cipher_close (hde);
4181 gcry_cipher_close (hdd);
4182 return;
4183 }
4184
4185 taglen2 = tv[i].taglen ? tv[i].taglen : GCRY_GCM_BLOCK_LEN;
4186
4187 if (memcmp (tv[i].tag, tag, taglen2))
4188 fail ("aes-gcm, encrypt tag mismatch entry %d, (byte-buf)\n", i);
4189
4190 for (byteNum = 0; byteNum < tv[i].inlen; ++byteNum)
4191 {
4192 err = gcry_cipher_decrypt (hdd, out+byteNum, 1, NULL, 0);
4193 if (err)
4194 {
4195 fail ("aes-gcm, gcry_cipher_decrypt (%d) (byte-buf) failed: %s\n",
4196 i, gpg_strerror (err));
4197 gcry_cipher_close (hde);
4198 gcry_cipher_close (hdd);
4199 return;
4200 }
4201 }
4202
4203 if (memcmp (tv[i].plaintext, out, tv[i].inlen))
4204 fail ("aes-gcm, decrypt mismatch entry %d\n", i);
4205
4206 err = gcry_cipher_checktag (hdd, tag, taglen2);
4207 if (err)
4208 {
4209 fail ("aes-gcm, gcry_cipher_checktag(%d) (byte-buf) failed: %s\n",
4210 i, gpg_strerror (err));
4211 gcry_cipher_close (hde);
4212 gcry_cipher_close (hdd);
4213 return;
4214 }
4215
4216 err = gcry_cipher_checktag (hdd, tag, 1);
4217 if (!err)
4218 {
4219 fail ("aes-gcm, gcry_cipher_checktag(%d) did not fail for invalid "
4220 " tag length of '%d'\n", i, 1);
4221 gcry_cipher_close (hde);
4222 gcry_cipher_close (hdd);
4223 return;
4224 }
4225 err = gcry_cipher_checktag (hdd, tag, 17);
4226 if (!err)
4227 {
4228 fail ("aes-gcm, gcry_cipher_checktag(%d) did not fail for invalid "
4229 " tag length of '%d'\n", i, 17);
4230 gcry_cipher_close (hde);
4231 gcry_cipher_close (hdd);
4232 return;
4233 }
4234
4235 if (tv[i].should_fail)
4236 {
4237 fail ("aes-gcm, negative test succeeded %d\n", i);
4238 gcry_cipher_close (hde);
4239 gcry_cipher_close (hdd);
4240 return;
4241 }
4242
4243 next_tv:
4244 gcry_cipher_close (hde);
4245 gcry_cipher_close (hdd);
4246 }
4247 if (verbose)
4248 fprintf (stderr, " Completed GCM checks.\n");
4249 }
4250
4251
4252 static void
check_gcm_cipher(void)4253 check_gcm_cipher (void)
4254 {
4255 /* Large buffers, no splitting. */
4256 _check_gcm_cipher(0xffffffff);
4257 /* Split input to one byte buffers. */
4258 _check_gcm_cipher(1);
4259 /* Split input to 7 byte buffers. */
4260 _check_gcm_cipher(7);
4261 /* Split input to 15 byte buffers. */
4262 _check_gcm_cipher(15);
4263 /* Split input to 16 byte buffers. */
4264 _check_gcm_cipher(16);
4265 /* Split input to 17 byte buffers. */
4266 _check_gcm_cipher(17);
4267 }
4268
4269
4270 static void
_check_eax_cipher(unsigned int step)4271 _check_eax_cipher (unsigned int step)
4272 {
4273 static const struct tv
4274 {
4275 int algo;
4276 char key[MAX_DATA_LEN];
4277 char nonce[MAX_DATA_LEN];
4278 int noncelen;
4279 unsigned char header[MAX_DATA_LEN];
4280 int headerlen;
4281 unsigned char plaintext[MAX_DATA_LEN];
4282 int inlen;
4283 char out[MAX_DATA_LEN];
4284 char tag[MAX_DATA_LEN];
4285 int taglen;
4286 int should_fail;
4287 } tv[] =
4288 {
4289 /* Test vectors from http://www.cs.ucdavis.edu/~rogaway/papers/eax.pdf */
4290 { GCRY_CIPHER_AES,
4291 "\x23\x39\x52\xDE\xE4\xD5\xED\x5F\x9B\x9C\x6D\x6F\xF8\x0F\xF4\x78",
4292 "\x62\xEC\x67\xF9\xC3\xA4\xA4\x07\xFC\xB2\xA8\xC4\x90\x31\xA8\xB3", 16,
4293 "\x6B\xFB\x91\x4F\xD0\x7E\xAE\x6B", 8,
4294 "",
4295 0,
4296 "",
4297 "\xE0\x37\x83\x0E\x83\x89\xF2\x7B\x02\x5A\x2D\x65\x27\xE7\x9D\x01", 16,
4298 0
4299 },
4300 { GCRY_CIPHER_AES,
4301 "\x91\x94\x5D\x3F\x4D\xCB\xEE\x0B\xF4\x5E\xF5\x22\x55\xF0\x95\xA4",
4302 "\xBE\xCA\xF0\x43\xB0\xA2\x3D\x84\x31\x94\xBA\x97\x2C\x66\xDE\xBD", 16,
4303 "\xFA\x3B\xFD\x48\x06\xEB\x53\xFA", 8,
4304 "\xF7\xFB",
4305 2,
4306 "\x19\xDD",
4307 "\x5C\x4C\x93\x31\x04\x9D\x0B\xDA\xB0\x27\x74\x08\xF6\x79\x67\xE5", 16,
4308 0
4309 },
4310 { GCRY_CIPHER_AES,
4311 "\x01\xF7\x4A\xD6\x40\x77\xF2\xE7\x04\xC0\xF6\x0A\xDA\x3D\xD5\x23",
4312 "\x70\xC3\xDB\x4F\x0D\x26\x36\x84\x00\xA1\x0E\xD0\x5D\x2B\xFF\x5E", 16,
4313 "\x23\x4A\x34\x63\xC1\x26\x4A\xC6", 8,
4314 "\x1A\x47\xCB\x49\x33",
4315 5,
4316 "\xD8\x51\xD5\xBA\xE0",
4317 "\x3A\x59\xF2\x38\xA2\x3E\x39\x19\x9D\xC9\x26\x66\x26\xC4\x0F\x80", 16,
4318 0
4319 },
4320 { GCRY_CIPHER_AES,
4321 "\xD0\x7C\xF6\xCB\xB7\xF3\x13\xBD\xDE\x66\xB7\x27\xAF\xD3\xC5\xE8",
4322 "\x84\x08\xDF\xFF\x3C\x1A\x2B\x12\x92\xDC\x19\x9E\x46\xB7\xD6\x17", 16,
4323 "\x33\xCC\xE2\xEA\xBF\xF5\xA7\x9D", 8,
4324 "\x48\x1C\x9E\x39\xB1",
4325 5,
4326 "\x63\x2A\x9D\x13\x1A",
4327 "\xD4\xC1\x68\xA4\x22\x5D\x8E\x1F\xF7\x55\x93\x99\x74\xA7\xBE\xDE", 16,
4328 0
4329 },
4330 { GCRY_CIPHER_AES,
4331 "\x35\xB6\xD0\x58\x00\x05\xBB\xC1\x2B\x05\x87\x12\x45\x57\xD2\xC2",
4332 "\xFD\xB6\xB0\x66\x76\xEE\xDC\x5C\x61\xD7\x42\x76\xE1\xF8\xE8\x16", 16,
4333 "\xAE\xB9\x6E\xAE\xBE\x29\x70\xE9", 8,
4334 "\x40\xD0\xC0\x7D\xA5\xE4",
4335 6,
4336 "\x07\x1D\xFE\x16\xC6\x75",
4337 "\xCB\x06\x77\xE5\x36\xF7\x3A\xFE\x6A\x14\xB7\x4E\xE4\x98\x44\xDD", 16,
4338 0
4339 },
4340 { GCRY_CIPHER_AES,
4341 "\xBD\x8E\x6E\x11\x47\x5E\x60\xB2\x68\x78\x4C\x38\xC6\x2F\xEB\x22",
4342 "\x6E\xAC\x5C\x93\x07\x2D\x8E\x85\x13\xF7\x50\x93\x5E\x46\xDA\x1B", 16,
4343 "\xD4\x48\x2D\x1C\xA7\x8D\xCE\x0F", 8,
4344 "\x4D\xE3\xB3\x5C\x3F\xC0\x39\x24\x5B\xD1\xFB\x7D",
4345 12,
4346 "\x83\x5B\xB4\xF1\x5D\x74\x3E\x35\x0E\x72\x84\x14",
4347 "\xAB\xB8\x64\x4F\xD6\xCC\xB8\x69\x47\xC5\xE1\x05\x90\x21\x0A\x4F", 16,
4348 0
4349 },
4350 { GCRY_CIPHER_AES,
4351 "\x7C\x77\xD6\xE8\x13\xBE\xD5\xAC\x98\xBA\xA4\x17\x47\x7A\x2E\x7D",
4352 "\x1A\x8C\x98\xDC\xD7\x3D\x38\x39\x3B\x2B\xF1\x56\x9D\xEE\xFC\x19", 16,
4353 "\x65\xD2\x01\x79\x90\xD6\x25\x28", 8,
4354 "\x8B\x0A\x79\x30\x6C\x9C\xE7\xED\x99\xDA\xE4\xF8\x7F\x8D\xD6\x16\x36",
4355 17,
4356 "\x02\x08\x3E\x39\x79\xDA\x01\x48\x12\xF5\x9F\x11\xD5\x26\x30\xDA\x30",
4357 "\x13\x73\x27\xD1\x06\x49\xB0\xAA\x6E\x1C\x18\x1D\xB6\x17\xD7\xF2", 16,
4358 0
4359 },
4360 { GCRY_CIPHER_AES,
4361 "\x5F\xFF\x20\xCA\xFA\xB1\x19\xCA\x2F\xC7\x35\x49\xE2\x0F\x5B\x0D",
4362 "\xDD\xE5\x9B\x97\xD7\x22\x15\x6D\x4D\x9A\xFF\x2B\xC7\x55\x98\x26", 16,
4363 "\x54\xB9\xF0\x4E\x6A\x09\x18\x9A", 8,
4364 "\x1B\xDA\x12\x2B\xCE\x8A\x8D\xBA\xF1\x87\x7D\x96\x2B\x85\x92\xDD"
4365 "\x2D\x56",
4366 18,
4367 "\x2E\xC4\x7B\x2C\x49\x54\xA4\x89\xAF\xC7\xBA\x48\x97\xED\xCD\xAE"
4368 "\x8C\xC3",
4369 "\x3B\x60\x45\x05\x99\xBD\x02\xC9\x63\x82\x90\x2A\xEF\x7F\x83\x2A", 16,
4370 0
4371 },
4372 { GCRY_CIPHER_AES,
4373 "\xA4\xA4\x78\x2B\xCF\xFD\x3E\xC5\xE7\xEF\x6D\x8C\x34\xA5\x61\x23",
4374 "\xB7\x81\xFC\xF2\xF7\x5F\xA5\xA8\xDE\x97\xA9\xCA\x48\xE5\x22\xEC", 16,
4375 "\x89\x9A\x17\x58\x97\x56\x1D\x7E", 8,
4376 "\x6C\xF3\x67\x20\x87\x2B\x85\x13\xF6\xEA\xB1\xA8\xA4\x44\x38\xD5"
4377 "\xEF\x11",
4378 18,
4379 "\x0D\xE1\x8F\xD0\xFD\xD9\x1E\x7A\xF1\x9F\x1D\x8E\xE8\x73\x39\x38"
4380 "\xB1\xE8",
4381 "\xE7\xF6\xD2\x23\x16\x18\x10\x2F\xDB\x7F\xE5\x5F\xF1\x99\x17\x00", 16,
4382 0
4383 },
4384 { GCRY_CIPHER_AES,
4385 "\x83\x95\xFC\xF1\xE9\x5B\xEB\xD6\x97\xBD\x01\x0B\xC7\x66\xAA\xC3",
4386 "\x22\xE7\xAD\xD9\x3C\xFC\x63\x93\xC5\x7E\xC0\xB3\xC1\x7D\x6B\x44", 16,
4387 "\x12\x67\x35\xFC\xC3\x20\xD2\x5A", 8,
4388 "\xCA\x40\xD7\x44\x6E\x54\x5F\xFA\xED\x3B\xD1\x2A\x74\x0A\x65\x9F"
4389 "\xFB\xBB\x3C\xEA\xB7",
4390 21,
4391 "\xCB\x89\x20\xF8\x7A\x6C\x75\xCF\xF3\x96\x27\xB5\x6E\x3E\xD1\x97"
4392 "\xC5\x52\xD2\x95\xA7",
4393 "\xCF\xC4\x6A\xFC\x25\x3B\x46\x52\xB1\xAF\x37\x95\xB1\x24\xAB\x6E", 16,
4394 0
4395 },
4396 /* Negative test for bad tag. */
4397 { GCRY_CIPHER_AES,
4398 "\x23\x39\x52\xDE\xE4\xD5\xED\x5F\x9B\x9C\x6D\x6F\xF8\x0F\xF4\x78",
4399 "\x62\xEC\x67\xF9\xC3\xA4\xA4\x07\xFC\xB2\xA8\xC4\x90\x31\xA8\xB3", 16,
4400 "\x6B\xFB\x91\x4F\xD0\x7E\xAE\x6B", 8,
4401 "",
4402 0,
4403 "",
4404 "\x00\x37\x83\x0E\x83\x89\xF2\x7B\x02\x5A\x2D\x65\x27\xE7\x9D\x01", 16,
4405 1
4406 },
4407 /* Test vectors from libtomcrypt. */
4408 {
4409 GCRY_CIPHER_AES,
4410 "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
4411 "", 0,
4412 "", 0,
4413 "",
4414 0,
4415 "",
4416 "\x9a\xd0\x7e\x7d\xbf\xf3\x01\xf5\x05\xde\x59\x6b\x96\x15\xdf\xff", 16,
4417 0
4418 },
4419 {
4420 GCRY_CIPHER_AES,
4421 "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
4422 "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f", 16,
4423 "", 0,
4424 "",
4425 0,
4426 "",
4427 "\x1c\xe1\x0d\x3e\xff\xd4\xca\xdb\xe2\xe4\x4b\x58\xd6\x0a\xb9\xec", 16,
4428 0
4429 },
4430 {
4431 GCRY_CIPHER_AES,
4432 "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
4433 "", 0,
4434 "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f", 16,
4435 "",
4436 0,
4437 "",
4438 "\x3a\x69\x8f\x7a\x27\x0e\x51\xb0\xf6\x5b\x3d\x3e\x47\x19\x3c\xff", 16,
4439 0
4440 },
4441 {
4442 GCRY_CIPHER_AES,
4443 "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
4444 "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f", 16,
4445 "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f", 16,
4446 "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
4447 "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f",
4448 32,
4449 "\x29\xd8\x78\xd1\xa3\xbe\x85\x7b\x6f\xb8\xc8\xea\x59\x50\xa7\x78"
4450 "\x33\x1f\xbf\x2c\xcf\x33\x98\x6f\x35\xe8\xcf\x12\x1d\xcb\x30\xbc",
4451 "\x4f\xbe\x03\x38\xbe\x1c\x8c\x7e\x1d\x7a\xe7\xe4\x5b\x92\xc5\x87", 16,
4452 0
4453 },
4454 {
4455 GCRY_CIPHER_AES,
4456 "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
4457 "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e", 15,
4458 "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d", 14,
4459 "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
4460 "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c",
4461 29,
4462 "\xdd\x25\xc7\x54\xc5\xb1\x7c\x59\x28\xb6\x9b\x73\x15\x5f\x7b\xb8"
4463 "\x88\x8f\xaf\x37\x09\x1a\xd9\x2c\x8a\x24\xdb\x86\x8b",
4464 "\x0d\x1a\x14\xe5\x22\x24\xff\xd2\x3a\x05\xfa\x02\xcd\xef\x52\xda", 16,
4465 0
4466 },
4467 };
4468
4469 gcry_cipher_hd_t hde, hdd;
4470 unsigned char out[MAX_DATA_LEN];
4471 unsigned char tag[16];
4472 int i, keylen;
4473 gcry_error_t err = 0;
4474 size_t pos, poslen, taglen2;
4475 int byteNum;
4476
4477 if (verbose)
4478 fprintf (stderr, " Starting EAX checks.\n");
4479
4480 for (i = 0; i < sizeof (tv) / sizeof (tv[0]); i++)
4481 {
4482 if (gcry_cipher_test_algo (tv[i].algo) && in_fips_mode)
4483 {
4484 if (verbose)
4485 fprintf (stderr, " algorithm %d not available in fips mode\n",
4486 tv[i].algo);
4487 continue;
4488 }
4489
4490 if (verbose)
4491 fprintf (stderr, " checking EAX mode for %s [%i]\n",
4492 gcry_cipher_algo_name (tv[i].algo),
4493 tv[i].algo);
4494 err = gcry_cipher_open (&hde, tv[i].algo, GCRY_CIPHER_MODE_EAX, 0);
4495 if (!err)
4496 err = gcry_cipher_open (&hdd, tv[i].algo, GCRY_CIPHER_MODE_EAX, 0);
4497 if (err)
4498 {
4499 fail ("aes-eax, gcry_cipher_open failed: %s\n", gpg_strerror (err));
4500 return;
4501 }
4502
4503 keylen = gcry_cipher_get_algo_keylen(tv[i].algo);
4504 if (!keylen)
4505 {
4506 fail ("aes-eax, gcry_cipher_get_algo_keylen failed\n");
4507 return;
4508 }
4509
4510 err = gcry_cipher_setkey (hde, tv[i].key, keylen);
4511 if (!err)
4512 err = gcry_cipher_setkey (hdd, tv[i].key, keylen);
4513 if (err)
4514 {
4515 fail ("aes-eax, gcry_cipher_setkey failed: %s\n",
4516 gpg_strerror (err));
4517 gcry_cipher_close (hde);
4518 gcry_cipher_close (hdd);
4519 return;
4520 }
4521
4522 err = gcry_cipher_setiv (hde, tv[i].nonce, tv[i].noncelen);
4523 if (!err)
4524 err = gcry_cipher_setiv (hdd, tv[i].nonce, tv[i].noncelen);
4525 if (err)
4526 {
4527 fail ("aes-eax, gcry_cipher_setiv failed: %s\n",
4528 gpg_strerror (err));
4529 gcry_cipher_close (hde);
4530 gcry_cipher_close (hdd);
4531 return;
4532 }
4533
4534 err = gcry_cipher_info (hde, GCRYCTL_GET_TAGLEN, NULL, &taglen2);
4535 if (err)
4536 {
4537 fail ("cipher-eax, gcryctl_get_taglen failed (tv %d): %s\n",
4538 i, gpg_strerror (err));
4539 gcry_cipher_close (hde);
4540 gcry_cipher_close (hdd);
4541 return;
4542 }
4543 if (taglen2 != 16)
4544 {
4545 fail ("cipher-eax, gcryctl_get_taglen returned bad length"
4546 " (tv %d): got=%zu want=%d\n",
4547 i, taglen2, 16);
4548 gcry_cipher_close (hde);
4549 gcry_cipher_close (hdd);
4550 return;
4551 }
4552
4553 for (pos = 0; pos < tv[i].headerlen; pos += step)
4554 {
4555 poslen = (pos + step < tv[i].headerlen) ?
4556 step : tv[i].headerlen - pos;
4557
4558 err = gcry_cipher_authenticate(hde, tv[i].header + pos, poslen);
4559 if (err)
4560 {
4561 fail ("aes-eax, gcry_cipher_authenticate (%d) (%lu:%d) failed: "
4562 "%s\n", i, (unsigned long) pos, step, gpg_strerror (err));
4563 gcry_cipher_close (hde);
4564 gcry_cipher_close (hdd);
4565 return;
4566 }
4567 err = gcry_cipher_authenticate(hdd, tv[i].header + pos, poslen);
4568 if (err)
4569 {
4570 fail ("aes-eax, de gcry_cipher_authenticate (%d) (%lu:%d) failed: "
4571 "%s\n", i, (unsigned long) pos, step, gpg_strerror (err));
4572 gcry_cipher_close (hde);
4573 gcry_cipher_close (hdd);
4574 return;
4575 }
4576 }
4577
4578 for (pos = 0; pos < tv[i].inlen; pos += step)
4579 {
4580 poslen = (pos + step < tv[i].inlen) ? step : tv[i].inlen - pos;
4581
4582 err = gcry_cipher_encrypt (hde, out + pos, poslen,
4583 tv[i].plaintext + pos, poslen);
4584 if (err)
4585 {
4586 fail ("aes-eax, gcry_cipher_encrypt (%d) (%lu:%d) failed: %s\n",
4587 i, (unsigned long) pos, step, gpg_strerror (err));
4588 gcry_cipher_close (hde);
4589 gcry_cipher_close (hdd);
4590 return;
4591 }
4592 }
4593
4594 if (memcmp (tv[i].out, out, tv[i].inlen))
4595 fail ("aes-eax, encrypt mismatch entry %d (step %d)\n", i, step);
4596
4597 for (pos = 0; pos < tv[i].inlen; pos += step)
4598 {
4599 poslen = (pos + step < tv[i].inlen) ? step : tv[i].inlen - pos;
4600
4601 err = gcry_cipher_decrypt (hdd, out + pos, poslen, NULL, 0);
4602 if (err)
4603 {
4604 fail ("aes-eax, gcry_cipher_decrypt (%d) (%lu:%d) failed: %s\n",
4605 i, (unsigned long) pos, step, gpg_strerror (err));
4606 gcry_cipher_close (hde);
4607 gcry_cipher_close (hdd);
4608 return;
4609 }
4610 }
4611
4612 if (memcmp (tv[i].plaintext, out, tv[i].inlen))
4613 fail ("aes-eax, decrypt mismatch entry %d (step %d)\n", i, step);
4614
4615 taglen2 = tv[i].taglen ? tv[i].taglen : 16;
4616
4617 err = gcry_cipher_gettag (hde, out, taglen2);
4618 if (err)
4619 {
4620 if (tv[i].should_fail)
4621 goto next_tv;
4622
4623 fail ("aes-eax, gcry_cipher_gettag(%d) failed: %s\n",
4624 i, gpg_strerror (err));
4625 gcry_cipher_close (hde);
4626 gcry_cipher_close (hdd);
4627 return;
4628 }
4629
4630 if ((memcmp (tv[i].tag, out, taglen2) != 0) ^ tv[i].should_fail)
4631 fail ("aes-eax, encrypt tag mismatch entry %d\n", i);
4632
4633 err = gcry_cipher_checktag (hdd, tv[i].tag, taglen2);
4634 if (err)
4635 {
4636 if (tv[i].should_fail)
4637 goto next_tv;
4638
4639 fail ("aes-eax, gcry_cipher_checktag(%d) failed: %s\n",
4640 i, gpg_strerror (err));
4641 gcry_cipher_close (hde);
4642 gcry_cipher_close (hdd);
4643 return;
4644 }
4645
4646 err = gcry_cipher_reset(hde);
4647 if (!err)
4648 err = gcry_cipher_reset(hdd);
4649 if (err)
4650 {
4651 fail ("aes-eax, gcry_cipher_reset (%d) failed: %s\n",
4652 i, gpg_strerror (err));
4653 gcry_cipher_close (hde);
4654 gcry_cipher_close (hdd);
4655 return;
4656 }
4657
4658 /* gcry_cipher_reset clears the IV */
4659 err = gcry_cipher_setiv (hde, tv[i].nonce, tv[i].noncelen);
4660 if (!err)
4661 err = gcry_cipher_setiv (hdd, tv[i].nonce, tv[i].noncelen);
4662 if (err)
4663 {
4664 fail ("aes-eax, gcry_cipher_setiv failed: %s\n",
4665 gpg_strerror (err));
4666 gcry_cipher_close (hde);
4667 gcry_cipher_close (hdd);
4668 return;
4669 }
4670
4671 /* this time we authenticate, encrypt and decrypt one byte at a time */
4672 for (byteNum = 0; byteNum < tv[i].headerlen; ++byteNum)
4673 {
4674 err = gcry_cipher_authenticate(hde, tv[i].header + byteNum, 1);
4675 if (err)
4676 {
4677 fail ("aes-eax, gcry_cipher_authenticate (%d) (byte-buf) failed: "
4678 "%s\n", i, gpg_strerror (err));
4679 gcry_cipher_close (hde);
4680 gcry_cipher_close (hdd);
4681 return;
4682 }
4683 err = gcry_cipher_authenticate(hdd, tv[i].header + byteNum, 1);
4684 if (err)
4685 {
4686 fail ("aes-eax, de gcry_cipher_authenticate (%d) (byte-buf) "
4687 "failed: %s\n", i, gpg_strerror (err));
4688 gcry_cipher_close (hde);
4689 gcry_cipher_close (hdd);
4690 return;
4691 }
4692 }
4693
4694 for (byteNum = 0; byteNum < tv[i].inlen; ++byteNum)
4695 {
4696 err = gcry_cipher_encrypt (hde, out+byteNum, 1,
4697 (tv[i].plaintext) + byteNum,
4698 1);
4699 if (err)
4700 {
4701 fail ("aes-eax, gcry_cipher_encrypt (%d) (byte-buf) failed: %s\n",
4702 i, gpg_strerror (err));
4703 gcry_cipher_close (hde);
4704 gcry_cipher_close (hdd);
4705 return;
4706 }
4707 }
4708
4709 if (memcmp (tv[i].out, out, tv[i].inlen))
4710 fail ("aes-eax, encrypt mismatch entry %d, (byte-buf)\n", i);
4711
4712 /* Test output to larger than 16-byte buffer. */
4713 taglen2 = tv[i].taglen ? tv[i].taglen : 16 + 1;
4714
4715 err = gcry_cipher_gettag (hde, tag, taglen2);
4716 if (err)
4717 {
4718 if (tv[i].should_fail)
4719 goto next_tv;
4720
4721 fail ("aes-eax, gcry_cipher_gettag(%d, %lu) (byte-buf) failed: %s\n",
4722 i, (unsigned long) taglen2, gpg_strerror (err));
4723 gcry_cipher_close (hde);
4724 gcry_cipher_close (hdd);
4725 return;
4726 }
4727
4728 taglen2 = tv[i].taglen ? tv[i].taglen : 16;
4729
4730 if ((memcmp (tv[i].tag, tag, taglen2) != 0) ^ tv[i].should_fail)
4731 fail ("aes-eax, encrypt tag mismatch entry %d, (byte-buf)\n", i);
4732
4733 for (byteNum = 0; byteNum < tv[i].inlen; ++byteNum)
4734 {
4735 err = gcry_cipher_decrypt (hdd, out+byteNum, 1, NULL, 0);
4736 if (err)
4737 {
4738 fail ("aes-eax, gcry_cipher_decrypt (%d) (byte-buf) failed: %s\n",
4739 i, gpg_strerror (err));
4740 gcry_cipher_close (hde);
4741 gcry_cipher_close (hdd);
4742 return;
4743 }
4744 }
4745
4746 if (memcmp (tv[i].plaintext, out, tv[i].inlen))
4747 fail ("aes-eax, decrypt mismatch entry %d\n", i);
4748
4749 err = gcry_cipher_checktag (hdd, tv[i].tag, taglen2);
4750 if (err)
4751 {
4752 if (tv[i].should_fail)
4753 goto next_tv;
4754
4755 fail ("aes-eax, gcry_cipher_checktag(%d) (byte-buf) failed: %s\n",
4756 i, gpg_strerror (err));
4757 gcry_cipher_close (hde);
4758 gcry_cipher_close (hdd);
4759 return;
4760 }
4761
4762 err = gcry_cipher_checktag (hdd, tag, 17);
4763 if (!err)
4764 {
4765 fail ("aes-eax, gcry_cipher_checktag(%d) did not fail for invalid "
4766 " tag length of '%d'\n", i, 17);
4767 gcry_cipher_close (hde);
4768 gcry_cipher_close (hdd);
4769 return;
4770 }
4771
4772 if (tv[i].should_fail)
4773 {
4774 fail ("aes-eax, negative test succeeded %d\n", i);
4775 gcry_cipher_close (hde);
4776 gcry_cipher_close (hdd);
4777 return;
4778 }
4779
4780 next_tv:
4781 gcry_cipher_close (hde);
4782 gcry_cipher_close (hdd);
4783 }
4784 if (verbose)
4785 fprintf (stderr, " Completed EAX checks.\n");
4786 }
4787
4788
4789 static void
check_eax_cipher(void)4790 check_eax_cipher (void)
4791 {
4792 /* Large buffers, no splitting. */
4793 _check_eax_cipher(0xffffffff);
4794 /* Split input to one byte buffers. */
4795 _check_eax_cipher(1);
4796 /* Split input to 7 byte buffers. */
4797 _check_eax_cipher(7);
4798 /* Split input to 16 byte buffers. */
4799 _check_eax_cipher(16);
4800 }
4801
4802
4803 static void
_check_poly1305_cipher(unsigned int step)4804 _check_poly1305_cipher (unsigned int step)
4805 {
4806 static const struct tv
4807 {
4808 int algo;
4809 const char *key;
4810 const char *iv;
4811 int ivlen;
4812 const char *aad;
4813 int aadlen;
4814 const char *plaintext;
4815 int inlen;
4816 const char *out;
4817 const char *tag;
4818 } tv[] =
4819 {
4820 /* draft-irtf-cfrg-chacha20-poly1305-03 */
4821 { GCRY_CIPHER_CHACHA20,
4822 "\x1c\x92\x40\xa5\xeb\x55\xd3\x8a\xf3\x33\x88\x86\x04\xf6\xb5\xf0"
4823 "\x47\x39\x17\xc1\x40\x2b\x80\x09\x9d\xca\x5c\xbc\x20\x70\x75\xc0",
4824 "\x00\x00\x00\x00\x01\x02\x03\x04\x05\x06\x07\x08", 12,
4825 "\xf3\x33\x88\x86\x00\x00\x00\x00\x00\x00\x4e\x91", 12,
4826 "\x49\x6e\x74\x65\x72\x6e\x65\x74\x2d\x44\x72\x61\x66\x74\x73\x20"
4827 "\x61\x72\x65\x20\x64\x72\x61\x66\x74\x20\x64\x6f\x63\x75\x6d\x65"
4828 "\x6e\x74\x73\x20\x76\x61\x6c\x69\x64\x20\x66\x6f\x72\x20\x61\x20"
4829 "\x6d\x61\x78\x69\x6d\x75\x6d\x20\x6f\x66\x20\x73\x69\x78\x20\x6d"
4830 "\x6f\x6e\x74\x68\x73\x20\x61\x6e\x64\x20\x6d\x61\x79\x20\x62\x65"
4831 "\x20\x75\x70\x64\x61\x74\x65\x64\x2c\x20\x72\x65\x70\x6c\x61\x63"
4832 "\x65\x64\x2c\x20\x6f\x72\x20\x6f\x62\x73\x6f\x6c\x65\x74\x65\x64"
4833 "\x20\x62\x79\x20\x6f\x74\x68\x65\x72\x20\x64\x6f\x63\x75\x6d\x65"
4834 "\x6e\x74\x73\x20\x61\x74\x20\x61\x6e\x79\x20\x74\x69\x6d\x65\x2e"
4835 "\x20\x49\x74\x20\x69\x73\x20\x69\x6e\x61\x70\x70\x72\x6f\x70\x72"
4836 "\x69\x61\x74\x65\x20\x74\x6f\x20\x75\x73\x65\x20\x49\x6e\x74\x65"
4837 "\x72\x6e\x65\x74\x2d\x44\x72\x61\x66\x74\x73\x20\x61\x73\x20\x72"
4838 "\x65\x66\x65\x72\x65\x6e\x63\x65\x20\x6d\x61\x74\x65\x72\x69\x61"
4839 "\x6c\x20\x6f\x72\x20\x74\x6f\x20\x63\x69\x74\x65\x20\x74\x68\x65"
4840 "\x6d\x20\x6f\x74\x68\x65\x72\x20\x74\x68\x61\x6e\x20\x61\x73\x20"
4841 "\x2f\xe2\x80\x9c\x77\x6f\x72\x6b\x20\x69\x6e\x20\x70\x72\x6f\x67"
4842 "\x72\x65\x73\x73\x2e\x2f\xe2\x80\x9d", 265,
4843 "\x64\xa0\x86\x15\x75\x86\x1a\xf4\x60\xf0\x62\xc7\x9b\xe6\x43\xbd"
4844 "\x5e\x80\x5c\xfd\x34\x5c\xf3\x89\xf1\x08\x67\x0a\xc7\x6c\x8c\xb2"
4845 "\x4c\x6c\xfc\x18\x75\x5d\x43\xee\xa0\x9e\xe9\x4e\x38\x2d\x26\xb0"
4846 "\xbd\xb7\xb7\x3c\x32\x1b\x01\x00\xd4\xf0\x3b\x7f\x35\x58\x94\xcf"
4847 "\x33\x2f\x83\x0e\x71\x0b\x97\xce\x98\xc8\xa8\x4a\xbd\x0b\x94\x81"
4848 "\x14\xad\x17\x6e\x00\x8d\x33\xbd\x60\xf9\x82\xb1\xff\x37\xc8\x55"
4849 "\x97\x97\xa0\x6e\xf4\xf0\xef\x61\xc1\x86\x32\x4e\x2b\x35\x06\x38"
4850 "\x36\x06\x90\x7b\x6a\x7c\x02\xb0\xf9\xf6\x15\x7b\x53\xc8\x67\xe4"
4851 "\xb9\x16\x6c\x76\x7b\x80\x4d\x46\xa5\x9b\x52\x16\xcd\xe7\xa4\xe9"
4852 "\x90\x40\xc5\xa4\x04\x33\x22\x5e\xe2\x82\xa1\xb0\xa0\x6c\x52\x3e"
4853 "\xaf\x45\x34\xd7\xf8\x3f\xa1\x15\x5b\x00\x47\x71\x8c\xbc\x54\x6a"
4854 "\x0d\x07\x2b\x04\xb3\x56\x4e\xea\x1b\x42\x22\x73\xf5\x48\x27\x1a"
4855 "\x0b\xb2\x31\x60\x53\xfa\x76\x99\x19\x55\xeb\xd6\x31\x59\x43\x4e"
4856 "\xce\xbb\x4e\x46\x6d\xae\x5a\x10\x73\xa6\x72\x76\x27\x09\x7a\x10"
4857 "\x49\xe6\x17\xd9\x1d\x36\x10\x94\xfa\x68\xf0\xff\x77\x98\x71\x30"
4858 "\x30\x5b\xea\xba\x2e\xda\x04\xdf\x99\x7b\x71\x4d\x6c\x6f\x2c\x29"
4859 "\xa6\xad\x5c\xb4\x02\x2b\x02\x70\x9b",
4860 "\xee\xad\x9d\x67\x89\x0c\xbb\x22\x39\x23\x36\xfe\xa1\x85\x1f\x38" },
4861 /* draft-irtf-cfrg-chacha20-poly1305-03 */
4862 { GCRY_CIPHER_CHACHA20,
4863 "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f"
4864 "\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f",
4865 "\x07\x00\x00\x00\x40\x41\x42\x43\x44\x45\x46\x47", 12,
4866 "\x50\x51\x52\x53\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7", 12,
4867 "Ladies and Gentlemen of the class of '99: If I could offer you "
4868 "only one tip for the future, sunscreen would be it.", 114,
4869 "\xd3\x1a\x8d\x34\x64\x8e\x60\xdb\x7b\x86\xaf\xbc\x53\xef\x7e\xc2"
4870 "\xa4\xad\xed\x51\x29\x6e\x08\xfe\xa9\xe2\xb5\xa7\x36\xee\x62\xd6"
4871 "\x3d\xbe\xa4\x5e\x8c\xa9\x67\x12\x82\xfa\xfb\x69\xda\x92\x72\x8b"
4872 "\x1a\x71\xde\x0a\x9e\x06\x0b\x29\x05\xd6\xa5\xb6\x7e\xcd\x3b\x36"
4873 "\x92\xdd\xbd\x7f\x2d\x77\x8b\x8c\x98\x03\xae\xe3\x28\x09\x1b\x58"
4874 "\xfa\xb3\x24\xe4\xfa\xd6\x75\x94\x55\x85\x80\x8b\x48\x31\xd7\xbc"
4875 "\x3f\xf4\xde\xf0\x8e\x4b\x7a\x9d\xe5\x76\xd2\x65\x86\xce\xc6\x4b"
4876 "\x61\x16",
4877 "\x1a\xe1\x0b\x59\x4f\x09\xe2\x6a\x7e\x90\x2e\xcb\xd0\x60\x06\x91" },
4878 /* generated with c implementation */
4879 { GCRY_CIPHER_CHACHA20,
4880 "\x1c\x92\x40\xa5\xeb\x55\xd3\x8a\xf3\x33\x88\x86\x04\xf6\xb5\xf0"
4881 "\x47\x39\x17\xc1\x40\x2b\x80\x09\x9d\xca\x5c\xbc\x20\x70\x75\xc0",
4882 "\x00\x00\x00\x00\x01\x02\x03\x04\x05\x06\x07\x08", 12,
4883 "\xf3\x33\x88\x86\x00\x00\x00\x00\x00\x00\x4e\x91", 12,
4884 "\xb0\x58\x83\x17\x3a\x8e\x69\xf2\x18\x9d\x71\xe4\x8a\x0b\x7a\xcd"
4885 "\xe2\xd8\xb9\x8b\xdf\x99\xc2\x6d\x05\x4b\x44\x1e\x65\x5d\xda\xd5"
4886 "\x79\xf0\x19\xab\x94\x50\xd0\xc5\x54\xfe\x76\xc8\xd9\xf3\x39\x33"
4887 "\x9c\x0f\x27\x89\x85\x99\xe3\xed\x5c\x31\x04\xa6\x20\xab\xb3\x78"
4888 "\xac\x31\xba\x21\x8c\xac\x70\xd1\xe2\x92\xd6\x50\x58\x69\xab\xd4"
4889 "\x38\xdc\x9c\x71\x81\xf7\xf1\x68\x10\x50\x07\x09\x0e\x51\x49\xd2"
4890 "\x10\x9a\x2e\x78\xfb\xc7\xd3\xc2\x84\xda\xf2\x52\x17\x2c\xa6\xe8"
4891 "\x56\x60\x80\x46\xed\xfb\x9f\xab\xc2\x01\xf0\x06\x6b\x6e\xcc\xf6"
4892 "\x55\x3e\x81\xc7\x71\x9f\x10\xf0\x8e\x5a\x4b\xf6\xae\x90\x75\x03"
4893 "\x4f\xb3\xb4\xff\x66\xfa\xe3\xb6\x1c\xca\x0c\x75\x8a\x08\x3d\xce"
4894 "\x58\x69\x9d\xa9\x19\x29\xda\x2f\xa1\xb2\xae\xa7\x83\xd5\x92\xc2"
4895 "\x15\xdc\xef\x76\xd2\xd1\x9f\xb4\x7f\x3e\xb3\x7a\xa8\x3e\xba\xa3"
4896 "\x9e\x2e\x73\xe3\x4d\xdc\x50\xba\x5b\xb0\x8b\x1a\x87\x21\x03\x93"
4897 "\x74\x20\x01\xda\x38\x85\x1c\x3c\x57\x51\x09\x0e\xd8\xfc\x2b\xef"
4898 "\x38\x8e\x11\xa4\x9e\x11\xcc\xc5\x9f\x4c\xc2\x0d\x3e\x5f\x73\x40"
4899 "\x5a\xf4\x5b\x57\x84\x6e\xc7\xd0\x8e\xad\x1c\x1b\xae\x59\xba\xf5"
4900 "\x77\xed\x44\x08\x9c\x9b\xfd\x88\xd9\x27\xe8\x43\xe8\xdd\x86\xfd"
4901 "\x05\x3a\xc2\x11\x88\x98\x87\xcb\xa1\x72\xc2\x52\x5c\xd1\x1a\x40"
4902 "\x80\xe2\x1e\xe8\x9b\x4e\x63\x9b\xfb\x58\x11\x44\x36\x35\x83\x9b"
4903 "\x20\x9b\x4b\x58\xef\x1f\xfa\xe1\xb0\xe0\xb8\x60\x87\x0b\xdb\x83"
4904 "\x6f\xeb\xc0\x80\x63\xa8\xc4\x22\x0f\x1d\xec\x9b\x44\xfa\xd3\x13"
4905 "\x75\xb0\xfe\x74\x3c\xde\x9e\xb4\x91\x72\xc5\xf6\x36\x14\x18\x2d"
4906 "\x15\x2e\x6b\x34\xcf\xed\x86\x4f\x1b\x56\xcf\x09\x8f\x3d\xd1\x8d"
4907 "\x01\x7c\xba\x6a\xf4\x82\xdc\xf6\x9e\xc9\x79\xd4\x9e\x50\xc2\x9a"
4908 "\x4f\x90\x10\x44\xd5\xcf\x6b\x1d\xb3\xce\x7c\xeb\x3f\x8f\xbc\xe6"
4909 "\x76\xad\x78\x97\xee\xaf\x66\x73\xe4\x11\xb9\x6c\xf4\xc1\x1a\x76"
4910 "\xd6\x54\x4c\x6c\x44\x58\xec\xd9\x8f\xf9\xc6\x7f\x71\x95\x04\xfe"
4911 "\x6b\x42\xd6\x4f\xc6\xa8\xc1\xfa\x1e\x2c\xf2\x49\x6a\x5a\xe5\x28"
4912 "\x34\x30\x05\xc1\x21\x3a\x5f\xfd\xaf\x61\x1f\xa0\x91\xd4\x17\xcf"
4913 "\x65\x9d\xf5\xdb\x4b\xc2\x3d\x12\xed\xe1\x4e\xf1\x34\x50\x13\xa7"
4914 "\x3f\xe6\x26\xcb\xc9\xb3\x64\x69\xa9\x82\x21\xec\x64\xa9\x2e\x83"
4915 "\xa9\x9d\xa0\xbe\x20\xef\x5f\x71\x45\xe7\x9f\x75\xa3\x72\x16\xef"
4916 "\x1b\xf7\x9a\x15\xe2\x75\x92\x39\xbb\xb1\x4f\x34\xf4\x88\x0d\xcf"
4917 "\xbf\xd6\xfe\x5d\x61\x14\x45\x83\xf9\x6a\x3e\x81\x0f\x14\x78\xda"
4918 "\x94\xe2\xce\x7d\x1c\x15\xd7\xe0\x95\x1d\xd8\x96\xc2\x11\xb1\x55"
4919 "\xae\xc6\x95\x43\x38\x0a\x01\xc2\x30\xb8\x1b\x12\x39\x98\x58\x20"
4920 "\xbd\x65\x50\x1d\x17\x13\x02\xb9\xe4\x88\x39\x72\xc8\x58\xa0\xa8"
4921 "\x8f\xb9\xc2\x78\x82\x3a\x56\xe8\x0d\xf9\x1b\xbb\xfb\xf0\x5b\xc4"
4922 "\x9a\x2d\xf0\xd5\x57\x6f\xce\x4b\xb6\x3e\x1b\xbf\x54\xb4\x3e\x4e"
4923 "\x52\x5c\x2e\x6b\x5e\x01\xd1\xb3\xb5\x16\x67\xe4\x16\xad\x3c\x4d"
4924 "\x1c\xb2\xc0\x54\xcc\xf9\xba\x11\x85\xdf\x43\x1a\xfb\x55\x9b\x88"
4925 "\x27\x9e\x17\x29\x41\x7d\x2a\xb4\xf6\x61\x93\xa5\x1f\x5b\xb3\x06"
4926 "\xbe\x86\x40\x11\xc6\xfc\x36\x44\xdb\xbf\x4c\x6b\x21\x15\xa9\x10"
4927 "\x01\xdc\x53\x9c\x57\x27\xbe\x55\x19\x86\x17\x96\xfa\xdc\x4d\xf4"
4928 "\xd9\x79\xbe\x6c\x29\x1b\xed\xbd\x09\x72\xb4\xbf\x88\xc7\x52\x39"
4929 "\x5f\x62\x35\xad\x41\x87\xa6\xaa\x99\x20\xbc\x7d\x97\x67\x83\xa5"
4930 "\xc3\x43\xc6\x7f\x31\xb9\x0c\xe1\x82\xa5\x66\x9a\x58\xe3\xaf\x6b"
4931 "\x59\x09\x5b\xad\xed\xc2\x57\x66\x4e\x72\xb0\xaa\x0d\xeb\x9c\x48"
4932 "\x3f\x0b\xaf\xc6\x46\x06\x54\x3a\x2a\x19\xb3\x9d\xde\xd9\xa0\xcf"
4933 "\x71\x69\x33\xe8\x2c\xa8\x56\x8c\x0b\xae\x41\xc7\xb5\xfd\xca\xea"
4934 "\x0f\xd1\xd7\xe0\x3e\xf6\xf5\xd1\xb2\x57\x21\x00\x32\xca\x02\x4d"
4935 "\x18\xbe\x2c\x25\xe9\xbe\x0a\x34\x44\x92\xaa\x43\x09\xf7\xb4\x35"
4936 "\xac\x65\xc3\xc1\x4c\x66\x74\x91\x9f\xae\xe2\x27\x37\x8a\xfe\x13"
4937 "\x57\xf0\x39\x30\xf0\x06\xef\xa0\x5f\x90\xb7\xfa\xd9\x42\x3e\xcb"
4938 "\xdc\x9c\x44\x36\x13\x8e\x66\xbc\x85\xe8\xfa\x2c\x73\xa5\x87\xbd"
4939 "\x63\x98\x42\x56\x1a\xe9\xc4\x80\xa1\x0e\xd5\x9a\x27\xd2\x82\x20"
4940 "\x08\xe5\x98\x60\x00\x6d\xd9\x53\x9b\xae\x67\xfb\x03\xff\x82\xf1"
4941 "\xc6\x9b\x0b\xf1\x2c\x97\x89\x1c\x8e\x84\xd0\xb3\x2a\x44\xa3\xb2"
4942 "\x77\x1d\xf2\x2e\x6a\xf7\x05\x67\x32\x21\xca\x39\x2e\x7f\x1a\x69"
4943 "\x21\xdd\xaa\xfc\x19\xad\xc5\xf8\xfe\x6f\x17\x9e\x32\x64\xf8\xeb"
4944 "\x98\x8a\x5e\x2e\x89\xea\xfb\xed\xd7\x09\x1a\x7f\xa5\xf6\xe3\xd4"
4945 "\x33\x60\xbb\xc2\x2b\x1a\xd6\x4c\x03\xe1\xc3\xc6\x90\x0e\x7a\x89"
4946 "\xe8\x50\x4b\x47\xc2\x91\x5d\x2a\x49\xf5\xb0\x5f\x69\xbb\x88\x51"
4947 "\x0c\xa2\xc0\x88\x99\x91\xcd\x77\x11\x31\x3a\x8f\x99\x03\xd7\x5e",
4948 1024,
4949 "\x9d\x96\x71\x67\x3d\x66\x16\x72\x55\x29\x61\x42\x77\x99\x4a\x50"
4950 "\xdd\x2a\x80\x56\x8f\xb7\x50\x82\x80\x63\x47\x7b\xc1\x44\x3b\x02"
4951 "\x5b\xe8\x96\x93\x97\x6c\xff\x42\x90\x40\xf9\xe9\x93\xfe\x7e\xa3"
4952 "\x4c\xd9\xe8\xdc\xda\xf7\x8f\xcd\xe7\xa7\x1f\xaa\x7c\x8b\x07\xda"
4953 "\xf0\x70\x4d\x47\x8e\x87\x86\x71\x1e\x7a\x13\x7b\x9c\x42\x5d\x30"
4954 "\x0c\x04\xfb\x7b\xe0\x0e\xa7\xb1\x5c\x89\xf7\xdd\x81\x0a\xe0\xe4"
4955 "\xe2\x69\xa2\x36\x60\x45\x1c\xcc\x27\x2f\xaf\x70\x59\x6d\xc5\xb4"
4956 "\x40\x04\x69\x1d\xe8\xf3\xf5\x7e\x49\xd7\x81\x12\x5b\xd3\xc6\x77"
4957 "\x82\x5c\x9e\x91\x6b\x6b\x7d\xd7\x45\xb8\x39\x94\x0a\x1a\xb4\xc4"
4958 "\xff\xba\x05\x7b\x0b\xba\xe1\x81\x90\x29\xdd\xb5\x58\x0b\x1f\x82"
4959 "\x9e\x4d\xdd\x1b\xc1\x62\x14\x1a\x8f\xc1\x8c\xf6\x46\x07\xb2\xcd"
4960 "\x6a\xb5\xa1\x06\x4c\xc3\xa3\x3f\x02\x08\xe2\x29\x3c\x05\xbd\xcb"
4961 "\xf0\xfa\x27\xf1\x7b\x48\x45\x46\x62\x88\x01\xb8\xd3\x0a\x29\xbc"
4962 "\xd6\xbb\x20\xee\x75\x5f\x29\x0c\x47\x9e\x0f\x1d\xdf\x81\x39\x9a"
4963 "\x1c\x48\x69\x09\xeb\x42\xae\x71\x11\x4c\x53\x9c\x69\xa6\x71\x50"
4964 "\x45\x4d\x31\x71\xdd\xdb\xb1\x64\x37\xbf\x03\x76\xb2\x44\xf9\xbb"
4965 "\xa3\x25\x6b\xcf\xb0\x9f\x1d\x78\xdf\x93\xde\x2d\x57\x23\x6f\xff"
4966 "\x02\xf8\xc6\xf5\x5f\x4b\xd5\x8a\x15\xc2\x5f\x9d\x47\x3b\x2f\x8f"
4967 "\x36\x93\x4a\x96\xae\x57\xaa\xd7\x6e\xea\x45\x94\xfb\xa2\xab\x56"
4968 "\xae\x7e\xb3\xc5\x87\xa5\xd4\x2d\xf0\x99\x1e\x0a\x05\xb8\x33\xe4"
4969 "\x89\x6c\x9e\x6d\x8c\xf1\xb4\xaa\x1f\xaa\xfb\x4b\x40\x90\xc0\x50"
4970 "\xf3\x7d\x2a\x67\x68\x25\x0a\x9a\x89\x1f\x90\xfd\xb0\x9d\x7d\xaf"
4971 "\x72\x22\xeb\x22\xb9\x63\x5f\x2c\x54\x49\xa3\x99\xc4\x74\xab\xc0"
4972 "\x2c\x85\x31\x26\x84\x57\xfd\xce\x34\x10\x63\x57\x9f\x0c\x0a\xa3"
4973 "\x02\xb0\x87\x36\xf5\xf8\x1e\x66\x81\x74\x2c\x3e\x90\xc0\x10\xf1"
4974 "\x53\xd4\xc3\x45\x9b\xe2\x58\xcf\x86\x2e\xf4\xb3\x11\xff\xe6\xc8"
4975 "\x5c\x74\x6e\xb4\xd9\x52\x2c\x52\x71\x5e\xb4\xf1\xca\xa7\x1c\x09"
4976 "\x6a\x2d\xc0\x20\x38\xf5\x61\xdc\xd9\x8d\x42\x71\x65\xf8\xce\xa7"
4977 "\xcb\x2c\x44\x09\x87\x5a\x02\xdd\x8c\xe1\xec\xd0\xe1\xeb\x4d\x25"
4978 "\x70\x57\xbd\xc7\x1b\xee\xb5\xc0\x81\xc5\x75\x45\xb8\xb7\xad\xfd"
4979 "\x33\xdc\xbe\x09\x71\xd0\xd4\xee\xf7\x37\x4e\x6f\x80\x5f\xec\x3f"
4980 "\x35\x75\x39\xaa\x41\xe6\x62\x17\xc5\x8f\xa4\xa7\x31\xd6\xd5\xe9"
4981 "\x56\xc2\xc7\x1d\xf1\x58\xf6\xad\x3b\xbc\xbe\x65\x12\xd4\xfb\xe2"
4982 "\x0a\x5a\x64\x9e\xad\x70\x1d\x95\xbd\x24\x1a\xa9\x99\xc0\x70\x74"
4983 "\xb1\x79\x01\x4f\xfd\x5d\x76\xa7\xd9\x53\x3d\x87\x2b\x51\xb4\xf3"
4984 "\x17\xa5\x41\xe9\x8b\xba\xd3\x69\xcd\xe6\x44\x0f\x18\x8f\x59\x0d"
4985 "\xb0\xb8\x2a\x7f\xbb\x16\x51\xf5\xe8\xad\xda\x66\xaa\x3a\xb6\x7d"
4986 "\x10\x13\x8d\xd9\x7d\x15\x09\x80\x7b\x00\x67\x96\x90\x21\x3e\xd4"
4987 "\x1a\xe8\x3b\x1c\x78\x31\x9b\x63\x64\xb9\x1b\x50\x11\x93\x48\x13"
4988 "\x89\xcb\xba\x57\x23\xcd\x95\x95\xd5\xee\x8b\x0d\xb4\xdf\x0c\x8a"
4989 "\xae\xae\x55\x3f\x93\xad\xc1\x3e\xe5\x31\x20\x73\x58\xb0\x0b\xba"
4990 "\xf5\x03\x7b\x50\x39\xa3\x66\xa9\x82\x47\x65\x29\xa8\x49\xd7\x5c"
4991 "\x51\x89\x97\x03\x31\x11\x75\x83\x6e\x4e\x80\x2d\x57\x93\x88\xec"
4992 "\x0e\x22\xa8\xde\x50\x99\x2c\xaa\xaf\x60\x3a\x74\xa0\x31\x16\x37"
4993 "\xcd\x8a\x4d\xda\x40\x1d\x0c\xf1\xc4\x7a\xd0\xaa\xf4\xa7\x55\xe3"
4994 "\xa4\xe3\x9d\x27\x4f\x81\xc6\x07\x74\x13\x8e\x4b\xd9\x6c\x33\xba"
4995 "\x28\x8d\xb7\x79\x36\x29\xfc\x98\x91\x29\x87\xe7\xf6\x92\xb8\x7c"
4996 "\xe4\xca\xb7\x21\x49\x8c\x01\x59\xad\x65\x37\x62\x9b\xba\x40\xc1"
4997 "\x79\x87\xe5\x48\x58\xe3\x0e\x3a\xda\x31\x03\x55\x36\x64\x00\xda"
4998 "\x61\x8a\x0a\x93\xdc\x82\xcc\x63\x40\xb5\x46\xde\xf0\x8c\x3f\x6d"
4999 "\x3e\x32\xf2\xe6\x1d\x37\xf0\xd1\x7e\x33\x52\xb6\x97\xc3\x80\x64"
5000 "\xa4\x0d\x5f\x97\xa5\xd8\xa3\x47\x1a\x83\x1f\xd0\x52\x81\xb9\xd9"
5001 "\x7a\x32\xe6\xf1\x3e\x7d\xdc\x01\x5d\xb8\x44\x12\xc0\x1f\x72\x72"
5002 "\x8b\x0e\xfa\x05\x37\x73\xbd\xc4\x06\x67\x18\xd7\xd4\x80\x2c\x2c"
5003 "\x13\x06\xfe\x82\x5b\x65\x88\xe3\x0b\x06\x3c\xe6\xe4\xd0\x8f\x24"
5004 "\x6a\x6a\x4d\x21\x4c\x2d\x05\x76\x12\xf9\xee\xbf\xb5\x5e\xcd\x03"
5005 "\xf0\x5b\x35\x82\xb7\x1d\x7b\xca\xa6\x14\x40\x68\xd2\xa5\x49\x34"
5006 "\x69\xb7\x05\x48\xf9\xdb\x93\xd4\x0b\x45\x8d\xb3\x1e\xa3\xf9\x5d"
5007 "\x8c\x18\xc5\x40\x14\x67\xc5\x40\xbe\x61\x53\x74\x52\x94\x6c\x5e"
5008 "\xc6\xdf\xd0\xe7\xe5\xbd\x4b\xca\x89\xca\xf6\xf4\xc5\x6f\xf6\x87"
5009 "\x9e\x3a\x11\x5a\xa8\xcd\x83\x70\x19\x63\x8a\xaf\x08\xb1\x33\xa9"
5010 "\x2a\xcc\xde\x7f\xd2\x63\xfb\x85\x40\x77\x40\x8f\x9d\xa0\x7c\xed"
5011 "\x8d\xe5\xe5\x31\x05\x75\xf2\x7e\xab\x22\x54\xbf\xfe\xd3\x1f\x45"
5012 "\x95\x0d\x6d\x07\x6a\x90\x06\xd6\x45\x97\xc0\x82\x88\xfc\xd8\xd0",
5013 "\xf1\xef\xf4\x8d\x9c\xfa\x92\x10\xd9\x4f\x22\x3f\x2f\x75\xe1\x8b" },
5014 };
5015
5016 gcry_cipher_hd_t hde, hdd;
5017 unsigned char out[2048];
5018 unsigned char tag[16];
5019 int i, keylen;
5020 gcry_error_t err = 0;
5021 size_t pos, poslen, taglen2;
5022 int byteNum;
5023
5024 if (verbose)
5025 fprintf (stderr, " Starting POLY1305 checks.\n");
5026
5027 for (i = 0; i < sizeof (tv) / sizeof (tv[0]); i++)
5028 {
5029 if (verbose)
5030 fprintf (stderr, " checking POLY1305 mode for %s [%i]\n",
5031 gcry_cipher_algo_name (tv[i].algo),
5032 tv[i].algo);
5033 err = gcry_cipher_open (&hde, tv[i].algo, GCRY_CIPHER_MODE_POLY1305, 0);
5034 if (!err)
5035 err = gcry_cipher_open (&hdd, tv[i].algo, GCRY_CIPHER_MODE_POLY1305, 0);
5036 if (err)
5037 {
5038 fail ("poly1305, gcry_cipher_open failed: %s\n", gpg_strerror (err));
5039 return;
5040 }
5041
5042 keylen = gcry_cipher_get_algo_keylen(tv[i].algo);
5043 if (!keylen)
5044 {
5045 fail ("poly1305, gcry_cipher_get_algo_keylen failed\n");
5046 return;
5047 }
5048
5049 err = gcry_cipher_setkey (hde, tv[i].key, keylen);
5050 if (!err)
5051 err = gcry_cipher_setkey (hdd, tv[i].key, keylen);
5052 if (err)
5053 {
5054 fail ("poly1305, gcry_cipher_setkey failed: %s\n",
5055 gpg_strerror (err));
5056 gcry_cipher_close (hde);
5057 gcry_cipher_close (hdd);
5058 return;
5059 }
5060
5061 err = gcry_cipher_setiv (hde, tv[i].iv, tv[i].ivlen);
5062 if (!err)
5063 err = gcry_cipher_setiv (hdd, tv[i].iv, tv[i].ivlen);
5064 if (err)
5065 {
5066 fail ("poly1305, gcry_cipher_setiv failed: %s\n",
5067 gpg_strerror (err));
5068 gcry_cipher_close (hde);
5069 gcry_cipher_close (hdd);
5070 return;
5071 }
5072
5073 err = gcry_cipher_info (hde, GCRYCTL_GET_TAGLEN, NULL, &taglen2);
5074 if (err)
5075 {
5076 fail ("cipher-poly1305, gcryctl_get_taglen failed (tv %d): %s\n",
5077 i, gpg_strerror (err));
5078 gcry_cipher_close (hde);
5079 gcry_cipher_close (hdd);
5080 return;
5081 }
5082 if (taglen2 != 16)
5083 {
5084 fail ("cipher-poly1305, gcryctl_get_taglen returned bad length"
5085 " (tv %d): got=%zu want=%d\n",
5086 i, taglen2, 16);
5087 gcry_cipher_close (hde);
5088 gcry_cipher_close (hdd);
5089 return;
5090 }
5091
5092 for (pos = 0; pos < tv[i].aadlen; pos += step)
5093 {
5094 poslen = (pos + step < tv[i].aadlen) ? step : tv[i].aadlen - pos;
5095
5096 err = gcry_cipher_authenticate(hde, tv[i].aad + pos, poslen);
5097 if (err)
5098 {
5099 fail ("poly1305, gcry_cipher_authenticate (%d) (%lu:%d) failed: "
5100 "%s\n", i, (unsigned long) pos, step, gpg_strerror (err));
5101 gcry_cipher_close (hde);
5102 gcry_cipher_close (hdd);
5103 return;
5104 }
5105 err = gcry_cipher_authenticate(hdd, tv[i].aad + pos, poslen);
5106 if (err)
5107 {
5108 fail ("poly1305, de gcry_cipher_authenticate (%d) (%lu:%d) failed: "
5109 "%s\n", i, (unsigned long) pos, step, gpg_strerror (err));
5110 gcry_cipher_close (hde);
5111 gcry_cipher_close (hdd);
5112 return;
5113 }
5114 }
5115
5116 for (pos = 0; pos < tv[i].inlen; pos += step)
5117 {
5118 poslen = (pos + step < tv[i].inlen) ? step : tv[i].inlen - pos;
5119
5120 err = gcry_cipher_encrypt (hde, out + pos, poslen,
5121 tv[i].plaintext + pos, poslen);
5122 if (err)
5123 {
5124 fail ("poly1305, gcry_cipher_encrypt (%d) (%lu:%d) failed: %s\n",
5125 i, (unsigned long) pos, step, gpg_strerror (err));
5126 gcry_cipher_close (hde);
5127 gcry_cipher_close (hdd);
5128 return;
5129 }
5130 }
5131
5132 if (memcmp (tv[i].out, out, tv[i].inlen))
5133 fail ("poly1305, encrypt mismatch entry %d (step %d)\n", i, step);
5134
5135 for (pos = 0; pos < tv[i].inlen; pos += step)
5136 {
5137 poslen = (pos + step < tv[i].inlen) ? step : tv[i].inlen - pos;
5138
5139 err = gcry_cipher_decrypt (hdd, out + pos, poslen, NULL, 0);
5140 if (err)
5141 {
5142 fail ("poly1305, gcry_cipher_decrypt (%d) (%lu:%d) failed: %s\n",
5143 i, (unsigned long) pos, step, gpg_strerror (err));
5144 gcry_cipher_close (hde);
5145 gcry_cipher_close (hdd);
5146 return;
5147 }
5148 }
5149
5150 if (memcmp (tv[i].plaintext, out, tv[i].inlen))
5151 fail ("poly1305, decrypt mismatch entry %d (step %d)\n", i, step);
5152
5153 err = gcry_cipher_gettag (hde, out, 16);
5154 if (err)
5155 {
5156 fail ("poly1305, gcry_cipher_gettag(%d) failed: %s\n",
5157 i, gpg_strerror (err));
5158 gcry_cipher_close (hde);
5159 gcry_cipher_close (hdd);
5160 return;
5161 }
5162
5163 if (memcmp (tv[i].tag, out, 16))
5164 fail ("poly1305, encrypt tag mismatch entry %d\n", i);
5165
5166
5167 err = gcry_cipher_checktag (hdd, out, 16);
5168 if (err)
5169 {
5170 fail ("poly1305, gcry_cipher_checktag(%d) failed: %s\n",
5171 i, gpg_strerror (err));
5172 gcry_cipher_close (hde);
5173 gcry_cipher_close (hdd);
5174 return;
5175 }
5176
5177 err = gcry_cipher_reset(hde);
5178 if (!err)
5179 err = gcry_cipher_reset(hdd);
5180 if (err)
5181 {
5182 fail ("poly1305, gcry_cipher_reset (%d) failed: %s\n",
5183 i, gpg_strerror (err));
5184 gcry_cipher_close (hde);
5185 gcry_cipher_close (hdd);
5186 return;
5187 }
5188
5189 /* gcry_cipher_reset clears the IV */
5190 err = gcry_cipher_setiv (hde, tv[i].iv, tv[i].ivlen);
5191 if (!err)
5192 err = gcry_cipher_setiv (hdd, tv[i].iv, tv[i].ivlen);
5193 if (err)
5194 {
5195 fail ("poly1305, gcry_cipher_setiv failed: %s\n",
5196 gpg_strerror (err));
5197 gcry_cipher_close (hde);
5198 gcry_cipher_close (hdd);
5199 return;
5200 }
5201
5202 /* this time we authenticate, encrypt and decrypt one byte at a time */
5203 for (byteNum = 0; byteNum < tv[i].aadlen; ++byteNum)
5204 {
5205 err = gcry_cipher_authenticate(hde, tv[i].aad + byteNum, 1);
5206 if (err)
5207 {
5208 fail ("poly1305, gcry_cipher_authenticate (%d) (byte-buf) failed: "
5209 "%s\n", i, gpg_strerror (err));
5210 gcry_cipher_close (hde);
5211 gcry_cipher_close (hdd);
5212 return;
5213 }
5214 err = gcry_cipher_authenticate(hdd, tv[i].aad + byteNum, 1);
5215 if (err)
5216 {
5217 fail ("poly1305, de gcry_cipher_authenticate (%d) (byte-buf) "
5218 "failed: %s\n", i, gpg_strerror (err));
5219 gcry_cipher_close (hde);
5220 gcry_cipher_close (hdd);
5221 return;
5222 }
5223 }
5224
5225 for (byteNum = 0; byteNum < tv[i].inlen; ++byteNum)
5226 {
5227 err = gcry_cipher_encrypt (hde, out+byteNum, 1,
5228 (tv[i].plaintext) + byteNum,
5229 1);
5230 if (err)
5231 {
5232 fail ("poly1305, gcry_cipher_encrypt (%d) (byte-buf) failed: %s\n",
5233 i, gpg_strerror (err));
5234 gcry_cipher_close (hde);
5235 gcry_cipher_close (hdd);
5236 return;
5237 }
5238 }
5239
5240 if (memcmp (tv[i].out, out, tv[i].inlen))
5241 fail ("poly1305, encrypt mismatch entry %d, (byte-buf)\n", i);
5242
5243 err = gcry_cipher_gettag (hde, tag, 16);
5244 if (err)
5245 {
5246 fail ("poly1305, gcry_cipher_gettag(%d) (byte-buf) failed: %s\n",
5247 i, gpg_strerror (err));
5248 gcry_cipher_close (hde);
5249 gcry_cipher_close (hdd);
5250 return;
5251 }
5252
5253 if (memcmp (tv[i].tag, tag, 16))
5254 fail ("poly1305, encrypt tag mismatch entry %d, (byte-buf)\n", i);
5255
5256 for (byteNum = 0; byteNum < tv[i].inlen; ++byteNum)
5257 {
5258 err = gcry_cipher_decrypt (hdd, out+byteNum, 1, NULL, 0);
5259 if (err)
5260 {
5261 fail ("poly1305, gcry_cipher_decrypt (%d) (byte-buf) failed: %s\n",
5262 i, gpg_strerror (err));
5263 gcry_cipher_close (hde);
5264 gcry_cipher_close (hdd);
5265 return;
5266 }
5267 }
5268
5269 if (memcmp (tv[i].plaintext, out, tv[i].inlen))
5270 fail ("poly1305, decrypt mismatch entry %d\n", i);
5271
5272 err = gcry_cipher_checktag (hdd, tag, 16);
5273 if (err)
5274 {
5275 fail ("poly1305, gcry_cipher_checktag(%d) (byte-buf) failed: %s\n",
5276 i, gpg_strerror (err));
5277 gcry_cipher_close (hde);
5278 gcry_cipher_close (hdd);
5279 return;
5280 }
5281
5282 gcry_cipher_close (hde);
5283 gcry_cipher_close (hdd);
5284 }
5285 if (verbose)
5286 fprintf (stderr, " Completed POLY1305 checks.\n");
5287 }
5288
5289
5290 static void
check_poly1305_cipher(void)5291 check_poly1305_cipher (void)
5292 {
5293 /* Large buffers, no splitting. */
5294 _check_poly1305_cipher(0xffffffff);
5295 /* Split input to one byte buffers. */
5296 _check_poly1305_cipher(1);
5297 /* Split input to 7 byte buffers. */
5298 _check_poly1305_cipher(7);
5299 /* Split input to 16 byte buffers. */
5300 _check_poly1305_cipher(16);
5301 }
5302
5303
5304 static void
check_ccm_cipher(void)5305 check_ccm_cipher (void)
5306 {
5307 static const struct tv
5308 {
5309 int algo;
5310 int keylen;
5311 const char *key;
5312 int noncelen;
5313 const char *nonce;
5314 int aadlen;
5315 const char *aad;
5316 int plainlen;
5317 const char *plaintext;
5318 int cipherlen;
5319 const char *ciphertext;
5320 } tv[] =
5321 {
5322 /* RFC 3610 */
5323 { GCRY_CIPHER_AES, /* Packet Vector #1 */
5324 16, "\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF",
5325 13, "\x00\x00\x00\x03\x02\x01\x00\xA0\xA1\xA2\xA3\xA4\xA5",
5326 8, "\x00\x01\x02\x03\x04\x05\x06\x07",
5327 23,
5328 "\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E",
5329 31,
5330 "\x58\x8C\x97\x9A\x61\xC6\x63\xD2\xF0\x66\xD0\xC2\xC0\xF9\x89\x80\x6D\x5F\x6B\x61\xDA\xC3\x84\x17\xE8\xD1\x2C\xFD\xF9\x26\xE0"},
5331 { GCRY_CIPHER_AES, /* Packet Vector #2 */
5332 16, "\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF",
5333 13, "\x00\x00\x00\x04\x03\x02\x01\xA0\xA1\xA2\xA3\xA4\xA5",
5334 8, "\x00\x01\x02\x03\x04\x05\x06\x07",
5335 24,
5336 "\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F",
5337 32,
5338 "\x72\xC9\x1A\x36\xE1\x35\xF8\xCF\x29\x1C\xA8\x94\x08\x5C\x87\xE3\xCC\x15\xC4\x39\xC9\xE4\x3A\x3B\xA0\x91\xD5\x6E\x10\x40\x09\x16"},
5339 { GCRY_CIPHER_AES, /* Packet Vector #3 */
5340 16, "\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF",
5341 13, "\x00\x00\x00\x05\x04\x03\x02\xA0\xA1\xA2\xA3\xA4\xA5",
5342 8, "\x00\x01\x02\x03\x04\x05\x06\x07",
5343 25,
5344 "\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F\x20",
5345 33,
5346 "\x51\xB1\xE5\xF4\x4A\x19\x7D\x1D\xA4\x6B\x0F\x8E\x2D\x28\x2A\xE8\x71\xE8\x38\xBB\x64\xDA\x85\x96\x57\x4A\xDA\xA7\x6F\xBD\x9F\xB0\xC5"},
5347 { GCRY_CIPHER_AES, /* Packet Vector #4 */
5348 16, "\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF",
5349 13, "\x00\x00\x00\x06\x05\x04\x03\xA0\xA1\xA2\xA3\xA4\xA5",
5350 12, "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B",
5351 19,
5352 "\x0C\x0D\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E",
5353 27,
5354 "\xA2\x8C\x68\x65\x93\x9A\x9A\x79\xFA\xAA\x5C\x4C\x2A\x9D\x4A\x91\xCD\xAC\x8C\x96\xC8\x61\xB9\xC9\xE6\x1E\xF1"},
5355 { GCRY_CIPHER_AES, /* Packet Vector #5 */
5356 16, "\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF",
5357 13, "\x00\x00\x00\x07\x06\x05\x04\xA0\xA1\xA2\xA3\xA4\xA5",
5358 12, "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B",
5359 20,
5360 "\x0C\x0D\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F",
5361 28,
5362 "\xDC\xF1\xFB\x7B\x5D\x9E\x23\xFB\x9D\x4E\x13\x12\x53\x65\x8A\xD8\x6E\xBD\xCA\x3E\x51\xE8\x3F\x07\x7D\x9C\x2D\x93"},
5363 { GCRY_CIPHER_AES, /* Packet Vector #6 */
5364 16, "\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF",
5365 13, "\x00\x00\x00\x08\x07\x06\x05\xA0\xA1\xA2\xA3\xA4\xA5",
5366 12, "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B",
5367 21,
5368 "\x0C\x0D\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F\x20",
5369 29,
5370 "\x6F\xC1\xB0\x11\xF0\x06\x56\x8B\x51\x71\xA4\x2D\x95\x3D\x46\x9B\x25\x70\xA4\xBD\x87\x40\x5A\x04\x43\xAC\x91\xCB\x94"},
5371 { GCRY_CIPHER_AES, /* Packet Vector #7 */
5372 16, "\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF",
5373 13, "\x00\x00\x00\x09\x08\x07\x06\xA0\xA1\xA2\xA3\xA4\xA5",
5374 8, "\x00\x01\x02\x03\x04\x05\x06\x07",
5375 23,
5376 "\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E",
5377 33,
5378 "\x01\x35\xD1\xB2\xC9\x5F\x41\xD5\xD1\xD4\xFE\xC1\x85\xD1\x66\xB8\x09\x4E\x99\x9D\xFE\xD9\x6C\x04\x8C\x56\x60\x2C\x97\xAC\xBB\x74\x90"},
5379 { GCRY_CIPHER_AES, /* Packet Vector #8 */
5380 16, "\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF",
5381 13, "\x00\x00\x00\x0A\x09\x08\x07\xA0\xA1\xA2\xA3\xA4\xA5",
5382 8, "\x00\x01\x02\x03\x04\x05\x06\x07",
5383 24,
5384 "\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F",
5385 34,
5386 "\x7B\x75\x39\x9A\xC0\x83\x1D\xD2\xF0\xBB\xD7\x58\x79\xA2\xFD\x8F\x6C\xAE\x6B\x6C\xD9\xB7\xDB\x24\xC1\x7B\x44\x33\xF4\x34\x96\x3F\x34\xB4"},
5387 { GCRY_CIPHER_AES, /* Packet Vector #9 */
5388 16, "\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF",
5389 13, "\x00\x00\x00\x0B\x0A\x09\x08\xA0\xA1\xA2\xA3\xA4\xA5",
5390 8, "\x00\x01\x02\x03\x04\x05\x06\x07",
5391 25,
5392 "\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F\x20",
5393 35,
5394 "\x82\x53\x1A\x60\xCC\x24\x94\x5A\x4B\x82\x79\x18\x1A\xB5\xC8\x4D\xF2\x1C\xE7\xF9\xB7\x3F\x42\xE1\x97\xEA\x9C\x07\xE5\x6B\x5E\xB1\x7E\x5F\x4E"},
5395 { GCRY_CIPHER_AES, /* Packet Vector #10 */
5396 16, "\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF",
5397 13, "\x00\x00\x00\x0C\x0B\x0A\x09\xA0\xA1\xA2\xA3\xA4\xA5",
5398 12, "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B",
5399 19,
5400 "\x0C\x0D\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E",
5401 29,
5402 "\x07\x34\x25\x94\x15\x77\x85\x15\x2B\x07\x40\x98\x33\x0A\xBB\x14\x1B\x94\x7B\x56\x6A\xA9\x40\x6B\x4D\x99\x99\x88\xDD"},
5403 { GCRY_CIPHER_AES, /* Packet Vector #11 */
5404 16, "\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF",
5405 13, "\x00\x00\x00\x0D\x0C\x0B\x0A\xA0\xA1\xA2\xA3\xA4\xA5",
5406 12, "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B",
5407 20,
5408 "\x0C\x0D\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F",
5409 30,
5410 "\x67\x6B\xB2\x03\x80\xB0\xE3\x01\xE8\xAB\x79\x59\x0A\x39\x6D\xA7\x8B\x83\x49\x34\xF5\x3A\xA2\xE9\x10\x7A\x8B\x6C\x02\x2C"},
5411 { GCRY_CIPHER_AES, /* Packet Vector #12 */
5412 16, "\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF",
5413 13, "\x00\x00\x00\x0E\x0D\x0C\x0B\xA0\xA1\xA2\xA3\xA4\xA5",
5414 12, "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B",
5415 21,
5416 "\x0C\x0D\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F\x20",
5417 31,
5418 "\xC0\xFF\xA0\xD6\xF0\x5B\xDB\x67\xF2\x4D\x43\xA4\x33\x8D\x2A\xA4\xBE\xD7\xB2\x0E\x43\xCD\x1A\xA3\x16\x62\xE7\xAD\x65\xD6\xDB"},
5419 { GCRY_CIPHER_AES, /* Packet Vector #13 */
5420 16, "\xD7\x82\x8D\x13\xB2\xB0\xBD\xC3\x25\xA7\x62\x36\xDF\x93\xCC\x6B",
5421 13, "\x00\x41\x2B\x4E\xA9\xCD\xBE\x3C\x96\x96\x76\x6C\xFA",
5422 8, "\x0B\xE1\xA8\x8B\xAC\xE0\x18\xB1",
5423 23,
5424 "\x08\xE8\xCF\x97\xD8\x20\xEA\x25\x84\x60\xE9\x6A\xD9\xCF\x52\x89\x05\x4D\x89\x5C\xEA\xC4\x7C",
5425 31,
5426 "\x4C\xB9\x7F\x86\xA2\xA4\x68\x9A\x87\x79\x47\xAB\x80\x91\xEF\x53\x86\xA6\xFF\xBD\xD0\x80\xF8\xE7\x8C\xF7\xCB\x0C\xDD\xD7\xB3"},
5427 { GCRY_CIPHER_AES, /* Packet Vector #14 */
5428 16, "\xD7\x82\x8D\x13\xB2\xB0\xBD\xC3\x25\xA7\x62\x36\xDF\x93\xCC\x6B",
5429 13, "\x00\x33\x56\x8E\xF7\xB2\x63\x3C\x96\x96\x76\x6C\xFA",
5430 8, "\x63\x01\x8F\x76\xDC\x8A\x1B\xCB",
5431 24,
5432 "\x90\x20\xEA\x6F\x91\xBD\xD8\x5A\xFA\x00\x39\xBA\x4B\xAF\xF9\xBF\xB7\x9C\x70\x28\x94\x9C\xD0\xEC",
5433 32,
5434 "\x4C\xCB\x1E\x7C\xA9\x81\xBE\xFA\xA0\x72\x6C\x55\xD3\x78\x06\x12\x98\xC8\x5C\x92\x81\x4A\xBC\x33\xC5\x2E\xE8\x1D\x7D\x77\xC0\x8A"},
5435 { GCRY_CIPHER_AES, /* Packet Vector #15 */
5436 16, "\xD7\x82\x8D\x13\xB2\xB0\xBD\xC3\x25\xA7\x62\x36\xDF\x93\xCC\x6B",
5437 13, "\x00\x10\x3F\xE4\x13\x36\x71\x3C\x96\x96\x76\x6C\xFA",
5438 8, "\xAA\x6C\xFA\x36\xCA\xE8\x6B\x40",
5439 25,
5440 "\xB9\x16\xE0\xEA\xCC\x1C\x00\xD7\xDC\xEC\x68\xEC\x0B\x3B\xBB\x1A\x02\xDE\x8A\x2D\x1A\xA3\x46\x13\x2E",
5441 33,
5442 "\xB1\xD2\x3A\x22\x20\xDD\xC0\xAC\x90\x0D\x9A\xA0\x3C\x61\xFC\xF4\xA5\x59\xA4\x41\x77\x67\x08\x97\x08\xA7\x76\x79\x6E\xDB\x72\x35\x06"},
5443 { GCRY_CIPHER_AES, /* Packet Vector #16 */
5444 16, "\xD7\x82\x8D\x13\xB2\xB0\xBD\xC3\x25\xA7\x62\x36\xDF\x93\xCC\x6B",
5445 13, "\x00\x76\x4C\x63\xB8\x05\x8E\x3C\x96\x96\x76\x6C\xFA",
5446 12, "\xD0\xD0\x73\x5C\x53\x1E\x1B\xEC\xF0\x49\xC2\x44",
5447 19,
5448 "\x12\xDA\xAC\x56\x30\xEF\xA5\x39\x6F\x77\x0C\xE1\xA6\x6B\x21\xF7\xB2\x10\x1C",
5449 27,
5450 "\x14\xD2\x53\xC3\x96\x7B\x70\x60\x9B\x7C\xBB\x7C\x49\x91\x60\x28\x32\x45\x26\x9A\x6F\x49\x97\x5B\xCA\xDE\xAF"},
5451 { GCRY_CIPHER_AES, /* Packet Vector #17 */
5452 16, "\xD7\x82\x8D\x13\xB2\xB0\xBD\xC3\x25\xA7\x62\x36\xDF\x93\xCC\x6B",
5453 13, "\x00\xF8\xB6\x78\x09\x4E\x3B\x3C\x96\x96\x76\x6C\xFA",
5454 12, "\x77\xB6\x0F\x01\x1C\x03\xE1\x52\x58\x99\xBC\xAE",
5455 20,
5456 "\xE8\x8B\x6A\x46\xC7\x8D\x63\xE5\x2E\xB8\xC5\x46\xEF\xB5\xDE\x6F\x75\xE9\xCC\x0D",
5457 28,
5458 "\x55\x45\xFF\x1A\x08\x5E\xE2\xEF\xBF\x52\xB2\xE0\x4B\xEE\x1E\x23\x36\xC7\x3E\x3F\x76\x2C\x0C\x77\x44\xFE\x7E\x3C"},
5459 { GCRY_CIPHER_AES, /* Packet Vector #18 */
5460 16, "\xD7\x82\x8D\x13\xB2\xB0\xBD\xC3\x25\xA7\x62\x36\xDF\x93\xCC\x6B",
5461 13, "\x00\xD5\x60\x91\x2D\x3F\x70\x3C\x96\x96\x76\x6C\xFA",
5462 12, "\xCD\x90\x44\xD2\xB7\x1F\xDB\x81\x20\xEA\x60\xC0",
5463 21,
5464 "\x64\x35\xAC\xBA\xFB\x11\xA8\x2E\x2F\x07\x1D\x7C\xA4\xA5\xEB\xD9\x3A\x80\x3B\xA8\x7F",
5465 29,
5466 "\x00\x97\x69\xEC\xAB\xDF\x48\x62\x55\x94\xC5\x92\x51\xE6\x03\x57\x22\x67\x5E\x04\xC8\x47\x09\x9E\x5A\xE0\x70\x45\x51"},
5467 { GCRY_CIPHER_AES, /* Packet Vector #19 */
5468 16, "\xD7\x82\x8D\x13\xB2\xB0\xBD\xC3\x25\xA7\x62\x36\xDF\x93\xCC\x6B",
5469 13, "\x00\x42\xFF\xF8\xF1\x95\x1C\x3C\x96\x96\x76\x6C\xFA",
5470 8, "\xD8\x5B\xC7\xE6\x9F\x94\x4F\xB8",
5471 23,
5472 "\x8A\x19\xB9\x50\xBC\xF7\x1A\x01\x8E\x5E\x67\x01\xC9\x17\x87\x65\x98\x09\xD6\x7D\xBE\xDD\x18",
5473 33,
5474 "\xBC\x21\x8D\xAA\x94\x74\x27\xB6\xDB\x38\x6A\x99\xAC\x1A\xEF\x23\xAD\xE0\xB5\x29\x39\xCB\x6A\x63\x7C\xF9\xBE\xC2\x40\x88\x97\xC6\xBA"},
5475 { GCRY_CIPHER_AES, /* Packet Vector #20 */
5476 16, "\xD7\x82\x8D\x13\xB2\xB0\xBD\xC3\x25\xA7\x62\x36\xDF\x93\xCC\x6B",
5477 13, "\x00\x92\x0F\x40\xE5\x6C\xDC\x3C\x96\x96\x76\x6C\xFA",
5478 8, "\x74\xA0\xEB\xC9\x06\x9F\x5B\x37",
5479 24,
5480 "\x17\x61\x43\x3C\x37\xC5\xA3\x5F\xC1\xF3\x9F\x40\x63\x02\xEB\x90\x7C\x61\x63\xBE\x38\xC9\x84\x37",
5481 34,
5482 "\x58\x10\xE6\xFD\x25\x87\x40\x22\xE8\x03\x61\xA4\x78\xE3\xE9\xCF\x48\x4A\xB0\x4F\x44\x7E\xFF\xF6\xF0\xA4\x77\xCC\x2F\xC9\xBF\x54\x89\x44"},
5483 { GCRY_CIPHER_AES, /* Packet Vector #21 */
5484 16, "\xD7\x82\x8D\x13\xB2\xB0\xBD\xC3\x25\xA7\x62\x36\xDF\x93\xCC\x6B",
5485 13, "\x00\x27\xCA\x0C\x71\x20\xBC\x3C\x96\x96\x76\x6C\xFA",
5486 8, "\x44\xA3\xAA\x3A\xAE\x64\x75\xCA",
5487 25,
5488 "\xA4\x34\xA8\xE5\x85\x00\xC6\xE4\x15\x30\x53\x88\x62\xD6\x86\xEA\x9E\x81\x30\x1B\x5A\xE4\x22\x6B\xFA",
5489 35,
5490 "\xF2\xBE\xED\x7B\xC5\x09\x8E\x83\xFE\xB5\xB3\x16\x08\xF8\xE2\x9C\x38\x81\x9A\x89\xC8\xE7\x76\xF1\x54\x4D\x41\x51\xA4\xED\x3A\x8B\x87\xB9\xCE"},
5491 { GCRY_CIPHER_AES, /* Packet Vector #22 */
5492 16, "\xD7\x82\x8D\x13\xB2\xB0\xBD\xC3\x25\xA7\x62\x36\xDF\x93\xCC\x6B",
5493 13, "\x00\x5B\x8C\xCB\xCD\x9A\xF8\x3C\x96\x96\x76\x6C\xFA",
5494 12, "\xEC\x46\xBB\x63\xB0\x25\x20\xC3\x3C\x49\xFD\x70",
5495 19,
5496 "\xB9\x6B\x49\xE2\x1D\x62\x17\x41\x63\x28\x75\xDB\x7F\x6C\x92\x43\xD2\xD7\xC2",
5497 29,
5498 "\x31\xD7\x50\xA0\x9D\xA3\xED\x7F\xDD\xD4\x9A\x20\x32\xAA\xBF\x17\xEC\x8E\xBF\x7D\x22\xC8\x08\x8C\x66\x6B\xE5\xC1\x97"},
5499 { GCRY_CIPHER_AES, /* Packet Vector #23 */
5500 16, "\xD7\x82\x8D\x13\xB2\xB0\xBD\xC3\x25\xA7\x62\x36\xDF\x93\xCC\x6B",
5501 13, "\x00\x3E\xBE\x94\x04\x4B\x9A\x3C\x96\x96\x76\x6C\xFA",
5502 12, "\x47\xA6\x5A\xC7\x8B\x3D\x59\x42\x27\xE8\x5E\x71",
5503 20,
5504 "\xE2\xFC\xFB\xB8\x80\x44\x2C\x73\x1B\xF9\x51\x67\xC8\xFF\xD7\x89\x5E\x33\x70\x76",
5505 30,
5506 "\xE8\x82\xF1\xDB\xD3\x8C\xE3\xED\xA7\xC2\x3F\x04\xDD\x65\x07\x1E\xB4\x13\x42\xAC\xDF\x7E\x00\xDC\xCE\xC7\xAE\x52\x98\x7D"},
5507 { GCRY_CIPHER_AES, /* Packet Vector #24 */
5508 16, "\xD7\x82\x8D\x13\xB2\xB0\xBD\xC3\x25\xA7\x62\x36\xDF\x93\xCC\x6B",
5509 13, "\x00\x8D\x49\x3B\x30\xAE\x8B\x3C\x96\x96\x76\x6C\xFA",
5510 12, "\x6E\x37\xA6\xEF\x54\x6D\x95\x5D\x34\xAB\x60\x59",
5511 21,
5512 "\xAB\xF2\x1C\x0B\x02\xFE\xB8\x8F\x85\x6D\xF4\xA3\x73\x81\xBC\xE3\xCC\x12\x85\x17\xD4",
5513 31,
5514 "\xF3\x29\x05\xB8\x8A\x64\x1B\x04\xB9\xC9\xFF\xB5\x8C\xC3\x90\x90\x0F\x3D\xA1\x2A\xB1\x6D\xCE\x9E\x82\xEF\xA1\x6D\xA6\x20\x59"},
5515 /* RFC 5528 */
5516 { GCRY_CIPHER_CAMELLIA128, /* Packet Vector #1 */
5517 16, "\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF",
5518 13, "\x00\x00\x00\x03\x02\x01\x00\xA0\xA1\xA2\xA3\xA4\xA5",
5519 8, "\x00\x01\x02\x03\x04\x05\x06\x07",
5520 23,
5521 "\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E",
5522 31,
5523 "\xBA\x73\x71\x85\xE7\x19\x31\x04\x92\xF3\x8A\x5F\x12\x51\xDA\x55\xFA\xFB\xC9\x49\x84\x8A\x0D\xFC\xAE\xCE\x74\x6B\x3D\xB9\xAD"},
5524 { GCRY_CIPHER_CAMELLIA128, /* Packet Vector #2 */
5525 16, "\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF",
5526 13, "\x00\x00\x00\x04\x03\x02\x01\xA0\xA1\xA2\xA3\xA4\xA5",
5527 8, "\x00\x01\x02\x03\x04\x05\x06\x07",
5528 24,
5529 "\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F",
5530 32,
5531 "\x5D\x25\x64\xBF\x8E\xAF\xE1\xD9\x95\x26\xEC\x01\x6D\x1B\xF0\x42\x4C\xFB\xD2\xCD\x62\x84\x8F\x33\x60\xB2\x29\x5D\xF2\x42\x83\xE8"},
5532 { GCRY_CIPHER_CAMELLIA128, /* Packet Vector #3 */
5533 16, "\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF",
5534 13, "\x00\x00\x00\x05\x04\x03\x02\xA0\xA1\xA2\xA3\xA4\xA5",
5535 8, "\x00\x01\x02\x03\x04\x05\x06\x07",
5536 25,
5537 "\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F\x20",
5538 33,
5539 "\x81\xF6\x63\xD6\xC7\x78\x78\x17\xF9\x20\x36\x08\xB9\x82\xAD\x15\xDC\x2B\xBD\x87\xD7\x56\xF7\x92\x04\xF5\x51\xD6\x68\x2F\x23\xAA\x46"},
5540 { GCRY_CIPHER_CAMELLIA128, /* Packet Vector #4 */
5541 16, "\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF",
5542 13, "\x00\x00\x00\x06\x05\x04\x03\xA0\xA1\xA2\xA3\xA4\xA5",
5543 12, "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B",
5544 19,
5545 "\x0C\x0D\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E",
5546 27,
5547 "\xCA\xEF\x1E\x82\x72\x11\xB0\x8F\x7B\xD9\x0F\x08\xC7\x72\x88\xC0\x70\xA4\xA0\x8B\x3A\x93\x3A\x63\xE4\x97\xA0"},
5548 { GCRY_CIPHER_CAMELLIA128, /* Packet Vector #5 */
5549 16, "\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF",
5550 13, "\x00\x00\x00\x07\x06\x05\x04\xA0\xA1\xA2\xA3\xA4\xA5",
5551 12, "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B",
5552 20,
5553 "\x0C\x0D\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F",
5554 28,
5555 "\x2A\xD3\xBA\xD9\x4F\xC5\x2E\x92\xBE\x43\x8E\x82\x7C\x10\x23\xB9\x6A\x8A\x77\x25\x8F\xA1\x7B\xA7\xF3\x31\xDB\x09"},
5556 { GCRY_CIPHER_CAMELLIA128, /* Packet Vector #6 */
5557 16, "\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF",
5558 13, "\x00\x00\x00\x08\x07\x06\x05\xA0\xA1\xA2\xA3\xA4\xA5",
5559 12, "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B",
5560 21,
5561 "\x0C\x0D\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F\x20",
5562 29,
5563 "\xFE\xA5\x48\x0B\xA5\x3F\xA8\xD3\xC3\x44\x22\xAA\xCE\x4D\xE6\x7F\xFA\x3B\xB7\x3B\xAB\xAB\x36\xA1\xEE\x4F\xE0\xFE\x28"},
5564 { GCRY_CIPHER_CAMELLIA128, /* Packet Vector #7 */
5565 16, "\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF",
5566 13, "\x00\x00\x00\x09\x08\x07\x06\xA0\xA1\xA2\xA3\xA4\xA5",
5567 8, "\x00\x01\x02\x03\x04\x05\x06\x07",
5568 23,
5569 "\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E",
5570 33,
5571 "\x54\x53\x20\x26\xE5\x4C\x11\x9A\x8D\x36\xD9\xEC\x6E\x1E\xD9\x74\x16\xC8\x70\x8C\x4B\x5C\x2C\xAC\xAF\xA3\xBC\xCF\x7A\x4E\xBF\x95\x73"},
5572 { GCRY_CIPHER_CAMELLIA128, /* Packet Vector #8 */
5573 16, "\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF",
5574 13, "\x00\x00\x00\x0A\x09\x08\x07\xA0\xA1\xA2\xA3\xA4\xA5",
5575 8, "\x00\x01\x02\x03\x04\x05\x06\x07",
5576 24,
5577 "\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F",
5578 34,
5579 "\x8A\xD1\x9B\x00\x1A\x87\xD1\x48\xF4\xD9\x2B\xEF\x34\x52\x5C\xCC\xE3\xA6\x3C\x65\x12\xA6\xF5\x75\x73\x88\xE4\x91\x3E\xF1\x47\x01\xF4\x41"},
5580 { GCRY_CIPHER_CAMELLIA128, /* Packet Vector #9 */
5581 16, "\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF",
5582 13, "\x00\x00\x00\x0B\x0A\x09\x08\xA0\xA1\xA2\xA3\xA4\xA5",
5583 8, "\x00\x01\x02\x03\x04\x05\x06\x07",
5584 25,
5585 "\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F\x20",
5586 35,
5587 "\x5D\xB0\x8D\x62\x40\x7E\x6E\x31\xD6\x0F\x9C\xA2\xC6\x04\x74\x21\x9A\xC0\xBE\x50\xC0\xD4\xA5\x77\x87\x94\xD6\xE2\x30\xCD\x25\xC9\xFE\xBF\x87"},
5588 { GCRY_CIPHER_CAMELLIA128, /* Packet Vector #10 */
5589 16, "\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF",
5590 13, "\x00\x00\x00\x0C\x0B\x0A\x09\xA0\xA1\xA2\xA3\xA4\xA5",
5591 12, "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B",
5592 19,
5593 "\x0C\x0D\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E",
5594 29,
5595 "\xDB\x11\x8C\xCE\xC1\xB8\x76\x1C\x87\x7C\xD8\x96\x3A\x67\xD6\xF3\xBB\xBC\x5C\xD0\x92\x99\xEB\x11\xF3\x12\xF2\x32\x37"},
5596 { GCRY_CIPHER_CAMELLIA128, /* Packet Vector #11 */
5597 16, "\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF",
5598 13, "\x00\x00\x00\x0D\x0C\x0B\x0A\xA0\xA1\xA2\xA3\xA4\xA5",
5599 12, "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B",
5600 20,
5601 "\x0C\x0D\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F",
5602 30,
5603 "\x7C\xC8\x3D\x8D\xC4\x91\x03\x52\x5B\x48\x3D\xC5\xCA\x7E\xA9\xAB\x81\x2B\x70\x56\x07\x9D\xAF\xFA\xDA\x16\xCC\xCF\x2C\x4E"},
5604 { GCRY_CIPHER_CAMELLIA128, /* Packet Vector #12 */
5605 16, "\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF",
5606 13, "\x00\x00\x00\x0E\x0D\x0C\x0B\xA0\xA1\xA2\xA3\xA4\xA5",
5607 12, "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B",
5608 21,
5609 "\x0C\x0D\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F\x20",
5610 31,
5611 "\x2C\xD3\x5B\x88\x20\xD2\x3E\x7A\xA3\x51\xB0\xE9\x2F\xC7\x93\x67\x23\x8B\x2C\xC7\x48\xCB\xB9\x4C\x29\x47\x79\x3D\x64\xAF\x75"},
5612 { GCRY_CIPHER_CAMELLIA128, /* Packet Vector #13 */
5613 16, "\xD7\x5C\x27\x78\x07\x8C\xA9\x3D\x97\x1F\x96\xFD\xE7\x20\xF4\xCD",
5614 13, "\x00\xA9\x70\x11\x0E\x19\x27\xB1\x60\xB6\xA3\x1C\x1C",
5615 8, "\x6B\x7F\x46\x45\x07\xFA\xE4\x96",
5616 23,
5617 "\xC6\xB5\xF3\xE6\xCA\x23\x11\xAE\xF7\x47\x2B\x20\x3E\x73\x5E\xA5\x61\xAD\xB1\x7D\x56\xC5\xA3",
5618 31,
5619 "\xA4\x35\xD7\x27\x34\x8D\xDD\x22\x90\x7F\x7E\xB8\xF5\xFD\xBB\x4D\x93\x9D\xA6\x52\x4D\xB4\xF6\x45\x58\xC0\x2D\x25\xB1\x27\xEE"},
5620 { GCRY_CIPHER_CAMELLIA128, /* Packet Vector #14 */
5621 16, "\xD7\x5C\x27\x78\x07\x8C\xA9\x3D\x97\x1F\x96\xFD\xE7\x20\xF4\xCD",
5622 13, "\x00\x83\xCD\x8C\xE0\xCB\x42\xB1\x60\xB6\xA3\x1C\x1C",
5623 8, "\x98\x66\x05\xB4\x3D\xF1\x5D\xE7",
5624 24,
5625 "\x01\xF6\xCE\x67\x64\xC5\x74\x48\x3B\xB0\x2E\x6B\xBF\x1E\x0A\xBD\x26\xA2\x25\x72\xB4\xD8\x0E\xE7",
5626 32,
5627 "\x8A\xE0\x52\x50\x8F\xBE\xCA\x93\x2E\x34\x6F\x05\xE0\xDC\x0D\xFB\xCF\x93\x9E\xAF\xFA\x3E\x58\x7C\x86\x7D\x6E\x1C\x48\x70\x38\x06"},
5628 { GCRY_CIPHER_CAMELLIA128, /* Packet Vector #15 */
5629 16, "\xD7\x5C\x27\x78\x07\x8C\xA9\x3D\x97\x1F\x96\xFD\xE7\x20\xF4\xCD",
5630 13, "\x00\x5F\x54\x95\x0B\x18\xF2\xB1\x60\xB6\xA3\x1C\x1C",
5631 8, "\x48\xF2\xE7\xE1\xA7\x67\x1A\x51",
5632 25,
5633 "\xCD\xF1\xD8\x40\x6F\xC2\xE9\x01\x49\x53\x89\x70\x05\xFB\xFB\x8B\xA5\x72\x76\xF9\x24\x04\x60\x8E\x08",
5634 33,
5635 "\x08\xB6\x7E\xE2\x1C\x8B\xF2\x6E\x47\x3E\x40\x85\x99\xE9\xC0\x83\x6D\x6A\xF0\xBB\x18\xDF\x55\x46\x6C\xA8\x08\x78\xA7\x90\x47\x6D\xE5"},
5636 { GCRY_CIPHER_CAMELLIA128, /* Packet Vector #16 */
5637 16, "\xD7\x5C\x27\x78\x07\x8C\xA9\x3D\x97\x1F\x96\xFD\xE7\x20\xF4\xCD",
5638 13, "\x00\xEC\x60\x08\x63\x31\x9A\xB1\x60\xB6\xA3\x1C\x1C",
5639 12, "\xDE\x97\xDF\x3B\x8C\xBD\x6D\x8E\x50\x30\xDA\x4C",
5640 19,
5641 "\xB0\x05\xDC\xFA\x0B\x59\x18\x14\x26\xA9\x61\x68\x5A\x99\x3D\x8C\x43\x18\x5B",
5642 27,
5643 "\x63\xB7\x8B\x49\x67\xB1\x9E\xDB\xB7\x33\xCD\x11\x14\xF6\x4E\xB2\x26\x08\x93\x68\xC3\x54\x82\x8D\x95\x0C\xC5"},
5644 { GCRY_CIPHER_CAMELLIA128, /* Packet Vector #17 */
5645 16, "\xD7\x5C\x27\x78\x07\x8C\xA9\x3D\x97\x1F\x96\xFD\xE7\x20\xF4\xCD",
5646 13, "\x00\x60\xCF\xF1\xA3\x1E\xA1\xB1\x60\xB6\xA3\x1C\x1C",
5647 12, "\xA5\xEE\x93\xE4\x57\xDF\x05\x46\x6E\x78\x2D\xCF",
5648 20,
5649 "\x2E\x20\x21\x12\x98\x10\x5F\x12\x9D\x5E\xD9\x5B\x93\xF7\x2D\x30\xB2\xFA\xCC\xD7",
5650 28,
5651 "\x0B\xC6\xBB\xE2\xA8\xB9\x09\xF4\x62\x9E\xE6\xDC\x14\x8D\xA4\x44\x10\xE1\x8A\xF4\x31\x47\x38\x32\x76\xF6\x6A\x9F"},
5652 { GCRY_CIPHER_CAMELLIA128, /* Packet Vector #18 */
5653 16, "\xD7\x5C\x27\x78\x07\x8C\xA9\x3D\x97\x1F\x96\xFD\xE7\x20\xF4\xCD",
5654 13, "\x00\x0F\x85\xCD\x99\x5C\x97\xB1\x60\xB6\xA3\x1C\x1C",
5655 12, "\x24\xAA\x1B\xF9\xA5\xCD\x87\x61\x82\xA2\x50\x74",
5656 21,
5657 "\x26\x45\x94\x1E\x75\x63\x2D\x34\x91\xAF\x0F\xC0\xC9\x87\x6C\x3B\xE4\xAA\x74\x68\xC9",
5658 29,
5659 "\x22\x2A\xD6\x32\xFA\x31\xD6\xAF\x97\x0C\x34\x5F\x7E\x77\xCA\x3B\xD0\xDC\x25\xB3\x40\xA1\xA3\xD3\x1F\x8D\x4B\x44\xB7"},
5660 { GCRY_CIPHER_CAMELLIA128, /* Packet Vector #19 */
5661 16, "\xD7\x5C\x27\x78\x07\x8C\xA9\x3D\x97\x1F\x96\xFD\xE7\x20\xF4\xCD",
5662 13, "\x00\xC2\x9B\x2C\xAA\xC4\xCD\xB1\x60\xB6\xA3\x1C\x1C",
5663 8, "\x69\x19\x46\xB9\xCA\x07\xBE\x87",
5664 23,
5665 "\x07\x01\x35\xA6\x43\x7C\x9D\xB1\x20\xCD\x61\xD8\xF6\xC3\x9C\x3E\xA1\x25\xFD\x95\xA0\xD2\x3D",
5666 33,
5667 "\x05\xB8\xE1\xB9\xC4\x9C\xFD\x56\xCF\x13\x0A\xA6\x25\x1D\xC2\xEC\xC0\x6C\xCC\x50\x8F\xE6\x97\xA0\x06\x6D\x57\xC8\x4B\xEC\x18\x27\x68"},
5668 { GCRY_CIPHER_CAMELLIA128, /* Packet Vector #20 */
5669 16, "\xD7\x5C\x27\x78\x07\x8C\xA9\x3D\x97\x1F\x96\xFD\xE7\x20\xF4\xCD",
5670 13, "\x00\x2C\x6B\x75\x95\xEE\x62\xB1\x60\xB6\xA3\x1C\x1C",
5671 8, "\xD0\xC5\x4E\xCB\x84\x62\x7D\xC4",
5672 24,
5673 "\xC8\xC0\x88\x0E\x6C\x63\x6E\x20\x09\x3D\xD6\x59\x42\x17\xD2\xE1\x88\x77\xDB\x26\x4E\x71\xA5\xCC",
5674 34,
5675 "\x54\xCE\xB9\x68\xDE\xE2\x36\x11\x57\x5E\xC0\x03\xDF\xAA\x1C\xD4\x88\x49\xBD\xF5\xAE\x2E\xDB\x6B\x7F\xA7\x75\xB1\x50\xED\x43\x83\xC5\xA9"},
5676 { GCRY_CIPHER_CAMELLIA128, /* Packet Vector #21 */
5677 16, "\xD7\x5C\x27\x78\x07\x8C\xA9\x3D\x97\x1F\x96\xFD\xE7\x20\xF4\xCD",
5678 13, "\x00\xC5\x3C\xD4\xC2\xAA\x24\xB1\x60\xB6\xA3\x1C\x1C",
5679 8, "\xE2\x85\xE0\xE4\x80\x8C\xDA\x3D",
5680 25,
5681 "\xF7\x5D\xAA\x07\x10\xC4\xE6\x42\x97\x79\x4D\xC2\xB7\xD2\xA2\x07\x57\xB1\xAA\x4E\x44\x80\x02\xFF\xAB",
5682 35,
5683 "\xB1\x40\x45\x46\xBF\x66\x72\x10\xCA\x28\xE3\x09\xB3\x9B\xD6\xCA\x7E\x9F\xC8\x28\x5F\xE6\x98\xD4\x3C\xD2\x0A\x02\xE0\xBD\xCA\xED\x20\x10\xD3"},
5684 { GCRY_CIPHER_CAMELLIA128, /* Packet Vector #22 */
5685 16, "\xD7\x5C\x27\x78\x07\x8C\xA9\x3D\x97\x1F\x96\xFD\xE7\x20\xF4\xCD",
5686 13, "\x00\xBE\xE9\x26\x7F\xBA\xDC\xB1\x60\xB6\xA3\x1C\x1C",
5687 12, "\x6C\xAE\xF9\x94\x11\x41\x57\x0D\x7C\x81\x34\x05",
5688 19,
5689 "\xC2\x38\x82\x2F\xAC\x5F\x98\xFF\x92\x94\x05\xB0\xAD\x12\x7A\x4E\x41\x85\x4E",
5690 29,
5691 "\x94\xC8\x95\x9C\x11\x56\x9A\x29\x78\x31\xA7\x21\x00\x58\x57\xAB\x61\xB8\x7A\x2D\xEA\x09\x36\xB6\xEB\x5F\x62\x5F\x5D"},
5692 { GCRY_CIPHER_CAMELLIA128, /* Packet Vector #23 */
5693 16, "\xD7\x5C\x27\x78\x07\x8C\xA9\x3D\x97\x1F\x96\xFD\xE7\x20\xF4\xCD",
5694 13, "\x00\xDF\xA8\xB1\x24\x50\x07\xB1\x60\xB6\xA3\x1C\x1C",
5695 12, "\x36\xA5\x2C\xF1\x6B\x19\xA2\x03\x7A\xB7\x01\x1E",
5696 20,
5697 "\x4D\xBF\x3E\x77\x4A\xD2\x45\xE5\xD5\x89\x1F\x9D\x1C\x32\xA0\xAE\x02\x2C\x85\xD7",
5698 30,
5699 "\x58\x69\xE3\xAA\xD2\x44\x7C\x74\xE0\xFC\x05\xF9\xA4\xEA\x74\x57\x7F\x4D\xE8\xCA\x89\x24\x76\x42\x96\xAD\x04\x11\x9C\xE7"},
5700 { GCRY_CIPHER_CAMELLIA128, /* Packet Vector #24 */
5701 16, "\xD7\x5C\x27\x78\x07\x8C\xA9\x3D\x97\x1F\x96\xFD\xE7\x20\xF4\xCD",
5702 13, "\x00\x3B\x8F\xD8\xD3\xA9\x37\xB1\x60\xB6\xA3\x1C\x1C",
5703 12, "\xA4\xD4\x99\xF7\x84\x19\x72\x8C\x19\x17\x8B\x0C",
5704 21,
5705 "\x9D\xC9\xED\xAE\x2F\xF5\xDF\x86\x36\xE8\xC6\xDE\x0E\xED\x55\xF7\x86\x7E\x33\x33\x7D",
5706 31,
5707 "\x4B\x19\x81\x56\x39\x3B\x0F\x77\x96\x08\x6A\xAF\xB4\x54\xF8\xC3\xF0\x34\xCC\xA9\x66\x94\x5F\x1F\xCE\xA7\xE1\x1B\xEE\x6A\x2F"}
5708 };
5709 static const int cut[] = { 0, 1, 8, 10, 16, 19, -1 };
5710 gcry_cipher_hd_t hde, hdd;
5711 unsigned char out[MAX_DATA_LEN];
5712 u64 ctl_params[3];
5713 int split, aadsplit;
5714 size_t j, i, keylen, blklen, authlen, taglen2;
5715 gcry_error_t err = 0;
5716
5717 if (verbose)
5718 fprintf (stderr, " Starting CCM checks.\n");
5719
5720 for (i = 0; i < sizeof (tv) / sizeof (tv[0]); i++)
5721 {
5722 if (gcry_cipher_test_algo (tv[i].algo) && in_fips_mode)
5723 {
5724 if (verbose)
5725 fprintf (stderr, " algorithm %d not available in fips mode\n",
5726 tv[i].algo);
5727 continue;
5728 }
5729
5730 if (verbose)
5731 fprintf (stderr, " checking CCM mode for %s [%i]\n",
5732 gcry_cipher_algo_name (tv[i].algo),
5733 tv[i].algo);
5734
5735 for (j = 0; j < sizeof (cut) / sizeof (cut[0]); j++)
5736 {
5737 split = cut[j] < 0 ? tv[i].plainlen : cut[j];
5738 if (tv[i].plainlen < split)
5739 continue;
5740
5741 err = gcry_cipher_open (&hde, tv[i].algo, GCRY_CIPHER_MODE_CCM, 0);
5742 if (!err)
5743 err = gcry_cipher_open (&hdd, tv[i].algo, GCRY_CIPHER_MODE_CCM, 0);
5744 if (err)
5745 {
5746 fail ("cipher-ccm, gcry_cipher_open failed: %s\n",
5747 gpg_strerror (err));
5748 return;
5749 }
5750
5751 keylen = gcry_cipher_get_algo_keylen(tv[i].algo);
5752 if (!keylen)
5753 {
5754 fail ("cipher-ccm, gcry_cipher_get_algo_keylen failed\n");
5755 return;
5756 }
5757
5758 err = gcry_cipher_setkey (hde, tv[i].key, keylen);
5759 if (!err)
5760 err = gcry_cipher_setkey (hdd, tv[i].key, keylen);
5761 if (err)
5762 {
5763 fail ("cipher-ccm, gcry_cipher_setkey failed: %s\n",
5764 gpg_strerror (err));
5765 gcry_cipher_close (hde);
5766 gcry_cipher_close (hdd);
5767 return;
5768 }
5769
5770 blklen = gcry_cipher_get_algo_blklen(tv[i].algo);
5771 if (!blklen)
5772 {
5773 fail ("cipher-ccm, gcry_cipher_get_algo_blklen failed\n");
5774 return;
5775 }
5776
5777 err = gcry_cipher_setiv (hde, tv[i].nonce, tv[i].noncelen);
5778 if (!err)
5779 err = gcry_cipher_setiv (hdd, tv[i].nonce, tv[i].noncelen);
5780 if (err)
5781 {
5782 fail ("cipher-ccm, gcry_cipher_setiv failed: %s\n",
5783 gpg_strerror (err));
5784 gcry_cipher_close (hde);
5785 gcry_cipher_close (hdd);
5786 return;
5787 }
5788
5789 authlen = tv[i].cipherlen - tv[i].plainlen;
5790 ctl_params[0] = tv[i].plainlen; /* encryptedlen */
5791 ctl_params[1] = tv[i].aadlen; /* aadlen */
5792 ctl_params[2] = authlen; /* authtaglen */
5793 err = gcry_cipher_ctl (hde, GCRYCTL_SET_CCM_LENGTHS, ctl_params,
5794 sizeof(ctl_params));
5795 if (!err)
5796 err = gcry_cipher_ctl (hdd, GCRYCTL_SET_CCM_LENGTHS, ctl_params,
5797 sizeof(ctl_params));
5798 if (err)
5799 {
5800 fail ("cipher-ccm, gcry_cipher_ctl GCRYCTL_SET_CCM_LENGTHS "
5801 "failed: %s\n", gpg_strerror (err));
5802 gcry_cipher_close (hde);
5803 gcry_cipher_close (hdd);
5804 return;
5805 }
5806
5807 err = gcry_cipher_info (hde, GCRYCTL_GET_TAGLEN, NULL, &taglen2);
5808 if (err)
5809 {
5810 fail ("cipher-ccm, gcryctl_get_taglen failed (tv %lu): %s\n",
5811 (unsigned long) i, gpg_strerror (err));
5812 gcry_cipher_close (hde);
5813 gcry_cipher_close (hdd);
5814 return;
5815 }
5816 if (taglen2 != authlen)
5817 {
5818 fail ("cipher-ccm, gcryctl_get_taglen returned bad length"
5819 " (tv %lu): got=%zu want=%zu\n",
5820 (unsigned long) i, taglen2, authlen);
5821 gcry_cipher_close (hde);
5822 gcry_cipher_close (hdd);
5823 return;
5824 }
5825
5826 aadsplit = split > tv[i].aadlen ? 0 : split;
5827
5828 err = gcry_cipher_authenticate (hde, tv[i].aad,
5829 tv[i].aadlen - aadsplit);
5830 if (!err)
5831 err = gcry_cipher_authenticate (hde,
5832 &tv[i].aad[tv[i].aadlen - aadsplit],
5833 aadsplit);
5834 if (!err)
5835 err = gcry_cipher_authenticate (hdd, tv[i].aad,
5836 tv[i].aadlen - aadsplit);
5837 if (!err)
5838 err = gcry_cipher_authenticate (hdd,
5839 &tv[i].aad[tv[i].aadlen - aadsplit],
5840 aadsplit);
5841 if (err)
5842 {
5843 fail ("cipher-ccm, gcry_cipher_authenticate failed: %s\n",
5844 gpg_strerror (err));
5845 gcry_cipher_close (hde);
5846 gcry_cipher_close (hdd);
5847 return;
5848 }
5849
5850 err = gcry_cipher_encrypt (hde, out, MAX_DATA_LEN, tv[i].plaintext,
5851 tv[i].plainlen - split);
5852 if (!err)
5853 err = gcry_cipher_encrypt (hde, &out[tv[i].plainlen - split],
5854 MAX_DATA_LEN - (tv[i].plainlen - split),
5855 &tv[i].plaintext[tv[i].plainlen - split],
5856 split);
5857 if (err)
5858 {
5859 fail ("cipher-ccm, gcry_cipher_encrypt (%lu:%lu) failed: %s\n",
5860 (unsigned long) i, (unsigned long) j, gpg_strerror (err));
5861 gcry_cipher_close (hde);
5862 gcry_cipher_close (hdd);
5863 return;
5864 }
5865
5866 err = gcry_cipher_gettag (hde, &out[tv[i].plainlen], authlen);
5867 if (err)
5868 {
5869 fail ("cipher-ccm, gcry_cipher_gettag (%lu:%lu) failed: %s\n",
5870 (unsigned long) i, (unsigned long) j, gpg_strerror (err));
5871 gcry_cipher_close (hde);
5872 gcry_cipher_close (hdd);
5873 return;
5874 }
5875
5876 if (memcmp (tv[i].ciphertext, out, tv[i].cipherlen))
5877 fail ("cipher-ccm, encrypt mismatch entry %lu:%lu\n",
5878 (unsigned long) i, (unsigned long) j);
5879
5880 err = gcry_cipher_decrypt (hdd, out, tv[i].plainlen - split, NULL, 0);
5881 if (!err)
5882 err = gcry_cipher_decrypt (hdd, &out[tv[i].plainlen - split], split,
5883 NULL, 0);
5884 if (err)
5885 {
5886 fail ("cipher-ccm, gcry_cipher_decrypt (%lu:%lu) failed: %s\n",
5887 (unsigned long) i, (unsigned long) j, gpg_strerror (err));
5888 gcry_cipher_close (hde);
5889 gcry_cipher_close (hdd);
5890 return;
5891 }
5892
5893 if (memcmp (tv[i].plaintext, out, tv[i].plainlen))
5894 fail ("cipher-ccm, decrypt mismatch entry %lu:%lu\n",
5895 (unsigned long) i, (unsigned long) j);
5896
5897 err = gcry_cipher_checktag (hdd, &out[tv[i].plainlen], authlen);
5898 if (err)
5899 {
5900 fail ("cipher-ccm, gcry_cipher_checktag (%lu:%lu) failed: %s\n",
5901 (unsigned long) i, (unsigned long) j, gpg_strerror (err));
5902 gcry_cipher_close (hde);
5903 gcry_cipher_close (hdd);
5904 return;
5905 }
5906
5907 gcry_cipher_close (hde);
5908 gcry_cipher_close (hdd);
5909 }
5910 }
5911
5912 /* Large buffer tests. */
5913
5914 /* Test encoding of aadlen > 0xfeff. */
5915 {
5916 static const char key[]={0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,
5917 0x48,0x49,0x4a,0x4b,0x4c,0x4d,0x4e,0x4f};
5918 static const char iv[]={0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19};
5919 static const char tag[]={0x9C,0x76,0xE7,0x33,0xD5,0x15,0xB3,0x6C,
5920 0xBA,0x76,0x95,0xF7,0xFB,0x91};
5921 char buf[1024];
5922 size_t enclen = 0x20000;
5923 size_t aadlen = 0x20000;
5924 size_t taglen = sizeof(tag);
5925
5926 err = gcry_cipher_open (&hde, GCRY_CIPHER_AES, GCRY_CIPHER_MODE_CCM, 0);
5927 if (err)
5928 {
5929 fail ("cipher-ccm-large, gcry_cipher_open failed: %s\n",
5930 gpg_strerror (err));
5931 return;
5932 }
5933
5934 err = gcry_cipher_setkey (hde, key, sizeof (key));
5935 if (err)
5936 {
5937 fail ("cipher-ccm-large, gcry_cipher_setkey failed: %s\n",
5938 gpg_strerror (err));
5939 gcry_cipher_close (hde);
5940 return;
5941 }
5942
5943 err = gcry_cipher_setiv (hde, iv, sizeof (iv));
5944 if (err)
5945 {
5946 fail ("cipher-ccm-large, gcry_cipher_setiv failed: %s\n",
5947 gpg_strerror (err));
5948 gcry_cipher_close (hde);
5949 return;
5950 }
5951
5952 ctl_params[0] = enclen; /* encryptedlen */
5953 ctl_params[1] = aadlen; /* aadlen */
5954 ctl_params[2] = taglen; /* authtaglen */
5955 err = gcry_cipher_ctl (hde, GCRYCTL_SET_CCM_LENGTHS, ctl_params,
5956 sizeof(ctl_params));
5957 if (err)
5958 {
5959 fail ("cipher-ccm-large, gcry_cipher_ctl GCRYCTL_SET_CCM_LENGTHS "
5960 "failed: %s\n", gpg_strerror (err));
5961 gcry_cipher_close (hde);
5962 return;
5963 }
5964
5965 memset (buf, 0xaa, sizeof(buf));
5966
5967 for (i = 0; i < aadlen; i += sizeof(buf))
5968 {
5969 err = gcry_cipher_authenticate (hde, buf, sizeof (buf));
5970 if (err)
5971 {
5972 fail ("cipher-ccm-large, gcry_cipher_authenticate failed: %s\n",
5973 gpg_strerror (err));
5974 gcry_cipher_close (hde);
5975 return;
5976 }
5977 }
5978
5979 for (i = 0; i < enclen; i += sizeof(buf))
5980 {
5981 memset (buf, 0xee, sizeof(buf));
5982 err = gcry_cipher_encrypt (hde, buf, sizeof (buf), NULL, 0);
5983 if (err)
5984 {
5985 fail ("cipher-ccm-large, gcry_cipher_encrypt failed: %s\n",
5986 gpg_strerror (err));
5987 gcry_cipher_close (hde);
5988 return;
5989 }
5990 }
5991
5992 err = gcry_cipher_gettag (hde, buf, taglen);
5993 if (err)
5994 {
5995 fail ("cipher-ccm-large, gcry_cipher_gettag failed: %s\n",
5996 gpg_strerror (err));
5997 gcry_cipher_close (hde);
5998 return;
5999 }
6000
6001 if (memcmp (buf, tag, taglen) != 0)
6002 fail ("cipher-ccm-large, encrypt mismatch entry\n");
6003
6004 gcry_cipher_close (hde);
6005 }
6006
6007 #if 0
6008 /* Test encoding of aadlen > 0xffffffff. */
6009 {
6010 static const char key[]={0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,
6011 0x48,0x49,0x4a,0x4b,0x4c,0x4d,0x4e,0x4f};
6012 static const char iv[]={0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19};
6013 static const char tag[]={0x01,0xB2,0xC3,0x4A,0xA6,0x6A,0x07,0x6D,
6014 0xBC,0xBD,0xEA,0x17,0xD3,0x73,0xD7,0xD4};
6015 char buf[1024];
6016 size_t enclen = (size_t)0xffffffff + 1 + 1024;
6017 size_t aadlen = (size_t)0xffffffff + 1 + 1024;
6018 size_t taglen = sizeof(tag);
6019
6020 err = gcry_cipher_open (&hde, GCRY_CIPHER_AES, GCRY_CIPHER_MODE_CCM, 0);
6021 if (err)
6022 {
6023 fail ("cipher-ccm-huge, gcry_cipher_open failed: %s\n",
6024 gpg_strerror (err));
6025 return;
6026 }
6027
6028 err = gcry_cipher_setkey (hde, key, sizeof (key));
6029 if (err)
6030 {
6031 fail ("cipher-ccm-huge, gcry_cipher_setkey failed: %s\n",
6032 gpg_strerror (err));
6033 gcry_cipher_close (hde);
6034 return;
6035 }
6036
6037 err = gcry_cipher_setiv (hde, iv, sizeof (iv));
6038 if (err)
6039 {
6040 fail ("cipher-ccm-huge, gcry_cipher_setiv failed: %s\n",
6041 gpg_strerror (err));
6042 gcry_cipher_close (hde);
6043 return;
6044 }
6045
6046 ctl_params[0] = enclen; /* encryptedlen */
6047 ctl_params[1] = aadlen; /* aadlen */
6048 ctl_params[2] = taglen; /* authtaglen */
6049 err = gcry_cipher_ctl (hde, GCRYCTL_SET_CCM_LENGTHS, ctl_params,
6050 sizeof(ctl_params));
6051 if (err)
6052 {
6053 fail ("cipher-ccm-huge, gcry_cipher_ctl GCRYCTL_SET_CCM_LENGTHS failed:"
6054 "%s\n", gpg_strerror (err));
6055 gcry_cipher_close (hde);
6056 return;
6057 }
6058
6059 memset (buf, 0xaa, sizeof(buf));
6060
6061 for (i = 0; i < aadlen; i += sizeof(buf))
6062 {
6063 err = gcry_cipher_authenticate (hde, buf, sizeof (buf));
6064 if (err)
6065 {
6066 fail ("cipher-ccm-huge, gcry_cipher_authenticate failed: %s\n",
6067 gpg_strerror (err));
6068 gcry_cipher_close (hde);
6069 return;
6070 }
6071 }
6072
6073 for (i = 0; i < enclen; i += sizeof(buf))
6074 {
6075 memset (buf, 0xee, sizeof(buf));
6076 err = gcry_cipher_encrypt (hde, buf, sizeof (buf), NULL, 0);
6077 if (err)
6078 {
6079 fail ("cipher-ccm-huge, gcry_cipher_encrypt failed: %s\n",
6080 gpg_strerror (err));
6081 gcry_cipher_close (hde);
6082 return;
6083 }
6084 }
6085
6086 err = gcry_cipher_gettag (hde, buf, taglen);
6087 if (err)
6088 {
6089 fail ("cipher-ccm-huge, gcry_cipher_gettag failed: %s\n",
6090 gpg_strerror (err));
6091 gcry_cipher_close (hde);
6092 return;
6093 }
6094
6095 if (memcmp (buf, tag, taglen) != 0)
6096 fail ("cipher-ccm-huge, encrypt mismatch entry\n");
6097
6098 gcry_cipher_close (hde);
6099 }
6100
6101 if (verbose)
6102 fprintf (stderr, " Completed CCM checks.\n");
6103 #endif
6104 }
6105
6106
6107 static void
do_check_ocb_cipher(int inplace)6108 do_check_ocb_cipher (int inplace)
6109 {
6110 /* Note that we use hex strings and not binary strings in TV. That
6111 makes it easier to maintain the test vectors. */
6112 static const struct
6113 {
6114 int algo;
6115 int taglen; /* 16, 12, or 8 bytes */
6116 const char *key; /* NULL means "000102030405060708090A0B0C0D0E0F" */
6117 const char *nonce;
6118 const char *aad;
6119 const char *plain;
6120 const char *ciph;
6121 } tv[] = {
6122 /* The RFC-7253 test vectos*/
6123 { GCRY_CIPHER_AES, 16, NULL,
6124 "BBAA99887766554433221100",
6125 "",
6126 "",
6127 "785407BFFFC8AD9EDCC5520AC9111EE6"
6128 },
6129 { GCRY_CIPHER_AES, 16, NULL,
6130 "BBAA99887766554433221101",
6131 "0001020304050607",
6132 "0001020304050607",
6133 "6820B3657B6F615A5725BDA0D3B4EB3A257C9AF1F8F03009"
6134 },
6135 { GCRY_CIPHER_AES, 16, NULL,
6136 "BBAA99887766554433221102",
6137 "0001020304050607",
6138 "",
6139 "81017F8203F081277152FADE694A0A00"
6140 },
6141 { GCRY_CIPHER_AES, 16, NULL,
6142 "BBAA99887766554433221103",
6143 "",
6144 "0001020304050607",
6145 "45DD69F8F5AAE72414054CD1F35D82760B2CD00D2F99BFA9"
6146 },
6147 { GCRY_CIPHER_AES, 16, NULL,
6148 "BBAA99887766554433221104",
6149 "000102030405060708090A0B0C0D0E0F",
6150 "000102030405060708090A0B0C0D0E0F",
6151 "571D535B60B277188BE5147170A9A22C3AD7A4FF3835B8C5"
6152 "701C1CCEC8FC3358"
6153 },
6154 { GCRY_CIPHER_AES, 16, NULL,
6155 "BBAA99887766554433221105",
6156 "000102030405060708090A0B0C0D0E0F",
6157 "",
6158 "8CF761B6902EF764462AD86498CA6B97"
6159 },
6160 { GCRY_CIPHER_AES, 16, NULL,
6161 "BBAA99887766554433221106",
6162 "",
6163 "000102030405060708090A0B0C0D0E0F",
6164 "5CE88EC2E0692706A915C00AEB8B2396F40E1C743F52436B"
6165 "DF06D8FA1ECA343D"
6166 },
6167 { GCRY_CIPHER_AES, 16, NULL,
6168 "BBAA99887766554433221107",
6169 "000102030405060708090A0B0C0D0E0F1011121314151617",
6170 "000102030405060708090A0B0C0D0E0F1011121314151617",
6171 "1CA2207308C87C010756104D8840CE1952F09673A448A122"
6172 "C92C62241051F57356D7F3C90BB0E07F"
6173 },
6174 { GCRY_CIPHER_AES, 16, NULL,
6175 "BBAA99887766554433221108",
6176 "000102030405060708090A0B0C0D0E0F1011121314151617",
6177 "",
6178 "6DC225A071FC1B9F7C69F93B0F1E10DE"
6179 },
6180 { GCRY_CIPHER_AES, 16, NULL,
6181 "BBAA99887766554433221109",
6182 "",
6183 "000102030405060708090A0B0C0D0E0F1011121314151617",
6184 "221BD0DE7FA6FE993ECCD769460A0AF2D6CDED0C395B1C3C"
6185 "E725F32494B9F914D85C0B1EB38357FF"
6186 },
6187 { GCRY_CIPHER_AES, 16, NULL,
6188 "BBAA9988776655443322110A",
6189 "000102030405060708090A0B0C0D0E0F1011121314151617"
6190 "18191A1B1C1D1E1F",
6191 "000102030405060708090A0B0C0D0E0F1011121314151617"
6192 "18191A1B1C1D1E1F",
6193 "BD6F6C496201C69296C11EFD138A467ABD3C707924B964DE"
6194 "AFFC40319AF5A48540FBBA186C5553C68AD9F592A79A4240"
6195 },
6196 { GCRY_CIPHER_AES, 16, NULL,
6197 "BBAA9988776655443322110B",
6198 "000102030405060708090A0B0C0D0E0F1011121314151617"
6199 "18191A1B1C1D1E1F",
6200 "",
6201 "FE80690BEE8A485D11F32965BC9D2A32"
6202 },
6203 { GCRY_CIPHER_AES, 16, NULL,
6204 "BBAA9988776655443322110C",
6205 "",
6206 "000102030405060708090A0B0C0D0E0F1011121314151617"
6207 "18191A1B1C1D1E1F",
6208 "2942BFC773BDA23CABC6ACFD9BFD5835BD300F0973792EF4"
6209 "6040C53F1432BCDFB5E1DDE3BC18A5F840B52E653444D5DF"
6210 },
6211 { GCRY_CIPHER_AES, 16, NULL,
6212 "BBAA9988776655443322110D",
6213 "000102030405060708090A0B0C0D0E0F1011121314151617"
6214 "18191A1B1C1D1E1F2021222324252627",
6215 "000102030405060708090A0B0C0D0E0F1011121314151617"
6216 "18191A1B1C1D1E1F2021222324252627",
6217 "D5CA91748410C1751FF8A2F618255B68A0A12E093FF45460"
6218 "6E59F9C1D0DDC54B65E8628E568BAD7AED07BA06A4A69483"
6219 "A7035490C5769E60"
6220 },
6221 { GCRY_CIPHER_AES, 16, NULL,
6222 "BBAA9988776655443322110E",
6223 "000102030405060708090A0B0C0D0E0F1011121314151617"
6224 "18191A1B1C1D1E1F2021222324252627",
6225 "",
6226 "C5CD9D1850C141E358649994EE701B68"
6227 },
6228 { GCRY_CIPHER_AES, 16, NULL,
6229 "BBAA9988776655443322110F",
6230 "",
6231 "000102030405060708090A0B0C0D0E0F1011121314151617"
6232 "18191A1B1C1D1E1F2021222324252627",
6233 "4412923493C57D5DE0D700F753CCE0D1D2D95060122E9F15"
6234 "A5DDBFC5787E50B5CC55EE507BCB084E479AD363AC366B95"
6235 "A98CA5F3000B1479"
6236 },
6237 { GCRY_CIPHER_AES, 12, "0F0E0D0C0B0A09080706050403020100",
6238 "BBAA9988776655443322110D",
6239 "000102030405060708090A0B0C0D0E0F1011121314151617"
6240 "18191A1B1C1D1E1F2021222324252627",
6241 "000102030405060708090A0B0C0D0E0F1011121314151617"
6242 "18191A1B1C1D1E1F2021222324252627",
6243 "1792A4E31E0755FB03E31B22116E6C2DDF9EFD6E33D536F1"
6244 "A0124B0A55BAE884ED93481529C76B6AD0C515F4D1CDD4FD"
6245 "AC4F02AA"
6246 },
6247 { GCRY_CIPHER_AES, 12, "0F0E0D0C0B0A09080706050403020100",
6248 "BBAA9988776655443322110D",
6249 "000102030405060708090A0B0C0D0E0F1011121314151617"
6250 "18191A1B1C1D1E1F2021222324252627",
6251 /* test vector for checksumming */
6252 "01000000000000000000000000000000"
6253 "02000000000000000000000000000000"
6254 "04000000000000000000000000000000"
6255 "08000000000000000000000000000000"
6256 "10000000000000000000000000000000"
6257 "20000000000000000000000000000000"
6258 "40000000000000000000000000000000"
6259 "80000000000000000000000000000000"
6260 "00010000000000000000000000000000"
6261 "00020000000000000000000000000000"
6262 "00040000000000000000000000000000"
6263 "00080000000000000000000000000000"
6264 "00100000000000000000000000000000"
6265 "00200000000000000000000000000000"
6266 "00400000000000000000000000000000"
6267 "00800000000000000000000000000000"
6268 "00000100000000000000000000000000"
6269 "00000200000000000000000000000000"
6270 "00000400000000000000000000000000"
6271 "00000800000000000000000000000000"
6272 "00001000000000000000000000000000"
6273 "00002000000000000000000000000000"
6274 "00004000000000000000000000000000"
6275 "00008000000000000000000000000000"
6276 "00000001000000000000000000000000"
6277 "00000002000000000000000000000000"
6278 "00000004000000000000000000000000"
6279 "00000008000000000000000000000000"
6280 "00000010000000000000000000000000"
6281 "00000020000000000000000000000000"
6282 "00000040000000000000000000000000"
6283 "00000080000000000000000000000000"
6284 "00000000010000000000000000000000"
6285 "00000000020000000000000000000000"
6286 "00000000040000000000000000000000"
6287 "00000000080000000000000000000000"
6288 "00000000100000000000000000000000"
6289 "00000000200000000000000000000000"
6290 "00000000400000000000000000000000"
6291 "00000000800000000000000000000000"
6292 "00000000000100000000000000000000"
6293 "00000000000200000000000000000000"
6294 "00000000000400000000000000000000"
6295 "00000000000800000000000000000000"
6296 "00000000001000000000000000000000"
6297 "00000000002000000000000000000000"
6298 "00000000004000000000000000000000"
6299 "00000000008000000000000000000000",
6300 "01105c6e36f6ac480f022c51e31ed702"
6301 "90fda4b7b783194d4b4be8e4e1e2dff4"
6302 "6a0804d1c5f9f808ea7933e31c063233"
6303 "2bf65a22b20bb13cde3b80b3682ba965"
6304 "b1207c58916f7856fa9968b410e50dee"
6305 "98b35c071163d1b352b9bbccd09fde29"
6306 "b850f40e71a8ae7d2e2d577f5ee39c46"
6307 "7fa28130b50a123c29958e4665dda9a5"
6308 "e0793997f8f19633a96392141d6e0e88"
6309 "77850ed4364065d1d2f8746e2f1d5fd1"
6310 "996cdde03215306503a30e41f58ef3c4"
6311 "400365cfea4fa6381157c12a46598edf"
6312 "18604854462ec66e3d3cf26d4723cb6a"
6313 "9d801095048086a606fdb9192760889b"
6314 "a8ce2e70e1b55a469137a9e2e6734565"
6315 "283cb1e2c74f37e0854d03e33f8ba499"
6316 "ef5d9af4edfce077c6280338f0a64286"
6317 "2e6bc27ebd5a4c91b3778e22631251c8"
6318 "c5bb75a10945597a9d6c274fc82d3338"
6319 "b403a0a549d1375f26e71ef22bce0941"
6320 "93ea87e2ed72fce0546148c351eec3be"
6321 "867bb1b96070c377fff3c98e21562beb"
6322 "475cfe28abcaaedf49981f6599b15140"
6323 "ea6130d24407079f18ba9d4a8960b082"
6324 "b39c57320e2e064f02fde88c23112146"
6325 "1cac3655868aef584714826ee4f361fb"
6326 "e6d692e1589cbb9dd3c74fa628df2a1f"
6327 "3b0029b1d62b7e9978013ed3c793c1dd"
6328 "1f184c8f7022a853cac40b74ac749aa3"
6329 "f33f0d14732dfda0f2c3c20591bf1f5a"
6330 "710ec0d0bca342baa5146068a78ff58c"
6331 "66316312b7a98af35a0f4e92799b4047"
6332 "f047ae61f25c28d232ce5c168cc745d6"
6333 "6da13cb0f9e38a696635dba7a21571cf"
6334 "cd64ec8cc33db7879f59a90d9edd00f6"
6335 "a899e39ab36b9269a3ac04ebad9326bf"
6336 "53cd9b400168a61714cd628a4056d236"
6337 "bd8622c76daa54cb65f5db2fe03bafbe"
6338 "0b23549ae31136f607293e8093a21934"
6339 "74fd5e9c2451b4c8e0499e6ad34fafc8"
6340 "ab77722a282f7f84b14ddebf7e696300"
6341 "c1ef92d4a0263c6cca104530f996e272"
6342 "f58992ff68d642b071a5848dc4acf2ae"
6343 "28fb1f27ae0f297d5136a7a0a4a03e89"
6344 "b588755b8217a1c62773790e69261269"
6345 "19f45daf7b3ccf18e3fc590a9a0e172f"
6346 "033ac4d13c3decc4c62d7de718ace802"
6347 "140452dc850989f6762e3578bbb04be3"
6348 "1a237c599c4649f4e586b2de"
6349 }
6350 };
6351 gpg_error_t err = 0;
6352 gcry_cipher_hd_t hde, hdd;
6353 unsigned char out[1024];
6354 unsigned char tag[16];
6355 int tidx;
6356
6357 if (verbose)
6358 fprintf (stderr, " Starting OCB checks.\n");
6359
6360 for (tidx = 0; tidx < DIM (tv); tidx++)
6361 {
6362 char *key, *nonce, *aad, *ciph, *plain;
6363 size_t keylen, noncelen, aadlen, ciphlen, plainlen;
6364 int taglen;
6365 size_t taglen2;
6366
6367 if (verbose)
6368 fprintf (stderr, " checking OCB mode for %s [%i] (tv %d)\n",
6369 gcry_cipher_algo_name (tv[tidx].algo), tv[tidx].algo, tidx);
6370
6371 /* Convert to hex strings to binary. */
6372 key = hex2buffer (tv[tidx].key? tv[tidx].key
6373 /* */: "000102030405060708090A0B0C0D0E0F",
6374 &keylen);
6375 nonce = hex2buffer (tv[tidx].nonce, &noncelen);
6376 aad = hex2buffer (tv[tidx].aad, &aadlen);
6377 plain = hex2buffer (tv[tidx].plain, &plainlen);
6378 ciph = hex2buffer (tv[tidx].ciph, &ciphlen);
6379
6380 /* Check that our test vectors are sane. */
6381 assert (plainlen <= sizeof out);
6382 assert (tv[tidx].taglen <= ciphlen);
6383 assert (tv[tidx].taglen <= sizeof tag);
6384
6385 err = gcry_cipher_open (&hde, tv[tidx].algo, GCRY_CIPHER_MODE_OCB, 0);
6386 if (!err)
6387 err = gcry_cipher_open (&hdd, tv[tidx].algo, GCRY_CIPHER_MODE_OCB, 0);
6388 if (err)
6389 {
6390 fail ("cipher-ocb, gcry_cipher_open failed (tv %d): %s\n",
6391 tidx, gpg_strerror (err));
6392 return;
6393 }
6394
6395 /* Set the taglen. For the first handle we do this only for a
6396 non-default taglen. For the second handle we check that we
6397 can also set to the default taglen. */
6398 taglen = tv[tidx].taglen;
6399 if (taglen != 16)
6400 {
6401 err = gcry_cipher_ctl (hde, GCRYCTL_SET_TAGLEN,
6402 &taglen, sizeof taglen);
6403 if (err)
6404 {
6405 fail ("cipher-ocb, gcryctl_set_taglen failed (tv %d): %s\n",
6406 tidx, gpg_strerror (err));
6407 gcry_cipher_close (hde);
6408 gcry_cipher_close (hdd);
6409 return;
6410 }
6411 }
6412 err = gcry_cipher_ctl (hdd, GCRYCTL_SET_TAGLEN,
6413 &taglen, sizeof taglen);
6414 if (err)
6415 {
6416 fail ("cipher-ocb, gcryctl_set_taglen failed (tv %d): %s\n",
6417 tidx, gpg_strerror (err));
6418 gcry_cipher_close (hde);
6419 gcry_cipher_close (hdd);
6420 return;
6421 }
6422
6423 err = gcry_cipher_info (hde, GCRYCTL_GET_TAGLEN, NULL, &taglen2);
6424 if (err)
6425 {
6426 fail ("cipher-ocb, gcryctl_get_taglen failed (tv %d): %s\n",
6427 tidx, gpg_strerror (err));
6428 gcry_cipher_close (hde);
6429 gcry_cipher_close (hdd);
6430 return;
6431 }
6432 if (taglen2 != tv[tidx].taglen)
6433 {
6434 fail ("cipher-ocb, gcryctl_get_taglen returned bad length (tv %d): "
6435 "got=%zu want=%d\n",
6436 tidx, taglen2, tv[tidx].taglen);
6437 gcry_cipher_close (hde);
6438 gcry_cipher_close (hdd);
6439 return;
6440 }
6441
6442 err = gcry_cipher_setkey (hde, key, keylen);
6443 if (!err)
6444 err = gcry_cipher_setkey (hdd, key, keylen);
6445 if (err)
6446 {
6447 fail ("cipher-ocb, gcry_cipher_setkey failed (tv %d): %s\n",
6448 tidx, gpg_strerror (err));
6449 gcry_cipher_close (hde);
6450 gcry_cipher_close (hdd);
6451 return;
6452 }
6453
6454 err = gcry_cipher_setiv (hde, nonce, noncelen);
6455 if (!err)
6456 err = gcry_cipher_setiv (hdd, nonce, noncelen);
6457 if (err)
6458 {
6459 fail ("cipher-ocb, gcry_cipher_setiv failed (tv %d): %s\n",
6460 tidx, gpg_strerror (err));
6461 gcry_cipher_close (hde);
6462 gcry_cipher_close (hdd);
6463 return;
6464 }
6465
6466 err = gcry_cipher_authenticate (hde, aad, aadlen);
6467 if (err)
6468 {
6469 fail ("cipher-ocb, gcry_cipher_authenticate failed (tv %d): %s\n",
6470 tidx, gpg_strerror (err));
6471 gcry_cipher_close (hde);
6472 gcry_cipher_close (hdd);
6473 return;
6474 }
6475
6476 err = gcry_cipher_final (hde);
6477 if (!err)
6478 {
6479 if (inplace)
6480 {
6481 memcpy(out, plain, plainlen);
6482 err = gcry_cipher_encrypt (hde, out, plainlen, NULL, 0);
6483 }
6484 else
6485 {
6486 err = gcry_cipher_encrypt (hde, out, sizeof(out),
6487 plain, plainlen);
6488 }
6489 }
6490 if (err)
6491 {
6492 fail ("cipher-ocb, gcry_cipher_encrypt failed (tv %d): %s\n",
6493 tidx, gpg_strerror (err));
6494 gcry_cipher_close (hde);
6495 gcry_cipher_close (hdd);
6496 return;
6497 }
6498
6499 /* Check that the encrypt output matches the expected cipher
6500 text without the tag (i.e. at the length of plaintext). */
6501 if (memcmp (ciph, out, plainlen))
6502 {
6503 mismatch (ciph, plainlen, out, plainlen);
6504 fail ("cipher-ocb, encrypt data mismatch (tv %d)\n", tidx);
6505 }
6506
6507 /* Check that the tag matches TAGLEN bytes from the end of the
6508 expected ciphertext. */
6509 err = gcry_cipher_gettag (hde, tag, tv[tidx].taglen);
6510 if (err)
6511 {
6512 fail ("cipher_ocb, gcry_cipher_gettag failed (tv %d): %s\n",
6513 tidx, gpg_strerror (err));
6514 }
6515 if (memcmp (ciph + ciphlen - tv[tidx].taglen, tag, tv[tidx].taglen))
6516 {
6517 mismatch (ciph + ciphlen - tv[tidx].taglen, tv[tidx].taglen,
6518 tag, tv[tidx].taglen);
6519 fail ("cipher-ocb, encrypt tag mismatch (tv %d)\n", tidx);
6520 }
6521
6522
6523 err = gcry_cipher_authenticate (hdd, aad, aadlen);
6524 if (err)
6525 {
6526 fail ("cipher-ocb, gcry_cipher_authenticate failed (tv %d): %s\n",
6527 tidx, gpg_strerror (err));
6528 gcry_cipher_close (hde);
6529 gcry_cipher_close (hdd);
6530 return;
6531 }
6532
6533 /* Now for the decryption. */
6534 err = gcry_cipher_final (hdd);
6535 if (!err)
6536 {
6537 if (inplace)
6538 {
6539 err = gcry_cipher_decrypt (hdd, out, plainlen, NULL, 0);
6540 }
6541 else
6542 {
6543 unsigned char tmp[sizeof(out)];
6544
6545 memcpy(tmp, out, plainlen);
6546 err = gcry_cipher_decrypt (hdd, out, plainlen, tmp, plainlen);
6547 }
6548 }
6549 if (err)
6550 {
6551 fail ("cipher-ocb, gcry_cipher_decrypt (tv %d) failed: %s\n",
6552 tidx, gpg_strerror (err));
6553 gcry_cipher_close (hde);
6554 gcry_cipher_close (hdd);
6555 return;
6556 }
6557
6558 /* We still have TAG from the encryption. */
6559 err = gcry_cipher_checktag (hdd, tag, tv[tidx].taglen);
6560 if (err)
6561 {
6562 fail ("cipher-ocb, gcry_cipher_checktag failed (tv %d): %s\n",
6563 tidx, gpg_strerror (err));
6564 }
6565
6566 /* Check that the decrypt output matches the original plaintext. */
6567 if (memcmp (plain, out, plainlen))
6568 {
6569 mismatch (plain, plainlen, out, plainlen);
6570 fail ("cipher-ocb, decrypt data mismatch (tv %d)\n", tidx);
6571 }
6572
6573 /* Check that gettag also works for decryption. */
6574 err = gcry_cipher_gettag (hdd, tag, tv[tidx].taglen);
6575 if (err)
6576 {
6577 fail ("cipher_ocb, decrypt gettag failed (tv %d): %s\n",
6578 tidx, gpg_strerror (err));
6579 }
6580 if (memcmp (ciph + ciphlen - tv[tidx].taglen, tag, tv[tidx].taglen))
6581 {
6582 mismatch (ciph + ciphlen - tv[tidx].taglen, tv[tidx].taglen,
6583 tag, tv[tidx].taglen);
6584 fail ("cipher-ocb, decrypt tag mismatch (tv %d)\n", tidx);
6585 }
6586
6587 gcry_cipher_close (hde);
6588 gcry_cipher_close (hdd);
6589
6590 xfree (nonce);
6591 xfree (aad);
6592 xfree (ciph);
6593 xfree (plain);
6594 xfree (key);
6595 }
6596
6597 if (verbose)
6598 fprintf (stderr, " Completed OCB checks.\n");
6599 }
6600
6601
6602 static void
check_ocb_cipher_largebuf_split(int algo,int keylen,const char * tagexpect,unsigned int splitpos)6603 check_ocb_cipher_largebuf_split (int algo, int keylen, const char *tagexpect,
6604 unsigned int splitpos)
6605 {
6606 static const unsigned char key[32] =
6607 "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F"
6608 "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F";
6609 static const unsigned char nonce[12] =
6610 "\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F\x00\x01\x02\x03";
6611 const size_t buflen = 1024 * 1024 * 2 + 32;
6612 unsigned char *inbuf;
6613 unsigned char *outbuf;
6614 gpg_error_t err = 0;
6615 gcry_cipher_hd_t hde, hdd;
6616 unsigned char tag[16];
6617 int i;
6618
6619 inbuf = xmalloc(buflen);
6620 if (!inbuf)
6621 {
6622 fail ("out-of-memory\n");
6623 return;
6624 }
6625 outbuf = xmalloc(buflen);
6626 if (!outbuf)
6627 {
6628 fail ("out-of-memory\n");
6629 xfree(inbuf);
6630 return;
6631 }
6632
6633 for (i = 0; i < buflen; i += 16)
6634 {
6635 unsigned char hash[20];
6636 unsigned char ctr[4];
6637
6638 ctr[0] = (i >> 0) & 0xff;
6639 ctr[1] = (i >> 8) & 0xff;
6640 ctr[2] = (i >> 16) & 0xff;
6641 ctr[3] = (i >> 24) & 0xff;
6642 gcry_md_hash_buffer (GCRY_MD_SHA1, hash, ctr, sizeof(ctr));
6643 memcpy(inbuf + i, hash, 16);
6644 }
6645
6646 err = gcry_cipher_open (&hde, algo, GCRY_CIPHER_MODE_OCB, 0);
6647 if (!err)
6648 err = gcry_cipher_open (&hdd, algo, GCRY_CIPHER_MODE_OCB, 0);
6649 if (err)
6650 {
6651 fail ("cipher-ocb, gcry_cipher_open failed (large, algo %d): %s\n",
6652 algo, gpg_strerror (err));
6653 goto out_free;
6654 }
6655
6656 err = gcry_cipher_setkey (hde, key, keylen);
6657 if (!err)
6658 err = gcry_cipher_setkey (hdd, key, keylen);
6659 if (err)
6660 {
6661 fail ("cipher-ocb, gcry_cipher_setkey failed (large, algo %d): %s\n",
6662 algo, gpg_strerror (err));
6663 gcry_cipher_close (hde);
6664 gcry_cipher_close (hdd);
6665 goto out_free;
6666 }
6667
6668 err = gcry_cipher_setiv (hde, nonce, 12);
6669 if (!err)
6670 err = gcry_cipher_setiv (hdd, nonce, 12);
6671 if (err)
6672 {
6673 fail ("cipher-ocb, gcry_cipher_setiv failed (large, algo %d): %s\n",
6674 algo, gpg_strerror (err));
6675 gcry_cipher_close (hde);
6676 gcry_cipher_close (hdd);
6677 goto out_free;
6678 }
6679
6680 if (splitpos)
6681 {
6682 err = gcry_cipher_authenticate (hde, inbuf, splitpos);
6683 }
6684 if (!err)
6685 {
6686 err = gcry_cipher_authenticate (hde, inbuf + splitpos, buflen - splitpos);
6687 }
6688 if (err)
6689 {
6690 fail ("cipher-ocb, gcry_cipher_authenticate failed (large, algo %d): %s\n",
6691 algo, gpg_strerror (err));
6692 gcry_cipher_close (hde);
6693 gcry_cipher_close (hdd);
6694 goto out_free;
6695 }
6696
6697 if (splitpos)
6698 {
6699 err = gcry_cipher_encrypt (hde, outbuf, splitpos, inbuf, splitpos);
6700 }
6701 if (!err)
6702 {
6703 err = gcry_cipher_final (hde);
6704 if (!err)
6705 {
6706 err = gcry_cipher_encrypt (hde, outbuf + splitpos, buflen - splitpos,
6707 inbuf + splitpos, buflen - splitpos);
6708 }
6709 }
6710 if (err)
6711 {
6712 fail ("cipher-ocb, gcry_cipher_encrypt failed (large, algo %d): %s\n",
6713 algo, gpg_strerror (err));
6714 gcry_cipher_close (hde);
6715 gcry_cipher_close (hdd);
6716 goto out_free;
6717 }
6718
6719 /* Check that the tag matches. */
6720 err = gcry_cipher_gettag (hde, tag, 16);
6721 if (err)
6722 {
6723 fail ("cipher_ocb, gcry_cipher_gettag failed (large, algo %d): %s\n",
6724 algo, gpg_strerror (err));
6725 }
6726 if (memcmp (tagexpect, tag, 16))
6727 {
6728 mismatch (tagexpect, 16, tag, 16);
6729 fail ("cipher-ocb, encrypt tag mismatch (large, algo %d)\n", algo);
6730 }
6731
6732 err = gcry_cipher_authenticate (hdd, inbuf, buflen);
6733 if (err)
6734 {
6735 fail ("cipher-ocb, gcry_cipher_authenticate failed (large, algo %d): %s\n",
6736 algo, gpg_strerror (err));
6737 gcry_cipher_close (hde);
6738 gcry_cipher_close (hdd);
6739 goto out_free;
6740 }
6741
6742 /* Now for the decryption. */
6743 if (splitpos)
6744 {
6745 err = gcry_cipher_decrypt (hdd, outbuf, splitpos, NULL, 0);
6746 }
6747 if (!err)
6748 {
6749 err = gcry_cipher_final (hdd);
6750 if (!err)
6751 {
6752 err = gcry_cipher_decrypt (hdd, outbuf + splitpos, buflen - splitpos,
6753 NULL, 0);
6754 }
6755 }
6756 if (err)
6757 {
6758 fail ("cipher-ocb, gcry_cipher_decrypt (large, algo %d) failed: %s\n",
6759 algo, gpg_strerror (err));
6760 gcry_cipher_close (hde);
6761 gcry_cipher_close (hdd);
6762 goto out_free;
6763 }
6764
6765 /* We still have TAG from the encryption. */
6766 err = gcry_cipher_checktag (hdd, tag, 16);
6767 if (err)
6768 {
6769 fail ("cipher-ocb, gcry_cipher_checktag failed (large, algo %d): %s\n",
6770 algo, gpg_strerror (err));
6771 }
6772
6773 /* Check that the decrypt output matches the original plaintext. */
6774 if (memcmp (inbuf, outbuf, buflen))
6775 {
6776 /*mismatch (inbuf, buflen, outbuf, buflen);*/
6777 fail ("cipher-ocb, decrypt data mismatch (large, algo %d)\n", algo);
6778 }
6779
6780 /* Check that gettag also works for decryption. */
6781 err = gcry_cipher_gettag (hdd, tag, 16);
6782 if (err)
6783 {
6784 fail ("cipher_ocb, decrypt gettag failed (large, algo %d): %s\n",
6785 algo, gpg_strerror (err));
6786 }
6787 if (memcmp (tagexpect, tag, 16))
6788 {
6789 mismatch (tagexpect, 16, tag, 16);
6790 fail ("cipher-ocb, decrypt tag mismatch (large, algo %d)\n", algo);
6791 }
6792
6793 gcry_cipher_close (hde);
6794 gcry_cipher_close (hdd);
6795
6796 out_free:
6797 xfree(outbuf);
6798 xfree(inbuf);
6799 }
6800
6801
6802 static void
check_ocb_cipher_checksum(int algo,int keylen)6803 check_ocb_cipher_checksum (int algo, int keylen)
6804 {
6805 static const unsigned char key[32] =
6806 "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F"
6807 "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F";
6808 static const unsigned char nonce[12] =
6809 "\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F\x00\x01\x02\x03";
6810 const size_t buflen = 128 * 16;
6811 unsigned char *inbuf, *outbuf;
6812 gpg_error_t err = 0;
6813 gcry_cipher_hd_t hde, hde2, hdd;
6814 unsigned char tag[16];
6815 unsigned char tag2[16];
6816 unsigned char tag3[16];
6817 int i;
6818
6819 inbuf = xmalloc(buflen);
6820 if (!inbuf)
6821 {
6822 fail ("out-of-memory\n");
6823 return;
6824 }
6825 outbuf = xmalloc(buflen);
6826 if (!inbuf)
6827 {
6828 fail ("out-of-memory\n");
6829 xfree(inbuf);
6830 return;
6831 }
6832
6833 memset(inbuf, 0, buflen);
6834 for (i = 0; i < 128; i += 16)
6835 {
6836 unsigned char *blk = inbuf + i;
6837 int bit2set = i / 16;
6838 int byteidx = bit2set / 8;
6839 int bitpos = bit2set % 8;
6840
6841 blk[byteidx] |= 1 << bitpos;
6842 }
6843
6844 err = gcry_cipher_open (&hde, algo, GCRY_CIPHER_MODE_OCB, 0);
6845 if (!err)
6846 err = gcry_cipher_open (&hde2, algo, GCRY_CIPHER_MODE_OCB, 0);
6847 if (!err)
6848 err = gcry_cipher_open (&hdd, algo, GCRY_CIPHER_MODE_OCB, 0);
6849 if (err)
6850 {
6851 fail ("cipher-ocb, gcry_cipher_open failed (checksum, algo %d): %s\n",
6852 algo, gpg_strerror (err));
6853 goto out_free;
6854 }
6855
6856 err = gcry_cipher_setkey (hde, key, keylen);
6857 if (!err)
6858 err = gcry_cipher_setkey (hde2, key, keylen);
6859 if (!err)
6860 err = gcry_cipher_setkey (hdd, key, keylen);
6861 if (err)
6862 {
6863 fail ("cipher-ocb, gcry_cipher_setkey failed (checksum, algo %d): %s\n",
6864 algo, gpg_strerror (err));
6865 gcry_cipher_close (hde);
6866 gcry_cipher_close (hde2);
6867 gcry_cipher_close (hdd);
6868 goto out_free;
6869 }
6870
6871 err = gcry_cipher_setiv (hde, nonce, 12);
6872 if (!err)
6873 err = gcry_cipher_setiv (hde2, nonce, 12);
6874 if (!err)
6875 err = gcry_cipher_setiv (hdd, nonce, 12);
6876 if (err)
6877 {
6878 fail ("cipher-ocb, gcry_cipher_setiv failed (checksum, algo %d): %s\n",
6879 algo, gpg_strerror (err));
6880 gcry_cipher_close (hde);
6881 gcry_cipher_close (hde2);
6882 gcry_cipher_close (hdd);
6883 goto out_free;
6884 }
6885
6886 err = gcry_cipher_final (hde);
6887 if (!err)
6888 {
6889 err = gcry_cipher_encrypt (hde, outbuf, buflen, inbuf, buflen);
6890 }
6891 for (i = 0; i < buflen && !err; i += 16)
6892 {
6893 if (i + 16 == buflen)
6894 err = gcry_cipher_final (hde2);
6895 if (!err)
6896 err = gcry_cipher_encrypt (hde2, outbuf + i, 16, inbuf + i, 16);
6897 }
6898 if (!err)
6899 {
6900 err = gcry_cipher_final (hdd);
6901 }
6902 if (!err)
6903 {
6904 err = gcry_cipher_decrypt (hdd, outbuf, buflen, outbuf, buflen);
6905 }
6906
6907 if (err)
6908 {
6909 fail ("cipher-ocb, gcry_cipher_encrypt failed (checksum, algo %d): %s\n",
6910 algo, gpg_strerror (err));
6911 gcry_cipher_close (hde);
6912 gcry_cipher_close (hde2);
6913 gcry_cipher_close (hdd);
6914 goto out_free;
6915 }
6916
6917 /* Check that the tag matches. */
6918 err = gcry_cipher_gettag (hde, tag, 16);
6919 if (err)
6920 {
6921 fail ("cipher_ocb, gcry_cipher_gettag failed (checksum, algo %d): %s\n",
6922 algo, gpg_strerror (err));
6923 }
6924 err = gcry_cipher_gettag (hde2, tag2, 16);
6925 if (err)
6926 {
6927 fail ("cipher_ocb, gcry_cipher_gettag failed (checksum2, algo %d): %s\n",
6928 algo, gpg_strerror (err));
6929 }
6930 err = gcry_cipher_gettag (hdd, tag3, 16);
6931 if (err)
6932 {
6933 fail ("cipher_ocb, gcry_cipher_gettag failed (checksum3, algo %d): %s\n",
6934 algo, gpg_strerror (err));
6935 }
6936 if (memcmp (tag, tag2, 16))
6937 {
6938 mismatch (tag, 16, tag2, 16);
6939 fail ("cipher-ocb, encrypt tag mismatch (checksum, algo %d)\n", algo);
6940 }
6941 if (memcmp (tag, tag3, 16))
6942 {
6943 mismatch (tag, 16, tag3, 16);
6944 fail ("cipher-ocb, decrypt tag mismatch (checksum, algo %d)\n", algo);
6945 }
6946
6947 gcry_cipher_close (hde);
6948 gcry_cipher_close (hde2);
6949 gcry_cipher_close (hdd);
6950
6951 out_free:
6952 xfree(inbuf);
6953 xfree(outbuf);
6954 }
6955
6956
6957 static void
check_ocb_cipher_largebuf(int algo,int keylen,const char * tagexpect)6958 check_ocb_cipher_largebuf (int algo, int keylen, const char *tagexpect)
6959 {
6960 unsigned int split;
6961
6962 for (split = 0; split < 32 * 16; split = split * 2 + 16)
6963 {
6964 check_ocb_cipher_largebuf_split(algo, keylen, tagexpect, split);
6965 }
6966
6967 check_ocb_cipher_checksum(algo, keylen);
6968 }
6969
6970
6971 static void
check_ocb_cipher_splitaad(void)6972 check_ocb_cipher_splitaad (void)
6973 {
6974 const char t_nonce[] = ("BBAA9988776655443322110D");
6975 const char t_plain[] = ("000102030405060708090A0B0C0D0E0F1011121314151617"
6976 "18191A1B1C1D1E1F2021222324252627");
6977 const char t_ciph[] = ("D5CA91748410C1751FF8A2F618255B68A0A12E093FF45460"
6978 "6E59F9C1D0DDC54B65E8628E568BAD7AED07BA06A4A69483"
6979 "A7035490C5769E60");
6980 struct {
6981 const char *aad0;
6982 const char *aad1;
6983 const char *aad2;
6984 const char *aad3;
6985 } tv[] = {
6986 {
6987 "000102030405060708090A0B0C0D0E0F"
6988 "101112131415161718191A1B1C1D1E1F2021222324252627"
6989 },
6990 {
6991 "000102030405060708090A0B0C0D0E0F",
6992 "101112131415161718191A1B1C1D1E1F",
6993 "2021222324252627"
6994 },
6995 {
6996 "000102030405060708090A0B0C0D0E0F",
6997 "1011121314151617",
6998 "18191A1B1C1D1E1F",
6999 "2021222324252627"
7000 },
7001 {
7002 "000102030405060708090A0B0C0D0E0F",
7003 "101112131415161718191A1B1C1D1E1F",
7004 "20",
7005 "21222324252627"
7006 },
7007 {
7008 "000102030405060708090A0B0C0D0E0F",
7009 "101112131415161718191A1B1C1D1E1F",
7010 "2021",
7011 "222324252627"
7012 },
7013 {
7014 "000102030405060708090A0B0C0D0E0F",
7015 "101112131415161718191A1B1C1D1E1F",
7016 "202122",
7017 "2324252627"
7018 },
7019 {
7020 "000102030405060708090A0B0C0D0E0F",
7021 "101112131415161718191A1B1C1D1E1F",
7022 "20212223",
7023 "24252627"
7024 },
7025 {
7026 "000102030405060708090A0B0C0D0E0F",
7027 "101112131415161718191A1B1C1D1E1F",
7028 "2021222324",
7029 "252627"
7030 },
7031 {
7032 "000102030405060708090A0B0C0D0E0F",
7033 "101112131415161718191A1B1C1D1E1F",
7034 "202122232425",
7035 "2627"
7036 },
7037 {
7038 "000102030405060708090A0B0C0D0E0F",
7039 "101112131415161718191A1B1C1D1E1F",
7040 "20212223242526"
7041 "27"
7042 },
7043 {
7044 "000102030405060708090A0B0C0D0E0F",
7045 "1011121314151617",
7046 "18191A1B1C1D1E1F2021222324252627"
7047 },
7048 {
7049 "00",
7050 "0102030405060708090A0B0C0D0E0F",
7051 "1011121314151617",
7052 "18191A1B1C1D1E1F2021222324252627"
7053 },
7054 {
7055 "0001",
7056 "02030405060708090A0B0C0D0E0F",
7057 "1011121314151617",
7058 "18191A1B1C1D1E1F2021222324252627"
7059 },
7060 {
7061 "000102030405060708090A0B0C0D",
7062 "0E0F",
7063 "1011121314151617",
7064 "18191A1B1C1D1E1F2021222324252627"
7065 },
7066 {
7067 "000102030405060708090A0B0C0D0E",
7068 "0F",
7069 "1011121314151617",
7070 "18191A1B1C1D1E1F2021222324252627"
7071 },
7072 {
7073 "000102030405060708090A0B0C0D0E",
7074 "0F101112131415161718191A1B1C1D1E1F20212223242526",
7075 "27"
7076 }
7077 };
7078
7079 gpg_error_t err = 0;
7080 gcry_cipher_hd_t hde;
7081 unsigned char out[MAX_DATA_LEN];
7082 unsigned char tag[16];
7083 int tidx;
7084 char *key, *nonce, *ciph, *plain;
7085 size_t keylen, noncelen, ciphlen, plainlen;
7086 int i;
7087
7088 /* Convert to hex strings to binary. */
7089 key = hex2buffer ("000102030405060708090A0B0C0D0E0F", &keylen);
7090 nonce = hex2buffer (t_nonce, &noncelen);
7091 plain = hex2buffer (t_plain, &plainlen);
7092 ciph = hex2buffer (t_ciph, &ciphlen);
7093
7094 /* Check that our test vectors are sane. */
7095 assert (plainlen <= sizeof out);
7096 assert (16 <= ciphlen);
7097 assert (16 <= sizeof tag);
7098
7099 for (tidx = 0; tidx < DIM (tv); tidx++)
7100 {
7101 char *aad[4];
7102 size_t aadlen[4];
7103
7104 if (verbose)
7105 fprintf (stderr, " checking OCB aad split (tv %d)\n", tidx);
7106
7107 aad[0] = tv[tidx].aad0? hex2buffer (tv[tidx].aad0, aadlen+0) : NULL;
7108 aad[1] = tv[tidx].aad1? hex2buffer (tv[tidx].aad1, aadlen+1) : NULL;
7109 aad[2] = tv[tidx].aad2? hex2buffer (tv[tidx].aad2, aadlen+2) : NULL;
7110 aad[3] = tv[tidx].aad3? hex2buffer (tv[tidx].aad3, aadlen+3) : NULL;
7111
7112 err = gcry_cipher_open (&hde, GCRY_CIPHER_AES, GCRY_CIPHER_MODE_OCB, 0);
7113 if (err)
7114 {
7115 fail ("cipher-ocb-splitadd, gcry_cipher_open failed: %s\n",
7116 gpg_strerror (err));
7117 return;
7118 }
7119
7120 err = gcry_cipher_setkey (hde, key, keylen);
7121 if (err)
7122 {
7123 fail ("cipher-ocb-splitaad, gcry_cipher_setkey failed: %s\n",
7124 gpg_strerror (err));
7125 gcry_cipher_close (hde);
7126 return;
7127 }
7128
7129 err = gcry_cipher_setiv (hde, nonce, noncelen);
7130 if (err)
7131 {
7132 fail ("cipher-ocb-splitaad, gcry_cipher_setiv failed: %s\n",
7133 gpg_strerror (err));
7134 gcry_cipher_close (hde);
7135 return;
7136 }
7137
7138 for (i=0; i < DIM (aad); i++)
7139 {
7140 if (!aad[i])
7141 continue;
7142 err = gcry_cipher_authenticate (hde, aad[i], aadlen[i]);
7143 if (err)
7144 {
7145 fail ("cipher-ocb-splitaad,"
7146 " gcry_cipher_authenticate failed (tv=%d,i=%d): %s\n",
7147 tidx, i, gpg_strerror (err));
7148 gcry_cipher_close (hde);
7149 return;
7150 }
7151 }
7152
7153 err = gcry_cipher_final (hde);
7154 if (!err)
7155 err = gcry_cipher_encrypt (hde, out, MAX_DATA_LEN, plain, plainlen);
7156 if (err)
7157 {
7158 fail ("cipher-ocb-splitaad, gcry_cipher_encrypt failed: %s\n",
7159 gpg_strerror (err));
7160 gcry_cipher_close (hde);
7161 return;
7162 }
7163
7164 /* Check that the encrypt output matches the expected cipher
7165 text without the tag (i.e. at the length of plaintext). */
7166 if (memcmp (ciph, out, plainlen))
7167 {
7168 mismatch (ciph, plainlen, out, plainlen);
7169 fail ("cipher-ocb-splitaad, encrypt data mismatch\n");
7170 }
7171
7172 /* Check that the tag matches TAGLEN bytes from the end of the
7173 expected ciphertext. */
7174 err = gcry_cipher_gettag (hde, tag, 16);
7175 if (err)
7176 {
7177 fail ("cipher-ocb-splitaad, gcry_cipher_gettag failed: %s\n",
7178 gpg_strerror (err));
7179 }
7180 if (memcmp (ciph + ciphlen - 16, tag, 16))
7181 {
7182 mismatch (ciph + ciphlen - 16, 16, tag, 16);
7183 fail ("cipher-ocb-splitaad, encrypt tag mismatch\n");
7184 }
7185
7186
7187 gcry_cipher_close (hde);
7188 xfree (aad[0]);
7189 xfree (aad[1]);
7190 xfree (aad[2]);
7191 xfree (aad[3]);
7192 }
7193
7194 xfree (nonce);
7195 xfree (ciph);
7196 xfree (plain);
7197 xfree (key);
7198 }
7199
7200
7201 static void
check_ocb_cipher(void)7202 check_ocb_cipher (void)
7203 {
7204 /* Check OCB cipher with separate destination and source buffers for
7205 * encryption/decryption. */
7206 do_check_ocb_cipher(0);
7207
7208 /* Check OCB cipher with inplace encrypt/decrypt. */
7209 do_check_ocb_cipher(1);
7210
7211 /* Check large buffer encryption/decryption. */
7212 check_ocb_cipher_largebuf(GCRY_CIPHER_AES, 16,
7213 "\x4a\x00\x7f\x8d\xbe\x38\x32\x48\xb2\x2f\x7f\x27\xd8\x15\x7f\xb0");
7214 check_ocb_cipher_largebuf(GCRY_CIPHER_AES256, 32,
7215 "\xec\xc5\xe9\x2b\x24\x91\xba\x64\xbc\xe3\x62\xb6\x83\x20\xad\xbd");
7216 check_ocb_cipher_largebuf(GCRY_CIPHER_CAMELLIA128, 16,
7217 "\xd5\xbd\x76\xec\x75\x4a\xab\x6c\x13\xec\x87\x95\x11\xd4\xf0\x3d");
7218 check_ocb_cipher_largebuf(GCRY_CIPHER_CAMELLIA192, 24,
7219 "\xde\xdd\x6b\xbf\xce\x15\x01\x39\x7c\xc5\x69\x19\x72\xa2\x67\x23");
7220 check_ocb_cipher_largebuf(GCRY_CIPHER_CAMELLIA256, 32,
7221 "\x0c\xf3\xd5\x82\x20\x73\xee\x0f\xbd\x6b\x32\x38\xf9\x10\xef\xe5");
7222 check_ocb_cipher_largebuf(GCRY_CIPHER_TWOFISH, 16,
7223 "\x54\x87\x68\xb6\x17\xe6\xd7\xa6\x76\x0d\x7e\x9f\x57\x8b\xec\x88");
7224 check_ocb_cipher_largebuf(GCRY_CIPHER_TWOFISH, 32,
7225 "\x0b\xc3\x93\x52\xfa\x97\x22\xe6\x88\x6e\x29\x4d\x77\x35\x48\x84");
7226 check_ocb_cipher_largebuf(GCRY_CIPHER_SERPENT128, 16,
7227 "\x7e\x49\x3b\xd6\xde\x6e\x9e\x53\x67\xcd\x00\xad\xc9\xd9\xa5\xbc");
7228 check_ocb_cipher_largebuf(GCRY_CIPHER_SERPENT192, 24,
7229 "\x1e\x33\x0e\x06\xc8\x27\x6a\x0b\x41\x5e\x93\xae\x39\xf4\x50\x12");
7230 check_ocb_cipher_largebuf(GCRY_CIPHER_SERPENT256, 32,
7231 "\x6b\x4c\x3f\x8f\x77\x75\xf2\x4d\xaf\xde\x2c\x5f\x1a\x80\xb8\x4d");
7232 check_ocb_cipher_largebuf(GCRY_CIPHER_SM4, 16,
7233 "\x3c\x32\x54\x5d\xc5\x17\xa1\x16\x3f\x8e\xc7\x1d\x8d\x8b\x2d\xb0");
7234
7235 /* Check that the AAD data is correctly buffered. */
7236 check_ocb_cipher_splitaad ();
7237 }
7238
7239
7240
7241 static void
do_check_xts_cipher(int inplace)7242 do_check_xts_cipher (int inplace)
7243 {
7244 /* Note that we use hex strings and not binary strings in TV. That
7245 makes it easier to maintain the test vectors. */
7246 static const struct
7247 {
7248 int algo;
7249 const char *key; /* NULL means "000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F" */
7250 const char *iv;
7251 const char *plain;
7252 const char *ciph;
7253 } tv[] = {
7254 /* CAVS; hex/XTSGenAES128.rsp; COUNT=100 */
7255 { GCRY_CIPHER_AES,
7256 "bcb6613c495de4bdad9c19f04e4b3915f9ecb379e1a575b633337e934fca1050",
7257 "64981173159d58ac355a20120c8e81f1",
7258 "189acacee06dfa7c94484c7dae59e166",
7259 "7900191d0f19a97668fdba9def84eedc"
7260 },
7261 /* CAVS; hex/XTSGenAES128.rsp; COUNT=101 */
7262 { GCRY_CIPHER_AES,
7263 "b7b93f516aef295eff3a29d837cf1f135347e8a21dae616ff5062b2e8d78ce5e",
7264 "873edea653b643bd8bcf51403197ed14",
7265 "236f8a5b58dd55f6194ed70c4ac1a17f1fe60ec9a6c454d087ccb77d6b638c47",
7266 "22e6a3c6379dcf7599b052b5a749c7f78ad8a11b9f1aa9430cf3aef445682e19"
7267 },
7268 /* CAVS; hex/XTSGenAES128.rsp; COUNT=301 */
7269 { GCRY_CIPHER_AES,
7270 "394c97881abd989d29c703e48a72b397a7acf51b59649eeea9b33274d8541df4",
7271 "4b15c684a152d485fe9937d39b168c29",
7272 "2f3b9dcfbae729583b1d1ffdd16bb6fe2757329435662a78f0",
7273 "f3473802e38a3ffef4d4fb8e6aa266ebde553a64528a06463e"
7274 },
7275 /* CAVS; hex/XTSGenAES128.rsp; COUNT=500 */
7276 { GCRY_CIPHER_AES,
7277 "783a83ec52a27405dff9de4c57f9c979b360b6a5df88d67ec1a052e6f582a717",
7278 "886e975b29bdf6f0c01bb47f61f6f0f5",
7279 "b04d84da856b9a59ce2d626746f689a8051dacd6bce3b990aa901e4030648879",
7280 "f941039ebab8cac39d59247cbbcb4d816c726daed11577692c55e4ac6d3e6820"
7281 },
7282 /* CAVS; hex/XTSGenAES256.rsp; COUNT=1 */
7283 { GCRY_CIPHER_AES256,
7284 "1ea661c58d943a0e4801e42f4b0947149e7f9f8e3e68d0c7505210bd311a0e7c"
7285 "d6e13ffdf2418d8d1911c004cda58da3d619b7e2b9141e58318eea392cf41b08",
7286 "adf8d92627464ad2f0428e84a9f87564",
7287 "2eedea52cd8215e1acc647e810bbc3642e87287f8d2e57e36c0a24fbc12a202e",
7288 "cbaad0e2f6cea3f50b37f934d46a9b130b9d54f07e34f36af793e86f73c6d7db"
7289 },
7290 /* CAVS; hex/XTSGenAES256.rsp; COUNT=101 */
7291 { GCRY_CIPHER_AES256,
7292 "266c336b3b01489f3267f52835fd92f674374b88b4e1ebd2d36a5f457581d9d0"
7293 "42c3eef7b0b7e5137b086496b4d9e6ac658d7196a23f23f036172fdb8faee527",
7294 "06b209a7a22f486ecbfadb0f3137ba42",
7295 "ca7d65ef8d3dfad345b61ccddca1ad81de830b9e86c7b426d76cb7db766852d9"
7296 "81c6b21409399d78f42cc0b33a7bbb06",
7297 "c73256870cc2f4dd57acc74b5456dbd776912a128bc1f77d72cdebbf270044b7"
7298 "a43ceed29025e1e8be211fa3c3ed002d"
7299 },
7300 /* CAVS; hex/XTSGenAES256.rsp; COUNT=401 */
7301 { GCRY_CIPHER_AES256,
7302 "33e89e817ff8d037d6ac5a2296657503f20885d94c483e26449066bd9284d130"
7303 "2dbdbb4b66b6b9f4687f13dd028eb6aa528ca91deb9c5f40db93218806033801",
7304 "a78c04335ab7498a52b81ed74b48e6cf",
7305 "14c3ac31291b075f40788247c3019e88c7b40bac3832da45bbc6c4fe7461371b"
7306 "4dfffb63f71c9f8edb98f28ff4f33121",
7307 "dead7e587519bc78c70d99279fbe3d9b1ad13cdaae69824e0ab8135413230bfd"
7308 "b13babe8f986fbb30d46ab5ec56b916e"
7309 },
7310 /* From https://github.com/heisencoder/XTS-AES/blob/master/testvals/ */
7311 { GCRY_CIPHER_AES,
7312 "fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0",
7313 "9a785634120000000000000000000000",
7314 "000102030405060708090a0b0c0d0e0f10",
7315 "7fb2e8beccbb5c118aa52ddca31220bb1b"
7316 },
7317 { GCRY_CIPHER_AES,
7318 "fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0",
7319 "9a785634120000000000000000000000",
7320 "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e",
7321 "d05bc090a8e04f1b3d3ecdd5baec0fd4edbf9dace45d6f6a7306e64be5dd82"
7322 },
7323 { GCRY_CIPHER_AES,
7324 "2718281828459045235360287471352631415926535897932384626433832795",
7325 "00000000000000000000000000000000",
7326 "000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F"
7327 "20212223",
7328 "27A7479BEFA1D476489F308CD4CFA6E288F548E5C4239F91712A587E2B05AC3D"
7329 "A96E4BBE"
7330 },
7331 { GCRY_CIPHER_AES256,
7332 "2718281828459045235360287471352662497757247093699959574966967627"
7333 "3141592653589793238462643383279502884197169399375105820974944592",
7334 "11000000000000000000000000000000",
7335 "3A060A8CAD115A6F44572E3759E43C8F8832FEDC28A8E35B357B5CF3EDBEF788"
7336 "CAD8BFCB23",
7337 "6D1C78A8BAD91DB2924C507CCEDE835F5BADD157DA0AF55C98BBC28CF676F9FA"
7338 "61618FA696"
7339 },
7340 { GCRY_CIPHER_AES256,
7341 "2718281828459045235360287471352662497757247093699959574966967627"
7342 "3141592653589793238462643383279502884197169399375105820974944592",
7343 "11000000000000000000000000000000",
7344 "3A060A8CAD115A6F44572E3759E43C8F8832FEDC28A8E35B357B5CF3EDBEF788"
7345 "CAD8BFCB23",
7346 "6D1C78A8BAD91DB2924C507CCEDE835F5BADD157DA0AF55C98BBC28CF676F9FA"
7347 "61618FA696"
7348 },
7349 { GCRY_CIPHER_AES,
7350 "e0e1e2e3e4e5e6e7e8e9eaebecedeeefc0c1c2c3c4c5c6c7c8c9cacbcccdcecf",
7351 "21436587a90000000000000000000000",
7352 "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f"
7353 "202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f"
7354 "404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f"
7355 "606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f"
7356 "808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f"
7357 "a0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebf"
7358 "c0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedf"
7359 "e0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff"
7360 "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f"
7361 "202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f"
7362 "404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f"
7363 "606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f"
7364 "808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f"
7365 "a0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebf"
7366 "c0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedf"
7367 "e0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff"
7368 "0001020304050607",
7369 "38b45812ef43a05bd957e545907e223b954ab4aaf088303ad910eadf14b42be6"
7370 "8b2461149d8c8ba85f992be970bc621f1b06573f63e867bf5875acafa04e42cc"
7371 "bd7bd3c2a0fb1fff791ec5ec36c66ae4ac1e806d81fbf709dbe29e471fad3854"
7372 "9c8e66f5345d7c1eb94f405d1ec785cc6f6a68f6254dd8339f9d84057e01a177"
7373 "41990482999516b5611a38f41bb6478e6f173f320805dd71b1932fc333cb9ee3"
7374 "9936beea9ad96fa10fb4112b901734ddad40bc1878995f8e11aee7d141a2f5d4"
7375 "8b7a4e1e7f0b2c04830e69a4fd1378411c2f287edf48c6c4e5c247a19680f7fe"
7376 "41cefbd49b582106e3616cbbe4dfb2344b2ae9519391f3e0fb4922254b1d6d2d"
7377 "19c6d4d537b3a26f3bcc51588b32f3eca0829b6a5ac72578fb814fb43cf80d64"
7378 "a233e3f997a3f02683342f2b33d25b492536b93becb2f5e1a8b82f5b88334272"
7379 "9e8ae09d16938841a21a97fb543eea3bbff59f13c1a18449e398701c1ad51648"
7380 "346cbc04c27bb2da3b93a1372ccae548fb53bee476f9e9c91773b1bb19828394"
7381 "d55d3e1a20ed69113a860b6829ffa847224604435070221b257e8dff783615d2"
7382 "cae4803a93aa4334ab482a0afac9c0aeda70b45a481df5dec5df8cc0f423c77a"
7383 "5fd46cd312021d4b438862419a791be03bb4d97c0e59578542531ba466a83baf"
7384 "92cefc151b5cc1611a167893819b63fb37ec662bc0fc907db74a94468a55a7bc"
7385 "8a6b18e86de60290"
7386 },
7387 { GCRY_CIPHER_AES256,
7388 "2718281828459045235360287471352662497757247093699959574966967627"
7389 "3141592653589793238462643383279502884197169399375105820974944592",
7390 "ffffffff000000000000000000000000",
7391 "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f"
7392 "202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f"
7393 "404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f"
7394 "606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f"
7395 "808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f"
7396 "a0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebf"
7397 "c0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedf"
7398 "e0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff"
7399 "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f"
7400 "202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f"
7401 "404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f"
7402 "606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f"
7403 "808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f"
7404 "a0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebf"
7405 "c0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedf"
7406 "e0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff",
7407 "bf53d2dade78e822a4d949a9bc6766b01b06a8ef70d26748c6a7fc36d80ae4c5"
7408 "520f7c4ab0ac8544424fa405162fef5a6b7f229498063618d39f0003cb5fb8d1"
7409 "c86b643497da1ff945c8d3bedeca4f479702a7a735f043ddb1d6aaade3c4a0ac"
7410 "7ca7f3fa5279bef56f82cd7a2f38672e824814e10700300a055e1630b8f1cb0e"
7411 "919f5e942010a416e2bf48cb46993d3cb6a51c19bacf864785a00bc2ecff15d3"
7412 "50875b246ed53e68be6f55bd7e05cfc2b2ed6432198a6444b6d8c247fab941f5"
7413 "69768b5c429366f1d3f00f0345b96123d56204c01c63b22ce78baf116e525ed9"
7414 "0fdea39fa469494d3866c31e05f295ff21fea8d4e6e13d67e47ce722e9698a1c"
7415 "1048d68ebcde76b86fcf976eab8aa9790268b7068e017a8b9b749409514f1053"
7416 "027fd16c3786ea1bac5f15cb79711ee2abe82f5cf8b13ae73030ef5b9e4457e7"
7417 "5d1304f988d62dd6fc4b94ed38ba831da4b7634971b6cd8ec325d9c61c00f1df"
7418 "73627ed3745a5e8489f3a95c69639c32cd6e1d537a85f75cc844726e8a72fc00"
7419 "77ad22000f1d5078f6b866318c668f1ad03d5a5fced5219f2eabbd0aa5c0f460"
7420 "d183f04404a0d6f469558e81fab24a167905ab4c7878502ad3e38fdbe62a4155"
7421 "6cec37325759533ce8f25f367c87bb5578d667ae93f9e2fd99bcbc5f2fbba88c"
7422 "f6516139420fcff3b7361d86322c4bd84c82f335abb152c4a93411373aaa8220"
7423 }
7424 };
7425 gpg_error_t err = 0;
7426 gcry_cipher_hd_t hde, hdd;
7427 int tidx;
7428 int got_err = 0;
7429
7430 if (verbose)
7431 fprintf (stderr, " Starting XTS checks.\n");
7432
7433 for (tidx = 0; !got_err && tidx < DIM (tv); tidx++)
7434 {
7435 const char *hexkey = tv[tidx].key;
7436 char *key, *iv, *ciph, *plain, *out;
7437 size_t keylen, ivlen, ciphlen, plainlen, outlen;
7438
7439 if (verbose)
7440 fprintf (stderr, " checking XTS mode for %s [%i] (tv %d)\n",
7441 gcry_cipher_algo_name (tv[tidx].algo), tv[tidx].algo, tidx);
7442
7443 if (!hexkey)
7444 hexkey = "000102030405060708090A0B0C0D0E0F"
7445 "101112131415161718191A1B1C1D1E1F";
7446
7447 /* Convert to hex strings to binary. */
7448 key = hex2buffer (hexkey, &keylen);
7449 iv = hex2buffer (tv[tidx].iv, &ivlen);
7450 plain = hex2buffer (tv[tidx].plain, &plainlen);
7451 ciph = hex2buffer (tv[tidx].ciph, &ciphlen);
7452 outlen = plainlen + 5;
7453 out = xmalloc (outlen);
7454
7455 assert (plainlen == ciphlen);
7456 assert (plainlen <= outlen);
7457 assert (out);
7458
7459 err = gcry_cipher_open (&hde, tv[tidx].algo, GCRY_CIPHER_MODE_XTS, 0);
7460 if (!err)
7461 err = gcry_cipher_open (&hdd, tv[tidx].algo, GCRY_CIPHER_MODE_XTS, 0);
7462 if (err)
7463 {
7464 fail ("cipher-xts, gcry_cipher_open failed (tv %d): %s\n",
7465 tidx, gpg_strerror (err));
7466 return;
7467 }
7468
7469 err = gcry_cipher_setkey (hde, key, keylen);
7470 if (err && in_fips_mode && memcmp(key, key + keylen/2, keylen/2) == 0)
7471 {
7472 /* Since both halves of key are the same, fail to set key in FIPS
7473 mode is expected. */
7474 goto next_tv;
7475 }
7476 if (!err)
7477 err = gcry_cipher_setkey (hdd, key, keylen);
7478 if (err)
7479 {
7480 fail ("cipher-xts, gcry_cipher_setkey failed (tv %d): %s\n",
7481 tidx, gpg_strerror (err));
7482 goto err_out;
7483 }
7484
7485 err = gcry_cipher_setiv (hde, iv, ivlen);
7486 if (!err)
7487 err = gcry_cipher_setiv (hdd, iv, ivlen);
7488 if (err)
7489 {
7490 fail ("cipher-xts, gcry_cipher_setiv failed (tv %d): %s\n",
7491 tidx, gpg_strerror (err));
7492 goto err_out;
7493 }
7494
7495 if (inplace)
7496 {
7497 memcpy(out, plain, plainlen);
7498 err = gcry_cipher_encrypt (hde, out, plainlen, NULL, 0);
7499 }
7500 else
7501 {
7502 err = gcry_cipher_encrypt (hde, out, outlen, plain, plainlen);
7503 }
7504 if (err)
7505 {
7506 fail ("cipher-xts, gcry_cipher_encrypt failed (tv %d): %s\n",
7507 tidx, gpg_strerror (err));
7508 goto err_out;
7509 }
7510
7511 /* Check that the encrypt output matches the expected cipher text. */
7512 if (memcmp (ciph, out, plainlen))
7513 {
7514 mismatch (ciph, plainlen, out, plainlen);
7515 fail ("cipher-xts, encrypt data mismatch (tv %d)\n", tidx);
7516 }
7517
7518 /* Now for the decryption. */
7519 if (inplace)
7520 {
7521 err = gcry_cipher_decrypt (hdd, out, plainlen, NULL, 0);
7522 }
7523 else
7524 {
7525 memcpy(ciph, out, ciphlen);
7526 err = gcry_cipher_decrypt (hdd, out, plainlen, ciph, ciphlen);
7527 }
7528 if (err)
7529 {
7530 fail ("cipher-xts, gcry_cipher_decrypt (tv %d) failed: %s\n",
7531 tidx, gpg_strerror (err));
7532 goto err_out;
7533 }
7534
7535 /* Check that the decrypt output matches the expected plain text. */
7536 if (memcmp (plain, out, plainlen))
7537 {
7538 mismatch (plain, plainlen, out, plainlen);
7539 fail ("cipher-xts, decrypt data mismatch (tv %d)\n", tidx);
7540 }
7541
7542 if (0)
7543 {
7544 err_out:
7545 got_err = 1;
7546 }
7547
7548 next_tv:
7549 gcry_cipher_close (hde);
7550 gcry_cipher_close (hdd);
7551
7552 xfree (iv);
7553 xfree (ciph);
7554 xfree (plain);
7555 xfree (key);
7556 xfree (out);
7557 }
7558
7559 if (verbose)
7560 fprintf (stderr, " Completed XTS checks.\n");
7561 }
7562
7563
7564 static void
check_xts_cipher(void)7565 check_xts_cipher (void)
7566 {
7567 /* Check XTS cipher with separate destination and source buffers for
7568 * encryption/decryption. */
7569 do_check_xts_cipher(0);
7570
7571 /* Check XTS cipher with inplace encrypt/decrypt. */
7572 do_check_xts_cipher(1);
7573 }
7574
7575
7576 static void
check_gost28147_cipher_basic(enum gcry_cipher_algos algo)7577 check_gost28147_cipher_basic (enum gcry_cipher_algos algo)
7578 {
7579 #if USE_GOST28147
7580 static const struct {
7581 char key[MAX_DATA_LEN];
7582 const char *oid;
7583 unsigned char plaintext[MAX_DATA_LEN];
7584 int inlen;
7585 char out[MAX_DATA_LEN];
7586 } tv[] =
7587 {
7588 {
7589 "\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x80"
7590 "\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xd0",
7591 "1.2.643.7.1.2.5.1.1",
7592 "\x01\x02\x03\x04\x05\x06\x07\x08",
7593 8,
7594 "\xce\x5a\x5e\xd7\xe0\x57\x7a\x5f",
7595 }, {
7596 "\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x80"
7597 "\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xd0",
7598 "1.2.643.2.2.31.0",
7599 "\x01\x02\x03\x04\x05\x06\x07\x08",
7600 8,
7601 "\x98\x56\xcf\x8b\xfc\xc2\x82\xf4",
7602 }, {
7603 "\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x80"
7604 "\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xd0",
7605 "1.2.643.2.2.31.1",
7606 "\x01\x02\x03\x04\x05\x06\x07\x08",
7607 8,
7608 "\x66\x81\x84\xae\xdc\x48\xc9\x17",
7609 }, {
7610 "\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x80"
7611 "\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xd0",
7612 "1.2.643.2.2.31.2",
7613 "\x01\x02\x03\x04\x05\x06\x07\x08",
7614 8,
7615 "\xdb\xee\x81\x14\x7b\x74\xb0\xf2",
7616 }, {
7617 "\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x80"
7618 "\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xd0",
7619 "1.2.643.2.2.31.3",
7620 "\x01\x02\x03\x04\x05\x06\x07\x08",
7621 8,
7622 "\x31\xa3\x85\x9d\x0a\xee\xb8\x0e",
7623 }, {
7624 "\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x80"
7625 "\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xd0",
7626 "1.2.643.2.2.31.4",
7627 "\x01\x02\x03\x04\x05\x06\x07\x08",
7628 8,
7629 "\xb1\x32\x3e\x0b\x21\x73\xcb\xd1",
7630 }, {
7631 "\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x80"
7632 "\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xd0",
7633 "1.2.643.2.2.30.0",
7634 "\x01\x02\x03\x04\x05\x06\x07\x08",
7635 8,
7636 "\xce\xd5\x2a\x7f\xf7\xf2\x60\xd5",
7637 }, {
7638 "\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x80"
7639 "\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xd0",
7640 "1.2.643.2.2.30.1",
7641 "\x01\x02\x03\x04\x05\x06\x07\x08",
7642 8,
7643 "\xe4\x21\x75\xe1\x69\x22\xd0\xa8",
7644 }
7645 };
7646
7647 gcry_cipher_hd_t hde, hdd;
7648 unsigned char out[MAX_DATA_LEN];
7649 int i, keylen;
7650 gcry_error_t err = 0;
7651
7652 if (verbose)
7653 fprintf (stderr, " Starting GOST28147 cipher checks.\n");
7654 keylen = gcry_cipher_get_algo_keylen(algo);
7655 if (!keylen)
7656 {
7657 fail ("gost28147, gcry_cipher_get_algo_keylen failed\n");
7658 return;
7659 }
7660
7661 for (i = 0; i < sizeof (tv) / sizeof (tv[0]); i++)
7662 {
7663 err = gcry_cipher_open (&hde, algo,
7664 GCRY_CIPHER_MODE_ECB, 0);
7665 if (!err)
7666 err = gcry_cipher_open (&hdd, algo,
7667 GCRY_CIPHER_MODE_ECB, 0);
7668 if (err)
7669 {
7670 fail ("gost28147, gcry_cipher_open failed: %s\n", gpg_strerror (err));
7671 return;
7672 }
7673
7674 err = gcry_cipher_setkey (hde, tv[i].key, keylen);
7675 if (!err)
7676 err = gcry_cipher_setkey (hdd, tv[i].key, keylen);
7677 if (err)
7678 {
7679 fail ("gost28147, gcry_cipher_setkey failed: %s\n",
7680 gpg_strerror (err));
7681 gcry_cipher_close (hde);
7682 gcry_cipher_close (hdd);
7683 return;
7684 }
7685
7686 err = gcry_cipher_set_sbox (hde, tv[i].oid);
7687 if (!err)
7688 err = gcry_cipher_set_sbox (hdd, tv[i].oid);
7689 if (err)
7690 {
7691 fail ("gost28147, gcry_cipher_set_sbox failed: %s\n",
7692 gpg_strerror (err));
7693 gcry_cipher_close (hde);
7694 gcry_cipher_close (hdd);
7695 return;
7696 }
7697
7698 err = gcry_cipher_encrypt (hde, out, MAX_DATA_LEN,
7699 tv[i].plaintext,
7700 tv[i].inlen == -1 ?
7701 strlen ((char*)tv[i].plaintext) :
7702 tv[i].inlen);
7703 if (err)
7704 {
7705 fail ("gost28147, gcry_cipher_encrypt (%d) failed: %s\n",
7706 i, gpg_strerror (err));
7707 gcry_cipher_close (hde);
7708 gcry_cipher_close (hdd);
7709 return;
7710 }
7711
7712 if (memcmp (tv[i].out, out, tv[i].inlen))
7713 {
7714 fail ("gost28147, encrypt mismatch entry %d\n", i);
7715 mismatch (tv[i].out, tv[i].inlen,
7716 out, tv[i].inlen);
7717 }
7718
7719 err = gcry_cipher_decrypt (hdd, out, tv[i].inlen, NULL, 0);
7720 if (err)
7721 {
7722 fail ("gost28147, gcry_cipher_decrypt (%d) failed: %s\n",
7723 i, gpg_strerror (err));
7724 gcry_cipher_close (hde);
7725 gcry_cipher_close (hdd);
7726 return;
7727 }
7728
7729 if (memcmp (tv[i].plaintext, out, tv[i].inlen))
7730 {
7731 fail ("gost28147, decrypt mismatch entry %d\n", i);
7732 mismatch (tv[i].plaintext, tv[i].inlen,
7733 out, tv[i].inlen);
7734 }
7735
7736 gcry_cipher_close (hde);
7737 gcry_cipher_close (hdd);
7738 }
7739
7740 #endif
7741 }
7742
7743 static void
check_gost28147_cipher(void)7744 check_gost28147_cipher (void)
7745 {
7746 check_gost28147_cipher_basic (GCRY_CIPHER_GOST28147);
7747 check_gost28147_cipher_basic (GCRY_CIPHER_GOST28147_MESH);
7748 }
7749
7750 static void
check_stream_cipher(void)7751 check_stream_cipher (void)
7752 {
7753 static const struct tv
7754 {
7755 const char *name;
7756 int algo;
7757 int keylen;
7758 int ivlen;
7759 const char *key;
7760 const char *iv;
7761 struct data
7762 {
7763 unsigned int inlen;
7764 const char *plaintext;
7765 const char *out;
7766 } data[MAX_DATA_LEN];
7767 } tv[] = {
7768 #ifdef USE_SALSA20
7769 {
7770 "Salsa20 128 bit, test 1",
7771 GCRY_CIPHER_SALSA20, 16, 8,
7772 "\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
7773 "\x00\x00\x00\x00\x00\x00\x00\x00",
7774 {
7775 { 8,
7776 "\x00\x00\x00\x00\x00\x00\x00\x00",
7777 "\x4D\xFA\x5E\x48\x1D\xA2\x3E\xA0"
7778 }
7779 }
7780 },
7781 {
7782 "Salsa20 128 bit, test 2",
7783 GCRY_CIPHER_SALSA20, 16, 8,
7784 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
7785 "\x80\x00\x00\x00\x00\x00\x00\x00",
7786 {
7787 { 8,
7788 "\x00\x00\x00\x00\x00\x00\x00\x00",
7789 "\xB6\x6C\x1E\x44\x46\xDD\x95\x57"
7790 }
7791 }
7792 },
7793 {
7794 "Salsa20 128 bit, test 3",
7795 GCRY_CIPHER_SALSA20, 16, 8,
7796 "\x00\x53\xA6\xF9\x4C\x9F\xF2\x45\x98\xEB\x3E\x91\xE4\x37\x8A\xDD",
7797 "\x0D\x74\xDB\x42\xA9\x10\x77\xDE",
7798 {
7799 { 8,
7800 "\x00\x00\x00\x00\x00\x00\x00\x00",
7801 "\x05\xE1\xE7\xBE\xB6\x97\xD9\x99"
7802 }
7803 }
7804 },
7805 {
7806 "Salsa20 256 bit, test 1",
7807 GCRY_CIPHER_SALSA20, 32, 8,
7808 "\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
7809 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
7810 "\x00\x00\x00\x00\x00\x00\x00\x00",
7811 {
7812 { 8,
7813 "\x00\x00\x00\x00\x00\x00\x00\x00",
7814 "\xE3\xBE\x8F\xDD\x8B\xEC\xA2\xE3"
7815 }
7816 }
7817 },
7818 {
7819 "Salsa20 256 bit, test 2",
7820 GCRY_CIPHER_SALSA20, 32, 8,
7821 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
7822 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
7823 "\x80\x00\x00\x00\x00\x00\x00\x00",
7824 {
7825 { 8,
7826 "\x00\x00\x00\x00\x00\x00\x00\x00",
7827 "\x2A\xBA\x3D\xC4\x5B\x49\x47\x00"
7828 }
7829 }
7830 },
7831 {
7832 "Salsa20 256 bit, ecrypt verified, set 6, vector 0",
7833 GCRY_CIPHER_SALSA20, 32, 8,
7834 "\x00\x53\xA6\xF9\x4C\x9F\xF2\x45\x98\xEB\x3E\x91\xE4\x37\x8A\xDD"
7835 "\x30\x83\xD6\x29\x7C\xCF\x22\x75\xC8\x1B\x6E\xC1\x14\x67\xBA\x0D",
7836 "\x0D\x74\xDB\x42\xA9\x10\x77\xDE",
7837 {
7838 { 8,
7839 "\x00\x00\x00\x00\x00\x00\x00\x00",
7840 "\xF5\xFA\xD5\x3F\x79\xF9\xDF\x58"
7841 },
7842 { 64,
7843 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
7844 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
7845 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
7846 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
7847 "\xF5\xFA\xD5\x3F\x79\xF9\xDF\x58\xC4\xAE\xA0\xD0\xED\x9A\x96\x01"
7848 "\xF2\x78\x11\x2C\xA7\x18\x0D\x56\x5B\x42\x0A\x48\x01\x96\x70\xEA"
7849 "\xF2\x4C\xE4\x93\xA8\x62\x63\xF6\x77\xB4\x6A\xCE\x19\x24\x77\x3D"
7850 "\x2B\xB2\x55\x71\xE1\xAA\x85\x93\x75\x8F\xC3\x82\xB1\x28\x0B\x71"
7851 }
7852 }
7853 },
7854 {
7855 "Salsa20/12 128 bit, test 1",
7856 GCRY_CIPHER_SALSA20R12, 16, 8,
7857 "\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
7858 "\x00\x00\x00\x00\x00\x00\x00\x00",
7859 {
7860 { 8,
7861 "\x00\x00\x00\x00\x00\x00\x00\x00",
7862 "\xFC\x20\x7D\xBF\xC7\x6C\x5E\x17"
7863 }
7864 }
7865 },
7866 {
7867 "Salsa20/12 128 bit, test 2",
7868 GCRY_CIPHER_SALSA20R12, 16, 8,
7869 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
7870 "\x80\x00\x00\x00\x00\x00\x00\x00",
7871 {
7872 { 8,
7873 "\x00\x00\x00\x00\x00\x00\x00\x00",
7874 "\x08\x28\x39\x9A\x6F\xEF\x20\xDA"
7875 }
7876 }
7877 },
7878 {
7879 "Salsa20/12 128 bit, test 3",
7880 GCRY_CIPHER_SALSA20R12, 16, 8,
7881 "\x00\x53\xA6\xF9\x4C\x9F\xF2\x45\x98\xEB\x3E\x91\xE4\x37\x8A\xDD",
7882 "\x0D\x74\xDB\x42\xA9\x10\x77\xDE",
7883 {
7884 { 8,
7885 "\x00\x00\x00\x00\x00\x00\x00\x00",
7886 "\xAD\x9E\x60\xE6\xD2\xA2\x64\xB8"
7887 }
7888 }
7889 },
7890 {
7891 "Salsa20/12 256 bit, test 1",
7892 GCRY_CIPHER_SALSA20R12, 32, 8,
7893 "\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
7894 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
7895 "\x00\x00\x00\x00\x00\x00\x00\x00",
7896 {
7897 { 8,
7898 "\x00\x00\x00\x00\x00\x00\x00\x00",
7899 "\xAF\xE4\x11\xED\x1C\x4E\x07\xE4"
7900 }
7901 }
7902 },
7903 {
7904 "Salsa20/12 256 bit, test 2",
7905 GCRY_CIPHER_SALSA20R12, 32, 8,
7906 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
7907 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
7908 "\x80\x00\x00\x00\x00\x00\x00\x00",
7909 {
7910 { 8,
7911 "\x00\x00\x00\x00\x00\x00\x00\x00",
7912 "\x17\x2C\x51\x92\xCB\x6E\x64\x5B"
7913 }
7914 }
7915 },
7916 {
7917 "Salsa20/12 256 bit, ecrypt verified, set 6, vector 0",
7918 GCRY_CIPHER_SALSA20R12, 32, 8,
7919 "\x00\x53\xA6\xF9\x4C\x9F\xF2\x45\x98\xEB\x3E\x91\xE4\x37\x8A\xDD"
7920 "\x30\x83\xD6\x29\x7C\xCF\x22\x75\xC8\x1B\x6E\xC1\x14\x67\xBA\x0D",
7921 "\x0D\x74\xDB\x42\xA9\x10\x77\xDE",
7922 {
7923 { 8,
7924 "\x00\x00\x00\x00\x00\x00\x00\x00",
7925 "\x52\xE2\x0C\xF8\x77\x5A\xE8\x82"
7926 },
7927 { 64,
7928 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
7929 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
7930 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
7931 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
7932 "\x52\xE2\x0C\xF8\x77\x5A\xE8\x82\xF2\x00\xC2\x99\x9F\xE4\xBA\x31"
7933 "\xA7\xA1\x8F\x1D\x5C\x97\x16\x19\x1D\x12\x31\x75\xE1\x47\xBD\x4E"
7934 "\x8C\xA6\xED\x16\x6C\xE0\xFC\x8E\x65\xA5\xCA\x60\x84\x20\xFC\x65"
7935 "\x44\xC9\x70\x0A\x0F\x21\x38\xE8\xC1\xA2\x86\xFB\x8C\x1F\xBF\xA0"
7936 }
7937 }
7938 },
7939 #endif /*USE_SALSA20*/
7940 #ifdef USE_CHACHA20
7941 /* From draft-strombergson-chacha-test-vectors-01 */
7942 {
7943 "ChaCha20 128 bit, TC1",
7944 GCRY_CIPHER_CHACHA20, 16, 8,
7945 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
7946 "\x00\x00\x00\x00\x00\x00\x00\x00",
7947 {
7948 { 8,
7949 "\x00\x00\x00\x00\x00\x00\x00\x00",
7950 "\x89\x67\x09\x52\x60\x83\x64\xfd"
7951 },
7952 { 112,
7953 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
7954 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
7955 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
7956 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
7957 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
7958 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
7959 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
7960 "\x89\x67\x09\x52\x60\x83\x64\xfd\x00\xb2\xf9\x09\x36\xf0\x31\xc8"
7961 "\xe7\x56\xe1\x5d\xba\x04\xb8\x49\x3d\x00\x42\x92\x59\xb2\x0f\x46"
7962 "\xcc\x04\xf1\x11\x24\x6b\x6c\x2c\xe0\x66\xbe\x3b\xfb\x32\xd9\xaa"
7963 "\x0f\xdd\xfb\xc1\x21\x23\xd4\xb9\xe4\x4f\x34\xdc\xa0\x5a\x10\x3f"
7964 "\x6c\xd1\x35\xc2\x87\x8c\x83\x2b\x58\x96\xb1\x34\xf6\x14\x2a\x9d"
7965 "\x4d\x8d\x0d\x8f\x10\x26\xd2\x0a\x0a\x81\x51\x2c\xbc\xe6\xe9\x75"
7966 "\x8a\x71\x43\xd0\x21\x97\x80\x22\xa3\x84\x14\x1a\x80\xce\xa3\x06"
7967 },
7968 { 128,
7969 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
7970 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
7971 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
7972 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
7973 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
7974 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
7975 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
7976 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
7977 "\x89\x67\x09\x52\x60\x83\x64\xfd\x00\xb2\xf9\x09\x36\xf0\x31\xc8"
7978 "\xe7\x56\xe1\x5d\xba\x04\xb8\x49\x3d\x00\x42\x92\x59\xb2\x0f\x46"
7979 "\xcc\x04\xf1\x11\x24\x6b\x6c\x2c\xe0\x66\xbe\x3b\xfb\x32\xd9\xaa"
7980 "\x0f\xdd\xfb\xc1\x21\x23\xd4\xb9\xe4\x4f\x34\xdc\xa0\x5a\x10\x3f"
7981 "\x6c\xd1\x35\xc2\x87\x8c\x83\x2b\x58\x96\xb1\x34\xf6\x14\x2a\x9d"
7982 "\x4d\x8d\x0d\x8f\x10\x26\xd2\x0a\x0a\x81\x51\x2c\xbc\xe6\xe9\x75"
7983 "\x8a\x71\x43\xd0\x21\x97\x80\x22\xa3\x84\x14\x1a\x80\xce\xa3\x06"
7984 "\x2f\x41\xf6\x7a\x75\x2e\x66\xad\x34\x11\x98\x4c\x78\x7e\x30\xad"
7985 }
7986 }
7987 },
7988 {
7989 "ChaCha20 256 bit, TC1",
7990 GCRY_CIPHER_CHACHA20, 32, 8,
7991 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
7992 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
7993 "\x00\x00\x00\x00\x00\x00\x00\x00",
7994 {
7995 { 8,
7996 "\x00\x00\x00\x00\x00\x00\x00\x00",
7997 "\x76\xb8\xe0\xad\xa0\xf1\x3d\x90"
7998 },
7999 { 112,
8000 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8001 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8002 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8003 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8004 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8005 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8006 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
8007 "\x76\xb8\xe0\xad\xa0\xf1\x3d\x90\x40\x5d\x6a\xe5\x53\x86\xbd\x28"
8008 "\xbd\xd2\x19\xb8\xa0\x8d\xed\x1a\xa8\x36\xef\xcc\x8b\x77\x0d\xc7"
8009 "\xda\x41\x59\x7c\x51\x57\x48\x8d\x77\x24\xe0\x3f\xb8\xd8\x4a\x37"
8010 "\x6a\x43\xb8\xf4\x15\x18\xa1\x1c\xc3\x87\xb6\x69\xb2\xee\x65\x86"
8011 "\x9f\x07\xe7\xbe\x55\x51\x38\x7a\x98\xba\x97\x7c\x73\x2d\x08\x0d"
8012 "\xcb\x0f\x29\xa0\x48\xe3\x65\x69\x12\xc6\x53\x3e\x32\xee\x7a\xed"
8013 "\x29\xb7\x21\x76\x9c\xe6\x4e\x43\xd5\x71\x33\xb0\x74\xd8\x39\xd5"
8014 },
8015 { 128,
8016 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8017 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8018 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8019 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8020 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8021 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8022 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8023 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
8024 "\x76\xb8\xe0\xad\xa0\xf1\x3d\x90\x40\x5d\x6a\xe5\x53\x86\xbd\x28"
8025 "\xbd\xd2\x19\xb8\xa0\x8d\xed\x1a\xa8\x36\xef\xcc\x8b\x77\x0d\xc7"
8026 "\xda\x41\x59\x7c\x51\x57\x48\x8d\x77\x24\xe0\x3f\xb8\xd8\x4a\x37"
8027 "\x6a\x43\xb8\xf4\x15\x18\xa1\x1c\xc3\x87\xb6\x69\xb2\xee\x65\x86"
8028 "\x9f\x07\xe7\xbe\x55\x51\x38\x7a\x98\xba\x97\x7c\x73\x2d\x08\x0d"
8029 "\xcb\x0f\x29\xa0\x48\xe3\x65\x69\x12\xc6\x53\x3e\x32\xee\x7a\xed"
8030 "\x29\xb7\x21\x76\x9c\xe6\x4e\x43\xd5\x71\x33\xb0\x74\xd8\x39\xd5"
8031 "\x31\xed\x1f\x28\x51\x0a\xfb\x45\xac\xe1\x0a\x1f\x4b\x79\x4d\x6f"
8032 }
8033 }
8034 },
8035 {
8036 "ChaCha20 256 bit, TC2",
8037 GCRY_CIPHER_CHACHA20, 32, 8,
8038 "\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8039 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
8040 "\x00\x00\x00\x00\x00\x00\x00\x00",
8041 {
8042 { 128,
8043 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8044 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8045 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8046 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8047 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8048 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8049 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8050 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
8051 "\xc5\xd3\x0a\x7c\xe1\xec\x11\x93\x78\xc8\x4f\x48\x7d\x77\x5a\x85"
8052 "\x42\xf1\x3e\xce\x23\x8a\x94\x55\xe8\x22\x9e\x88\x8d\xe8\x5b\xbd"
8053 "\x29\xeb\x63\xd0\xa1\x7a\x5b\x99\x9b\x52\xda\x22\xbe\x40\x23\xeb"
8054 "\x07\x62\x0a\x54\xf6\xfa\x6a\xd8\x73\x7b\x71\xeb\x04\x64\xda\xc0"
8055 "\x10\xf6\x56\xe6\xd1\xfd\x55\x05\x3e\x50\xc4\x87\x5c\x99\x30\xa3"
8056 "\x3f\x6d\x02\x63\xbd\x14\xdf\xd6\xab\x8c\x70\x52\x1c\x19\x33\x8b"
8057 "\x23\x08\xb9\x5c\xf8\xd0\xbb\x7d\x20\x2d\x21\x02\x78\x0e\xa3\x52"
8058 "\x8f\x1c\xb4\x85\x60\xf7\x6b\x20\xf3\x82\xb9\x42\x50\x0f\xce\xac"
8059 }
8060 }
8061 },
8062 {
8063 "ChaCha20 256 bit, TC3",
8064 GCRY_CIPHER_CHACHA20, 32, 8,
8065 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8066 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
8067 "\x01\x00\x00\x00\x00\x00\x00\x00",
8068 {
8069 { 128,
8070 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8071 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8072 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8073 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8074 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8075 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8076 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8077 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
8078 "\xef\x3f\xdf\xd6\xc6\x15\x78\xfb\xf5\xcf\x35\xbd\x3d\xd3\x3b\x80"
8079 "\x09\x63\x16\x34\xd2\x1e\x42\xac\x33\x96\x0b\xd1\x38\xe5\x0d\x32"
8080 "\x11\x1e\x4c\xaf\x23\x7e\xe5\x3c\xa8\xad\x64\x26\x19\x4a\x88\x54"
8081 "\x5d\xdc\x49\x7a\x0b\x46\x6e\x7d\x6b\xbd\xb0\x04\x1b\x2f\x58\x6b"
8082 "\x53\x05\xe5\xe4\x4a\xff\x19\xb2\x35\x93\x61\x44\x67\x5e\xfb\xe4"
8083 "\x40\x9e\xb7\xe8\xe5\xf1\x43\x0f\x5f\x58\x36\xae\xb4\x9b\xb5\x32"
8084 "\x8b\x01\x7c\x4b\x9d\xc1\x1f\x8a\x03\x86\x3f\xa8\x03\xdc\x71\xd5"
8085 "\x72\x6b\x2b\x6b\x31\xaa\x32\x70\x8a\xfe\x5a\xf1\xd6\xb6\x90\x58"
8086 }
8087 }
8088 },
8089 {
8090 "ChaCha20 256 bit, TC4",
8091 GCRY_CIPHER_CHACHA20, 32, 8,
8092 "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"
8093 "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff",
8094 "\xff\xff\xff\xff\xff\xff\xff\xff",
8095 {
8096 { 128,
8097 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8098 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8099 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8100 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8101 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8102 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8103 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8104 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
8105 "\xd9\xbf\x3f\x6b\xce\x6e\xd0\xb5\x42\x54\x55\x77\x67\xfb\x57\x44"
8106 "\x3d\xd4\x77\x89\x11\xb6\x06\x05\x5c\x39\xcc\x25\xe6\x74\xb8\x36"
8107 "\x3f\xea\xbc\x57\xfd\xe5\x4f\x79\x0c\x52\xc8\xae\x43\x24\x0b\x79"
8108 "\xd4\x90\x42\xb7\x77\xbf\xd6\xcb\x80\xe9\x31\x27\x0b\x7f\x50\xeb"
8109 "\x5b\xac\x2a\xcd\x86\xa8\x36\xc5\xdc\x98\xc1\x16\xc1\x21\x7e\xc3"
8110 "\x1d\x3a\x63\xa9\x45\x13\x19\xf0\x97\xf3\xb4\xd6\xda\xb0\x77\x87"
8111 "\x19\x47\x7d\x24\xd2\x4b\x40\x3a\x12\x24\x1d\x7c\xca\x06\x4f\x79"
8112 "\x0f\x1d\x51\xcc\xaf\xf6\xb1\x66\x7d\x4b\xbc\xa1\x95\x8c\x43\x06"
8113 }
8114 }
8115 },
8116 {
8117 "ChaCha20 256 bit, TC5",
8118 GCRY_CIPHER_CHACHA20, 32, 8,
8119 "\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55"
8120 "\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55",
8121 "\x55\x55\x55\x55\x55\x55\x55\x55",
8122 {
8123 { 128,
8124 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8125 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8126 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8127 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8128 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8129 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8130 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8131 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
8132 "\xbe\xa9\x41\x1a\xa4\x53\xc5\x43\x4a\x5a\xe8\xc9\x28\x62\xf5\x64"
8133 "\x39\x68\x55\xa9\xea\x6e\x22\xd6\xd3\xb5\x0a\xe1\xb3\x66\x33\x11"
8134 "\xa4\xa3\x60\x6c\x67\x1d\x60\x5c\xe1\x6c\x3a\xec\xe8\xe6\x1e\xa1"
8135 "\x45\xc5\x97\x75\x01\x7b\xee\x2f\xa6\xf8\x8a\xfc\x75\x80\x69\xf7"
8136 "\xe0\xb8\xf6\x76\xe6\x44\x21\x6f\x4d\x2a\x34\x22\xd7\xfa\x36\xc6"
8137 "\xc4\x93\x1a\xca\x95\x0e\x9d\xa4\x27\x88\xe6\xd0\xb6\xd1\xcd\x83"
8138 "\x8e\xf6\x52\xe9\x7b\x14\x5b\x14\x87\x1e\xae\x6c\x68\x04\xc7\x00"
8139 "\x4d\xb5\xac\x2f\xce\x4c\x68\xc7\x26\xd0\x04\xb1\x0f\xca\xba\x86"
8140 }
8141 }
8142 },
8143 {
8144 "ChaCha20 256 bit, TC6",
8145 GCRY_CIPHER_CHACHA20, 32, 8,
8146 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
8147 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa",
8148 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa",
8149 {
8150 { 128,
8151 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8152 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8153 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8154 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8155 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8156 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8157 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8158 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
8159 "\x9a\xa2\xa9\xf6\x56\xef\xde\x5a\xa7\x59\x1c\x5f\xed\x4b\x35\xae"
8160 "\xa2\x89\x5d\xec\x7c\xb4\x54\x3b\x9e\x9f\x21\xf5\xe7\xbc\xbc\xf3"
8161 "\xc4\x3c\x74\x8a\x97\x08\x88\xf8\x24\x83\x93\xa0\x9d\x43\xe0\xb7"
8162 "\xe1\x64\xbc\x4d\x0b\x0f\xb2\x40\xa2\xd7\x21\x15\xc4\x80\x89\x06"
8163 "\x72\x18\x44\x89\x44\x05\x45\xd0\x21\xd9\x7e\xf6\xb6\x93\xdf\xe5"
8164 "\xb2\xc1\x32\xd4\x7e\x6f\x04\x1c\x90\x63\x65\x1f\x96\xb6\x23\xe6"
8165 "\x2a\x11\x99\x9a\x23\xb6\xf7\xc4\x61\xb2\x15\x30\x26\xad\x5e\x86"
8166 "\x6a\x2e\x59\x7e\xd0\x7b\x84\x01\xde\xc6\x3a\x09\x34\xc6\xb2\xa9"
8167 }
8168 }
8169 },
8170 {
8171 "ChaCha20 256 bit, TC7",
8172 GCRY_CIPHER_CHACHA20, 32, 8,
8173 "\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff"
8174 "\xff\xee\xdd\xcc\xbb\xaa\x99\x88\x77\x66\x55\x44\x33\x22\x11\x00",
8175 "\x0f\x1e\x2d\x3c\x4b\x5a\x69\x78",
8176 {
8177 { 128,
8178 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8179 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8180 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8181 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8182 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8183 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8184 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8185 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
8186 "\x9f\xad\xf4\x09\xc0\x08\x11\xd0\x04\x31\xd6\x7e\xfb\xd8\x8f\xba"
8187 "\x59\x21\x8d\x5d\x67\x08\xb1\xd6\x85\x86\x3f\xab\xbb\x0e\x96\x1e"
8188 "\xea\x48\x0f\xd6\xfb\x53\x2b\xfd\x49\x4b\x21\x51\x01\x50\x57\x42"
8189 "\x3a\xb6\x0a\x63\xfe\x4f\x55\xf7\xa2\x12\xe2\x16\x7c\xca\xb9\x31"
8190 "\xfb\xfd\x29\xcf\x7b\xc1\xd2\x79\xed\xdf\x25\xdd\x31\x6b\xb8\x84"
8191 "\x3d\x6e\xde\xe0\xbd\x1e\xf1\x21\xd1\x2f\xa1\x7c\xbc\x2c\x57\x4c"
8192 "\xcc\xab\x5e\x27\x51\x67\xb0\x8b\xd6\x86\xf8\xa0\x9d\xf8\x7e\xc3"
8193 "\xff\xb3\x53\x61\xb9\x4e\xbf\xa1\x3f\xec\x0e\x48\x89\xd1\x8d\xa5"
8194 }
8195 }
8196 },
8197 {
8198 "ChaCha20 256 bit, TC8",
8199 GCRY_CIPHER_CHACHA20, 32, 8,
8200 "\xc4\x6e\xc1\xb1\x8c\xe8\xa8\x78\x72\x5a\x37\xe7\x80\xdf\xb7\x35"
8201 "\x1f\x68\xed\x2e\x19\x4c\x79\xfb\xc6\xae\xbe\xe1\xa6\x67\x97\x5d",
8202 "\x1a\xda\x31\xd5\xcf\x68\x82\x21",
8203 {
8204 { 128,
8205 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8206 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8207 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8208 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8209 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8210 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8211 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8212 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
8213 "\xf6\x3a\x89\xb7\x5c\x22\x71\xf9\x36\x88\x16\x54\x2b\xa5\x2f\x06"
8214 "\xed\x49\x24\x17\x92\x30\x2b\x00\xb5\xe8\xf8\x0a\xe9\xa4\x73\xaf"
8215 "\xc2\x5b\x21\x8f\x51\x9a\xf0\xfd\xd4\x06\x36\x2e\x8d\x69\xde\x7f"
8216 "\x54\xc6\x04\xa6\xe0\x0f\x35\x3f\x11\x0f\x77\x1b\xdc\xa8\xab\x92"
8217 "\xe5\xfb\xc3\x4e\x60\xa1\xd9\xa9\xdb\x17\x34\x5b\x0a\x40\x27\x36"
8218 "\x85\x3b\xf9\x10\xb0\x60\xbd\xf1\xf8\x97\xb6\x29\x0f\x01\xd1\x38"
8219 "\xae\x2c\x4c\x90\x22\x5b\xa9\xea\x14\xd5\x18\xf5\x59\x29\xde\xa0"
8220 "\x98\xca\x7a\x6c\xcf\xe6\x12\x27\x05\x3c\x84\xe4\x9a\x4a\x33\x32"
8221 },
8222 { 127,
8223 "\xf6\x3a\x89\xb7\x5c\x22\x71\xf9\x36\x88\x16\x54\x2b\xa5\x2f\x06"
8224 "\xed\x49\x24\x17\x92\x30\x2b\x00\xb5\xe8\xf8\x0a\xe9\xa4\x73\xaf"
8225 "\xc2\x5b\x21\x8f\x51\x9a\xf0\xfd\xd4\x06\x36\x2e\x8d\x69\xde\x7f"
8226 "\x54\xc6\x04\xa6\xe0\x0f\x35\x3f\x11\x0f\x77\x1b\xdc\xa8\xab\x92"
8227 "\xe5\xfb\xc3\x4e\x60\xa1\xd9\xa9\xdb\x17\x34\x5b\x0a\x40\x27\x36"
8228 "\x85\x3b\xf9\x10\xb0\x60\xbd\xf1\xf8\x97\xb6\x29\x0f\x01\xd1\x38"
8229 "\xae\x2c\x4c\x90\x22\x5b\xa9\xea\x14\xd5\x18\xf5\x59\x29\xde\xa0"
8230 "\x98\xca\x7a\x6c\xcf\xe6\x12\x27\x05\x3c\x84\xe4\x9a\x4a\x33",
8231 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8232 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8233 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8234 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8235 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8236 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8237 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8238 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8239 }
8240 }
8241 },
8242 /* from draft-nir-cfrg-chacha20-poly1305-02 */
8243 {
8244 "ChaCha20 256 bit, IV96-bit",
8245 GCRY_CIPHER_CHACHA20, 32, 12,
8246 "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f"
8247 "\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f",
8248 "\x07\x00\x00\x00\x40\x41\x42\x43\x44\x45\x46\x47",
8249 {
8250 { 64,
8251 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8252 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8253 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
8254 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
8255 "\x7b\xac\x2b\x25\x2d\xb4\x47\xaf\x09\xb6\x7a\x55\xa4\xe9\x55\x84"
8256 "\x0a\xe1\xd6\x73\x10\x75\xd9\xeb\x2a\x93\x75\x78\x3e\xd5\x53\xff"
8257 "\xa2\x7e\xcc\xde\xad\xdb\x4d\xb4\xd1\x17\x9c\xe4\xc9\x0b\x43\xd8"
8258 "\xbc\xb7\x94\x8c\x4b\x4b\x7d\x8b\x7d\xf6\x27\x39\x32\xa4\x69\x16"
8259 },
8260 },
8261 },
8262 #endif /*USE_CHACHA20*/
8263 };
8264
8265 gcry_cipher_hd_t hde, hdd;
8266 unsigned char out[MAX_DATA_LEN];
8267 int i, j;
8268 gcry_error_t err = 0;
8269
8270
8271 if (verbose)
8272 fprintf (stderr, " Starting stream cipher checks.\n");
8273
8274 for (i = 0; i < sizeof (tv) / sizeof (tv[0]); i++)
8275 {
8276 if (gcry_cipher_test_algo (tv[i].algo) && in_fips_mode)
8277 {
8278 if (verbose)
8279 fprintf (stderr, " algorithm %d not available in fips mode\n",
8280 tv[i].algo);
8281 continue;
8282 }
8283 if (verbose)
8284 fprintf (stderr, " checking stream mode for %s [%i] (%s)\n",
8285 gcry_cipher_algo_name (tv[i].algo), tv[i].algo, tv[i].name);
8286
8287 if (gcry_cipher_get_algo_blklen(tv[i].algo) != 1)
8288 {
8289 fail ("stream, gcry_cipher_get_algo_blklen: bad block length\n");
8290 continue;
8291 }
8292
8293 err = gcry_cipher_open (&hde, tv[i].algo, GCRY_CIPHER_MODE_STREAM, 0);
8294 if (!err)
8295 err = gcry_cipher_open (&hdd, tv[i].algo, GCRY_CIPHER_MODE_STREAM, 0);
8296 if (err)
8297 {
8298 fail ("stream, gcry_cipher_open for stream mode failed: %s\n",
8299 gpg_strerror (err));
8300 continue;
8301 }
8302
8303 /* Now loop over all the data samples. */
8304 for (j = 0; tv[i].data[j].inlen; j++)
8305 {
8306 err = gcry_cipher_setkey (hde, tv[i].key, tv[i].keylen);
8307 if (!err)
8308 err = gcry_cipher_setkey (hdd, tv[i].key, tv[i].keylen);
8309 if (err)
8310 {
8311 fail ("stream, gcry_cipher_setkey failed: %s\n",
8312 gpg_strerror (err));
8313 goto next;
8314 }
8315
8316 err = gcry_cipher_setiv (hde, tv[i].iv, tv[i].ivlen);
8317 if (!err)
8318 err = gcry_cipher_setiv (hdd, tv[i].iv, tv[i].ivlen);
8319 if (err)
8320 {
8321 fail ("stream, gcry_cipher_setiv failed: %s\n",
8322 gpg_strerror (err));
8323 goto next;
8324 }
8325
8326 err = gcry_cipher_encrypt (hde, out, MAX_DATA_LEN,
8327 tv[i].data[j].plaintext,
8328 tv[i].data[j].inlen);
8329 if (err)
8330 {
8331 fail ("stream, gcry_cipher_encrypt (%d, %d) failed: %s\n",
8332 i, j, gpg_strerror (err));
8333 goto next;
8334 }
8335
8336 if (memcmp (tv[i].data[j].out, out, tv[i].data[j].inlen))
8337 {
8338 fail ("stream, encrypt mismatch entry %d:%d\n", i, j);
8339 mismatch (tv[i].data[j].out, tv[i].data[j].inlen,
8340 out, tv[i].data[j].inlen);
8341 }
8342
8343 err = gcry_cipher_decrypt (hdd, out, tv[i].data[j].inlen, NULL, 0);
8344 if (err)
8345 {
8346 fail ("stream, gcry_cipher_decrypt (%d, %d) failed: %s\n",
8347 i, j, gpg_strerror (err));
8348 goto next;
8349 }
8350
8351 if (memcmp (tv[i].data[j].plaintext, out, tv[i].data[j].inlen))
8352 fail ("stream, decrypt mismatch entry %d:%d\n", i, j);
8353 }
8354
8355
8356 /* This time we encrypt and decrypt one byte at a time */
8357 for (j = 0; tv[i].data[j].inlen; j++)
8358 {
8359 int byteNum;
8360
8361 err = gcry_cipher_setkey (hde, tv[i].key, tv[i].keylen);
8362 if (!err)
8363 err = gcry_cipher_setkey (hdd, tv[i].key, tv[i].keylen);
8364 if (err)
8365 {
8366 fail ("stream, gcry_cipher_setkey failed: %s\n",
8367 gpg_strerror (err));
8368 goto next;
8369 }
8370
8371 err = gcry_cipher_setiv (hde, tv[i].iv, tv[i].ivlen);
8372 if (!err)
8373 err = gcry_cipher_setiv (hdd, tv[i].iv, tv[i].ivlen);
8374 if (err)
8375 {
8376 fail ("stream, gcry_cipher_setiv failed: %s\n",
8377 gpg_strerror (err));
8378 goto next;
8379 }
8380
8381 for (byteNum = 0; byteNum < tv[i].data[j].inlen; ++byteNum)
8382 {
8383 err = gcry_cipher_encrypt (hde, out+byteNum, 1,
8384 (tv[i].data[j].plaintext) + byteNum,
8385 1);
8386 if (err)
8387 {
8388 fail ("stream, gcry_cipher_encrypt (%d, %d) failed: %s\n",
8389 i, j, gpg_strerror (err));
8390 goto next;
8391 }
8392 }
8393
8394 if (memcmp (tv[i].data[j].out, out, tv[i].data[j].inlen))
8395 fail ("stream, encrypt mismatch entry %d:%d (byte-wise)\n", i, j);
8396
8397 for (byteNum = 0; byteNum < tv[i].data[j].inlen; ++byteNum)
8398 {
8399 err = gcry_cipher_decrypt (hdd, out+byteNum, 1, NULL, 0);
8400 if (err)
8401 {
8402 fail ("stream, gcry_cipher_decrypt (%d, %d) failed: %s\n",
8403 i, j, gpg_strerror (err));
8404 goto next;
8405 }
8406 }
8407
8408 if (memcmp (tv[i].data[j].plaintext, out, tv[i].data[j].inlen))
8409 fail ("stream, decrypt mismatch entry %d:%d (byte-wise)\n", i, j);
8410 }
8411
8412 next:
8413 gcry_cipher_close (hde);
8414 gcry_cipher_close (hdd);
8415 }
8416 if (verbose)
8417 fprintf (stderr, " Completed stream cipher checks.\n");
8418 }
8419
8420
8421 static void
check_stream_cipher_large_block(void)8422 check_stream_cipher_large_block (void)
8423 {
8424 static const struct tv
8425 {
8426 const char *name;
8427 int algo;
8428 int keylen;
8429 int ivlen;
8430 const char *key;
8431 const char *iv;
8432 struct data
8433 {
8434 int offset, length;
8435 const char *result;
8436 } data[MAX_DATA_LEN];
8437 } tv[] = {
8438 #ifdef USE_SALSA20
8439 {
8440 "Salsa20 256 bit, ecrypt verified, set 6, vector 0",
8441 GCRY_CIPHER_SALSA20, 32, 8,
8442 "\x00\x53\xA6\xF9\x4C\x9F\xF2\x45\x98\xEB\x3E\x91\xE4\x37\x8A\xDD"
8443 "\x30\x83\xD6\x29\x7C\xCF\x22\x75\xC8\x1B\x6E\xC1\x14\x67\xBA\x0D",
8444 "\x0D\x74\xDB\x42\xA9\x10\x77\xDE",
8445 {
8446 { 0, 64,
8447 "\xF5\xFA\xD5\x3F\x79\xF9\xDF\x58\xC4\xAE\xA0\xD0\xED\x9A\x96\x01"
8448 "\xF2\x78\x11\x2C\xA7\x18\x0D\x56\x5B\x42\x0A\x48\x01\x96\x70\xEA"
8449 "\xF2\x4C\xE4\x93\xA8\x62\x63\xF6\x77\xB4\x6A\xCE\x19\x24\x77\x3D"
8450 "\x2B\xB2\x55\x71\xE1\xAA\x85\x93\x75\x8F\xC3\x82\xB1\x28\x0B\x71"
8451 },
8452 { 65472, 64,
8453 "\xB7\x0C\x50\x13\x9C\x63\x33\x2E\xF6\xE7\x7A\xC5\x43\x38\xA4\x07"
8454 "\x9B\x82\xBE\xC9\xF9\xA4\x03\xDF\xEA\x82\x1B\x83\xF7\x86\x07\x91"
8455 "\x65\x0E\xF1\xB2\x48\x9D\x05\x90\xB1\xDE\x77\x2E\xED\xA4\xE3\xBC"
8456 "\xD6\x0F\xA7\xCE\x9C\xD6\x23\xD9\xD2\xFD\x57\x58\xB8\x65\x3E\x70"
8457 },
8458 { 65536, 64,
8459 "\x81\x58\x2C\x65\xD7\x56\x2B\x80\xAE\xC2\xF1\xA6\x73\xA9\xD0\x1C"
8460 "\x9F\x89\x2A\x23\xD4\x91\x9F\x6A\xB4\x7B\x91\x54\xE0\x8E\x69\x9B"
8461 "\x41\x17\xD7\xC6\x66\x47\x7B\x60\xF8\x39\x14\x81\x68\x2F\x5D\x95"
8462 "\xD9\x66\x23\xDB\xC4\x89\xD8\x8D\xAA\x69\x56\xB9\xF0\x64\x6B\x6E"
8463 },
8464 { 131008, 64,
8465 "\xA1\x3F\xFA\x12\x08\xF8\xBF\x50\x90\x08\x86\xFA\xAB\x40\xFD\x10"
8466 "\xE8\xCA\xA3\x06\xE6\x3D\xF3\x95\x36\xA1\x56\x4F\xB7\x60\xB2\x42"
8467 "\xA9\xD6\xA4\x62\x8C\xDC\x87\x87\x62\x83\x4E\x27\xA5\x41\xDA\x2A"
8468 "\x5E\x3B\x34\x45\x98\x9C\x76\xF6\x11\xE0\xFE\xC6\xD9\x1A\xCA\xCC"
8469 }
8470 }
8471 },
8472 {
8473 "Salsa20 256 bit, ecrypt verified, set 6, vector 1",
8474 GCRY_CIPHER_SALSA20, 32, 8,
8475 "\x05\x58\xAB\xFE\x51\xA4\xF7\x4A\x9D\xF0\x43\x96\xE9\x3C\x8F\xE2"
8476 "\x35\x88\xDB\x2E\x81\xD4\x27\x7A\xCD\x20\x73\xC6\x19\x6C\xBF\x12",
8477 "\x16\x7D\xE4\x4B\xB2\x19\x80\xE7",
8478 {
8479 { 0, 64,
8480 "\x39\x44\xF6\xDC\x9F\x85\xB1\x28\x08\x38\x79\xFD\xF1\x90\xF7\xDE"
8481 "\xE4\x05\x3A\x07\xBC\x09\x89\x6D\x51\xD0\x69\x0B\xD4\xDA\x4A\xC1"
8482 "\x06\x2F\x1E\x47\xD3\xD0\x71\x6F\x80\xA9\xB4\xD8\x5E\x6D\x60\x85"
8483 "\xEE\x06\x94\x76\x01\xC8\x5F\x1A\x27\xA2\xF7\x6E\x45\xA6\xAA\x87"
8484 },
8485 { 65472, 64,
8486 "\x36\xE0\x3B\x4B\x54\xB0\xB2\xE0\x4D\x06\x9E\x69\x00\x82\xC8\xC5"
8487 "\x92\xDF\x56\xE6\x33\xF5\xD8\xC7\x68\x2A\x02\xA6\x5E\xCD\x13\x71"
8488 "\x8C\xA4\x35\x2A\xAC\xCB\x0D\xA2\x0E\xD6\xBB\xBA\x62\xE1\x77\xF2"
8489 "\x10\xE3\x56\x0E\x63\xBB\x82\x2C\x41\x58\xCA\xA8\x06\xA8\x8C\x82"
8490 },
8491 { 65536, 64,
8492 "\x1B\x77\x9E\x7A\x91\x7C\x8C\x26\x03\x9F\xFB\x23\xCF\x0E\xF8\xE0"
8493 "\x8A\x1A\x13\xB4\x3A\xCD\xD9\x40\x2C\xF5\xDF\x38\x50\x10\x98\xDF"
8494 "\xC9\x45\xA6\xCC\x69\xA6\xA1\x73\x67\xBC\x03\x43\x1A\x86\xB3\xED"
8495 "\x04\xB0\x24\x5B\x56\x37\x9B\xF9\x97\xE2\x58\x00\xAD\x83\x7D\x7D"
8496 },
8497 { 131008, 64,
8498 "\x7E\xC6\xDA\xE8\x1A\x10\x5E\x67\x17\x2A\x0B\x8C\x4B\xBE\x7D\x06"
8499 "\xA7\xA8\x75\x9F\x91\x4F\xBE\xB1\xAF\x62\xC8\xA5\x52\xEF\x4A\x4F"
8500 "\x56\x96\x7E\xA2\x9C\x74\x71\xF4\x6F\x3B\x07\xF7\xA3\x74\x6E\x95"
8501 "\x3D\x31\x58\x21\xB8\x5B\x6E\x8C\xB4\x01\x22\xB9\x66\x35\x31\x3C"
8502 }
8503 }
8504 },
8505 {
8506 "Salsa20 256 bit, ecrypt verified, set 6, vector 2",
8507 GCRY_CIPHER_SALSA20, 32, 8,
8508 "\x0A\x5D\xB0\x03\x56\xA9\xFC\x4F\xA2\xF5\x48\x9B\xEE\x41\x94\xE7"
8509 "\x3A\x8D\xE0\x33\x86\xD9\x2C\x7F\xD2\x25\x78\xCB\x1E\x71\xC4\x17",
8510 "\x1F\x86\xED\x54\xBB\x22\x89\xF0",
8511 {
8512 { 0, 64,
8513 "\x3F\xE8\x5D\x5B\xB1\x96\x0A\x82\x48\x0B\x5E\x6F\x4E\x96\x5A\x44"
8514 "\x60\xD7\xA5\x45\x01\x66\x4F\x7D\x60\xB5\x4B\x06\x10\x0A\x37\xFF"
8515 "\xDC\xF6\xBD\xE5\xCE\x3F\x48\x86\xBA\x77\xDD\x5B\x44\xE9\x56\x44"
8516 "\xE4\x0A\x8A\xC6\x58\x01\x15\x5D\xB9\x0F\x02\x52\x2B\x64\x40\x23"
8517 },
8518 { 65472, 64,
8519 "\xC8\xD6\xE5\x4C\x29\xCA\x20\x40\x18\xA8\x30\xE2\x66\xCE\xEE\x0D"
8520 "\x03\x7D\xC4\x7E\x92\x19\x47\x30\x2A\xCE\x40\xD1\xB9\x96\xA6\xD8"
8521 "\x0B\x59\x86\x77\xF3\x35\x2F\x1D\xAA\x6D\x98\x88\xF8\x91\xAD\x95"
8522 "\xA1\xC3\x2F\xFE\xB7\x1B\xB8\x61\xE8\xB0\x70\x58\x51\x51\x71\xC9"
8523 },
8524 { 65536, 64,
8525 "\xB7\x9F\xD7\x76\x54\x2B\x46\x20\xEF\xCB\x88\x44\x95\x99\xF2\x34"
8526 "\x03\xE7\x4A\x6E\x91\xCA\xCC\x50\xA0\x5A\x8F\x8F\x3C\x0D\xEA\x8B"
8527 "\x00\xE1\xA5\xE6\x08\x1F\x55\x26\xAE\x97\x5B\x3B\xC0\x45\x0F\x1A"
8528 "\x0C\x8B\x66\xF8\x08\xF1\x90\x4B\x97\x13\x61\x13\x7C\x93\x15\x6F"
8529 },
8530 { 131008, 64,
8531 "\x79\x98\x20\x4F\xED\x70\xCE\x8E\x0D\x02\x7B\x20\x66\x35\xC0\x8C"
8532 "\x8B\xC4\x43\x62\x26\x08\x97\x0E\x40\xE3\xAE\xDF\x3C\xE7\x90\xAE"
8533 "\xED\xF8\x9F\x92\x26\x71\xB4\x53\x78\xE2\xCD\x03\xF6\xF6\x23\x56"
8534 "\x52\x9C\x41\x58\xB7\xFF\x41\xEE\x85\x4B\x12\x35\x37\x39\x88\xC8"
8535 }
8536 }
8537 },
8538 {
8539 "Salsa20 256 bit, ecrypt verified, set 6, vector 3",
8540 GCRY_CIPHER_SALSA20, 32, 8,
8541 "\x0F\x62\xB5\x08\x5B\xAE\x01\x54\xA7\xFA\x4D\xA0\xF3\x46\x99\xEC"
8542 "\x3F\x92\xE5\x38\x8B\xDE\x31\x84\xD7\x2A\x7D\xD0\x23\x76\xC9\x1C",
8543 "\x28\x8F\xF6\x5D\xC4\x2B\x92\xF9",
8544 {
8545 { 0, 64,
8546 "\x5E\x5E\x71\xF9\x01\x99\x34\x03\x04\xAB\xB2\x2A\x37\xB6\x62\x5B"
8547 "\xF8\x83\xFB\x89\xCE\x3B\x21\xF5\x4A\x10\xB8\x10\x66\xEF\x87\xDA"
8548 "\x30\xB7\x76\x99\xAA\x73\x79\xDA\x59\x5C\x77\xDD\x59\x54\x2D\xA2"
8549 "\x08\xE5\x95\x4F\x89\xE4\x0E\xB7\xAA\x80\xA8\x4A\x61\x76\x66\x3F"
8550 },
8551 { 65472, 64,
8552 "\x2D\xA2\x17\x4B\xD1\x50\xA1\xDF\xEC\x17\x96\xE9\x21\xE9\xD6\xE2"
8553 "\x4E\xCF\x02\x09\xBC\xBE\xA4\xF9\x83\x70\xFC\xE6\x29\x05\x6F\x64"
8554 "\x91\x72\x83\x43\x6E\x2D\x3F\x45\x55\x62\x25\x30\x7D\x5C\xC5\xA5"
8555 "\x65\x32\x5D\x89\x93\xB3\x7F\x16\x54\x19\x5C\x24\x0B\xF7\x5B\x16"
8556 },
8557 { 65536, 64,
8558 "\xAB\xF3\x9A\x21\x0E\xEE\x89\x59\x8B\x71\x33\x37\x70\x56\xC2\xFE"
8559 "\xF4\x2D\xA7\x31\x32\x75\x63\xFB\x67\xC7\xBE\xDB\x27\xF3\x8C\x7C"
8560 "\x5A\x3F\xC2\x18\x3A\x4C\x6B\x27\x7F\x90\x11\x52\x47\x2C\x6B\x2A"
8561 "\xBC\xF5\xE3\x4C\xBE\x31\x5E\x81\xFD\x3D\x18\x0B\x5D\x66\xCB\x6C"
8562 },
8563 { 131008, 64,
8564 "\x1B\xA8\x9D\xBD\x3F\x98\x83\x97\x28\xF5\x67\x91\xD5\xB7\xCE\x23"
8565 "\x50\x36\xDE\x84\x3C\xCC\xAB\x03\x90\xB8\xB5\x86\x2F\x1E\x45\x96"
8566 "\xAE\x8A\x16\xFB\x23\xDA\x99\x7F\x37\x1F\x4E\x0A\xAC\xC2\x6D\xB8"
8567 "\xEB\x31\x4E\xD4\x70\xB1\xAF\x6B\x9F\x8D\x69\xDD\x79\xA9\xD7\x50"
8568 }
8569 }
8570 },
8571 {
8572 "Salsa20/12 256 bit, ecrypt verified, set 6, vector 0",
8573 GCRY_CIPHER_SALSA20R12, 32, 8,
8574 "\x00\x53\xA6\xF9\x4C\x9F\xF2\x45\x98\xEB\x3E\x91\xE4\x37\x8A\xDD"
8575 "\x30\x83\xD6\x29\x7C\xCF\x22\x75\xC8\x1B\x6E\xC1\x14\x67\xBA\x0D",
8576 "\x0D\x74\xDB\x42\xA9\x10\x77\xDE",
8577 {
8578 { 0, 64,
8579 "\x52\xE2\x0C\xF8\x77\x5A\xE8\x82\xF2\x00\xC2\x99\x9F\xE4\xBA\x31"
8580 "\xA7\xA1\x8F\x1D\x5C\x97\x16\x19\x1D\x12\x31\x75\xE1\x47\xBD\x4E"
8581 "\x8C\xA6\xED\x16\x6C\xE0\xFC\x8E\x65\xA5\xCA\x60\x84\x20\xFC\x65"
8582 "\x44\xC9\x70\x0A\x0F\x21\x38\xE8\xC1\xA2\x86\xFB\x8C\x1F\xBF\xA0"
8583 },
8584 { 65472, 64,
8585 "\x8F\xBC\x9F\xE8\x69\x1B\xD4\xF0\x82\xB4\x7F\x54\x05\xED\xFB\xC1"
8586 "\x6F\x4D\x5A\x12\xDD\xCB\x2D\x75\x4E\x8A\x99\x98\xD0\xB2\x19\x55"
8587 "\x7D\xFE\x29\x84\xF4\xA1\xD2\xDD\xA7\x6B\x95\x96\x92\x8C\xCE\x05"
8588 "\x56\xF5\x00\x66\xCD\x59\x9E\x44\xEF\x5C\x14\xB2\x26\x68\x3A\xEF"
8589 },
8590 { 65536, 64,
8591 "\xBC\xBD\x01\xDD\x28\x96\x1C\xC7\xAD\x30\x47\x38\x6C\xBC\xC6\x7C"
8592 "\x10\x8D\x6A\xF1\x11\x67\xE4\x0D\x7A\xE1\xB2\xFC\x45\x18\xA8\x67"
8593 "\xEF\xE4\x02\x65\x1D\x1D\x88\x51\xC4\xFD\x23\x30\xC5\x97\xB3\x6A"
8594 "\x46\xD5\x68\x9E\x00\xFC\x96\xFE\xCF\x9C\xE3\xE2\x21\x1D\x44\xBE"
8595 },
8596 { 131008, 64,
8597 "\x91\x66\xF3\x1C\xD8\x5B\x5B\xB1\x8F\xC6\x14\xE5\x4E\x4A\xD6\x7F"
8598 "\xB8\x65\x8E\x3B\xF9\xFB\x19\xB7\xA8\x2F\x0F\xE7\xDC\x90\x2D\xF5"
8599 "\x63\xC6\xAC\x4F\x44\x67\x48\xC4\xBC\x3E\x14\x05\xE1\x24\x82\x0D"
8600 "\xC4\x09\x41\x99\x8F\x44\xA8\x10\xE7\x22\x78\x7F\xCD\x47\x78\x4C"
8601 }
8602 }
8603 },
8604 {
8605 "Salsa20/12 256 bit, ecrypt verified, set 6, vector 1",
8606 GCRY_CIPHER_SALSA20R12, 32, 8,
8607 "\x05\x58\xAB\xFE\x51\xA4\xF7\x4A\x9D\xF0\x43\x96\xE9\x3C\x8F\xE2"
8608 "\x35\x88\xDB\x2E\x81\xD4\x27\x7A\xCD\x20\x73\xC6\x19\x6C\xBF\x12",
8609 "\x16\x7D\xE4\x4B\xB2\x19\x80\xE7",
8610 {
8611 { 0, 64,
8612 "\xC0\x75\x60\xB3\xE7\x76\xB4\x71\xC5\xE2\x93\x14\x26\xCA\xF1\xED"
8613 "\x3A\xE4\xB8\x67\x08\x76\x82\xCA\x9D\xFD\xC2\xBA\xE8\x93\x50\xBD"
8614 "\x84\x82\x1C\xAE\xFF\x85\xAA\xC4\x9D\x74\x35\xA7\xD9\x88\x93\x52"
8615 "\xF5\x27\x9E\x36\x12\x3F\x41\x72\x8A\x14\xEF\x26\x9F\xCB\x94\x4B"
8616 },
8617 { 65472, 64,
8618 "\xEE\xD1\xBB\x58\xF9\x0C\x89\xE0\x5C\xC6\x8B\x2D\xB6\x05\x58\x49"
8619 "\xB3\xD2\xB1\x87\xB7\xF0\x2F\x9A\x24\xCE\x34\x2A\xF0\xFC\x47\xA3"
8620 "\x74\xBD\x75\x90\xFB\xF4\xFD\x9E\xE5\x9B\x1A\x38\x1E\xBF\xD2\x29"
8621 "\xAD\x2A\x29\x01\xB3\xFB\x61\x08\x12\x90\x0B\x92\x30\xE6\x22\xE9"
8622 },
8623 { 65536, 64,
8624 "\x70\xF0\x49\x3A\x1B\x62\x53\xCC\x5E\xD3\x45\x0A\x31\xCF\x37\x7D"
8625 "\x83\x4B\xAD\x20\x72\x30\x29\x27\xCC\xD8\x30\x10\x4B\xD3\x05\xFF"
8626 "\x59\xD2\x94\x17\xB2\x32\x88\x4E\xC9\x59\x19\x4D\x60\x47\xC3\xDD"
8627 "\x66\x56\xC4\x7E\x32\x00\x64\xEB\x01\x44\xF7\x34\x1B\xC3\xD6\x97"
8628 },
8629 { 131008, 64,
8630 "\xD2\xCC\xF7\xC1\xAF\x2A\xB4\x66\xE6\x27\xDB\x44\x08\x40\x96\x9A"
8631 "\xBD\xAB\x68\xD8\x86\xAE\x6A\x38\xA1\x3F\xEE\x17\x50\xCA\x97\xB5"
8632 "\xD3\x31\x5B\x84\x08\x47\x28\x86\x2F\xBC\xC7\xD4\xA9\x7C\x75\xC8"
8633 "\x65\x5F\xF9\xD6\xBB\xC2\x61\x88\x63\x6F\x3E\xDF\xE1\x5C\x7D\x30"
8634 }
8635 }
8636 },
8637 {
8638 "Salsa20/12 256 bit, ecrypt verified, set 6, vector 2",
8639 GCRY_CIPHER_SALSA20R12, 32, 8,
8640 "\x0A\x5D\xB0\x03\x56\xA9\xFC\x4F\xA2\xF5\x48\x9B\xEE\x41\x94\xE7"
8641 "\x3A\x8D\xE0\x33\x86\xD9\x2C\x7F\xD2\x25\x78\xCB\x1E\x71\xC4\x17",
8642 "\x1F\x86\xED\x54\xBB\x22\x89\xF0",
8643 {
8644 { 0, 64,
8645 "\x51\x22\x52\x91\x01\x90\xD1\x54\xD1\x4D\x0B\x92\x32\xB8\x84\x31"
8646 "\x8C\xCB\x43\x81\x9B\xD5\x42\x19\x32\xC0\x3A\x13\xF0\x7B\x40\x10"
8647 "\x83\xD7\x89\x72\x5A\xA9\xDA\x0B\x41\xCB\x62\x24\x94\x5E\xDC\xB0"
8648 "\xFB\x6F\xD7\xC2\x34\x22\x35\xC9\x70\xF6\x4E\x10\x1C\x25\x68\x64"
8649 },
8650 { 65472, 64,
8651 "\x97\x96\x74\x55\x84\x0A\x4A\xE5\xC1\xCA\xCE\x49\x15\x19\x13\x8A"
8652 "\xA3\x5E\x5F\x02\x40\x7D\x4A\x1F\xE5\x08\x6D\x35\xF3\x55\x1E\xF4"
8653 "\x77\xD9\x28\x9D\x17\x23\x79\x7C\x1A\x49\xEC\x26\x62\x9A\xFA\xDC"
8654 "\x56\xA0\x38\xA3\x8C\x75\x88\x1B\x62\x17\xFD\x74\x67\x25\x59\x09"
8655 },
8656 { 65536, 64,
8657 "\x1B\xF8\x2E\x3D\x5C\x54\xDA\xAB\xCF\x84\x15\xF8\xA2\xA1\xA2\x2E"
8658 "\x86\x88\x06\x33\x4F\xF3\x11\x36\x04\x74\x1C\x1D\xF2\xB9\x84\x0F"
8659 "\x87\xDE\xEF\xB0\x07\x23\xA8\xA1\xB2\x4A\x4D\xA1\x7E\xCD\xAD\x00"
8660 "\x01\xF9\x79\xDD\xAE\x2D\xF0\xC5\xE1\xE5\x32\xC4\x8F\x8E\x0D\x34"
8661 },
8662 { 131008, 64,
8663 "\x06\xD8\x4F\x6A\x71\x34\x84\x20\x32\x9F\xCD\x0C\x41\x75\x9A\xD1"
8664 "\x8F\x99\x57\xA3\x8F\x22\x89\x3B\xA5\x58\xC5\x05\x11\x97\x28\x5C"
8665 "\x6B\xE2\xFD\x6C\x96\xA5\xC6\x62\xAF\xD3\x11\x78\xE7\x0F\x96\x0A"
8666 "\xAB\x3F\x47\x96\x23\xA4\x44\xB6\x81\x91\xE4\xC5\x28\x46\x93\x88"
8667 }
8668 }
8669 },
8670 {
8671 "Salsa20/12 256 bit, ecrypt verified, set 6, vector 3",
8672 GCRY_CIPHER_SALSA20R12, 32, 8,
8673 "\x0F\x62\xB5\x08\x5B\xAE\x01\x54\xA7\xFA\x4D\xA0\xF3\x46\x99\xEC"
8674 "\x3F\x92\xE5\x38\x8B\xDE\x31\x84\xD7\x2A\x7D\xD0\x23\x76\xC9\x1C",
8675 "\x28\x8F\xF6\x5D\xC4\x2B\x92\xF9",
8676 {
8677 { 0, 64,
8678 "\x99\xDB\x33\xAD\x11\xCE\x0C\xCB\x3B\xFD\xBF\x8D\x0C\x18\x16\x04"
8679 "\x52\xD0\x14\xCD\xE9\x89\xB4\xC4\x11\xA5\x59\xFF\x7C\x20\xA1\x69"
8680 "\xE6\xDC\x99\x09\xD8\x16\xBE\xCE\xDC\x40\x63\xCE\x07\xCE\xA8\x28"
8681 "\xF4\x4B\xF9\xB6\xC9\xA0\xA0\xB2\x00\xE1\xB5\x2A\xF4\x18\x59\xC5"
8682 },
8683 { 65472, 64,
8684 "\x2F\xF2\x02\x64\xEE\xAF\x47\xAB\x7D\x57\xC3\x62\x24\x53\x54\x51"
8685 "\x73\x5A\xC8\x36\xD3\x2D\xD2\x8A\xE6\x36\x45\xCE\x95\x2F\x7F\xDB"
8686 "\xE6\x68\x9C\x69\x59\x77\xB1\xC7\x6E\x60\xDD\x5B\x27\xAC\xA4\x76"
8687 "\xD2\x62\x0F\xDC\x93\x13\xE8\x48\x9B\xA5\x6A\x70\xC9\xF4\xC3\xA8"
8688 },
8689 { 65536, 64,
8690 "\xEB\x30\xCD\xA7\x27\xC0\xF8\xB7\xE4\x5D\x5E\xF3\x0D\xB7\xCB\xE0"
8691 "\x21\xF2\x29\x1E\x5F\x56\x93\x8D\x56\xF6\x87\xB7\x37\xC3\xB4\x27"
8692 "\x54\x5C\x56\xA6\xD3\xA0\xBF\x2B\x2F\x47\xB4\x84\x93\xFA\xE4\x5E"
8693 "\xD5\x0C\x2E\x9B\xBE\x49\xFD\x92\xD6\x7C\x76\x49\x05\x5F\x06\xFD"
8694 },
8695 { 131008, 64,
8696 "\x0E\xBF\x6C\xC3\xCB\xCB\xE7\x4E\x6E\xE8\x07\x47\x1B\x49\x2A\x67"
8697 "\x39\xA5\x2F\x57\x11\x31\xA2\x50\xBC\xDF\xA0\x76\xA2\x65\x90\xD7"
8698 "\xED\xE6\x75\x1C\x03\x26\xA0\x2C\xB1\x1C\x58\x77\x35\x52\x80\x4F"
8699 "\xD8\x68\x67\x15\x35\x5C\x5A\x5C\xC5\x91\x96\x3A\x75\xE9\x94\xB4"
8700 }
8701 }
8702 }
8703 #endif /*USE_SALSA20*/
8704 };
8705
8706
8707 char zeroes[512];
8708 gcry_cipher_hd_t hde;
8709 unsigned char *buffer;
8710 unsigned char *p;
8711 size_t buffersize;
8712 unsigned int n;
8713 int i, j;
8714 gcry_error_t err = 0;
8715
8716 if (verbose)
8717 fprintf (stderr, " Starting large block stream cipher checks.\n");
8718
8719 memset (zeroes, 0, 512);
8720
8721 buffersize = 128 * 1024;
8722 buffer = gcry_xmalloc (buffersize+1024);
8723 memset (buffer+buffersize, 0x5a, 1024);
8724
8725 for (i = 0; i < sizeof (tv) / sizeof (tv[0]); i++)
8726 {
8727 if (gcry_cipher_test_algo (tv[i].algo) && in_fips_mode)
8728 {
8729 if (verbose)
8730 fprintf (stderr, " algorithm %d not available in fips mode\n",
8731 tv[i].algo);
8732 continue;
8733 }
8734
8735 if (verbose)
8736 fprintf (stderr, " checking large block stream for %s [%i] (%s)\n",
8737 gcry_cipher_algo_name (tv[i].algo), tv[i].algo, tv[i].name);
8738
8739 err = gcry_cipher_open (&hde, tv[i].algo, GCRY_CIPHER_MODE_STREAM, 0);
8740 if (err)
8741 {
8742 fail ("large stream, gcry_cipher_open for stream mode failed: %s\n",
8743 gpg_strerror (err));
8744 continue;
8745 }
8746
8747 err = gcry_cipher_setkey (hde, tv[i].key, tv[i].keylen);
8748 if (err)
8749 {
8750 fail ("large stream, gcry_cipher_setkey failed: %s\n",
8751 gpg_strerror (err));
8752 goto next;
8753 }
8754
8755 err = gcry_cipher_setiv (hde, tv[i].iv, tv[i].ivlen);
8756 if (err)
8757 {
8758 fail ("large stream, gcry_cipher_setiv failed: %s\n",
8759 gpg_strerror (err));
8760 goto next;
8761 }
8762
8763 for (j=0, p=buffer; j < buffersize/512; j++, p += 512)
8764 {
8765 err = gcry_cipher_encrypt (hde, p, 512, zeroes, 512);
8766 if (err)
8767 {
8768 fail ("large stream, "
8769 "gcry_cipher_encrypt (%d) block %d failed: %s\n",
8770 i, j, gpg_strerror (err));
8771 goto next;
8772 }
8773 }
8774 for (j=0, p=buffer+buffersize; j < 1024; j++, p++)
8775 if (*p != 0x5a)
8776 die ("large stream, buffer corrupted at j=%d\n", j);
8777
8778 /* Now loop over all the data samples. */
8779 for (j = 0; tv[i].data[j].length; j++)
8780 {
8781 assert (tv[i].data[j].offset + tv[i].data[j].length <= buffersize);
8782
8783 if (memcmp (tv[i].data[j].result,
8784 buffer + tv[i].data[j].offset, tv[i].data[j].length))
8785 {
8786 fail ("large stream, encrypt mismatch entry %d:%d\n", i, j);
8787 mismatch (tv[i].data[j].result, tv[i].data[j].length,
8788 buffer + tv[i].data[j].offset, tv[i].data[j].length);
8789 }
8790 }
8791
8792 /*
8793 * Let's do the same thing again but using changing block sizes.
8794 */
8795 err = gcry_cipher_setkey (hde, tv[i].key, tv[i].keylen);
8796 if (err)
8797 {
8798 fail ("large stream, gcry_cipher_setkey failed: %s\n",
8799 gpg_strerror (err));
8800 goto next;
8801 }
8802
8803 err = gcry_cipher_setiv (hde, tv[i].iv, tv[i].ivlen);
8804 if (err)
8805 {
8806 fail ("large stream, gcry_cipher_setiv failed: %s\n",
8807 gpg_strerror (err));
8808 goto next;
8809 }
8810
8811 for (n=0, p=buffer, j = 0; n < buffersize; n += j, p += j)
8812 {
8813 switch (j)
8814 {
8815 case 0: j = 1; break;
8816 case 1: j = 64; break;
8817 case 64: j= 384; break;
8818 case 384: j = 63; break;
8819 case 63: j = 512; break;
8820 case 512: j = 32; break;
8821 case 32: j = 503; break;
8822 default: j = 509; break;
8823 }
8824 if ( n + j >= buffersize )
8825 j = buffersize - n;
8826 assert (j <= 512);
8827 err = gcry_cipher_encrypt (hde, p, j, zeroes, j);
8828 if (err)
8829 {
8830 fail ("large stream, "
8831 "gcry_cipher_encrypt (%d) offset %u failed: %s\n",
8832 i, n, gpg_strerror (err));
8833 goto next;
8834 }
8835 }
8836 for (j=0, p=buffer+buffersize; j < 1024; j++, p++)
8837 if (*p != 0x5a)
8838 die ("large stream, buffer corrupted at j=%d (line %d)\n",
8839 j, __LINE__);
8840
8841 /* Now loop over all the data samples. */
8842 for (j = 0; tv[i].data[j].length; j++)
8843 {
8844 assert (tv[i].data[j].offset + tv[i].data[j].length <= buffersize);
8845
8846 if (memcmp (tv[i].data[j].result,
8847 buffer + tv[i].data[j].offset, tv[i].data[j].length))
8848 {
8849 fail ("large stream var, encrypt mismatch entry %d:%d\n", i, j);
8850 mismatch (tv[i].data[j].result, tv[i].data[j].length,
8851 buffer + tv[i].data[j].offset, tv[i].data[j].length);
8852 }
8853 }
8854
8855 next:
8856 gcry_cipher_close (hde);
8857 }
8858
8859 gcry_free (buffer);
8860 if (verbose)
8861 fprintf (stderr, " Completed large block stream cipher checks.\n");
8862 }
8863
8864
8865
8866 /* Check that our bulk encryption functions work properly. */
8867 static void
check_bulk_cipher_modes(void)8868 check_bulk_cipher_modes (void)
8869 {
8870 static const struct
8871 {
8872 int algo;
8873 int mode;
8874 const char *key;
8875 int keylen;
8876 const char *iv;
8877 int ivlen;
8878 char t1_hash[20];
8879 } tv[] = {
8880 { GCRY_CIPHER_AES, GCRY_CIPHER_MODE_CFB,
8881 "abcdefghijklmnop", 16,
8882 "1234567890123456", 16,
8883 /*[0]*/
8884 { 0x53, 0xda, 0x27, 0x3c, 0x78, 0x3d, 0x54, 0x66, 0x19, 0x63,
8885 0xd7, 0xe6, 0x20, 0x10, 0xcd, 0xc0, 0x5a, 0x0b, 0x06, 0xcc }
8886 },
8887 { GCRY_CIPHER_AES192, GCRY_CIPHER_MODE_CFB,
8888 "abcdefghijklmnopABCDEFG", 24,
8889 "1234567890123456", 16,
8890 /*[1]*/
8891 { 0xc7, 0xb1, 0xd0, 0x09, 0x95, 0x04, 0x34, 0x61, 0x2b, 0xd9,
8892 0xcb, 0xb3, 0xc7, 0xcb, 0xef, 0xea, 0x16, 0x19, 0x9b, 0x3e }
8893 },
8894 { GCRY_CIPHER_AES256, GCRY_CIPHER_MODE_CFB,
8895 "abcdefghijklmnopABCDEFGHIJKLMNOP", 32,
8896 "1234567890123456", 16,
8897 /*[2]*/
8898 { 0x31, 0xe1, 0x1f, 0x63, 0x65, 0x47, 0x8c, 0x3f, 0x53, 0xdb,
8899 0xd9, 0x4d, 0x91, 0x1d, 0x02, 0x9c, 0x05, 0x25, 0x58, 0x29 }
8900 },
8901 { GCRY_CIPHER_AES, GCRY_CIPHER_MODE_CBC,
8902 "abcdefghijklmnop", 16,
8903 "1234567890123456", 16,
8904 /*[3]*/
8905 { 0xdc, 0x0c, 0xc2, 0xd9, 0x6b, 0x47, 0xf9, 0xeb, 0x06, 0xb4,
8906 0x2f, 0x6e, 0xec, 0x72, 0xbf, 0x55, 0x26, 0x7f, 0xa9, 0x97 }
8907 },
8908 { GCRY_CIPHER_AES192, GCRY_CIPHER_MODE_CBC,
8909 "abcdefghijklmnopABCDEFG", 24,
8910 "1234567890123456", 16,
8911 /*[4]*/
8912 { 0x2b, 0x90, 0x9b, 0xe6, 0x40, 0xab, 0x6e, 0xc2, 0xc5, 0xb1,
8913 0x87, 0xf5, 0x43, 0x84, 0x7b, 0x04, 0x06, 0x47, 0xd1, 0x8f }
8914 },
8915 { GCRY_CIPHER_AES256, GCRY_CIPHER_MODE_CBC,
8916 "abcdefghijklmnopABCDEFGHIJKLMNOP", 32,
8917 "1234567890123456", 16,
8918 /*[5]*/
8919 { 0xaa, 0xa8, 0xdf, 0x03, 0xb0, 0xba, 0xc4, 0xe3, 0xc1, 0x02,
8920 0x38, 0x31, 0x8d, 0x86, 0xcb, 0x49, 0x6d, 0xad, 0xae, 0x01 }
8921 },
8922 { GCRY_CIPHER_AES, GCRY_CIPHER_MODE_OFB,
8923 "abcdefghijklmnop", 16,
8924 "1234567890123456", 16,
8925 /*[6]*/
8926 { 0x65, 0xfe, 0xde, 0x48, 0xd0, 0xa1, 0xa6, 0xf9, 0x24, 0x6b,
8927 0x52, 0x5f, 0x21, 0x8a, 0x6f, 0xc7, 0x70, 0x3b, 0xd8, 0x4a }
8928 },
8929 { GCRY_CIPHER_AES192, GCRY_CIPHER_MODE_OFB,
8930 "abcdefghijklmnopABCDEFG", 24,
8931 "1234567890123456", 16,
8932 /*[7]*/
8933 { 0x59, 0x5b, 0x02, 0xa2, 0x88, 0xc0, 0xbe, 0x94, 0x43, 0xaa,
8934 0x39, 0xf6, 0xbd, 0xcc, 0x83, 0x99, 0xee, 0x00, 0xa1, 0x91 }
8935 },
8936 { GCRY_CIPHER_AES256, GCRY_CIPHER_MODE_OFB,
8937 "abcdefghijklmnopABCDEFGHIJKLMNOP", 32,
8938 "1234567890123456", 16,
8939 /*[8]*/
8940 { 0x38, 0x8c, 0xe1, 0xe2, 0xbe, 0x67, 0x60, 0xe8, 0xeb, 0xce,
8941 0xd0, 0xc6, 0xaa, 0xd6, 0xf6, 0x26, 0x15, 0x56, 0xd0, 0x2b }
8942 },
8943 { GCRY_CIPHER_AES, GCRY_CIPHER_MODE_CTR,
8944 "abcdefghijklmnop", 16,
8945 "1234567890123456", 16,
8946 /*[9]*/
8947 { 0x9a, 0x48, 0x94, 0xd6, 0x50, 0x46, 0x81, 0xdb, 0x68, 0x34,
8948 0x3b, 0xc5, 0x9e, 0x66, 0x94, 0x81, 0x98, 0xa0, 0xf9, 0xff }
8949 },
8950 { GCRY_CIPHER_AES192, GCRY_CIPHER_MODE_CTR,
8951 "abcdefghijklmnopABCDEFG", 24,
8952 "1234567890123456", 16,
8953 /*[10]*/
8954 { 0x2c, 0x2c, 0xd3, 0x75, 0x81, 0x2a, 0x59, 0x07, 0xeb, 0x08,
8955 0xce, 0x28, 0x4c, 0x0c, 0x6a, 0xa8, 0x8f, 0xa3, 0x98, 0x7e }
8956 },
8957 { GCRY_CIPHER_AES256, GCRY_CIPHER_MODE_CTR,
8958 "abcdefghijklmnopABCDEFGHIJKLMNOP", 32,
8959 "1234567890123456", 16,
8960 /*[11]*/
8961 { 0x64, 0xce, 0x73, 0x03, 0xc7, 0x89, 0x99, 0x1f, 0xf1, 0xce,
8962 0xfe, 0xfb, 0xb9, 0x42, 0x30, 0xdf, 0xbb, 0x68, 0x6f, 0xd3 }
8963 },
8964 { GCRY_CIPHER_AES, GCRY_CIPHER_MODE_ECB,
8965 "abcdefghijklmnop", 16,
8966 "1234567890123456", 16,
8967 /*[12]*/
8968 { 0x51, 0xae, 0xf5, 0xac, 0x22, 0xa0, 0xba, 0x11, 0xc5, 0xaa,
8969 0xb4, 0x70, 0x99, 0xce, 0x18, 0x08, 0x12, 0x9b, 0xb1, 0xc5 }
8970 },
8971 { GCRY_CIPHER_AES192, GCRY_CIPHER_MODE_ECB,
8972 "abcdefghijklmnopABCDEFG", 24,
8973 "1234567890123456", 16,
8974 /*[13]*/
8975 { 0x57, 0x91, 0xea, 0x48, 0xd8, 0xbf, 0x9e, 0xc1, 0xae, 0x33,
8976 0xb3, 0xfd, 0xf7, 0x7a, 0xeb, 0x30, 0xb1, 0x62, 0x0d, 0x82 }
8977 },
8978 { GCRY_CIPHER_AES256, GCRY_CIPHER_MODE_ECB,
8979 "abcdefghijklmnopABCDEFGHIJKLMNOP", 32,
8980 "1234567890123456", 16,
8981 /*[14]*/
8982 { 0x2d, 0x71, 0x54, 0xb9, 0xc5, 0x28, 0x76, 0xff, 0x76, 0xb5,
8983 0x99, 0x37, 0x99, 0x9d, 0xf7, 0x10, 0x6d, 0x86, 0x4f, 0x3f }
8984 },
8985 { GCRY_CIPHER_AES128, GCRY_CIPHER_MODE_XTS,
8986 "abcdefghijklmnopABCDEFGHIJKLMNOP", 32,
8987 "1234567890123456", 16,
8988 /*[15]*/
8989 { 0x71, 0x46, 0x40, 0xb0, 0xed, 0x6f, 0xc4, 0x82, 0x2b, 0x3f,
8990 0xb6, 0xf7, 0x81, 0x08, 0x4c, 0x8b, 0xc1, 0x66, 0x4c, 0x1b }
8991 },
8992 { GCRY_CIPHER_AES256, GCRY_CIPHER_MODE_XTS,
8993 "abcdefghijklmnopABCDEFGHIJKLMNOP_abcdefghijklmnopABCDEFGHIJKLMNO", 64,
8994 "1234567890123456", 16,
8995 /*[16]*/
8996 { 0x8e, 0xbc, 0xa5, 0x21, 0x0a, 0x4b, 0x53, 0x14, 0x79, 0x81,
8997 0x25, 0xad, 0x24, 0x45, 0x98, 0xbd, 0x9f, 0x27, 0x5f, 0x01 }
8998 },
8999 { GCRY_CIPHER_AES, GCRY_CIPHER_MODE_OFB,
9000 "abcdefghijklmnop", 16,
9001 "1234567890123456", 16,
9002 /*[17]*/
9003 { 0x65, 0xfe, 0xde, 0x48, 0xd0, 0xa1, 0xa6, 0xf9, 0x24, 0x6b,
9004 0x52, 0x5f, 0x21, 0x8a, 0x6f, 0xc7, 0x70, 0x3b, 0xd8, 0x4a }
9005 },
9006 { GCRY_CIPHER_AES192, GCRY_CIPHER_MODE_OFB,
9007 "abcdefghijklmnopABCDEFG", 24,
9008 "1234567890123456", 16,
9009 /*[18]*/
9010 { 0x59, 0x5b, 0x02, 0xa2, 0x88, 0xc0, 0xbe, 0x94, 0x43, 0xaa,
9011 0x39, 0xf6, 0xbd, 0xcc, 0x83, 0x99, 0xee, 0x00, 0xa1, 0x91 }
9012 },
9013 { GCRY_CIPHER_AES256, GCRY_CIPHER_MODE_OFB,
9014 "abcdefghijklmnopABCDEFGHIJKLMNOP", 32,
9015 "1234567890123456", 16,
9016 /*[19]*/
9017 { 0x38, 0x8c, 0xe1, 0xe2, 0xbe, 0x67, 0x60, 0xe8, 0xeb, 0xce,
9018 0xd0, 0xc6, 0xaa, 0xd6, 0xf6, 0x26, 0x15, 0x56, 0xd0, 0x2b }
9019 },
9020 };
9021 gcry_cipher_hd_t hde = NULL;
9022 gcry_cipher_hd_t hdd = NULL;
9023 unsigned char *buffer_base, *outbuf_base; /* Allocated buffers. */
9024 unsigned char *buffer, *outbuf; /* Aligned buffers. */
9025 size_t buflen;
9026 unsigned char hash[20];
9027 int i, j, keylen, blklen;
9028 gcry_error_t err = 0;
9029
9030 if (verbose)
9031 fprintf (stderr, "Starting bulk cipher checks.\n");
9032
9033 buflen = 16*100; /* We check a 1600 byte buffer. */
9034 buffer_base = gcry_xmalloc (buflen+16);
9035 buffer = buffer_base + (16 - ((size_t)buffer_base & 0x0f));
9036 outbuf_base = gcry_xmalloc (buflen+16);
9037 outbuf = outbuf_base + (16 - ((size_t)outbuf_base & 0x0f));
9038
9039
9040 for (i = 0; i < DIM (tv); i++)
9041 {
9042 if (verbose)
9043 fprintf (stderr, " checking bulk encryption for %s [%i], mode %d\n",
9044 gcry_cipher_algo_name (tv[i].algo),
9045 tv[i].algo, tv[i].mode);
9046 err = gcry_cipher_open (&hde, tv[i].algo, tv[i].mode, 0);
9047 if (!err)
9048 err = gcry_cipher_open (&hdd, tv[i].algo, tv[i].mode, 0);
9049 if (err)
9050 {
9051 fail ("gcry_cipher_open failed: %s\n", gpg_strerror (err));
9052 goto leave;
9053 }
9054
9055 keylen = gcry_cipher_get_algo_keylen(tv[i].algo);
9056 if (!keylen)
9057 {
9058 fail ("gcry_cipher_get_algo_keylen failed\n");
9059 goto leave;
9060 }
9061
9062 clutter_vector_registers();
9063 err = gcry_cipher_setkey (hde, tv[i].key, tv[i].keylen);
9064 clutter_vector_registers();
9065 if (!err)
9066 err = gcry_cipher_setkey (hdd, tv[i].key, tv[i].keylen);
9067 if (err)
9068 {
9069 fail ("gcry_cipher_setkey failed: %s\n", gpg_strerror (err));
9070 goto leave;
9071 }
9072
9073 blklen = gcry_cipher_get_algo_blklen(tv[i].algo);
9074 if (!blklen)
9075 {
9076 fail ("gcry_cipher_get_algo_blklen failed\n");
9077 goto leave;
9078 }
9079
9080 clutter_vector_registers();
9081 err = gcry_cipher_setiv (hde, tv[i].iv, tv[i].ivlen);
9082 clutter_vector_registers();
9083 if (!err)
9084 err = gcry_cipher_setiv (hdd, tv[i].iv, tv[i].ivlen);
9085 if (err)
9086 {
9087 fail ("gcry_cipher_setiv failed: %s\n", gpg_strerror (err));
9088 goto leave;
9089 }
9090
9091 /* Fill the buffer with our test pattern. */
9092 for (j=0; j < buflen; j++)
9093 buffer[j] = ((j & 0xff) ^ ((j >> 8) & 0xff));
9094
9095 clutter_vector_registers();
9096 err = gcry_cipher_encrypt (hde, outbuf, buflen, buffer, buflen);
9097 if (err)
9098 {
9099 fail ("gcry_cipher_encrypt (algo %d, mode %d) failed: %s\n",
9100 tv[i].algo, tv[i].mode, gpg_strerror (err));
9101 goto leave;
9102 }
9103
9104 gcry_md_hash_buffer (GCRY_MD_SHA1, hash, outbuf, buflen);
9105 #if 0
9106 printf ("/*[%d]*/\n", i);
9107 fputs (" {", stdout);
9108 for (j=0; j < 20; j++)
9109 printf (" 0x%02x%c%s", hash[j], j==19? ' ':',', j == 9? "\n ":"");
9110 puts ("}");
9111 #endif
9112
9113 if (memcmp (hash, tv[i].t1_hash, 20))
9114 fail ("encrypt mismatch (algo %d, mode %d)\n",
9115 tv[i].algo, tv[i].mode);
9116
9117 clutter_vector_registers();
9118 err = gcry_cipher_decrypt (hdd, outbuf, buflen, NULL, 0);
9119 if (err)
9120 {
9121 fail ("gcry_cipher_decrypt (algo %d, mode %d) failed: %s\n",
9122 tv[i].algo, tv[i].mode, gpg_strerror (err));
9123 goto leave;
9124 }
9125
9126 if (memcmp (buffer, outbuf, buflen))
9127 fail ("decrypt mismatch (algo %d, mode %d)\n",
9128 tv[i].algo, tv[i].mode);
9129
9130 gcry_cipher_close (hde); hde = NULL;
9131 gcry_cipher_close (hdd); hdd = NULL;
9132 }
9133
9134 if (verbose)
9135 fprintf (stderr, "Completed bulk cipher checks.\n");
9136 leave:
9137 gcry_cipher_close (hde);
9138 gcry_cipher_close (hdd);
9139 gcry_free (buffer_base);
9140 gcry_free (outbuf_base);
9141 }
9142
9143
9144 static unsigned int
get_algo_mode_blklen(int algo,int mode)9145 get_algo_mode_blklen (int algo, int mode)
9146 {
9147 unsigned int blklen = gcry_cipher_get_algo_blklen(algo);
9148
9149 /* Some modes override blklen. */
9150 switch (mode)
9151 {
9152 case GCRY_CIPHER_MODE_STREAM:
9153 case GCRY_CIPHER_MODE_OFB:
9154 case GCRY_CIPHER_MODE_CTR:
9155 case GCRY_CIPHER_MODE_CFB:
9156 case GCRY_CIPHER_MODE_CFB8:
9157 case GCRY_CIPHER_MODE_CCM:
9158 case GCRY_CIPHER_MODE_GCM:
9159 case GCRY_CIPHER_MODE_EAX:
9160 case GCRY_CIPHER_MODE_POLY1305:
9161 return 1;
9162 }
9163
9164 return blklen;
9165 }
9166
9167
9168 static unsigned int
get_algo_mode_taglen(int algo,int mode)9169 get_algo_mode_taglen (int algo, int mode)
9170 {
9171 switch (mode)
9172 {
9173 case GCRY_CIPHER_MODE_CCM:
9174 case GCRY_CIPHER_MODE_GCM:
9175 case GCRY_CIPHER_MODE_POLY1305:
9176 return 16;
9177 case GCRY_CIPHER_MODE_EAX:
9178 return gcry_cipher_get_algo_blklen(algo);
9179 }
9180
9181 return 0;
9182 }
9183
9184
9185 static int
check_one_cipher_core_reset(gcry_cipher_hd_t hd,int algo,int mode,int pass,int nplain)9186 check_one_cipher_core_reset (gcry_cipher_hd_t hd, int algo, int mode, int pass,
9187 int nplain)
9188 {
9189 static const unsigned char iv[8] = { 0, 1, 2, 3, 4, 5, 6, 7 };
9190 u64 ctl_params[3];
9191 int err;
9192
9193 gcry_cipher_reset (hd);
9194
9195 if (mode == GCRY_CIPHER_MODE_OCB || mode == GCRY_CIPHER_MODE_CCM)
9196 {
9197 clutter_vector_registers();
9198 err = gcry_cipher_setiv (hd, iv, sizeof(iv));
9199 if (err)
9200 {
9201 fail ("pass %d, algo %d, mode %d, gcry_cipher_setiv failed: %s\n",
9202 pass, algo, mode, gpg_strerror (err));
9203 gcry_cipher_close (hd);
9204 return -1;
9205 }
9206 }
9207
9208 if (mode == GCRY_CIPHER_MODE_CCM)
9209 {
9210 ctl_params[0] = nplain; /* encryptedlen */
9211 ctl_params[1] = 0; /* aadlen */
9212 ctl_params[2] = 16; /* authtaglen */
9213 err = gcry_cipher_ctl (hd, GCRYCTL_SET_CCM_LENGTHS, ctl_params,
9214 sizeof(ctl_params));
9215 if (err)
9216 {
9217 fail ("pass %d, algo %d, mode %d, gcry_cipher_ctl "
9218 "GCRYCTL_SET_CCM_LENGTHS failed: %s\n",
9219 pass, algo, mode, gpg_strerror (err));
9220 gcry_cipher_close (hd);
9221 return -1;
9222 }
9223 }
9224
9225 return 0;
9226 }
9227
9228 /* The core of the cipher check. In addition to the parameters passed
9229 to check_one_cipher it also receives the KEY and the plain data.
9230 PASS is printed with error messages. The function returns 0 on
9231 success. */
9232 static int
check_one_cipher_core(int algo,int mode,int flags,const char * key,size_t nkey,const unsigned char * plain,size_t nplain,int bufshift,int pass)9233 check_one_cipher_core (int algo, int mode, int flags,
9234 const char *key, size_t nkey,
9235 const unsigned char *plain, size_t nplain,
9236 int bufshift, int pass)
9237 {
9238 gcry_cipher_hd_t hd;
9239 unsigned char *in_buffer, *out_buffer;
9240 unsigned char *enc_result;
9241 unsigned char tag_result[16];
9242 unsigned char tag[16];
9243 unsigned char *in, *out;
9244 int keylen;
9245 gcry_error_t err = 0;
9246 unsigned int blklen;
9247 unsigned int piecelen;
9248 unsigned int pos;
9249 unsigned int taglen;
9250
9251 in_buffer = malloc (nplain + 1);
9252 out_buffer = malloc (nplain + 1);
9253 enc_result = malloc (nplain);
9254 if (!in_buffer || !out_buffer || !enc_result)
9255 {
9256 fail ("pass %d, algo %d, mode %d, malloc failed\n",
9257 pass, algo, mode);
9258 goto err_out_free;
9259 }
9260
9261 blklen = get_algo_mode_blklen(algo, mode);
9262 taglen = get_algo_mode_taglen(algo, mode);
9263
9264 assert (nkey == 64);
9265 assert (nplain > 0);
9266 assert ((nplain % 16) == 0);
9267 assert (blklen > 0);
9268
9269 if ((mode == GCRY_CIPHER_MODE_CBC && (flags & GCRY_CIPHER_CBC_CTS)) ||
9270 mode == GCRY_CIPHER_MODE_XTS)
9271 {
9272 /* Input cannot be split in to multiple operations with CTS. */
9273 blklen = nplain;
9274 }
9275
9276 if (!bufshift)
9277 {
9278 in = in_buffer;
9279 out = out_buffer;
9280 }
9281 else if (bufshift == 1)
9282 {
9283 in = in_buffer+1;
9284 out = out_buffer;
9285 }
9286 else if (bufshift == 2)
9287 {
9288 in = in_buffer+1;
9289 out = out_buffer+1;
9290 }
9291 else
9292 {
9293 in = in_buffer;
9294 out = out_buffer+1;
9295 }
9296
9297 keylen = gcry_cipher_get_algo_keylen (algo);
9298 if (!keylen)
9299 {
9300 fail ("pass %d, algo %d, mode %d, gcry_cipher_get_algo_keylen failed\n",
9301 pass, algo, mode);
9302 goto err_out_free;
9303 }
9304
9305 if (keylen < 40 / 8 || keylen > 32)
9306 {
9307 fail ("pass %d, algo %d, mode %d, keylength problem (%d)\n", pass, algo, mode, keylen);
9308 goto err_out_free;
9309 }
9310
9311 if (mode == GCRY_CIPHER_MODE_XTS)
9312 {
9313 keylen *= 2;
9314 }
9315
9316 err = gcry_cipher_open (&hd, algo, mode, flags);
9317 if (err)
9318 {
9319 fail ("pass %d, algo %d, mode %d, gcry_cipher_open failed: %s\n",
9320 pass, algo, mode, gpg_strerror (err));
9321 goto err_out_free;
9322 }
9323
9324 clutter_vector_registers();
9325 err = gcry_cipher_setkey (hd, key, keylen);
9326 if (err)
9327 {
9328 fail ("pass %d, algo %d, mode %d, gcry_cipher_setkey failed: %s\n",
9329 pass, algo, mode, gpg_strerror (err));
9330 gcry_cipher_close (hd);
9331 goto err_out_free;
9332 }
9333
9334 if (check_one_cipher_core_reset (hd, algo, mode, pass, nplain) < 0)
9335 goto err_out_free;
9336
9337 clutter_vector_registers();
9338 err = gcry_cipher_encrypt (hd, out, nplain, plain, nplain);
9339 if (err)
9340 {
9341 fail ("pass %d, algo %d, mode %d, gcry_cipher_encrypt failed: %s\n",
9342 pass, algo, mode, gpg_strerror (err));
9343 gcry_cipher_close (hd);
9344 goto err_out_free;
9345 }
9346
9347 if (taglen > 0)
9348 {
9349 clutter_vector_registers();
9350 err = gcry_cipher_gettag (hd, tag, taglen);
9351 if (err)
9352 {
9353 fail ("pass %d, algo %d, mode %d, gcry_cipher_gettag failed: %s\n",
9354 pass, algo, mode, gpg_strerror (err));
9355 gcry_cipher_close (hd);
9356 goto err_out_free;
9357 }
9358
9359 memcpy(tag_result, tag, taglen);
9360 }
9361
9362 memcpy (enc_result, out, nplain);
9363
9364 if (check_one_cipher_core_reset (hd, algo, mode, pass, nplain) < 0)
9365 goto err_out_free;
9366
9367 clutter_vector_registers();
9368 err = gcry_cipher_decrypt (hd, in, nplain, out, nplain);
9369 if (err)
9370 {
9371 fail ("pass %d, algo %d, mode %d, gcry_cipher_decrypt failed: %s\n",
9372 pass, algo, mode, gpg_strerror (err));
9373 gcry_cipher_close (hd);
9374 goto err_out_free;
9375 }
9376
9377 if (taglen > 0)
9378 {
9379 clutter_vector_registers();
9380 err = gcry_cipher_checktag (hd, tag_result, taglen);
9381 if (err)
9382 {
9383 fail ("pass %d, algo %d, mode %d, gcry_cipher_checktag failed: %s\n",
9384 pass, algo, mode, gpg_strerror (err));
9385 gcry_cipher_close (hd);
9386 goto err_out_free;
9387 }
9388 }
9389
9390 if (memcmp (plain, in, nplain))
9391 fail ("pass %d, algo %d, mode %d, encrypt-decrypt mismatch\n",
9392 pass, algo, mode);
9393
9394 /* Again, using in-place encryption. */
9395 if (check_one_cipher_core_reset (hd, algo, mode, pass, nplain) < 0)
9396 goto err_out_free;
9397
9398 memcpy (out, plain, nplain);
9399 clutter_vector_registers();
9400 err = gcry_cipher_encrypt (hd, out, nplain, NULL, 0);
9401 if (err)
9402 {
9403 fail ("pass %d, algo %d, mode %d, in-place, gcry_cipher_encrypt failed:"
9404 " %s\n",
9405 pass, algo, mode, gpg_strerror (err));
9406 gcry_cipher_close (hd);
9407 goto err_out_free;
9408 }
9409
9410 if (taglen > 0)
9411 {
9412 err = gcry_cipher_gettag (hd, tag, taglen);
9413 if (err)
9414 {
9415 fail ("pass %d, algo %d, mode %d, in-place, "
9416 "gcry_cipher_gettag failed: %s\n",
9417 pass, algo, mode, gpg_strerror (err));
9418 gcry_cipher_close (hd);
9419 goto err_out_free;
9420 }
9421
9422 if (memcmp (tag_result, tag, taglen))
9423 fail ("pass %d, algo %d, mode %d, in-place, tag mismatch\n",
9424 pass, algo, mode);
9425 }
9426
9427 if (memcmp (enc_result, out, nplain))
9428 fail ("pass %d, algo %d, mode %d, in-place, encrypt mismatch\n",
9429 pass, algo, mode);
9430
9431 if (check_one_cipher_core_reset (hd, algo, mode, pass, nplain) < 0)
9432 goto err_out_free;
9433
9434 clutter_vector_registers();
9435 err = gcry_cipher_decrypt (hd, out, nplain, NULL, 0);
9436 if (err)
9437 {
9438 fail ("pass %d, algo %d, mode %d, in-place, gcry_cipher_decrypt failed:"
9439 " %s\n",
9440 pass, algo, mode, gpg_strerror (err));
9441 gcry_cipher_close (hd);
9442 goto err_out_free;
9443 }
9444
9445 if (taglen > 0)
9446 {
9447 clutter_vector_registers();
9448 err = gcry_cipher_checktag (hd, tag_result, taglen);
9449 if (err)
9450 {
9451 fail ("pass %d, algo %d, mode %d, in-place, "
9452 "gcry_cipher_checktag failed: %s\n",
9453 pass, algo, mode, gpg_strerror (err));
9454 gcry_cipher_close (hd);
9455 goto err_out_free;
9456 }
9457 }
9458
9459 if (memcmp (plain, out, nplain))
9460 fail ("pass %d, algo %d, mode %d, in-place, encrypt-decrypt mismatch\n",
9461 pass, algo, mode);
9462
9463 /* Again, splitting encryption in multiple operations. */
9464 if (check_one_cipher_core_reset (hd, algo, mode, pass, nplain) < 0)
9465 goto err_out_free;
9466
9467 piecelen = blklen;
9468 pos = 0;
9469 while (pos < nplain)
9470 {
9471 if (piecelen > nplain - pos)
9472 piecelen = nplain - pos;
9473
9474 clutter_vector_registers();
9475 err = gcry_cipher_encrypt (hd, out + pos, piecelen, plain + pos,
9476 piecelen);
9477 if (err)
9478 {
9479 fail ("pass %d, algo %d, mode %d, split-buffer (pos: %d, "
9480 "piecelen: %d), gcry_cipher_encrypt failed: %s\n",
9481 pass, algo, mode, pos, piecelen, gpg_strerror (err));
9482 gcry_cipher_close (hd);
9483 goto err_out_free;
9484 }
9485
9486 pos += piecelen;
9487 piecelen = piecelen * 2 - ((piecelen != blklen) ? blklen : 0);
9488 }
9489
9490 if (taglen > 0)
9491 {
9492 clutter_vector_registers();
9493 err = gcry_cipher_gettag (hd, tag, taglen);
9494 if (err)
9495 {
9496 fail ("pass %d, algo %d, mode %d, split-buffer (pos: %d, "
9497 "piecelen: %d), gcry_cipher_gettag failed: %s\n",
9498 pass, algo, mode, pos, piecelen, gpg_strerror (err));
9499 gcry_cipher_close (hd);
9500 goto err_out_free;
9501 }
9502
9503 if (memcmp (tag_result, tag, taglen))
9504 fail ("pass %d, algo %d, mode %d, in-place, tag mismatch\n",
9505 pass, algo, mode);
9506 }
9507
9508 if (memcmp (enc_result, out, nplain))
9509 fail ("pass %d, algo %d, mode %d, split-buffer, encrypt mismatch\n",
9510 pass, algo, mode);
9511
9512 if (check_one_cipher_core_reset (hd, algo, mode, pass, nplain) < 0)
9513 goto err_out_free;
9514
9515 piecelen = blklen;
9516 pos = 0;
9517 while (pos < nplain)
9518 {
9519 if (piecelen > nplain - pos)
9520 piecelen = nplain - pos;
9521
9522 clutter_vector_registers();
9523 err = gcry_cipher_decrypt (hd, in + pos, piecelen, out + pos, piecelen);
9524 if (err)
9525 {
9526 fail ("pass %d, algo %d, mode %d, split-buffer (pos: %d, "
9527 "piecelen: %d), gcry_cipher_decrypt failed: %s\n",
9528 pass, algo, mode, pos, piecelen, gpg_strerror (err));
9529 gcry_cipher_close (hd);
9530 goto err_out_free;
9531 }
9532
9533 pos += piecelen;
9534 piecelen = piecelen * 2 - ((piecelen != blklen) ? blklen : 0);
9535 }
9536
9537 if (taglen > 0)
9538 {
9539 clutter_vector_registers();
9540 err = gcry_cipher_checktag (hd, tag_result, taglen);
9541 if (err)
9542 {
9543 fail ("pass %d, algo %d, mode %d, split-buffer (pos: %d, "
9544 "piecelen: %d), gcry_cipher_checktag failed: %s\n",
9545 pass, algo, mode, pos, piecelen, gpg_strerror (err));
9546 gcry_cipher_close (hd);
9547 goto err_out_free;
9548 }
9549 }
9550
9551 if (memcmp (plain, in, nplain))
9552 fail ("pass %d, algo %d, mode %d, split-buffer, encrypt-decrypt mismatch\n",
9553 pass, algo, mode);
9554
9555 /* Again, using in-place encryption and splitting encryption in multiple
9556 * operations. */
9557 if (check_one_cipher_core_reset (hd, algo, mode, pass, nplain) < 0)
9558 goto err_out_free;
9559
9560 piecelen = blklen;
9561 pos = 0;
9562 while (pos < nplain)
9563 {
9564 if (piecelen > nplain - pos)
9565 piecelen = nplain - pos;
9566
9567 memcpy (out + pos, plain + pos, piecelen);
9568 clutter_vector_registers();
9569 err = gcry_cipher_encrypt (hd, out + pos, piecelen, NULL, 0);
9570 if (err)
9571 {
9572 fail ("pass %d, algo %d, mode %d, in-place split-buffer (pos: %d, "
9573 "piecelen: %d), gcry_cipher_encrypt failed: %s\n",
9574 pass, algo, mode, pos, piecelen, gpg_strerror (err));
9575 gcry_cipher_close (hd);
9576 goto err_out_free;
9577 }
9578
9579 pos += piecelen;
9580 piecelen = piecelen * 2 - ((piecelen != blklen) ? blklen : 0);
9581 }
9582
9583 if (memcmp (enc_result, out, nplain))
9584 fail ("pass %d, algo %d, mode %d, in-place split-buffer, encrypt mismatch\n",
9585 pass, algo, mode);
9586
9587 if (check_one_cipher_core_reset (hd, algo, mode, pass, nplain) < 0)
9588 goto err_out_free;
9589
9590 piecelen = blklen;
9591 pos = 0;
9592 while (pos < nplain)
9593 {
9594 if (piecelen > nplain - pos)
9595 piecelen = nplain - pos;
9596
9597 clutter_vector_registers();
9598 err = gcry_cipher_decrypt (hd, out + pos, piecelen, NULL, 0);
9599 if (err)
9600 {
9601 fail ("pass %d, algo %d, mode %d, in-place split-buffer (pos: %d, "
9602 "piecelen: %d), gcry_cipher_decrypt failed: %s\n",
9603 pass, algo, mode, pos, piecelen, gpg_strerror (err));
9604 gcry_cipher_close (hd);
9605 goto err_out_free;
9606 }
9607
9608 pos += piecelen;
9609 piecelen = piecelen * 2 - ((piecelen != blklen) ? blklen : 0);
9610 }
9611
9612 if (memcmp (plain, out, nplain))
9613 fail ("pass %d, algo %d, mode %d, in-place split-buffer, encrypt-decrypt"
9614 " mismatch\n", pass, algo, mode);
9615
9616
9617 gcry_cipher_close (hd);
9618
9619 free (enc_result);
9620 free (out_buffer);
9621 free (in_buffer);
9622 return 0;
9623
9624 err_out_free:
9625 free (enc_result);
9626 free (out_buffer);
9627 free (in_buffer);
9628 return -1;
9629 }
9630
9631
9632
9633 static int
check_one_cipher_ctr_reset(gcry_cipher_hd_t hd,int algo,int mode,u32 ctr_high_bits,int be_ctr,int pass)9634 check_one_cipher_ctr_reset (gcry_cipher_hd_t hd, int algo, int mode,
9635 u32 ctr_high_bits, int be_ctr,
9636 int pass)
9637 {
9638 unsigned char iv[16] = { 0 };
9639 unsigned char swap;
9640 unsigned int ivlen;
9641 u32 ctr_low_bits;
9642 int err;
9643 int i;
9644
9645 /* This should be largest parallel block processing count in any
9646 * implementation negated. Currently for CTR this is 32 and, for
9647 * ChaCha20, count is 8. */
9648 ctr_low_bits = (mode == GCRY_CIPHER_MODE_CTR) ? -32 : -8;
9649
9650 gcry_cipher_reset (hd);
9651
9652 if (mode == GCRY_CIPHER_MODE_CTR)
9653 ivlen = get_algo_mode_blklen(algo, GCRY_CIPHER_MODE_ECB);
9654 else
9655 ivlen = 16;
9656
9657 /* Little-endian fill. */
9658 for (i = 0; i < 4; i++)
9659 iv[i + 0] = (ctr_low_bits >> (i * 8)) & 0xff;
9660 for (i = 0; i < 4; i++)
9661 iv[i + 4] = (ctr_high_bits >> (i * 8)) & 0xff;
9662
9663 if (be_ctr)
9664 {
9665 /* Swap to big-endian. */
9666 for (i = 0; i < ivlen / 2; i++)
9667 {
9668 swap = iv[i];
9669 iv[i] = iv[ivlen - (i + 1)];
9670 iv[ivlen - (i + 1)] = swap;
9671 }
9672 }
9673
9674 clutter_vector_registers();
9675 if (mode == GCRY_CIPHER_MODE_CTR)
9676 err = gcry_cipher_setctr (hd, iv, ivlen);
9677 else
9678 err = gcry_cipher_setiv (hd, iv, ivlen);
9679
9680 if (err)
9681 {
9682 fail ("pass %d, algo %d, mode %d, gcry_cipher_setiv failed: %s\n",
9683 pass, algo, mode, gpg_strerror (err));
9684 gcry_cipher_close (hd);
9685 return -1;
9686 }
9687
9688 return 0;
9689 }
9690
9691 static int
check_one_cipher_ctr_overflow(int algo,int mode,int flags,const char * key,size_t nkey,const unsigned char * plain,size_t nplain,unsigned long ctr_high_bits,int be_ctr,int pass)9692 check_one_cipher_ctr_overflow (int algo, int mode, int flags,
9693 const char *key, size_t nkey,
9694 const unsigned char *plain, size_t nplain,
9695 unsigned long ctr_high_bits, int be_ctr,
9696 int pass)
9697 {
9698 gcry_cipher_hd_t hd;
9699 unsigned char *out;
9700 unsigned char *enc_result;
9701 int keylen;
9702 gcry_error_t err = 0;
9703 unsigned int firstlen;
9704 unsigned int leftlen;
9705 unsigned int blklen;
9706 unsigned int pos;
9707 unsigned int i;
9708
9709 out = malloc (nplain);
9710 enc_result = malloc (nplain);
9711 if (!out || !enc_result)
9712 {
9713 fail ("pass %d, algo %d, mode %d, malloc failed\n",
9714 pass, algo, mode);
9715 goto err_out_free;
9716 }
9717
9718 assert (nkey == 64);
9719 assert (nplain > 0);
9720 assert ((nplain % 16) == 0);
9721
9722 keylen = gcry_cipher_get_algo_keylen (algo);
9723 if (!keylen)
9724 {
9725 fail ("pass %d, algo %d, mode %d, gcry_cipher_get_algo_keylen failed\n",
9726 pass, algo, mode);
9727 goto err_out_free;
9728 }
9729
9730 if (keylen < 40 / 8 || keylen > 32)
9731 {
9732 fail ("pass %d, algo %d, mode %d, keylength problem (%d)\n",
9733 pass, algo, mode, keylen);
9734 goto err_out_free;
9735 }
9736
9737 err = gcry_cipher_open (&hd, algo, mode, flags);
9738 if (err)
9739 {
9740 fail ("pass %d, algo %d, mode %d, gcry_cipher_open failed: %s\n",
9741 pass, algo, mode, gpg_strerror (err));
9742 goto err_out_free;
9743 }
9744
9745 clutter_vector_registers();
9746 err = gcry_cipher_setkey (hd, key, keylen);
9747 if (err)
9748 {
9749 fail ("pass %d, algo %d, mode %d, gcry_cipher_setkey failed: %s\n",
9750 pass, algo, mode, gpg_strerror (err));
9751 gcry_cipher_close (hd);
9752 goto err_out_free;
9753 }
9754
9755 if (check_one_cipher_ctr_reset (hd, algo, mode, ctr_high_bits, be_ctr,
9756 pass) < 0)
9757 goto err_out_free;
9758
9759 /* Non-bulk processing. */
9760 for (i = 0; i < nplain; i += 16)
9761 {
9762 clutter_vector_registers();
9763 err = gcry_cipher_encrypt (hd, out + i, 16, plain + i, 16);
9764 if (err)
9765 {
9766 fail ("pass %d, algo %d, mode %d, gcry_cipher_encrypt failed: %s\n",
9767 pass, algo, mode, gpg_strerror (err));
9768 gcry_cipher_close (hd);
9769 goto err_out_free;
9770 }
9771 }
9772
9773 memcpy (enc_result, out, nplain);
9774
9775 /* Test with different bulk processing sizes. */
9776 for (blklen = 2 * 16; blklen <= 32 * 16; blklen *= 2)
9777 {
9778 /* Move bulk processing start offset, test at different spots to
9779 * test bulk counter calculation throughly. */
9780 for (firstlen = 16; firstlen < 8 * 64; firstlen += 16)
9781 {
9782 if (check_one_cipher_ctr_reset (hd, algo, mode, ctr_high_bits, be_ctr,
9783 pass) < 0)
9784 goto err_out_free;
9785
9786 clutter_vector_registers();
9787 err = gcry_cipher_encrypt (hd, out, firstlen, plain, firstlen);
9788 if (err)
9789 {
9790 fail ("pass %d, algo %d, mode %d, gcry_cipher_encrypt "
9791 "failed: %s\n", pass, algo, mode, gpg_strerror (err));
9792 gcry_cipher_close (hd);
9793 goto err_out_free;
9794 }
9795
9796 leftlen = nplain - firstlen;
9797 pos = firstlen;
9798 while (leftlen)
9799 {
9800 unsigned int currlen = leftlen > blklen ? blklen : leftlen;
9801
9802 clutter_vector_registers();
9803 err = gcry_cipher_encrypt (hd, out + pos, currlen, plain + pos,
9804 currlen);
9805 if (err)
9806 {
9807 fail ("pass %d, algo %d, mode %d, block len %d, first len %d,"
9808 "gcry_cipher_encrypt failed: %s\n", pass, algo, mode,
9809 blklen, firstlen, gpg_strerror (err));
9810 gcry_cipher_close (hd);
9811 goto err_out_free;
9812 }
9813
9814 pos += currlen;
9815 leftlen -= currlen;
9816 }
9817
9818 if (memcmp (enc_result, out, nplain))
9819 fail ("pass %d, algo %d, mode %d, block len %d, first len %d, "
9820 "encrypt mismatch\n", pass, algo, mode, blklen, firstlen);
9821 }
9822 }
9823
9824 gcry_cipher_close (hd);
9825
9826 free (enc_result);
9827 free (out);
9828 return 0;
9829
9830 err_out_free:
9831 free (enc_result);
9832 free (out);
9833 return -1;
9834 }
9835
9836
9837 static void
check_one_cipher(int algo,int mode,int flags)9838 check_one_cipher (int algo, int mode, int flags)
9839 {
9840 size_t medium_buffer_size = 2048 - 16;
9841 size_t large_buffer_size = 64 * 1024 + 1024 - 16;
9842 char key[64+1];
9843 unsigned char *plain;
9844 int bufshift, i;
9845
9846 plain = malloc (large_buffer_size + 1);
9847 if (!plain)
9848 {
9849 fail ("pass %d, algo %d, mode %d, malloc failed\n", -1, algo, mode);
9850 return;
9851 }
9852
9853 for (bufshift = 0; bufshift < 4; bufshift++)
9854 {
9855 /* Pass 0: Standard test. */
9856 memcpy (key, "0123456789abcdef.,;/[]{}-=ABCDEF_"
9857 "0123456789abcdef.,;/[]{}-=ABCDEF", 64);
9858 memcpy (plain, "foobar42FOOBAR17", 16);
9859 for (i = 16; i < medium_buffer_size; i += 16)
9860 {
9861 memcpy (&plain[i], &plain[i-16], 16);
9862 if (!++plain[i+7])
9863 plain[i+6]++;
9864 if (!++plain[i+15])
9865 plain[i+14]++;
9866 }
9867
9868 if (check_one_cipher_core (algo, mode, flags, key, 64, plain,
9869 medium_buffer_size, bufshift,
9870 0+10*bufshift))
9871 goto out;
9872
9873 /* Pass 1: Key not aligned. */
9874 memmove (key+1, key, 64);
9875 if (check_one_cipher_core (algo, mode, flags, key+1, 64, plain,
9876 medium_buffer_size, bufshift,
9877 1+10*bufshift))
9878 goto out;
9879
9880 /* Pass 2: Key not aligned and data not aligned. */
9881 memmove (plain+1, plain, medium_buffer_size);
9882 if (check_one_cipher_core (algo, mode, flags, key+1, 64, plain+1,
9883 medium_buffer_size, bufshift,
9884 2+10*bufshift))
9885 goto out;
9886
9887 /* Pass 3: Key aligned and data not aligned. */
9888 memmove (key, key+1, 64);
9889 if (check_one_cipher_core (algo, mode, flags, key, 64, plain+1,
9890 medium_buffer_size, bufshift,
9891 3+10*bufshift))
9892 goto out;
9893 }
9894
9895 /* Pass 5: Large buffer test. */
9896 memcpy (key, "0123456789abcdef.,;/[]{}-=ABCDEF_"
9897 "0123456789abcdef.,;/[]{}-=ABCDEF", 64);
9898 memcpy (plain, "foobar42FOOBAR17", 16);
9899 for (i = 16; i < large_buffer_size; i += 16)
9900 {
9901 memcpy (&plain[i], &plain[i-16], 16);
9902 if (!++plain[i+7])
9903 plain[i+6]++;
9904 if (!++plain[i+15])
9905 plain[i+14]++;
9906 }
9907
9908 if (check_one_cipher_core (algo, mode, flags, key, 64, plain,
9909 large_buffer_size, bufshift,
9910 50))
9911 goto out;
9912
9913 /* Pass 6: Counter overflow tests for ChaCha20 and CTR mode. */
9914 if (mode == GCRY_CIPHER_MODE_STREAM && algo == GCRY_CIPHER_CHACHA20)
9915 {
9916 /* 32bit overflow test (little-endian counter) */
9917 if (check_one_cipher_ctr_overflow (algo, mode, flags, key, 64, plain,
9918 medium_buffer_size, 0UL,
9919 0, 60))
9920 goto out;
9921 /* 64bit overflow test (little-endian counter) */
9922 if (check_one_cipher_ctr_overflow (algo, mode, flags, key, 64, plain,
9923 medium_buffer_size, 0xffffffffUL,
9924 0, 61))
9925 goto out;
9926 }
9927 else if (mode == GCRY_CIPHER_MODE_CTR)
9928 {
9929 /* 32bit overflow test (big-endian counter) */
9930 if (check_one_cipher_ctr_overflow (algo, mode, flags, key, 64, plain,
9931 medium_buffer_size, 0UL,
9932 1, 62))
9933 goto out;
9934 /* 64bit overflow test (big-endian counter) */
9935 if (check_one_cipher_ctr_overflow (algo, mode, flags, key, 64, plain,
9936 medium_buffer_size, 0xffffffffUL,
9937 1, 63))
9938 goto out;
9939 }
9940
9941 out:
9942 free (plain);
9943 }
9944
9945
9946
9947 static void
check_ciphers(void)9948 check_ciphers (void)
9949 {
9950 static const int algos[] = {
9951 #if USE_BLOWFISH
9952 GCRY_CIPHER_BLOWFISH,
9953 #endif
9954 #if USE_DES
9955 GCRY_CIPHER_DES,
9956 GCRY_CIPHER_3DES,
9957 #endif
9958 #if USE_CAST5
9959 GCRY_CIPHER_CAST5,
9960 #endif
9961 #if USE_AES
9962 GCRY_CIPHER_AES,
9963 GCRY_CIPHER_AES192,
9964 GCRY_CIPHER_AES256,
9965 #endif
9966 #if USE_TWOFISH
9967 GCRY_CIPHER_TWOFISH,
9968 GCRY_CIPHER_TWOFISH128,
9969 #endif
9970 #if USE_SERPENT
9971 GCRY_CIPHER_SERPENT128,
9972 GCRY_CIPHER_SERPENT192,
9973 GCRY_CIPHER_SERPENT256,
9974 #endif
9975 #if USE_RFC2268
9976 GCRY_CIPHER_RFC2268_40,
9977 #endif
9978 #if USE_SEED
9979 GCRY_CIPHER_SEED,
9980 #endif
9981 #if USE_CAMELLIA
9982 GCRY_CIPHER_CAMELLIA128,
9983 GCRY_CIPHER_CAMELLIA192,
9984 GCRY_CIPHER_CAMELLIA256,
9985 #endif
9986 #if USE_IDEA
9987 GCRY_CIPHER_IDEA,
9988 #endif
9989 #if USE_GOST28147
9990 GCRY_CIPHER_GOST28147,
9991 GCRY_CIPHER_GOST28147_MESH,
9992 #endif
9993 #if USE_SM4
9994 GCRY_CIPHER_SM4,
9995 #endif
9996 0
9997 };
9998 static const int algos2[] = {
9999 #if USE_ARCFOUR
10000 GCRY_CIPHER_ARCFOUR,
10001 #endif
10002 #if USE_SALSA20
10003 GCRY_CIPHER_SALSA20,
10004 GCRY_CIPHER_SALSA20R12,
10005 #endif
10006 #if USE_CHACHA20
10007 GCRY_CIPHER_CHACHA20,
10008 #endif
10009 0
10010 };
10011 int i;
10012
10013 if (verbose)
10014 fprintf (stderr, "Starting Cipher checks.\n");
10015 for (i = 0; algos[i]; i++)
10016 {
10017 if (gcry_cipher_test_algo (algos[i]) && in_fips_mode)
10018 {
10019 if (verbose)
10020 fprintf (stderr, " algorithm %d not available in fips mode\n",
10021 algos[i]);
10022 continue;
10023 }
10024 if (verbose)
10025 fprintf (stderr, " checking %s [%i]\n",
10026 gcry_cipher_algo_name (algos[i]),
10027 gcry_cipher_map_name (gcry_cipher_algo_name (algos[i])));
10028
10029 check_one_cipher (algos[i], GCRY_CIPHER_MODE_ECB, 0);
10030 check_one_cipher (algos[i], GCRY_CIPHER_MODE_CFB, 0);
10031 check_one_cipher (algos[i], GCRY_CIPHER_MODE_CFB8, 0);
10032 check_one_cipher (algos[i], GCRY_CIPHER_MODE_OFB, 0);
10033 check_one_cipher (algos[i], GCRY_CIPHER_MODE_CBC, 0);
10034 check_one_cipher (algos[i], GCRY_CIPHER_MODE_CBC, GCRY_CIPHER_CBC_CTS);
10035 check_one_cipher (algos[i], GCRY_CIPHER_MODE_CTR, 0);
10036 check_one_cipher (algos[i], GCRY_CIPHER_MODE_EAX, 0);
10037 if (gcry_cipher_get_algo_blklen (algos[i]) == GCRY_CCM_BLOCK_LEN)
10038 check_one_cipher (algos[i], GCRY_CIPHER_MODE_CCM, 0);
10039 if (gcry_cipher_get_algo_blklen (algos[i]) == GCRY_GCM_BLOCK_LEN)
10040 check_one_cipher (algos[i], GCRY_CIPHER_MODE_GCM, 0);
10041 if (gcry_cipher_get_algo_blklen (algos[i]) == GCRY_OCB_BLOCK_LEN)
10042 check_one_cipher (algos[i], GCRY_CIPHER_MODE_OCB, 0);
10043 if (gcry_cipher_get_algo_blklen (algos[i]) == GCRY_XTS_BLOCK_LEN)
10044 check_one_cipher (algos[i], GCRY_CIPHER_MODE_XTS, 0);
10045 }
10046
10047 for (i = 0; algos2[i]; i++)
10048 {
10049 if (gcry_cipher_test_algo (algos2[i]) && in_fips_mode)
10050 {
10051 if (verbose)
10052 fprintf (stderr, " algorithm %d not available in fips mode\n",
10053 algos2[i]);
10054 continue;
10055 }
10056 if (verbose)
10057 fprintf (stderr, " checking %s\n",
10058 gcry_cipher_algo_name (algos2[i]));
10059
10060 check_one_cipher (algos2[i], GCRY_CIPHER_MODE_STREAM, 0);
10061 if (algos2[i] == GCRY_CIPHER_CHACHA20)
10062 check_one_cipher (algos2[i], GCRY_CIPHER_MODE_POLY1305, 0);
10063 }
10064 /* we have now run all cipher's selftests */
10065
10066 if (verbose)
10067 fprintf (stderr, "Completed Cipher checks.\n");
10068
10069 /* TODO: add some extra encryption to test the higher level functions */
10070 }
10071
10072
10073 static void
check_cipher_modes(void)10074 check_cipher_modes(void)
10075 {
10076 if (verbose)
10077 fprintf (stderr, "Starting Cipher Mode checks.\n");
10078
10079 check_ecb_cipher ();
10080 check_aes128_cbc_cts_cipher ();
10081 check_cbc_mac_cipher ();
10082 check_ctr_cipher ();
10083 check_cfb_cipher ();
10084 check_ofb_cipher ();
10085 check_ccm_cipher ();
10086 check_gcm_cipher ();
10087 check_poly1305_cipher ();
10088 check_ocb_cipher ();
10089 check_xts_cipher ();
10090 check_eax_cipher ();
10091 check_gost28147_cipher ();
10092 check_stream_cipher ();
10093 check_stream_cipher_large_block ();
10094
10095 if (verbose)
10096 fprintf (stderr, "Completed Cipher Mode checks.\n");
10097 }
10098
10099
10100 static void
fillbuf_count(char * buf,size_t buflen,unsigned char pos)10101 fillbuf_count (char *buf, size_t buflen, unsigned char pos)
10102 {
10103 while (buflen--)
10104 *((unsigned char *)(buf++)) = pos++;
10105 }
10106
10107
10108 static void
check_one_md(int algo,const char * data,int len,const char * expect,int elen,const char * key,int klen)10109 check_one_md (int algo, const char *data, int len, const char *expect, int elen,
10110 const char *key, int klen)
10111 {
10112 gcry_md_hd_t hd, hd2;
10113 unsigned char *p;
10114 int mdlen;
10115 int i, j;
10116 int xof = 0;
10117 gcry_error_t err = 0;
10118
10119 err = gcry_md_open (&hd, algo, 0);
10120 if (err)
10121 {
10122 fail ("algo %d, gcry_md_open failed: %s\n", algo, gpg_strerror (err));
10123 return;
10124 }
10125
10126 mdlen = gcry_md_get_algo_dlen (algo);
10127 if (mdlen < 1 || mdlen > 500)
10128 {
10129 if (mdlen == 0 && (algo == GCRY_MD_SHAKE128 || algo == GCRY_MD_SHAKE256))
10130 {
10131 xof = 1;
10132 }
10133 else
10134 {
10135 gcry_md_close (hd);
10136 fail ("algo %d, gcry_md_get_algo_dlen failed: %d\n", algo, mdlen);
10137 return;
10138 }
10139 }
10140
10141 if (key && klen)
10142 {
10143 clutter_vector_registers();
10144 err = gcry_md_setkey (hd, key, klen);
10145 if (err)
10146 {
10147 gcry_md_close (hd);
10148 fail ("algo %d, gcry_md_setkey failed: %s\n", algo, gpg_strerror (err));
10149 return;
10150 }
10151 }
10152
10153 if (*data == '!' && !data[1] && !xof)
10154 {
10155 unsigned char *p1, *p2;
10156 char buf[129];
10157
10158 /* Test hashing small input sizes first as full block, then byte-by-byte
10159 * and check that resulting digests are the same. */
10160
10161 err = gcry_md_open (&hd2, algo, 0);
10162 if (err)
10163 {
10164 gcry_md_close (hd);
10165 fail ("algo %d, gcry_md_open failed: %s\n", algo, gpg_strerror (err));
10166 return;
10167 }
10168
10169 if (key && klen)
10170 {
10171 clutter_vector_registers();
10172 err = gcry_md_setkey (hd2, key, klen);
10173 if (err)
10174 {
10175 gcry_md_close (hd);
10176 gcry_md_close (hd2);
10177 fail ("algo %d, gcry_md_setkey failed: %s\n", algo, gpg_strerror (err));
10178 return;
10179 }
10180 }
10181
10182 for (i = 0; i < sizeof(buf); i++)
10183 buf[i] = i;
10184
10185 for (i = 1; i < sizeof(buf); i++)
10186 {
10187 gcry_md_reset (hd);
10188 gcry_md_reset (hd2);
10189
10190 clutter_vector_registers();
10191 gcry_md_write (hd, buf, i);
10192 for (j = 0; j < i; j++)
10193 gcry_md_write (hd2, &buf[j], 1);
10194
10195 clutter_vector_registers();
10196 p1 = gcry_md_read (hd, algo);
10197 p2 = gcry_md_read (hd2, algo);
10198 if (memcmp (p1, p2, mdlen))
10199 {
10200 printf ("full block (input length %d): ", i);
10201 for (i = 0; i < mdlen; i++)
10202 printf ("%02x ", p1[i] & 0xFF);
10203 printf ("\nbyte-by-byte: ");
10204 for (i = 0; i < mdlen; i++)
10205 printf ("%02x ", p2[i] & 0xFF);
10206 printf ("\n");
10207
10208 fail ("algo %d, digest mismatch\n", algo);
10209 }
10210 }
10211
10212 gcry_md_close (hd2);
10213 gcry_md_reset (hd);
10214 }
10215
10216 if ((*data == '!' && !data[1]) || /* hash one million times a "a" */
10217 (*data == '?' && !data[1])) /* hash million byte data-set with byte pattern 0x00,0x01,0x02,... */
10218 {
10219 char aaa[1000];
10220 size_t left = 1000 * 1000;
10221 size_t startlen = 1;
10222 size_t piecelen = startlen;
10223
10224 if (*data == '!')
10225 memset (aaa, 'a', 1000);
10226
10227 /* Write in chuck with all sizes 1 to 1000 (500500 bytes) */
10228 for (i = 1; i <= 1000 && left > 0; i++)
10229 {
10230 piecelen = i;
10231 if (piecelen > sizeof(aaa))
10232 piecelen = sizeof(aaa);
10233 if (piecelen > left)
10234 piecelen = left;
10235
10236 if (*data == '?')
10237 fillbuf_count(aaa, piecelen, 1000 * 1000 - left);
10238
10239 clutter_vector_registers();
10240 gcry_md_write (hd, aaa, piecelen);
10241
10242 left -= piecelen;
10243 }
10244
10245 /* Write in odd size chunks so that we test the buffering. */
10246 while (left > 0)
10247 {
10248 if (piecelen > sizeof(aaa))
10249 piecelen = sizeof(aaa);
10250 if (piecelen > left)
10251 piecelen = left;
10252
10253 if (*data == '?')
10254 fillbuf_count(aaa, piecelen, 1000 * 1000 - left);
10255
10256 clutter_vector_registers();
10257 gcry_md_write (hd, aaa, piecelen);
10258
10259 left -= piecelen;
10260
10261 if (piecelen == sizeof(aaa))
10262 piecelen = ++startlen;
10263 else
10264 piecelen = piecelen * 2 - ((piecelen != startlen) ? startlen : 0);
10265 }
10266 }
10267 else
10268 {
10269 clutter_vector_registers();
10270 gcry_md_write (hd, data, len);
10271 }
10272
10273 clutter_vector_registers();
10274 err = gcry_md_copy (&hd2, hd);
10275 if (err)
10276 {
10277 fail ("algo %d, gcry_md_copy failed: %s\n", algo, gpg_strerror (err));
10278 }
10279
10280 gcry_md_close (hd);
10281
10282 if (!xof)
10283 {
10284 static const char buf[128];
10285
10286 clutter_vector_registers();
10287 p = gcry_md_read (hd2, algo);
10288
10289 if (memcmp (p, expect, mdlen))
10290 {
10291 printf ("computed: ");
10292 for (i = 0; i < mdlen; i++)
10293 printf ("%02x ", p[i] & 0xFF);
10294 printf ("\nexpected: ");
10295 for (i = 0; i < mdlen; i++)
10296 printf ("%02x ", expect[i] & 0xFF);
10297 printf ("\n");
10298
10299 fail ("algo %d, digest mismatch\n", algo);
10300 }
10301
10302 /* Write after final/read is allowed for timing attack mitigation
10303 * purposes. Try writing and see if we catch fire. */
10304 clutter_vector_registers();
10305 gcry_md_write (hd2, buf, sizeof(buf));
10306 }
10307 else
10308 {
10309 char buf[1000];
10310 int outmax = sizeof(buf) > elen ? elen : sizeof(buf);
10311
10312 clutter_vector_registers();
10313 err = gcry_md_copy (&hd, hd2);
10314 if (err)
10315 {
10316 fail ("algo %d, gcry_md_copy failed: %s\n", algo, gpg_strerror (err));
10317 }
10318
10319 clutter_vector_registers();
10320 err = gcry_md_extract(hd2, algo, buf, outmax);
10321 if (err)
10322 {
10323 fail ("algo %d, gcry_md_extract failed: %s\n", algo, gpg_strerror (err));
10324 }
10325
10326 if (memcmp (buf, expect, outmax))
10327 {
10328 printf ("computed: ");
10329 for (i = 0; i < outmax; i++)
10330 printf ("%02x ", buf[i] & 0xFF);
10331 printf ("\nexpected: ");
10332 for (i = 0; i < outmax; i++)
10333 printf ("%02x ", expect[i] & 0xFF);
10334 printf ("\n");
10335
10336 fail ("algo %d, digest mismatch\n", algo);
10337 }
10338
10339 memset(buf, 0, sizeof(buf));
10340
10341 /* Extract one byte at time. */
10342 clutter_vector_registers();
10343 for (i = 0; i < outmax && !err; i++)
10344 err = gcry_md_extract(hd, algo, &buf[i], 1);
10345 if (err)
10346 {
10347 fail ("algo %d, gcry_md_extract failed: %s\n", algo, gpg_strerror (err));
10348 }
10349
10350 if (memcmp (buf, expect, outmax))
10351 {
10352 printf ("computed: ");
10353 for (i = 0; i < outmax; i++)
10354 printf ("%02x ", buf[i] & 0xFF);
10355 printf ("\nexpected: ");
10356 for (i = 0; i < outmax; i++)
10357 printf ("%02x ", expect[i] & 0xFF);
10358 printf ("\n");
10359
10360 fail ("algo %d, digest mismatch\n", algo);
10361 }
10362
10363 if (*data == '!' && !data[1])
10364 {
10365 int crcalgo = GCRY_MD_RMD160;
10366 gcry_md_hd_t crc1, crc2;
10367 size_t startlen;
10368 size_t piecelen;
10369 size_t left;
10370 const unsigned char *p1, *p2;
10371 int crclen;
10372
10373 crclen = gcry_md_get_algo_dlen (crcalgo);
10374
10375 err = gcry_md_open (&crc1, crcalgo, 0);
10376 if (err)
10377 {
10378 fail ("algo %d, crcalgo: %d, gcry_md_open failed: %s\n", algo,
10379 crcalgo, gpg_strerror (err));
10380 return;
10381 }
10382
10383 err = gcry_md_open (&crc2, crcalgo, 0);
10384 if (err)
10385 {
10386 fail ("algo %d, crcalgo: %d, gcry_md_open failed: %s\n", algo,
10387 crcalgo, gpg_strerror (err));
10388 return;
10389 }
10390
10391 /* Extract large chucks, total 1000000 additional bytes. */
10392 for (i = 0; i < 1000; i++)
10393 {
10394 clutter_vector_registers();
10395 err = gcry_md_extract(hd, algo, buf, 1000);
10396 if (!err)
10397 gcry_md_write(crc1, buf, 1000);
10398 }
10399 if (err)
10400 {
10401 fail ("algo %d, gcry_md_extract failed: %s\n", algo,
10402 gpg_strerror (err));
10403 }
10404
10405 /* Extract in odd size chunks, total 1000000 additional bytes. */
10406 left = 1000 * 1000;
10407 startlen = 1;
10408 piecelen = startlen;
10409
10410 while (!err && left > 0)
10411 {
10412 if (piecelen > sizeof(buf))
10413 piecelen = sizeof(buf);
10414 if (piecelen > left)
10415 piecelen = left;
10416
10417 clutter_vector_registers();
10418 err = gcry_md_extract (hd2, algo, buf, piecelen);
10419 if (!err)
10420 gcry_md_write(crc2, buf, piecelen);
10421 if (err)
10422 {
10423 fail ("algo %d, gcry_md_extract failed: %s\n", algo,
10424 gpg_strerror (err));
10425 }
10426
10427 left -= piecelen;
10428
10429 if (piecelen == sizeof(buf))
10430 piecelen = ++startlen;
10431 else
10432 piecelen = piecelen * 2 - ((piecelen != startlen) ? startlen : 0);
10433 }
10434
10435 clutter_vector_registers();
10436 p1 = gcry_md_read (crc1, crcalgo);
10437 clutter_vector_registers();
10438 p2 = gcry_md_read (crc2, crcalgo);
10439
10440 if (memcmp (p1, p2, crclen))
10441 {
10442 printf ("computed: ");
10443 for (i = 0; i < crclen; i++)
10444 printf ("%02x ", p2[i] & 0xFF);
10445 printf ("\nexpected: ");
10446 for (i = 0; i < crclen; i++)
10447 printf ("%02x ", p1[i] & 0xFF);
10448 printf ("\n");
10449
10450 fail ("algo %d, large xof output mismatch\n", algo);
10451 }
10452
10453 gcry_md_close (crc1);
10454 gcry_md_close (crc2);
10455 }
10456
10457 gcry_md_close (hd);
10458 }
10459
10460 gcry_md_close (hd2);
10461 }
10462
10463
10464 static void
check_one_md_multi(int algo,const char * data,int len,const char * expect)10465 check_one_md_multi (int algo, const char *data, int len, const char *expect)
10466 {
10467 gpg_error_t err;
10468 gcry_buffer_t iov[3];
10469 int iovcnt;
10470 char digest[64];
10471 int mdlen;
10472 int i;
10473
10474 mdlen = gcry_md_get_algo_dlen (algo);
10475 if (mdlen < 1 || mdlen > 64)
10476 {
10477 if (mdlen == 0 && (algo == GCRY_MD_SHAKE128 || algo == GCRY_MD_SHAKE256))
10478 return;
10479
10480 fail ("check_one_md_multi: algo %d, gcry_md_get_algo_dlen failed: %d\n",
10481 algo, mdlen);
10482 return;
10483 }
10484
10485 if (*data == '!' && !data[1])
10486 return; /* We can't do that here. */
10487 if (*data == '?' && !data[1])
10488 return; /* We can't do that here. */
10489
10490 memset (iov, 0, sizeof iov);
10491
10492 iov[0].data = (void*)data;
10493 if (len)
10494 {
10495 iov[0].len = 1;
10496 len--;
10497 data++;
10498 }
10499 iovcnt = 1;
10500 if (len >= 4)
10501 {
10502 iov[iovcnt].data = (void*)data;
10503 iov[iovcnt].len = 4;
10504 iovcnt++;
10505 data += 4;
10506 len -= 4;
10507 }
10508 iov[iovcnt].data = (void*)data;
10509 iov[iovcnt].len = len;
10510 iovcnt++;
10511 assert (iovcnt <= DIM (iov));
10512
10513 clutter_vector_registers();
10514 err = gcry_md_hash_buffers (algo, 0, digest, iov, iovcnt);
10515 if (err)
10516 {
10517 fail ("check_one_md_multi: algo %d, gcry_hash_buffers failed: %s\n",
10518 algo, gpg_strerror (err));
10519 return;
10520 }
10521 if (memcmp (digest, expect, mdlen))
10522 {
10523 printf ("computed: ");
10524 for (i = 0; i < mdlen; i++)
10525 printf ("%02x ", digest[i] & 0xFF);
10526 printf ("\nexpected: ");
10527 for (i = 0; i < mdlen; i++)
10528 printf ("%02x ", expect[i] & 0xFF);
10529 printf ("\n");
10530
10531 fail ("check_one_md_multi: algo %d, digest mismatch\n", algo);
10532 }
10533 }
10534
10535
10536 static void
check_one_md_final(int algo,const char * expect,unsigned int expectlen)10537 check_one_md_final(int algo, const char *expect, unsigned int expectlen)
10538 {
10539 const unsigned int max_inbuf_len = 288 + 1;
10540 char *inbuf;
10541 char xorbuf[64];
10542 char digest[64];
10543 unsigned int mdlen;
10544 int i, j;
10545
10546 mdlen = gcry_md_get_algo_dlen (algo);
10547 if (mdlen < 1 || mdlen > 64)
10548 {
10549 return;
10550 }
10551
10552 if (expectlen == 0)
10553 expectlen = mdlen;
10554
10555 if (expectlen != mdlen)
10556 {
10557 fail ("check_one_md_final: algo %d, digest length mismatch\n", algo);
10558 return;
10559 }
10560
10561 clutter_vector_registers();
10562 gcry_md_hash_buffer (algo, xorbuf, NULL, 0);
10563 for (i = 1; i < max_inbuf_len; i++)
10564 {
10565 inbuf = xmalloc(i);
10566 if (!inbuf)
10567 {
10568 fail ("out-of-memory\n");
10569 return;
10570 }
10571
10572 for (j = 0; j < i; j++)
10573 inbuf[j] = j;
10574
10575 gcry_md_hash_buffer (algo, digest, inbuf, i);
10576 for (j = 0; j < expectlen; j++)
10577 xorbuf[j] ^= digest[j];
10578
10579 xfree (inbuf);
10580 }
10581
10582 if (memcmp(expect, xorbuf, expectlen) != 0)
10583 {
10584 printf ("computed: ");
10585 for (i = 0; i < expectlen; i++)
10586 printf ("%02x ", xorbuf[i] & 0xFF);
10587 printf ("\nexpected: ");
10588 for (i = 0; i < expectlen; i++)
10589 printf ("%02x ", expect[i] & 0xFF);
10590 printf ("\n");
10591
10592 fail ("check_one_md_final: algo %d, digest mismatch\n", algo);
10593 }
10594 }
10595
10596
10597 static void
check_digests(void)10598 check_digests (void)
10599 {
10600 static const char blake2_data_vector[] =
10601 "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
10602 "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f"
10603 "\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f"
10604 "\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f"
10605 "\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f"
10606 "\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f"
10607 "\x60\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f"
10608 "\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f"
10609 "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f"
10610 "\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f"
10611 "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf"
10612 "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf"
10613 "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf"
10614 "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf"
10615 "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef"
10616 "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff";
10617 static const struct algos
10618 {
10619 int md;
10620 const char *data;
10621 const char *expect;
10622 int datalen;
10623 int expectlen;
10624 const char *key;
10625 int keylen;
10626 } algos[] =
10627 {
10628 { GCRY_MD_MD2, "",
10629 "\x83\x50\xe5\xa3\xe2\x4c\x15\x3d\xf2\x27\x5c\x9f\x80\x69\x27\x73" },
10630 { GCRY_MD_MD2, "a",
10631 "\x32\xec\x01\xec\x4a\x6d\xac\x72\xc0\xab\x96\xfb\x34\xc0\xb5\xd1" },
10632 { GCRY_MD_MD2, "message digest",
10633 "\xab\x4f\x49\x6b\xfb\x2a\x53\x0b\x21\x9f\xf3\x30\x31\xfe\x06\xb0" },
10634 { GCRY_MD_MD4, "",
10635 "\x31\xD6\xCF\xE0\xD1\x6A\xE9\x31\xB7\x3C\x59\xD7\xE0\xC0\x89\xC0" },
10636 { GCRY_MD_MD4, "a",
10637 "\xbd\xe5\x2c\xb3\x1d\xe3\x3e\x46\x24\x5e\x05\xfb\xdb\xd6\xfb\x24" },
10638 { GCRY_MD_MD4, "message digest",
10639 "\xd9\x13\x0a\x81\x64\x54\x9f\xe8\x18\x87\x48\x06\xe1\xc7\x01\x4b" },
10640 { GCRY_MD_MD5, "",
10641 "\xD4\x1D\x8C\xD9\x8F\x00\xB2\x04\xE9\x80\x09\x98\xEC\xF8\x42\x7E" },
10642 { GCRY_MD_MD5, "a",
10643 "\x0C\xC1\x75\xB9\xC0\xF1\xB6\xA8\x31\xC3\x99\xE2\x69\x77\x26\x61" },
10644 { GCRY_MD_MD5, "abc",
10645 "\x90\x01\x50\x98\x3C\xD2\x4F\xB0\xD6\x96\x3F\x7D\x28\xE1\x7F\x72" },
10646 { GCRY_MD_MD5, "message digest",
10647 "\xF9\x6B\x69\x7D\x7C\xB7\x93\x8D\x52\x5A\x2F\x31\xAA\xF1\x61\xD0" },
10648 { GCRY_MD_MD5,
10649 "Libgcrypt is free software; you can redistribute it and/or modif"
10650 "y it under the terms of the GNU Lesser general Public License as"
10651 " published by the Free Software Foundation; either version 2.1 o"
10652 "f the License, or (at your option) any later version.\nLibgcrypt"
10653 " is distributed in the hope that it will be useful, but WITHOUT "
10654 "ANY WARRANTY; without even the implied warranty of MERCHANTABILI"
10655 "TY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser Gene"
10656 "ral Public License for more details.",
10657 "\xc4\x1a\x5c\x0b\x44\x5f\xba\x1a\xda\xbc\xc0\x38\x0e\x0c\x9e\x33" },
10658 { GCRY_MD_MD5, "!",
10659 "\x77\x07\xd6\xae\x4e\x02\x7c\x70\xee\xa2\xa9\x35\xc2\x29\x6f\x21" },
10660 { GCRY_MD_MD5, "?",
10661 "\x5c\x72\x5c\xbc\x2d\xbb\xe1\x14\x81\x59\xe9\xd9\xcf\x90\x64\x8f" },
10662 { GCRY_MD_SHA1, "abc",
10663 "\xA9\x99\x3E\x36\x47\x06\x81\x6A\xBA\x3E"
10664 "\x25\x71\x78\x50\xC2\x6C\x9C\xD0\xD8\x9D" },
10665 { GCRY_MD_SHA1,
10666 "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
10667 "\x84\x98\x3E\x44\x1C\x3B\xD2\x6E\xBA\xAE"
10668 "\x4A\xA1\xF9\x51\x29\xE5\xE5\x46\x70\xF1" },
10669 { GCRY_MD_SHA1, "!" /* kludge for "a"*1000000 */ ,
10670 "\x34\xAA\x97\x3C\xD4\xC4\xDA\xA4\xF6\x1E"
10671 "\xEB\x2B\xDB\xAD\x27\x31\x65\x34\x01\x6F" },
10672 { GCRY_MD_SHA1, "?" /* kludge for "\x00\x01\x02"..."\xfe\xff\x00\x01"... (length 1000000) */ ,
10673 "\x5f\x8d\x3c\x4f\x12\xf0\x49\x9e\x28\x73"
10674 "\x79\xec\x97\x3b\x98\x4c\x94\x75\xaa\x8f" },
10675 { GCRY_MD_SHA1,
10676 "Libgcrypt is free software; you can redistribute it and/or modif"
10677 "y it under the terms of the GNU Lesser general Public License as"
10678 " published by the Free Software Foundation; either version 2.1 o"
10679 "f the License, or (at your option) any later version.\nLibgcrypt"
10680 " is distributed in the hope that it will be useful, but WITHOUT "
10681 "ANY WARRANTY; without even the implied warranty of MERCHANTABILI"
10682 "TY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser Gene"
10683 "ral Public License for more details.",
10684 "\xf5\xd9\xcb\x66\x91\xb4\x7a\x7c\x60\x35\xe2\x1c\x38\x26\x52\x13"
10685 "\x8e\xd5\xe5\xdf" },
10686 /* From RFC3874 */
10687 { GCRY_MD_SHA224, "abc",
10688 "\x23\x09\x7d\x22\x34\x05\xd8\x22\x86\x42\xa4\x77\xbd\xa2\x55\xb3"
10689 "\x2a\xad\xbc\xe4\xbd\xa0\xb3\xf7\xe3\x6c\x9d\xa7" },
10690 { GCRY_MD_SHA224,
10691 "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
10692 "\x75\x38\x8b\x16\x51\x27\x76\xcc\x5d\xba\x5d\xa1\xfd\x89\x01\x50"
10693 "\xb0\xc6\x45\x5c\xb4\xf5\x8b\x19\x52\x52\x25\x25" },
10694 { GCRY_MD_SHA224, "!",
10695 "\x20\x79\x46\x55\x98\x0c\x91\xd8\xbb\xb4\xc1\xea\x97\x61\x8a\x4b"
10696 "\xf0\x3f\x42\x58\x19\x48\xb2\xee\x4e\xe7\xad\x67" },
10697 { GCRY_MD_SHA224, "?",
10698 "\xfa\xb9\xf0\xdf\x12\xfe\xa1\x1a\x34\x78\x96\x31\xe6\x53\x48\xbf"
10699 "\x3b\xca\x70\x78\xf2\x44\xdf\x62\xab\x27\xb8\xda" },
10700 { GCRY_MD_SHA224,
10701 "Libgcrypt is free software; you can redistribute it and/or modif"
10702 "y it under the terms of the GNU Lesser general Public License as"
10703 " published by the Free Software Foundation; either version 2.1 o"
10704 "f the License, or (at your option) any later version.\nLibgcrypt"
10705 " is distributed in the hope that it will be useful, but WITHOUT "
10706 "ANY WARRANTY; without even the implied warranty of MERCHANTABILI"
10707 "TY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser Gene"
10708 "ral Public License for more details.",
10709 "\x80\xf0\x60\x79\xb0\xe9\x65\xab\x8a\x76\xbf\x6e\x88\x64\x75\xe7"
10710 "\xfd\xf0\xc2\x4c\xf6\xf2\xa6\x01\xed\x50\x71\x08" },
10711 { GCRY_MD_SHA256, "abc",
10712 "\xba\x78\x16\xbf\x8f\x01\xcf\xea\x41\x41\x40\xde\x5d\xae\x22\x23"
10713 "\xb0\x03\x61\xa3\x96\x17\x7a\x9c\xb4\x10\xff\x61\xf2\x00\x15\xad" },
10714 { GCRY_MD_SHA256,
10715 "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
10716 "\x24\x8d\x6a\x61\xd2\x06\x38\xb8\xe5\xc0\x26\x93\x0c\x3e\x60\x39"
10717 "\xa3\x3c\xe4\x59\x64\xff\x21\x67\xf6\xec\xed\xd4\x19\xdb\x06\xc1" },
10718 { GCRY_MD_SHA256, "!",
10719 "\xcd\xc7\x6e\x5c\x99\x14\xfb\x92\x81\xa1\xc7\xe2\x84\xd7\x3e\x67"
10720 "\xf1\x80\x9a\x48\xa4\x97\x20\x0e\x04\x6d\x39\xcc\xc7\x11\x2c\xd0" },
10721 { GCRY_MD_SHA256, "?",
10722 "\x67\x87\x0d\xfc\x9c\x64\xe7\xaa\x27\x0a\x3f\x7e\x80\x51\xae\x65"
10723 "\xd2\x07\xf9\x3f\xc3\xdf\x04\xd7\x57\x2e\x63\x65\xaf\x69\xcd\x0d" },
10724 { GCRY_MD_SHA256,
10725 "Libgcrypt is free software; you can redistribute it and/or modif"
10726 "y it under the terms of the GNU Lesser general Public License as"
10727 " published by the Free Software Foundation; either version 2.1 o"
10728 "f the License, or (at your option) any later version.\nLibgcrypt"
10729 " is distributed in the hope that it will be useful, but WITHOUT "
10730 "ANY WARRANTY; without even the implied warranty of MERCHANTABILI"
10731 "TY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser Gene"
10732 "ral Public License for more details.",
10733 "\xb0\x18\x70\x67\xb8\xac\x68\x50\xec\x95\x43\x77\xb5\x44\x5b\x0f"
10734 "\x2e\xbd\x40\xc9\xdc\x2a\x2c\x33\x8b\x53\xeb\x3e\x9e\x01\xd7\x02" },
10735 { GCRY_MD_SHA384, "abc",
10736 "\xcb\x00\x75\x3f\x45\xa3\x5e\x8b\xb5\xa0\x3d\x69\x9a\xc6\x50\x07"
10737 "\x27\x2c\x32\xab\x0e\xde\xd1\x63\x1a\x8b\x60\x5a\x43\xff\x5b\xed"
10738 "\x80\x86\x07\x2b\xa1\xe7\xcc\x23\x58\xba\xec\xa1\x34\xc8\x25\xa7" },
10739 { GCRY_MD_SHA384,
10740 "Libgcrypt is free software; you can redistribute it and/or modif"
10741 "y it under the terms of the GNU Lesser general Public License as"
10742 " published by the Free Software Foundation; either version 2.1 o"
10743 "f the License, or (at your option) any later version.\nLibgcrypt"
10744 " is distributed in the hope that it will be useful, but WITHOUT "
10745 "ANY WARRANTY; without even the implied warranty of MERCHANTABILI"
10746 "TY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser Gene"
10747 "ral Public License for more details.",
10748 "\xe4\x6d\xb4\x28\x33\x77\x99\x49\x94\x0f\xcf\x87\xc2\x2f\x30\xd6"
10749 "\x06\x24\x82\x9d\x80\x64\x8a\x07\xa1\x20\x8f\x5f\xf3\x85\xb3\xaa"
10750 "\x39\xb8\x61\x00\xfc\x7f\x18\xc6\x82\x23\x4b\x45\xfa\xf1\xbc\x69" },
10751 { GCRY_MD_SHA384, "!",
10752 "\x9d\x0e\x18\x09\x71\x64\x74\xcb\x08\x6e\x83\x4e\x31\x0a\x4a\x1c"
10753 "\xed\x14\x9e\x9c\x00\xf2\x48\x52\x79\x72\xce\xc5\x70\x4c\x2a\x5b"
10754 "\x07\xb8\xb3\xdc\x38\xec\xc4\xeb\xae\x97\xdd\xd8\x7f\x3d\x89\x85" },
10755 { GCRY_MD_SHA384, "?",
10756 "\xfa\x77\xbb\x86\x3a\xd5\xae\x88\xa9\x9c\x5e\xda\xb5\xc7\xcb\x40"
10757 "\xcd\xf4\x30\xef\xa8\x1b\x23\x7b\xa9\xde\xfd\x81\x12\xf6\x7e\xed"
10758 "\xa7\xd2\x27\x91\xd1\xbc\x76\x44\x57\x59\x71\x11\xe6\x8a\x2c\xde" },
10759 { GCRY_MD_SHA512, "abc",
10760 "\xDD\xAF\x35\xA1\x93\x61\x7A\xBA\xCC\x41\x73\x49\xAE\x20\x41\x31"
10761 "\x12\xE6\xFA\x4E\x89\xA9\x7E\xA2\x0A\x9E\xEE\xE6\x4B\x55\xD3\x9A"
10762 "\x21\x92\x99\x2A\x27\x4F\xC1\xA8\x36\xBA\x3C\x23\xA3\xFE\xEB\xBD"
10763 "\x45\x4D\x44\x23\x64\x3C\xE8\x0E\x2A\x9A\xC9\x4F\xA5\x4C\xA4\x9F" },
10764 { GCRY_MD_SHA512,
10765 "Libgcrypt is free software; you can redistribute it and/or modif"
10766 "y it under the terms of the GNU Lesser general Public License as"
10767 " published by the Free Software Foundation; either version 2.1 o"
10768 "f the License, or (at your option) any later version.\nLibgcrypt"
10769 " is distributed in the hope that it will be useful, but WITHOUT "
10770 "ANY WARRANTY; without even the implied warranty of MERCHANTABILI"
10771 "TY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser Gene"
10772 "ral Public License for more details.",
10773 "\x72\x8c\xde\xd8\xe4\xd7\xb6\xa5\x0f\xde\x6b\x4d\x33\xaf\x15\x19"
10774 "\xdd\xec\x62\x0f\xf7\x1a\x1e\x10\x32\x05\x02\xa6\xb0\x1f\x70\x37"
10775 "\xbc\xd7\x15\xed\x71\x6c\x78\x20\xc8\x54\x87\xd0\x66\x6a\x17\x83"
10776 "\x05\x61\x92\xbe\xcc\x8f\x3b\xbf\x11\x72\x22\x69\x23\x5b\x48\x5c" },
10777 { GCRY_MD_SHA512, "!",
10778 "\xe7\x18\x48\x3d\x0c\xe7\x69\x64\x4e\x2e\x42\xc7\xbc\x15\xb4\x63"
10779 "\x8e\x1f\x98\xb1\x3b\x20\x44\x28\x56\x32\xa8\x03\xaf\xa9\x73\xeb"
10780 "\xde\x0f\xf2\x44\x87\x7e\xa6\x0a\x4c\xb0\x43\x2c\xe5\x77\xc3\x1b"
10781 "\xeb\x00\x9c\x5c\x2c\x49\xaa\x2e\x4e\xad\xb2\x17\xad\x8c\xc0\x9b" },
10782 { GCRY_MD_SHA512, "?",
10783 "\x91\xe9\x42\x4e\xa9\xdc\x44\x01\x40\x64\xa4\x5a\x69\xcc\xac\xa3"
10784 "\x74\xee\x78\xeb\x79\x1f\x94\x38\x5b\x73\xef\xf8\xfd\x5d\x74\xd8"
10785 "\x51\x36\xfe\x63\x52\xde\x07\x70\x95\xd6\x78\x2b\x7b\x46\x8a\x2c"
10786 "\x30\x0f\x48\x0c\x74\x43\x06\xdb\xa3\x8d\x64\x3d\xe9\xa1\xa7\x72" },
10787 { GCRY_MD_SHA512_256, "abc",
10788 "\x53\x04\x8E\x26\x81\x94\x1E\xF9\x9B\x2E\x29\xB7\x6B\x4C\x7D\xAB"
10789 "\xE4\xC2\xD0\xC6\x34\xFC\x6D\x46\xE0\xE2\xF1\x31\x07\xE7\xAF\x23" },
10790 { GCRY_MD_SHA512_256, "!",
10791 "\x9a\x59\xa0\x52\x93\x01\x87\xa9\x70\x38\xca\xe6\x92\xf3\x07\x08"
10792 "\xaa\x64\x91\x92\x3e\xf5\x19\x43\x94\xdc\x68\xd5\x6c\x74\xfb\x21" },
10793 { GCRY_MD_SHA512_224, "abc",
10794 "\x46\x34\x27\x0F\x70\x7B\x6A\x54\xDA\xAE\x75\x30\x46\x08\x42\xE2"
10795 "\x0E\x37\xED\x26\x5C\xEE\xE9\xA4\x3E\x89\x24\xAA" },
10796 { GCRY_MD_SHA512_224, "!",
10797 "\x37\xab\x33\x1d\x76\xf0\xd3\x6d\xe4\x22\xbd\x0e\xde\xb2\x2a\x28"
10798 "\xac\xcd\x48\x7b\x7a\x84\x53\xae\x96\x5d\xd2\x87" },
10799 { GCRY_MD_SHA3_224, "abc",
10800 "\xe6\x42\x82\x4c\x3f\x8c\xf2\x4a\xd0\x92\x34\xee\x7d\x3c\x76\x6f"
10801 "\xc9\xa3\xa5\x16\x8d\x0c\x94\xad\x73\xb4\x6f\xdf" },
10802 { GCRY_MD_SHA3_256, "abc",
10803 "\x3a\x98\x5d\xa7\x4f\xe2\x25\xb2\x04\x5c\x17\x2d\x6b\xd3\x90\xbd"
10804 "\x85\x5f\x08\x6e\x3e\x9d\x52\x5b\x46\xbf\xe2\x45\x11\x43\x15\x32" },
10805 { GCRY_MD_SHA3_384, "abc",
10806 "\xec\x01\x49\x82\x88\x51\x6f\xc9\x26\x45\x9f\x58\xe2\xc6\xad\x8d"
10807 "\xf9\xb4\x73\xcb\x0f\xc0\x8c\x25\x96\xda\x7c\xf0\xe4\x9b\xe4\xb2"
10808 "\x98\xd8\x8c\xea\x92\x7a\xc7\xf5\x39\xf1\xed\xf2\x28\x37\x6d\x25" },
10809 { GCRY_MD_SHA3_512, "abc",
10810 "\xb7\x51\x85\x0b\x1a\x57\x16\x8a\x56\x93\xcd\x92\x4b\x6b\x09\x6e"
10811 "\x08\xf6\x21\x82\x74\x44\xf7\x0d\x88\x4f\x5d\x02\x40\xd2\x71\x2e"
10812 "\x10\xe1\x16\xe9\x19\x2a\xf3\xc9\x1a\x7e\xc5\x76\x47\xe3\x93\x40"
10813 "\x57\x34\x0b\x4c\xf4\x08\xd5\xa5\x65\x92\xf8\x27\x4e\xec\x53\xf0" },
10814 { GCRY_MD_SHA3_224, "",
10815 "\x6b\x4e\x03\x42\x36\x67\xdb\xb7\x3b\x6e\x15\x45\x4f\x0e\xb1\xab"
10816 "\xd4\x59\x7f\x9a\x1b\x07\x8e\x3f\x5b\x5a\x6b\xc7" },
10817 { GCRY_MD_SHA3_256, "",
10818 "\xa7\xff\xc6\xf8\xbf\x1e\xd7\x66\x51\xc1\x47\x56\xa0\x61\xd6\x62"
10819 "\xf5\x80\xff\x4d\xe4\x3b\x49\xfa\x82\xd8\x0a\x4b\x80\xf8\x43\x4a" },
10820 { GCRY_MD_SHA3_384, "",
10821 "\x0c\x63\xa7\x5b\x84\x5e\x4f\x7d\x01\x10\x7d\x85\x2e\x4c\x24\x85"
10822 "\xc5\x1a\x50\xaa\xaa\x94\xfc\x61\x99\x5e\x71\xbb\xee\x98\x3a\x2a"
10823 "\xc3\x71\x38\x31\x26\x4a\xdb\x47\xfb\x6b\xd1\xe0\x58\xd5\xf0\x04" },
10824 { GCRY_MD_SHA3_512, "",
10825 "\xa6\x9f\x73\xcc\xa2\x3a\x9a\xc5\xc8\xb5\x67\xdc\x18\x5a\x75\x6e"
10826 "\x97\xc9\x82\x16\x4f\xe2\x58\x59\xe0\xd1\xdc\xc1\x47\x5c\x80\xa6"
10827 "\x15\xb2\x12\x3a\xf1\xf5\xf9\x4c\x11\xe3\xe9\x40\x2c\x3a\xc5\x58"
10828 "\xf5\x00\x19\x9d\x95\xb6\xd3\xe3\x01\x75\x85\x86\x28\x1d\xcd\x26" },
10829 { GCRY_MD_SHA3_224, "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlm"
10830 "nomnopnopq",
10831 "\x8a\x24\x10\x8b\x15\x4a\xda\x21\xc9\xfd\x55\x74\x49\x44\x79\xba"
10832 "\x5c\x7e\x7a\xb7\x6e\xf2\x64\xea\xd0\xfc\xce\x33" },
10833 { GCRY_MD_SHA3_256, "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlm"
10834 "nomnopnopq",
10835 "\x41\xc0\xdb\xa2\xa9\xd6\x24\x08\x49\x10\x03\x76\xa8\x23\x5e\x2c"
10836 "\x82\xe1\xb9\x99\x8a\x99\x9e\x21\xdb\x32\xdd\x97\x49\x6d\x33\x76" },
10837 { GCRY_MD_SHA3_384, "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlm"
10838 "nomnopnopq",
10839 "\x99\x1c\x66\x57\x55\xeb\x3a\x4b\x6b\xbd\xfb\x75\xc7\x8a\x49\x2e"
10840 "\x8c\x56\xa2\x2c\x5c\x4d\x7e\x42\x9b\xfd\xbc\x32\xb9\xd4\xad\x5a"
10841 "\xa0\x4a\x1f\x07\x6e\x62\xfe\xa1\x9e\xef\x51\xac\xd0\x65\x7c\x22" },
10842 { GCRY_MD_SHA3_512, "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlm"
10843 "nomnopnopq",
10844 "\x04\xa3\x71\xe8\x4e\xcf\xb5\xb8\xb7\x7c\xb4\x86\x10\xfc\xa8\x18"
10845 "\x2d\xd4\x57\xce\x6f\x32\x6a\x0f\xd3\xd7\xec\x2f\x1e\x91\x63\x6d"
10846 "\xee\x69\x1f\xbe\x0c\x98\x53\x02\xba\x1b\x0d\x8d\xc7\x8c\x08\x63"
10847 "\x46\xb5\x33\xb4\x9c\x03\x0d\x99\xa2\x7d\xaf\x11\x39\xd6\xe7\x5e" },
10848 { GCRY_MD_SHA3_224, "abcdefghbcdefghicdefghijdefghijkefghijklfghijk"
10849 "lmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu",
10850 "\x54\x3e\x68\x68\xe1\x66\x6c\x1a\x64\x36\x30\xdf\x77\x36\x7a\xe5"
10851 "\xa6\x2a\x85\x07\x0a\x51\xc1\x4c\xbf\x66\x5c\xbc" },
10852 { GCRY_MD_SHA3_256, "abcdefghbcdefghicdefghijdefghijkefghijklfghijk"
10853 "lmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu",
10854 "\x91\x6f\x60\x61\xfe\x87\x97\x41\xca\x64\x69\xb4\x39\x71\xdf\xdb"
10855 "\x28\xb1\xa3\x2d\xc3\x6c\xb3\x25\x4e\x81\x2b\xe2\x7a\xad\x1d\x18" },
10856 { GCRY_MD_SHA3_384, "abcdefghbcdefghicdefghijdefghijkefghijklfghijk"
10857 "lmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu",
10858 "\x79\x40\x7d\x3b\x59\x16\xb5\x9c\x3e\x30\xb0\x98\x22\x97\x47\x91"
10859 "\xc3\x13\xfb\x9e\xcc\x84\x9e\x40\x6f\x23\x59\x2d\x04\xf6\x25\xdc"
10860 "\x8c\x70\x9b\x98\xb4\x3b\x38\x52\xb3\x37\x21\x61\x79\xaa\x7f\xc7" },
10861 { GCRY_MD_SHA3_512, "abcdefghbcdefghicdefghijdefghijkefghijklfghijk"
10862 "lmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu",
10863 "\xaf\xeb\xb2\xef\x54\x2e\x65\x79\xc5\x0c\xad\x06\xd2\xe5\x78\xf9"
10864 "\xf8\xdd\x68\x81\xd7\xdc\x82\x4d\x26\x36\x0f\xee\xbf\x18\xa4\xfa"
10865 "\x73\xe3\x26\x11\x22\x94\x8e\xfc\xfd\x49\x2e\x74\xe8\x2e\x21\x89"
10866 "\xed\x0f\xb4\x40\xd1\x87\xf3\x82\x27\x0c\xb4\x55\xf2\x1d\xd1\x85" },
10867 { GCRY_MD_SHA3_224, "!",
10868 "\xd6\x93\x35\xb9\x33\x25\x19\x2e\x51\x6a\x91\x2e\x6d\x19\xa1\x5c"
10869 "\xb5\x1c\x6e\xd5\xc1\x52\x43\xe7\xa7\xfd\x65\x3c" },
10870 { GCRY_MD_SHA3_256, "!",
10871 "\x5c\x88\x75\xae\x47\x4a\x36\x34\xba\x4f\xd5\x5e\xc8\x5b\xff\xd6"
10872 "\x61\xf3\x2a\xca\x75\xc6\xd6\x99\xd0\xcd\xcb\x6c\x11\x58\x91\xc1" },
10873 { GCRY_MD_SHA3_384, "!",
10874 "\xee\xe9\xe2\x4d\x78\xc1\x85\x53\x37\x98\x34\x51\xdf\x97\xc8\xad"
10875 "\x9e\xed\xf2\x56\xc6\x33\x4f\x8e\x94\x8d\x25\x2d\x5e\x0e\x76\x84"
10876 "\x7a\xa0\x77\x4d\xdb\x90\xa8\x42\x19\x0d\x2c\x55\x8b\x4b\x83\x40" },
10877 { GCRY_MD_SHA3_512, "!",
10878 "\x3c\x3a\x87\x6d\xa1\x40\x34\xab\x60\x62\x7c\x07\x7b\xb9\x8f\x7e"
10879 "\x12\x0a\x2a\x53\x70\x21\x2d\xff\xb3\x38\x5a\x18\xd4\xf3\x88\x59"
10880 "\xed\x31\x1d\x0a\x9d\x51\x41\xce\x9c\xc5\xc6\x6e\xe6\x89\xb2\x66"
10881 "\xa8\xaa\x18\xac\xe8\x28\x2a\x0e\x0d\xb5\x96\xc9\x0b\x0a\x7b\x87" },
10882 { GCRY_MD_SHA3_224, "?",
10883 "\x1b\xd1\xc6\x12\x02\x35\x52\x8b\x44\x7e\x16\x39\x20\x05\xec\x67"
10884 "\x2d\x57\x20\xe0\x90\xc9\x78\x08\x86\x4f\x1b\xd0" },
10885 { GCRY_MD_SHA3_256, "?",
10886 "\xfe\xb7\xf4\x76\x78\x97\x48\x2f\xe2\x29\x1b\x66\x85\xc1\x7b\x45"
10887 "\xc5\x08\xed\x82\x50\xcc\x5d\x99\x96\xd2\xc3\x82\x1a\xa8\xd4\xa7" },
10888 { GCRY_MD_SHA3_384, "?",
10889 "\x45\x1f\x0b\x93\x4b\xca\x3e\x65\x93\xd4\xaa\x8c\x18\xc1\x04\x84"
10890 "\x12\xd5\x1e\x35\xe1\x05\xd9\x77\x3f\xc1\x08\x8b\x77\x36\xad\x4a"
10891 "\x33\x70\xaf\x49\x8b\xea\x4c\x5c\x52\xe7\x5b\xed\x31\x74\x57\x12" },
10892 { GCRY_MD_SHA3_512, "?",
10893 "\xa2\xee\xb5\x6f\x2a\x87\xa5\xb3\x9b\xd9\x1c\xf0\xaa\xdf\xb1\xd5"
10894 "\xad\x0a\x1a\xaa\xd3\x63\x81\xcf\xb8\x7c\x36\xa7\x80\x3b\x03\xd6"
10895 "\x31\x5c\x5d\x33\x8e\x52\xb1\x42\x4d\x27\x1c\xa2\xa5\xf2\xc5\x97"
10896 "\x10\x12\xe5\xee\x86\xa3\xcc\xaf\x91\x7a\x94\x28\x65\xea\x66\xe3" },
10897 { GCRY_MD_RMD160, "",
10898 "\x9c\x11\x85\xa5\xc5\xe9\xfc\x54\x61\x28"
10899 "\x08\x97\x7e\xe8\xf5\x48\xb2\x25\x8d\x31" },
10900 { GCRY_MD_RMD160, "a",
10901 "\x0b\xdc\x9d\x2d\x25\x6b\x3e\xe9\xda\xae"
10902 "\x34\x7b\xe6\xf4\xdc\x83\x5a\x46\x7f\xfe" },
10903 { GCRY_MD_RMD160, "abc",
10904 "\x8e\xb2\x08\xf7\xe0\x5d\x98\x7a\x9b\x04"
10905 "\x4a\x8e\x98\xc6\xb0\x87\xf1\x5a\x0b\xfc" },
10906 { GCRY_MD_RMD160, "message digest",
10907 "\x5d\x06\x89\xef\x49\xd2\xfa\xe5\x72\xb8"
10908 "\x81\xb1\x23\xa8\x5f\xfa\x21\x59\x5f\x36" },
10909 { GCRY_MD_RMD160,
10910 "Libgcrypt is free software; you can redistribute it and/or modif"
10911 "y it under the terms of the GNU Lesser general Public License as"
10912 " published by the Free Software Foundation; either version 2.1 o"
10913 "f the License, or (at your option) any later version.\nLibgcrypt"
10914 " is distributed in the hope that it will be useful, but WITHOUT "
10915 "ANY WARRANTY; without even the implied warranty of MERCHANTABILI"
10916 "TY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser Gene"
10917 "ral Public License for more details.",
10918 "\x06\x6d\x3c\x4e\xc9\xba\x89\x75\x16\x90\x96\x4e\xfd\x43\x07\xde"
10919 "\x04\xca\x69\x6b" },
10920 { GCRY_MD_RMD160, "!",
10921 "\x52\x78\x32\x43\xc1\x69\x7b\xdb\xe1\x6d\x37\xf9\x7f\x68\xf0\x83"
10922 "\x25\xdc\x15\x28" },
10923 { GCRY_MD_RMD160, "?",
10924 "\x68\x14\x86\x70\x3d\x51\x4e\x36\x68\x50\xf8\xb3\x00\x75\xda\x49"
10925 "\x0a\xaa\x2c\xf6" },
10926 { GCRY_MD_CRC32, "", "\x00\x00\x00\x00" },
10927 { GCRY_MD_CRC32, "foo", "\x8c\x73\x65\x21" },
10928 { GCRY_MD_CRC32,
10929 "Libgcrypt is free software; you can redistribute it and/or modif"
10930 "y it under the terms of the GNU Lesser general Public License as"
10931 " published by the Free Software Foundation; either version 2.1 o"
10932 "f the License, or (at your option) any later version.\nLibgcrypt"
10933 " is distributed in the hope that it will be useful, but WITHOUT "
10934 "ANY WARRANTY; without even the implied warranty of MERCHANTABILI"
10935 "TY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser Gene"
10936 "ral Public License for more details.",
10937 "\x4A\x53\x7D\x67" },
10938 { GCRY_MD_CRC32, "123456789", "\xcb\xf4\x39\x26" },
10939 { GCRY_MD_CRC32, "!", "\xdc\x25\xbf\xbc" },
10940 { GCRY_MD_CRC32, "?", "\x61\x82\x29\x1B" },
10941 { GCRY_MD_CRC32_RFC1510, "", "\x00\x00\x00\x00" },
10942 { GCRY_MD_CRC32_RFC1510, "foo", "\x73\x32\xbc\x33" },
10943 { GCRY_MD_CRC32_RFC1510, "test0123456789", "\xb8\x3e\x88\xd6" },
10944 { GCRY_MD_CRC32_RFC1510, "MASSACHVSETTS INSTITVTE OF TECHNOLOGY",
10945 "\xe3\x41\x80\xf7" },
10946 { GCRY_MD_CRC32_RFC1510, "\x80\x00", "\x3b\x83\x98\x4b", 2 },
10947 { GCRY_MD_CRC32_RFC1510, "\x00\x08", "\x0e\xdb\x88\x32", 2 },
10948 { GCRY_MD_CRC32_RFC1510, "\x00\x80", "\xed\xb8\x83\x20", 2 },
10949 { GCRY_MD_CRC32_RFC1510, "\x80", "\xed\xb8\x83\x20" },
10950 { GCRY_MD_CRC32_RFC1510, "\x80\x00\x00\x00", "\xed\x59\xb6\x3b", 4 },
10951 { GCRY_MD_CRC32_RFC1510, "\x00\x00\x00\x01", "\x77\x07\x30\x96", 4 },
10952 { GCRY_MD_CRC32_RFC1510, "123456789", "\x2d\xfd\x2d\x88" },
10953 { GCRY_MD_CRC32_RFC1510, "!", "\xce\x5c\x74\x22" },
10954 { GCRY_MD_CRC32_RFC1510, "?", "\x73\xfb\xe2\x85" },
10955 { GCRY_MD_CRC24_RFC2440, "", "\xb7\x04\xce" },
10956 { GCRY_MD_CRC24_RFC2440, "foo", "\x4f\xc2\x55" },
10957 { GCRY_MD_CRC24_RFC2440, "123456789", "\x21\xcf\x02" },
10958 { GCRY_MD_CRC24_RFC2440, "!", "\xa5\xcb\x6b" },
10959 { GCRY_MD_CRC24_RFC2440, "?", "\x7f\x67\x03" },
10960
10961 { GCRY_MD_TIGER, "",
10962 "\x24\xF0\x13\x0C\x63\xAC\x93\x32\x16\x16\x6E\x76"
10963 "\xB1\xBB\x92\x5F\xF3\x73\xDE\x2D\x49\x58\x4E\x7A" },
10964 { GCRY_MD_TIGER, "abc",
10965 "\xF2\x58\xC1\xE8\x84\x14\xAB\x2A\x52\x7A\xB5\x41"
10966 "\xFF\xC5\xB8\xBF\x93\x5F\x7B\x95\x1C\x13\x29\x51" },
10967 { GCRY_MD_TIGER, "Tiger",
10968 "\x9F\x00\xF5\x99\x07\x23\x00\xDD\x27\x6A\xBB\x38"
10969 "\xC8\xEB\x6D\xEC\x37\x79\x0C\x11\x6F\x9D\x2B\xDF" },
10970 { GCRY_MD_TIGER, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefg"
10971 "hijklmnopqrstuvwxyz0123456789+-",
10972 "\x87\xFB\x2A\x90\x83\x85\x1C\xF7\x47\x0D\x2C\xF8"
10973 "\x10\xE6\xDF\x9E\xB5\x86\x44\x50\x34\xA5\xA3\x86" },
10974 { GCRY_MD_TIGER, "ABCDEFGHIJKLMNOPQRSTUVWXYZ=abcdef"
10975 "ghijklmnopqrstuvwxyz+0123456789",
10976 "\x46\x7D\xB8\x08\x63\xEB\xCE\x48\x8D\xF1\xCD\x12"
10977 "\x61\x65\x5D\xE9\x57\x89\x65\x65\x97\x5F\x91\x97" },
10978 { GCRY_MD_TIGER, "Tiger - A Fast New Hash Function, "
10979 "by Ross Anderson and Eli Biham",
10980 "\x0C\x41\x0A\x04\x29\x68\x86\x8A\x16\x71\xDA\x5A"
10981 "\x3F\xD2\x9A\x72\x5E\xC1\xE4\x57\xD3\xCD\xB3\x03" },
10982 { GCRY_MD_TIGER, "Tiger - A Fast New Hash Function, "
10983 "by Ross Anderson and Eli Biham, proceedings of Fa"
10984 "st Software Encryption 3, Cambridge.",
10985 "\xEB\xF5\x91\xD5\xAF\xA6\x55\xCE\x7F\x22\x89\x4F"
10986 "\xF8\x7F\x54\xAC\x89\xC8\x11\xB6\xB0\xDA\x31\x93" },
10987 { GCRY_MD_TIGER, "Tiger - A Fast New Hash Function, "
10988 "by Ross Anderson and Eli Biham, proceedings of Fa"
10989 "st Software Encryption 3, Cambridge, 1996.",
10990 "\x3D\x9A\xEB\x03\xD1\xBD\x1A\x63\x57\xB2\x77\x4D"
10991 "\xFD\x6D\x5B\x24\xDD\x68\x15\x1D\x50\x39\x74\xFC" },
10992 { GCRY_MD_TIGER, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefgh"
10993 "ijklmnopqrstuvwxyz0123456789+-ABCDEFGHIJKLMNOPQRS"
10994 "TUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-",
10995 "\x00\xB8\x3E\xB4\xE5\x34\x40\xC5\x76\xAC\x6A\xAE"
10996 "\xE0\xA7\x48\x58\x25\xFD\x15\xE7\x0A\x59\xFF\xE4" },
10997
10998 { GCRY_MD_TIGER1, "",
10999 "\x32\x93\xAC\x63\x0C\x13\xF0\x24\x5F\x92\xBB\xB1"
11000 "\x76\x6E\x16\x16\x7A\x4E\x58\x49\x2D\xDE\x73\xF3" },
11001 { GCRY_MD_TIGER1, "a",
11002 "\x77\xBE\xFB\xEF\x2E\x7E\xF8\xAB\x2E\xC8\xF9\x3B"
11003 "\xF5\x87\xA7\xFC\x61\x3E\x24\x7F\x5F\x24\x78\x09" },
11004 { GCRY_MD_TIGER1, "abc",
11005 "\x2A\xAB\x14\x84\xE8\xC1\x58\xF2\xBF\xB8\xC5\xFF"
11006 "\x41\xB5\x7A\x52\x51\x29\x13\x1C\x95\x7B\x5F\x93" },
11007 { GCRY_MD_TIGER1, "message digest",
11008 "\xD9\x81\xF8\xCB\x78\x20\x1A\x95\x0D\xCF\x30\x48"
11009 "\x75\x1E\x44\x1C\x51\x7F\xCA\x1A\xA5\x5A\x29\xF6" },
11010 { GCRY_MD_TIGER1, "abcdefghijklmnopqrstuvwxyz",
11011 "\x17\x14\xA4\x72\xEE\xE5\x7D\x30\x04\x04\x12\xBF"
11012 "\xCC\x55\x03\x2A\x0B\x11\x60\x2F\xF3\x7B\xEE\xE9" },
11013 { GCRY_MD_TIGER1,
11014 "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
11015 "\x0F\x7B\xF9\xA1\x9B\x9C\x58\xF2\xB7\x61\x0D\xF7"
11016 "\xE8\x4F\x0A\xC3\xA7\x1C\x63\x1E\x7B\x53\xF7\x8E" },
11017 { GCRY_MD_TIGER1,
11018 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
11019 "abcdefghijklmnopqrstuvwxyz" "0123456789",
11020 "\x8D\xCE\xA6\x80\xA1\x75\x83\xEE\x50\x2B\xA3\x8A"
11021 "\x3C\x36\x86\x51\x89\x0F\xFB\xCC\xDC\x49\xA8\xCC" },
11022 { GCRY_MD_TIGER1,
11023 "1234567890" "1234567890" "1234567890" "1234567890"
11024 "1234567890" "1234567890" "1234567890" "1234567890",
11025 "\x1C\x14\x79\x55\x29\xFD\x9F\x20\x7A\x95\x8F\x84"
11026 "\xC5\x2F\x11\xE8\x87\xFA\x0C\xAB\xDF\xD9\x1B\xFD" },
11027 { GCRY_MD_TIGER1, "!",
11028 "\x6D\xB0\xE2\x72\x9C\xBE\xAD\x93\xD7\x15\xC6\xA7"
11029 "\xD3\x63\x02\xE9\xB3\xCE\xE0\xD2\xBC\x31\x4B\x41" },
11030 { GCRY_MD_TIGER1,
11031 "Libgcrypt is free software; you can redistribute it and/or modif"
11032 "y it under the terms of the GNU Lesser general Public License as"
11033 " published by the Free Software Foundation; either version 2.1 o"
11034 "f the License, or (at your option) any later version.\nLibgcrypt"
11035 " is distributed in the hope that it will be useful, but WITHOUT "
11036 "ANY WARRANTY; without even the implied warranty of MERCHANTABILI"
11037 "TY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser Gene"
11038 "ral Public License for more details.",
11039 "\x60\xee\xdf\x95\x39\xc8\x44\x94\x64\xdc\xdf\x3d\x2e\x1c\xe5\x79"
11040 "\x6a\x95\xbd\x30\x68\x8c\x7e\xb8" },
11041 { GCRY_MD_TIGER1, "?",
11042 "\x4b\xe2\x3f\x23\xf5\x34\xbe\xbf\x97\x42\x95\x80"
11043 "\x54\xe4\x6c\x12\x64\x85\x44\x0a\xa9\x49\x9b\x65" },
11044
11045 { GCRY_MD_TIGER2, "",
11046 "\x44\x41\xBE\x75\xF6\x01\x87\x73\xC2\x06\xC2\x27"
11047 "\x45\x37\x4B\x92\x4A\xA8\x31\x3F\xEF\x91\x9F\x41" },
11048 { GCRY_MD_TIGER2, "a",
11049 "\x67\xE6\xAE\x8E\x9E\x96\x89\x99\xF7\x0A\x23\xE7"
11050 "\x2A\xEA\xA9\x25\x1C\xBC\x7C\x78\xA7\x91\x66\x36" },
11051 { GCRY_MD_TIGER2, "abc",
11052 "\xF6\x8D\x7B\xC5\xAF\x4B\x43\xA0\x6E\x04\x8D\x78"
11053 "\x29\x56\x0D\x4A\x94\x15\x65\x8B\xB0\xB1\xF3\xBF" },
11054 { GCRY_MD_TIGER2, "message digest",
11055 "\xE2\x94\x19\xA1\xB5\xFA\x25\x9D\xE8\x00\x5E\x7D"
11056 "\xE7\x50\x78\xEA\x81\xA5\x42\xEF\x25\x52\x46\x2D" },
11057 { GCRY_MD_TIGER2, "abcdefghijklmnopqrstuvwxyz",
11058 "\xF5\xB6\xB6\xA7\x8C\x40\x5C\x85\x47\xE9\x1C\xD8"
11059 "\x62\x4C\xB8\xBE\x83\xFC\x80\x4A\x47\x44\x88\xFD" },
11060 { GCRY_MD_TIGER2,
11061 "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
11062 "\xA6\x73\x7F\x39\x97\xE8\xFB\xB6\x3D\x20\xD2\xDF"
11063 "\x88\xF8\x63\x76\xB5\xFE\x2D\x5C\xE3\x66\x46\xA9" },
11064 { GCRY_MD_TIGER2,
11065 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
11066 "abcdefghijklmnopqrstuvwxyz" "0123456789",
11067 "\xEA\x9A\xB6\x22\x8C\xEE\x7B\x51\xB7\x75\x44\xFC"
11068 "\xA6\x06\x6C\x8C\xBB\x5B\xBA\xE6\x31\x95\x05\xCD" },
11069 { GCRY_MD_TIGER2,
11070 "1234567890" "1234567890" "1234567890" "1234567890"
11071 "1234567890" "1234567890" "1234567890" "1234567890",
11072 "\xD8\x52\x78\x11\x53\x29\xEB\xAA\x0E\xEC\x85\xEC"
11073 "\xDC\x53\x96\xFD\xA8\xAA\x3A\x58\x20\x94\x2F\xFF" },
11074 { GCRY_MD_TIGER2, "!",
11075 "\xE0\x68\x28\x1F\x06\x0F\x55\x16\x28\xCC\x57\x15"
11076 "\xB9\xD0\x22\x67\x96\x91\x4D\x45\xF7\x71\x7C\xF4" },
11077
11078 { GCRY_MD_WHIRLPOOL, "",
11079 "\x19\xFA\x61\xD7\x55\x22\xA4\x66\x9B\x44\xE3\x9C\x1D\x2E\x17\x26"
11080 "\xC5\x30\x23\x21\x30\xD4\x07\xF8\x9A\xFE\xE0\x96\x49\x97\xF7\xA7"
11081 "\x3E\x83\xBE\x69\x8B\x28\x8F\xEB\xCF\x88\xE3\xE0\x3C\x4F\x07\x57"
11082 "\xEA\x89\x64\xE5\x9B\x63\xD9\x37\x08\xB1\x38\xCC\x42\xA6\x6E\xB3" },
11083 { GCRY_MD_WHIRLPOOL, "a",
11084 "\x8A\xCA\x26\x02\x79\x2A\xEC\x6F\x11\xA6\x72\x06\x53\x1F\xB7\xD7"
11085 "\xF0\xDF\xF5\x94\x13\x14\x5E\x69\x73\xC4\x50\x01\xD0\x08\x7B\x42"
11086 "\xD1\x1B\xC6\x45\x41\x3A\xEF\xF6\x3A\x42\x39\x1A\x39\x14\x5A\x59"
11087 "\x1A\x92\x20\x0D\x56\x01\x95\xE5\x3B\x47\x85\x84\xFD\xAE\x23\x1A" },
11088 { GCRY_MD_WHIRLPOOL, "?",
11089 "\x88\xf0\x78\x6d\x0d\x47\xe5\x32\x1f\x88\xb1\x48\x05\x53\x58\x7d"
11090 "\x19\x4b\x32\x9b\xf1\xfb\x17\xc5\x98\x3a\x87\xa2\x48\x61\x3d\x2b"
11091 "\xb2\xbc\x9f\x0d\xd2\x14\x37\x30\x55\x30\x91\xa7\xb8\x0c\x0f\x80"
11092 "\x7c\x7b\x94\xf6\x55\xf6\x0b\x12\x85\x0c\x8e\x6d\x17\x5b\x1e\x71" },
11093 { GCRY_MD_WHIRLPOOL,
11094 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
11095 "\xDC\x37\xE0\x08\xCF\x9E\xE6\x9B\xF1\x1F\x00\xED\x9A\xBA\x26\x90"
11096 "\x1D\xD7\xC2\x8C\xDE\xC0\x66\xCC\x6A\xF4\x2E\x40\xF8\x2F\x3A\x1E"
11097 "\x08\xEB\xA2\x66\x29\x12\x9D\x8F\xB7\xCB\x57\x21\x1B\x92\x81\xA6"
11098 "\x55\x17\xCC\x87\x9D\x7B\x96\x21\x42\xC6\x5F\x5A\x7A\xF0\x14\x67" },
11099 { GCRY_MD_WHIRLPOOL,
11100 "!",
11101 "\x0C\x99\x00\x5B\xEB\x57\xEF\xF5\x0A\x7C\xF0\x05\x56\x0D\xDF\x5D"
11102 "\x29\x05\x7F\xD8\x6B\x20\xBF\xD6\x2D\xEC\xA0\xF1\xCC\xEA\x4A\xF5"
11103 "\x1F\xC1\x54\x90\xED\xDC\x47\xAF\x32\xBB\x2B\x66\xC3\x4F\xF9\xAD"
11104 "\x8C\x60\x08\xAD\x67\x7F\x77\x12\x69\x53\xB2\x26\xE4\xED\x8B\x01" },
11105 { GCRY_MD_WHIRLPOOL,
11106 "Libgcrypt is free software; you can redistribute it and/or modif"
11107 "y it under the terms of the GNU Lesser general Public License as"
11108 " published by the Free Software Foundation; either version 2.1 o"
11109 "f the License, or (at your option) any later version.\nLibgcrypt"
11110 " is distributed in the hope that it will be useful, but WITHOUT "
11111 "ANY WARRANTY; without even the implied warranty of MERCHANTABILI"
11112 "TY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser Gene"
11113 "ral Public License for more details.",
11114 "\xcd\x4a\xa4\xaf\xf6\x7f\xec\xce\xbb\x6c\xdf\x91\x96\xe1\xf3\xf6"
11115 "\x78\xe2\x8e\x3a\x76\xcf\x06\xc7\xa1\x20\x7b\x81\x32\x60\xf7\x8e"
11116 "\x68\x19\x62\x33\x4f\xe5\x0a\x24\xfb\x9e\x74\x03\x74\xe4\x61\x29"
11117 "\x6f\xb3\x13\xe6\x7e\xc2\x88\x99\x9e\xfb\xe7\x9d\x11\x30\x89\xd2" },
11118 { GCRY_MD_GOSTR3411_94,
11119 "This is message, length=32 bytes",
11120 "\xB1\xC4\x66\xD3\x75\x19\xB8\x2E\x83\x19\x81\x9F\xF3\x25\x95\xE0"
11121 "\x47\xA2\x8C\xB6\xF8\x3E\xFF\x1C\x69\x16\xA8\x15\xA6\x37\xFF\xFA" },
11122 { GCRY_MD_GOSTR3411_94,
11123 "Suppose the original message has length = 50 bytes",
11124 "\x47\x1A\xBA\x57\xA6\x0A\x77\x0D\x3A\x76\x13\x06\x35\xC1\xFB\xEA"
11125 "\x4E\xF1\x4D\xE5\x1F\x78\xB4\xAE\x57\xDD\x89\x3B\x62\xF5\x52\x08" },
11126 { GCRY_MD_GOSTR3411_94,
11127 "",
11128 "\xCE\x85\xB9\x9C\xC4\x67\x52\xFF\xFE\xE3\x5C\xAB\x9A\x7B\x02\x78"
11129 "\xAB\xB4\xC2\xD2\x05\x5C\xFF\x68\x5A\xF4\x91\x2C\x49\x49\x0F\x8D" },
11130 { GCRY_MD_GOSTR3411_94,
11131 "!",
11132 "\x5C\x00\xCC\xC2\x73\x4C\xDD\x33\x32\xD3\xD4\x74\x95\x76\xE3\xC1"
11133 "\xA7\xDB\xAF\x0E\x7E\xA7\x4E\x9F\xA6\x02\x41\x3C\x90\xA1\x29\xFA" },
11134 { GCRY_MD_GOSTR3411_94,
11135 "Libgcrypt is free software; you can redistribute it and/or modif"
11136 "y it under the terms of the GNU Lesser general Public License as"
11137 " published by the Free Software Foundation; either version 2.1 o"
11138 "f the License, or (at your option) any later version.\nLibgcrypt"
11139 " is distributed in the hope that it will be useful, but WITHOUT "
11140 "ANY WARRANTY; without even the implied warranty of MERCHANTABILI"
11141 "TY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser Gene"
11142 "ral Public License for more details.",
11143 "\x00\x0c\x85\xc8\x54\xd2\x9a\x6e\x47\x2e\xff\xa4\xa2\xe7\xd0\x2e"
11144 "\x8a\xcc\x14\x53\xb4\x87\xc8\x5c\x95\x9a\x3e\x85\x8c\x7d\x6e\x0c" },
11145 { GCRY_MD_STRIBOG512,
11146 "012345678901234567890123456789012345678901234567890123456789012",
11147 "\x1b\x54\xd0\x1a\x4a\xf5\xb9\xd5\xcc\x3d\x86\xd6\x8d\x28\x54\x62"
11148 "\xb1\x9a\xbc\x24\x75\x22\x2f\x35\xc0\x85\x12\x2b\xe4\xba\x1f\xfa"
11149 "\x00\xad\x30\xf8\x76\x7b\x3a\x82\x38\x4c\x65\x74\xf0\x24\xc3\x11"
11150 "\xe2\xa4\x81\x33\x2b\x08\xef\x7f\x41\x79\x78\x91\xc1\x64\x6f\x48" },
11151 { GCRY_MD_STRIBOG256,
11152 "012345678901234567890123456789012345678901234567890123456789012",
11153 "\x9d\x15\x1e\xef\xd8\x59\x0b\x89\xda\xa6\xba\x6c\xb7\x4a\xf9\x27"
11154 "\x5d\xd0\x51\x02\x6b\xb1\x49\xa4\x52\xfd\x84\xe5\xe5\x7b\x55\x00" },
11155 { GCRY_MD_STRIBOG512,
11156 "\xd1\xe5\x20\xe2\xe5\xf2\xf0\xe8\x2c\x20\xd1\xf2\xf0\xe8\xe1\xee"
11157 "\xe6\xe8\x20\xe2\xed\xf3\xf6\xe8\x2c\x20\xe2\xe5\xfe\xf2\xfa\x20"
11158 "\xf1\x20\xec\xee\xf0\xff\x20\xf1\xf2\xf0\xe5\xeb\xe0\xec\xe8\x20"
11159 "\xed\xe0\x20\xf5\xf0\xe0\xe1\xf0\xfb\xff\x20\xef\xeb\xfa\xea\xfb"
11160 "\x20\xc8\xe3\xee\xf0\xe5\xe2\xfb",
11161 "\x1e\x88\xe6\x22\x26\xbf\xca\x6f\x99\x94\xf1\xf2\xd5\x15\x69\xe0"
11162 "\xda\xf8\x47\x5a\x3b\x0f\xe6\x1a\x53\x00\xee\xe4\x6d\x96\x13\x76"
11163 "\x03\x5f\xe8\x35\x49\xad\xa2\xb8\x62\x0f\xcd\x7c\x49\x6c\xe5\xb3"
11164 "\x3f\x0c\xb9\xdd\xdc\x2b\x64\x60\x14\x3b\x03\xda\xba\xc9\xfb\x28" },
11165 { GCRY_MD_STRIBOG256,
11166 "\xd1\xe5\x20\xe2\xe5\xf2\xf0\xe8\x2c\x20\xd1\xf2\xf0\xe8\xe1\xee"
11167 "\xe6\xe8\x20\xe2\xed\xf3\xf6\xe8\x2c\x20\xe2\xe5\xfe\xf2\xfa\x20"
11168 "\xf1\x20\xec\xee\xf0\xff\x20\xf1\xf2\xf0\xe5\xeb\xe0\xec\xe8\x20"
11169 "\xed\xe0\x20\xf5\xf0\xe0\xe1\xf0\xfb\xff\x20\xef\xeb\xfa\xea\xfb"
11170 "\x20\xc8\xe3\xee\xf0\xe5\xe2\xfb",
11171 "\x9d\xd2\xfe\x4e\x90\x40\x9e\x5d\xa8\x7f\x53\x97\x6d\x74\x05\xb0"
11172 "\xc0\xca\xc6\x28\xfc\x66\x9a\x74\x1d\x50\x06\x3c\x55\x7e\x8f\x50" },
11173 /* Special tests for carry flag in addition */
11174 { GCRY_MD_STRIBOG512,
11175 "\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE"
11176 "\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE"
11177 "\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE"
11178 "\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE"
11179 "\x16\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11"
11180 "\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11"
11181 "\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11"
11182 "\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x16",
11183 "\x8b\x06\xf4\x1e\x59\x90\x7d\x96\x36\xe8\x92\xca\xf5\x94\x2f\xcd"
11184 "\xfb\x71\xfa\x31\x16\x9a\x5e\x70\xf0\xed\xb8\x73\x66\x4d\xf4\x1c"
11185 "\x2c\xce\x6e\x06\xdc\x67\x55\xd1\x5a\x61\xcd\xeb\x92\xbd\x60\x7c"
11186 "\xc4\xaa\xca\x67\x32\xbf\x35\x68\xa2\x3a\x21\x0d\xd5\x20\xfd\x41" },
11187 { GCRY_MD_STRIBOG512,
11188 "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"
11189 "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"
11190 "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"
11191 "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"
11192 "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"
11193 "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"
11194 "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"
11195 "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff",
11196 "\x90\xa1\x61\xd1\x2a\xd3\x09\x49\x8d\x3f\xe5\xd4\x82\x02\xd8\xa4"
11197 "\xe9\xc4\x06\xd6\xa2\x64\xae\xab\x25\x8a\xc5\xec\xc3\x7a\x79\x62"
11198 "\xaa\xf9\x58\x7a\x5a\xbb\x09\xb6\xbb\x81\xec\x4b\x37\x52\xa3\xff"
11199 "\x5a\x83\x8e\xf1\x75\xbe\x57\x72\x05\x6b\xc5\xfe\x54\xfc\xfc\x7e" },
11200 #include "./sha3-224.h"
11201 #include "./sha3-256.h"
11202 #include "./sha3-384.h"
11203 #include "./sha3-512.h"
11204 { GCRY_MD_SHAKE128,
11205 "",
11206 "\x7F\x9C\x2B\xA4\xE8\x8F\x82\x7D\x61\x60\x45\x50\x76\x05\x85\x3E"
11207 "\xD7\x3B\x80\x93\xF6\xEF\xBC\x88\xEB\x1A\x6E\xAC\xFA\x66\xEF\x26"
11208 "\x3C\xB1\xEE\xA9\x88\x00\x4B\x93\x10\x3C\xFB\x0A\xEE\xFD\x2A\x68"
11209 "\x6E\x01\xFA\x4A\x58\xE8\xA3\x63\x9C\xA8\xA1\xE3\xF9\xAE\x57\xE2"
11210 "\x35\xB8\xCC\x87\x3C\x23\xDC\x62\xB8\xD2\x60\x16\x9A\xFA\x2F\x75"
11211 "\xAB\x91\x6A\x58\xD9\x74\x91\x88\x35\xD2\x5E\x6A\x43\x50\x85\xB2"
11212 "\xBA\xDF\xD6\xDF\xAA\xC3\x59\xA5\xEF\xBB\x7B\xCC\x4B\x59\xD5\x38"
11213 "\xDF\x9A\x04\x30\x2E\x10\xC8\xBC\x1C\xBF\x1A\x0B\x3A\x51\x20\xEA"
11214 "\x17\xCD\xA7\xCF\xAD\x76\x5F\x56\x23\x47\x4D\x36\x8C\xCC\xA8\xAF"
11215 "\x00\x07\xCD\x9F\x5E\x4C\x84\x9F\x16\x7A\x58\x0B\x14\xAA\xBD\xEF"
11216 "\xAE\xE7\xEE\xF4\x7C\xB0\xFC\xA9\x76\x7B\xE1\xFD\xA6\x94\x19\xDF"
11217 "\xB9\x27\xE9\xDF\x07\x34\x8B\x19\x66\x91\xAB\xAE\xB5\x80\xB3\x2D"
11218 "\xEF\x58\x53\x8B\x8D\x23\xF8\x77\x32\xEA\x63\xB0\x2B\x4F\xA0\xF4"
11219 "\x87\x33\x60\xE2\x84\x19\x28\xCD\x60\xDD\x4C\xEE\x8C\xC0\xD4\xC9"
11220 "\x22\xA9\x61\x88\xD0\x32\x67\x5C\x8A\xC8\x50\x93\x3C\x7A\xFF\x15"
11221 "\x33\xB9\x4C\x83\x4A\xDB\xB6\x9C\x61\x15\xBA\xD4\x69\x2D\x86\x19"
11222 "\xF9\x0B\x0C\xDF\x8A\x7B\x9C\x26\x40\x29\xAC\x18\x5B\x70\xB8\x3F"
11223 "\x28\x01\xF2\xF4\xB3\xF7\x0C\x59\x3E\xA3\xAE\xEB\x61\x3A\x7F\x1B"
11224 "\x1D\xE3\x3F\xD7\x50\x81\xF5\x92\x30\x5F\x2E\x45\x26\xED\xC0\x96"
11225 "\x31\xB1\x09\x58\xF4\x64\xD8\x89\xF3\x1B\xA0\x10\x25\x0F\xDA\x7F"
11226 "\x13\x68\xEC\x29\x67\xFC\x84\xEF\x2A\xE9\xAF\xF2\x68\xE0\xB1\x70"
11227 "\x0A\xFF\xC6\x82\x0B\x52\x3A\x3D\x91\x71\x35\xF2\xDF\xF2\xEE\x06"
11228 "\xBF\xE7\x2B\x31\x24\x72\x1D\x4A\x26\xC0\x4E\x53\xA7\x5E\x30\xE7"
11229 "\x3A\x7A\x9C\x4A\x95\xD9\x1C\x55\xD4\x95\xE9\xF5\x1D\xD0\xB5\xE9"
11230 "\xD8\x3C\x6D\x5E\x8C\xE8\x03\xAA\x62\xB8\xD6\x54\xDB\x53\xD0\x9B"
11231 "\x8D\xCF\xF2\x73\xCD\xFE\xB5\x73\xFA\xD8\xBC\xD4\x55\x78\xBE\xC2"
11232 "\xE7\x70\xD0\x1E\xFD\xE8\x6E\x72\x1A\x3F\x7C\x6C\xCE\x27\x5D\xAB"
11233 "\xE6\xE2\x14\x3F\x1A\xF1\x8D\xA7\xEF\xDD\xC4\xC7\xB7\x0B\x5E\x34"
11234 "\x5D\xB9\x3C\xC9\x36\xBE\xA3\x23\x49\x1C\xCB\x38\xA3\x88\xF5\x46"
11235 "\xA9\xFF\x00\xDD\x4E\x13\x00\xB9\xB2\x15\x3D\x20\x41\xD2\x05\xB4"
11236 "\x43\xE4\x1B\x45\xA6\x53\xF2\xA5\xC4\x49\x2C\x1A\xDD\x54\x45\x12"
11237 "\xDD\xA2\x52\x98\x33\x46\x2B\x71\xA4\x1A\x45\xBE\x97\x29\x0B\x6F",
11238 0, 512, },
11239 { GCRY_MD_SHAKE128,
11240 "\x5A\xAB\x62\x75\x6D\x30\x7A\x66\x9D\x14\x6A\xBA\x98\x8D\x90\x74"
11241 "\xC5\xA1\x59\xB3\xDE\x85\x15\x1A\x81\x9B\x11\x7C\xA1\xFF\x65\x97"
11242 "\xF6\x15\x6E\x80\xFD\xD2\x8C\x9C\x31\x76\x83\x51\x64\xD3\x7D\xA7"
11243 "\xDA\x11\xD9\x4E\x09\xAD\xD7\x70\xB6\x8A\x6E\x08\x1C\xD2\x2C\xA0"
11244 "\xC0\x04\xBF\xE7\xCD\x28\x3B\xF4\x3A\x58\x8D\xA9\x1F\x50\x9B\x27"
11245 "\xA6\x58\x4C\x47\x4A\x4A\x2F\x3E\xE0\xF1\xF5\x64\x47\x37\x92\x40"
11246 "\xA5\xAB\x1F\xB7\x7F\xDC\xA4\x9B\x30\x5F\x07\xBA\x86\xB6\x27\x56"
11247 "\xFB\x9E\xFB\x4F\xC2\x25\xC8\x68\x45\xF0\x26\xEA\x54\x20\x76\xB9"
11248 "\x1A\x0B\xC2\xCD\xD1\x36\xE1\x22\xC6\x59\xBE\x25\x9D\x98\xE5\x84"
11249 "\x1D\xF4\xC2\xF6\x03\x30\xD4\xD8\xCD\xEE\x7B\xF1\xA0\xA2\x44\x52"
11250 "\x4E\xEC\xC6\x8F\xF2\xAE\xF5\xBF\x00\x69\xC9\xE8\x7A\x11\xC6\xE5"
11251 "\x19\xDE\x1A\x40\x62\xA1\x0C\x83\x83\x73\x88\xF7\xEF\x58\x59\x8A"
11252 "\x38\x46\xF4\x9D\x49\x96\x82\xB6\x83\xC4\xA0\x62\xB4\x21\x59\x4F"
11253 "\xAF\xBC\x13\x83\xC9\x43\xBA\x83\xBD\xEF\x51\x5E\xFC\xF1\x0D",
11254 "\xF0\x71\x5D\xE3\x56\x92\xFD\x70\x12\x3D\xC6\x83\x68\xD0\xFE\xEC"
11255 "\x06\xA0\xC7\x4C\xF8\xAD\xB0\x5D\xDC\x25\x54\x87\xB1\xA8\xD4\xD1"
11256 "\x21\x3E\x9E\xAB\xAF\x41\xF1\x16\x17\x19\xD0\x65\xD7\x94\xB7\x50"
11257 "\xF8\x4B\xE3\x2A\x32\x34\xB4\xD5\x36\x46\x0D\x55\x20\x68\x8A\x5A"
11258 "\x79\xA1\x7A\x4B\xA8\x98\x7F\xCB\x61\xBF\x7D\xAA\x8B\x54\x7B\xF5"
11259 "\xC1\xCE\x36\xB5\x6A\x73\x25\x7D\xBB\xF1\xBA\xBB\x64\xF2\x49\xBD"
11260 "\xCE\xB6\x7B\xA1\xC8\x88\x37\x0A\x96\x3D\xFD\x6B\x6A\x2A\xDE\x2C"
11261 "\xEF\xD1\x4C\x32\x52\xCB\x37\x58\x52\x0F\x0C\x65\xF4\x52\x46\x82"
11262 "\x77\x24\x99\x46\x3A\xE1\xA3\x41\x80\x01\x83\xAA\x60\xEF\xA0\x51"
11263 "\x18\xA2\x82\x01\x74\x4F\x7B\xA0\xB0\xA3\x92\x8D\xD7\xC0\x26\x3F"
11264 "\xD2\x64\xB7\xCD\x7B\x2E\x2E\x09\xB3\x22\xBF\xCE\xA8\xEE\xD0\x42"
11265 "\x75\x79\x5B\xE7\xC0\xF0\x0E\x11\x38\x27\x37\x0D\x05\x1D\x50\x26"
11266 "\x95\x80\x30\x00\x05\xAC\x12\x88\xFE\xA6\xCD\x9A\xE9\xF4\xF3\x7C"
11267 "\xE0\xF8\xAC\xE8\xBF\x3E\xBE\x1D\x70\x56\x25\x59\x54\xC7\x61\x93"
11268 "\x1D\x3C\x42\xED\x62\xF7\xF1\xCE\x1B\x94\x5C\xDE\xCC\x0A\x74\x32"
11269 "\x2D\x7F\x64\xD6\x00\x4F\xF2\x16\x84\x14\x93\x07\x28\x8B\x44\x8E"
11270 "\x45\x43\x34\x75\xB1\xEA\x13\x14\xB0\x0F\x1F\xC4\x50\x08\x9A\x9D"
11271 "\x1F\x77\x10\xC6\xD7\x65\x2E\xCF\x65\x4F\x3B\x48\x7D\x02\x83\xD4"
11272 "\xD8\xA2\x8E\xFB\x50\x66\xC4\x25\x0D\x5A\xD6\x98\xE1\x5D\xBA\x88"
11273 "\xE9\x25\xE4\xDE\x99\xB6\x9B\xC3\x83\xAC\x80\x45\xB7\xF1\x02\x2A"
11274 "\xDD\x39\xD4\x43\x54\x6A\xE0\x92\x4F\x13\xF4\x89\x60\x96\xDF\xDF"
11275 "\x37\xCA\x72\x20\x79\x87\xC4\xA7\x70\x5A\x7A\xBE\x72\x4B\x7F\xA1"
11276 "\x0C\x90\x9F\x39\x25\x44\x9F\x01\x0D\x61\xE2\x07\xAD\xD9\x52\x19"
11277 "\x07\x1A\xCE\xED\xB9\xB9\xDC\xED\x32\xA9\xE1\x23\x56\x1D\x60\x82"
11278 "\xD4\x6A\xEF\xAE\x07\xEE\x1B\xD1\x32\x76\x5E\x3E\x51\x3C\x66\x50"
11279 "\x1B\x38\x7A\xB2\xEE\x09\xA0\x4A\xE6\x3E\x25\x80\x85\x17\xAF\xEA"
11280 "\x3E\x05\x11\x69\xCF\xD2\xFF\xF8\xC5\x85\x8E\x2D\x96\x23\x89\x7C"
11281 "\x9E\x85\x17\x5A\xC5\xA8\x63\x94\xCD\x0A\x32\xA0\xA6\x2A\x8F\x5D"
11282 "\x6C\xCC\xBF\x49\x3D\xAA\x43\xF7\x83\x62\xBB\xCA\x40\xAD\xF7\x33"
11283 "\xF8\x71\xE0\xC0\x09\x98\xD9\xBF\xD6\x88\x06\x56\x66\x6C\xD7\xBE"
11284 "\x4F\xE9\x89\x2C\x61\xDC\xD5\xCD\x23\xA5\xE4\x27\x7E\xEE\x8B\x4A"
11285 "\xFD\x29\xB6\x9B\xBA\x55\x66\x0A\x21\x71\x12\xFF\x6E\x34\x56\xB1",
11286 223, 512, },
11287 { GCRY_MD_SHAKE128,
11288 "!",
11289 "\x9d\x22\x2c\x79\xc4\xff\x9d\x09\x2c\xf6\xca\x86\x14\x3a\xa4\x11"
11290 "\xe3\x69\x97\x38\x08\xef\x97\x09\x32\x55\x82\x6c\x55\x72\xef\x58"
11291 "\x42\x4c\x4b\x5c\x28\x47\x5f\xfd\xcf\x98\x16\x63\x86\x7f\xec\x63"
11292 "\x21\xc1\x26\x2e\x38\x7b\xcc\xf8\xca\x67\x68\x84\xc4\xa9\xd0\xc1"
11293 "\x3b\xfa\x68\x69\x76\x3d\x5a\xe4\xbb\xc9\xb3\xcc\xd0\x9d\x1c\xa5"
11294 "\xea\x74\x46\x53\x8d\x69\xb3\xfb\x98\xc7\x2b\x59\xa2\xb4\x81\x7d"
11295 "\xb5\xea\xdd\x90\x11\xf9\x0f\xa7\x10\x91\x93\x1f\x81\x34\xf4\xf0"
11296 "\x0b\x56\x2e\x2f\xe1\x05\x93\x72\x70\x36\x1c\x19\x09\x86\x2a\xd4"
11297 "\x50\x46\xe3\x93\x2f\x5d\xd3\x11\xec\x72\xfe\xc5\xf8\xfb\x8f\x60"
11298 "\xb4\x5a\x3b\xee\x3f\x85\xbb\xf7\xfc\xed\xc6\xa5\x55\x67\x76\x48"
11299 "\xe0\x65\x4b\x38\x19\x41\xa8\x6b\xd3\xe5\x12\x65\x7b\x0d\x57\xa7"
11300 "\x99\x1f\xc4\x54\x3f\x89\xd8\x29\x04\x92\x22\x2c\xe4\xa3\x3e\x17"
11301 "\x60\x2b\x3b\x99\xc0\x09\xf7\x65\x5f\x87\x53\x5c\xda\xa3\x71\x6f"
11302 "\x58\xc4\x7b\x8a\x15\x7a\xd1\x95\xf0\x28\x09\xf2\x75\x00\xb9\x25"
11303 "\x49\x79\x31\x1c\x6b\xb4\x15\x96\x8c\xd1\x04\x31\x16\x9a\x27\xd5"
11304 "\xa8\xd6\x1e\x13\xa6\xb8\xb7\x7a\xf1\xf8\xb6\xdd\x2e\xef\xde\xa0"
11305 "\x40\x78\x96\x80\x49\x0b\x5e\xdc\xb1\xd3\xe5\x38\xa4\x66\xf7\x57"
11306 "\xad\x71\x8f\xe1\xfd\x9f\xae\xef\xa4\x72\x46\xad\x5e\x36\x7f\x87"
11307 "\xd3\xb4\x85\x0d\x44\x86\xeb\x21\x99\xe9\x4a\x79\x79\xe2\x09\x1a"
11308 "\xbc\xdf\x3b\xc1\x33\x79\xc8\x96\xdc\xeb\x79\xa8\xfd\x08\xf1\x10"
11309 "\x73\xf3\x3e\x3f\x99\x23\x22\xb3\x12\x02\xde\xe2\x34\x33\x0c\xf3"
11310 "\x30\x4a\x58\x8f\x0d\x59\xda\xe4\xe6\x3b\xa2\xac\x3c\xe6\x82\xcc"
11311 "\x19\xd4\xe3\x41\x67\x8c\xc3\xa6\x7a\x47\xc1\x13\xb4\xdb\x89\x0f"
11312 "\x30\xa9\x2a\xa0\x8a\x1f\x6d\xc8\xfb\x64\x63\xf8\x03\x8c\x2b\x40"
11313 "\xb2\x53\x00\x77\xb2\x36\xce\x88\xaf\xcc\xcd\xa0\x8a\xd6\xd7\x5e"
11314 "\xee\x18\x99\xb1\x0c\xd8\x00\xc2\xce\x53\x72\xbf\xf2\x2e\xe3\xa3"
11315 "\x39\xd4\xb9\xc1\xa2\xf5\xf4\xb8\x20\xf6\x87\xe5\x51\x9b\xd0\x5b"
11316 "\x1f\xc5\xda\x0e\xb4\x53\x36\x81\x4f\x48\x13\x2c\x64\x0e\x66\xc3"
11317 "\xa0\x2a\x22\xe6\x35\x98\xf9\x4f\x22\xf3\x51\x84\x11\x04\x46\xb6"
11318 "\x48\xcf\x84\x74\xf3\x0c\x43\xea\xd5\x83\x09\xfb\x25\x90\x16\x09"
11319 "\xe2\x41\x87\xe8\x01\xc8\x09\x56\x1a\x64\x80\x94\x50\xe6\x03\xc4"
11320 "\xa8\x03\x95\x25\xc4\x76\xb5\x8e\x32\xce\x2c\x47\xb3\x7d\xa5\x91",
11321 0, 512, },
11322 { GCRY_MD_SHAKE256,
11323 "",
11324 "\x46\xB9\xDD\x2B\x0B\xA8\x8D\x13\x23\x3B\x3F\xEB\x74\x3E\xEB\x24"
11325 "\x3F\xCD\x52\xEA\x62\xB8\x1B\x82\xB5\x0C\x27\x64\x6E\xD5\x76\x2F"
11326 "\xD7\x5D\xC4\xDD\xD8\xC0\xF2\x00\xCB\x05\x01\x9D\x67\xB5\x92\xF6"
11327 "\xFC\x82\x1C\x49\x47\x9A\xB4\x86\x40\x29\x2E\xAC\xB3\xB7\xC4\xBE"
11328 "\x14\x1E\x96\x61\x6F\xB1\x39\x57\x69\x2C\xC7\xED\xD0\xB4\x5A\xE3"
11329 "\xDC\x07\x22\x3C\x8E\x92\x93\x7B\xEF\x84\xBC\x0E\xAB\x86\x28\x53"
11330 "\x34\x9E\xC7\x55\x46\xF5\x8F\xB7\xC2\x77\x5C\x38\x46\x2C\x50\x10"
11331 "\xD8\x46\xC1\x85\xC1\x51\x11\xE5\x95\x52\x2A\x6B\xCD\x16\xCF\x86"
11332 "\xF3\xD1\x22\x10\x9E\x3B\x1F\xDD\x94\x3B\x6A\xEC\x46\x8A\x2D\x62"
11333 "\x1A\x7C\x06\xC6\xA9\x57\xC6\x2B\x54\xDA\xFC\x3B\xE8\x75\x67\xD6"
11334 "\x77\x23\x13\x95\xF6\x14\x72\x93\xB6\x8C\xEA\xB7\xA9\xE0\xC5\x8D"
11335 "\x86\x4E\x8E\xFD\xE4\xE1\xB9\xA4\x6C\xBE\x85\x47\x13\x67\x2F\x5C"
11336 "\xAA\xAE\x31\x4E\xD9\x08\x3D\xAB\x4B\x09\x9F\x8E\x30\x0F\x01\xB8"
11337 "\x65\x0F\x1F\x4B\x1D\x8F\xCF\x3F\x3C\xB5\x3F\xB8\xE9\xEB\x2E\xA2"
11338 "\x03\xBD\xC9\x70\xF5\x0A\xE5\x54\x28\xA9\x1F\x7F\x53\xAC\x26\x6B"
11339 "\x28\x41\x9C\x37\x78\xA1\x5F\xD2\x48\xD3\x39\xED\xE7\x85\xFB\x7F"
11340 "\x5A\x1A\xAA\x96\xD3\x13\xEA\xCC\x89\x09\x36\xC1\x73\xCD\xCD\x0F"
11341 "\xAB\x88\x2C\x45\x75\x5F\xEB\x3A\xED\x96\xD4\x77\xFF\x96\x39\x0B"
11342 "\xF9\xA6\x6D\x13\x68\xB2\x08\xE2\x1F\x7C\x10\xD0\x4A\x3D\xBD\x4E"
11343 "\x36\x06\x33\xE5\xDB\x4B\x60\x26\x01\xC1\x4C\xEA\x73\x7D\xB3\xDC"
11344 "\xF7\x22\x63\x2C\xC7\x78\x51\xCB\xDD\xE2\xAA\xF0\xA3\x3A\x07\xB3"
11345 "\x73\x44\x5D\xF4\x90\xCC\x8F\xC1\xE4\x16\x0F\xF1\x18\x37\x8F\x11"
11346 "\xF0\x47\x7D\xE0\x55\xA8\x1A\x9E\xDA\x57\xA4\xA2\xCF\xB0\xC8\x39"
11347 "\x29\xD3\x10\x91\x2F\x72\x9E\xC6\xCF\xA3\x6C\x6A\xC6\xA7\x58\x37"
11348 "\x14\x30\x45\xD7\x91\xCC\x85\xEF\xF5\xB2\x19\x32\xF2\x38\x61\xBC"
11349 "\xF2\x3A\x52\xB5\xDA\x67\xEA\xF7\xBA\xAE\x0F\x5F\xB1\x36\x9D\xB7"
11350 "\x8F\x3A\xC4\x5F\x8C\x4A\xC5\x67\x1D\x85\x73\x5C\xDD\xDB\x09\xD2"
11351 "\xB1\xE3\x4A\x1F\xC0\x66\xFF\x4A\x16\x2C\xB2\x63\xD6\x54\x12\x74"
11352 "\xAE\x2F\xCC\x86\x5F\x61\x8A\xBE\x27\xC1\x24\xCD\x8B\x07\x4C\xCD"
11353 "\x51\x63\x01\xB9\x18\x75\x82\x4D\x09\x95\x8F\x34\x1E\xF2\x74\xBD"
11354 "\xAB\x0B\xAE\x31\x63\x39\x89\x43\x04\xE3\x58\x77\xB0\xC2\x8A\x9B"
11355 "\x1F\xD1\x66\xC7\x96\xB9\xCC\x25\x8A\x06\x4A\x8F\x57\xE2\x7F\x2A",
11356 0, 512, },
11357 { GCRY_MD_SHAKE256,
11358 "\xB3\x2D\x95\xB0\xB9\xAA\xD2\xA8\x81\x6D\xE6\xD0\x6D\x1F\x86\x00"
11359 "\x85\x05\xBD\x8C\x14\x12\x4F\x6E\x9A\x16\x3B\x5A\x2A\xDE\x55\xF8"
11360 "\x35\xD0\xEC\x38\x80\xEF\x50\x70\x0D\x3B\x25\xE4\x2C\xC0\xAF\x05"
11361 "\x0C\xCD\x1B\xE5\xE5\x55\xB2\x30\x87\xE0\x4D\x7B\xF9\x81\x36\x22"
11362 "\x78\x0C\x73\x13\xA1\x95\x4F\x87\x40\xB6\xEE\x2D\x3F\x71\xF7\x68"
11363 "\xDD\x41\x7F\x52\x04\x82\xBD\x3A\x08\xD4\xF2\x22\xB4\xEE\x9D\xBD"
11364 "\x01\x54\x47\xB3\x35\x07\xDD\x50\xF3\xAB\x42\x47\xC5\xDE\x9A\x8A"
11365 "\xBD\x62\xA8\xDE\xCE\xA0\x1E\x3B\x87\xC8\xB9\x27\xF5\xB0\x8B\xEB"
11366 "\x37\x67\x4C\x6F\x8E\x38\x0C\x04",
11367 "\xCC\x2E\xAA\x04\xEE\xF8\x47\x9C\xDA\xE8\x56\x6E\xB8\xFF\xA1\x10"
11368 "\x0A\x40\x79\x95\xBF\x99\x9A\xE9\x7E\xDE\x52\x66\x81\xDC\x34\x90"
11369 "\x61\x6F\x28\x44\x2D\x20\xDA\x92\x12\x4C\xE0\x81\x58\x8B\x81\x49"
11370 "\x1A\xED\xF6\x5C\xAA\xF0\xD2\x7E\x82\xA4\xB0\xE1\xD1\xCA\xB2\x38"
11371 "\x33\x32\x8F\x1B\x8D\xA4\x30\xC8\xA0\x87\x66\xA8\x63\x70\xFA\x84"
11372 "\x8A\x79\xB5\x99\x8D\xB3\xCF\xFD\x05\x7B\x96\xE1\xE2\xEE\x0E\xF2"
11373 "\x29\xEC\xA1\x33\xC1\x55\x48\xF9\x83\x99\x02\x04\x37\x30\xE4\x4B"
11374 "\xC5\x2C\x39\xFA\xDC\x1D\xDE\xEA\xD9\x5F\x99\x39\xF2\x20\xCA\x30"
11375 "\x06\x61\x54\x0D\xF7\xED\xD9\xAF\x37\x8A\x5D\x4A\x19\xB2\xB9\x3E"
11376 "\x6C\x78\xF4\x9C\x35\x33\x43\xA0\xB5\xF1\x19\x13\x2B\x53\x12\xD0"
11377 "\x04\x83\x1D\x01\x76\x9A\x31\x6D\x2F\x51\xBF\x64\xCC\xB2\x0A\x21"
11378 "\xC2\xCF\x7A\xC8\xFB\x6F\x6E\x90\x70\x61\x26\xBD\xAE\x06\x11\xDD"
11379 "\x13\x96\x2E\x8B\x53\xD6\xEA\xE2\x6C\x7B\x0D\x25\x51\xDA\xF6\x24"
11380 "\x8E\x9D\x65\x81\x73\x82\xB0\x4D\x23\x39\x2D\x10\x8E\x4D\x34\x43"
11381 "\xDE\x5A\xDC\x72\x73\xC7\x21\xA8\xF8\x32\x0E\xCF\xE8\x17\x7A\xC0"
11382 "\x67\xCA\x8A\x50\x16\x9A\x6E\x73\x00\x0E\xBC\xDC\x1E\x4E\xE6\x33"
11383 "\x9F\xC8\x67\xC3\xD7\xAE\xAB\x84\x14\x63\x98\xD7\xBA\xDE\x12\x1D"
11384 "\x19\x89\xFA\x45\x73\x35\x56\x4E\x97\x57\x70\xA3\xA0\x02\x59\xCA"
11385 "\x08\x70\x61\x08\x26\x1A\xA2\xD3\x4D\xE0\x0F\x8C\xAC\x7D\x45\xD3"
11386 "\x5E\x5A\xA6\x3E\xA6\x9E\x1D\x1A\x2F\x7D\xAB\x39\x00\xD5\x1E\x0B"
11387 "\xC6\x53\x48\xA2\x55\x54\x00\x70\x39\xA5\x2C\x3C\x30\x99\x80\xD1"
11388 "\x7C\xAD\x20\xF1\x15\x63\x10\xA3\x9C\xD3\x93\x76\x0C\xFE\x58\xF6"
11389 "\xF8\xAD\xE4\x21\x31\x28\x82\x80\xA3\x5E\x1D\xB8\x70\x81\x83\xB9"
11390 "\x1C\xFA\xF5\x82\x7E\x96\xB0\xF7\x74\xC4\x50\x93\xB4\x17\xAF\xF9"
11391 "\xDD\x64\x17\xE5\x99\x64\xA0\x1B\xD2\xA6\x12\xFF\xCF\xBA\x18\xA0"
11392 "\xF1\x93\xDB\x29\x7B\x9A\x6C\xC1\xD2\x70\xD9\x7A\xAE\x8F\x8A\x3A"
11393 "\x6B\x26\x69\x5A\xB6\x64\x31\xC2\x02\xE1\x39\xD6\x3D\xD3\xA2\x47"
11394 "\x78\x67\x6C\xEF\xE3\xE2\x1B\x02\xEC\x4E\x8F\x5C\xFD\x66\x58\x7A"
11395 "\x12\xB4\x40\x78\xFC\xD3\x9E\xEE\x44\xBB\xEF\x4A\x94\x9A\x63\xC0"
11396 "\xDF\xD5\x8C\xF2\xFB\x2C\xD5\xF0\x02\xE2\xB0\x21\x92\x66\xCF\xC0"
11397 "\x31\x81\x74\x86\xDE\x70\xB4\x28\x5A\x8A\x70\xF3\xD3\x8A\x61\xD3"
11398 "\x15\x5D\x99\xAA\xF4\xC2\x53\x90\xD7\x36\x45\xAB\x3E\x8D\x80\xF0",
11399 136, 512, },
11400 { GCRY_MD_SHAKE256,
11401 "!",
11402 "\x35\x78\xa7\xa4\xca\x91\x37\x56\x9c\xdf\x76\xed\x61\x7d\x31\xbb"
11403 "\x99\x4f\xca\x9c\x1b\xbf\x8b\x18\x40\x13\xde\x82\x34\xdf\xd1\x3a"
11404 "\x3f\xd1\x24\xd4\xdf\x76\xc0\xa5\x39\xee\x7d\xd2\xf6\xe1\xec\x34"
11405 "\x61\x24\xc8\x15\xd9\x41\x0e\x14\x5e\xb5\x61\xbc\xd9\x7b\x18\xab"
11406 "\x6c\xe8\xd5\x55\x3e\x0e\xab\x3d\x1f\x7d\xfb\x8f\x9d\xee\xfe\x16"
11407 "\x84\x7e\x21\x92\xf6\xf6\x1f\xb8\x2f\xb9\x0d\xde\x60\xb1\x90\x63"
11408 "\xc5\x6a\x4c\x55\xcd\xd7\xb6\x72\xb7\x5b\xf5\x15\xad\xbf\xe2\x04"
11409 "\x90\x3c\x8c\x00\x36\xde\x54\xa2\x99\x9a\x92\x0d\xe9\x0f\x66\xd7"
11410 "\xff\x6e\xc8\xe4\xc9\x3d\x24\xae\x34\x6f\xdc\xb3\xa5\xa5\xbd\x57"
11411 "\x39\xec\x15\xa6\xed\xdb\x5c\xe5\xb0\x2d\xa5\x30\x39\xfa\xc6\x3e"
11412 "\x19\x55\x5f\xaa\x2e\xdd\xc6\x93\xb1\xf0\xc2\xa6\xfc\xbe\x7c\x0a"
11413 "\x0a\x09\x1d\x0e\xe7\x00\xd7\x32\x2e\x4b\x0f\xf0\x95\x90\xde\x16"
11414 "\x64\x22\xf9\xea\xd5\xda\x4c\x99\x3d\x60\x5f\xe4\xd9\xc6\x34\x84"
11415 "\x3a\xa1\x78\xb1\x76\x72\xc6\x56\x8c\x8a\x2e\x62\xab\xeb\xea\x2c"
11416 "\x21\xc3\x02\xbd\x36\x6a\xd6\x98\x95\x9e\x1f\x6e\x43\x4a\xf1\x55"
11417 "\x56\x8b\x27\x34\xd8\x37\x9f\xcd\x3f\xfe\x64\x89\xba\xff\xa6\xd7"
11418 "\x11\x09\x44\x2e\x1b\x34\x4f\x13\x8a\x09\xca\xe3\xe2\xd3\x94\x2e"
11419 "\xee\x82\x8f\xc4\x7e\x64\xde\xb5\xe0\x0a\x02\x4a\xe1\xf2\xc0\x77"
11420 "\xe6\xb7\xb1\x33\xf6\xc1\xde\x91\x30\x92\xd4\xe8\x29\xec\xd2\xb2"
11421 "\xef\x28\xca\x80\x20\x82\x1e\x2b\x8b\xe5\x17\xd9\x3e\xd0\x88\x36"
11422 "\xf6\xf0\x66\xcc\x3d\x03\xb6\x25\xd8\x49\x7f\x29\xdb\xc1\xc3\x9e"
11423 "\x6f\xe4\x63\x22\x6f\x85\xc1\x28\xa2\xc2\x98\x88\x11\x2e\x06\xa9"
11424 "\x9c\x5d\x17\xb2\x5e\x90\x0d\x20\x4f\x39\x72\x31\xcd\xf7\x9c\x31"
11425 "\x34\x46\x53\x2d\xad\x07\xf4\xc0\xbd\x9f\xba\x1d\xd4\x13\xd8\xa7"
11426 "\xe6\xcb\xc0\xa0\x86\x2c\xc7\x69\x23\x9a\x89\xf9\xdb\x08\x5b\x78"
11427 "\xa0\x54\x59\x6a\xd7\x08\x0d\xdf\x96\x01\x9b\x73\x99\xb5\x03\x48"
11428 "\x0e\x5a\x65\xa2\x20\x8d\x74\x72\x4c\x98\x7d\x32\x5e\x9b\x0e\x82"
11429 "\xfe\xcd\x4f\x27\xf3\x13\x5b\x1d\x9e\x27\xb4\x8e\x69\xdd\x6f\x59"
11430 "\x62\xb8\xa6\x3b\x48\x92\x1e\xc8\xee\x53\x86\x9f\x1a\xc1\xc8\x18"
11431 "\x23\x87\xee\x0d\x6c\xfe\xf6\x53\xff\x8b\xf6\x05\xf1\x47\x04\xb7"
11432 "\x1b\xeb\x65\x53\xf2\x81\xfa\x75\x69\x48\xc4\x38\x49\x4b\x19\xb4"
11433 "\xee\x69\xa5\x43\x6b\x22\x2b\xc9\x88\xed\xa4\xac\x60\x00\x24\xc9",
11434 0, 512, },
11435 { GCRY_MD_BLAKE2B_512, "abc",
11436 "\xBA\x80\xA5\x3F\x98\x1C\x4D\x0D\x6A\x27\x97\xB6\x9F\x12\xF6\xE9"
11437 "\x4C\x21\x2F\x14\x68\x5A\xC4\xB7\x4B\x12\xBB\x6F\xDB\xFF\xA2\xD1"
11438 "\x7D\x87\xC5\x39\x2A\xAB\x79\x2D\xC2\x52\xD5\xDE\x45\x33\xCC\x95"
11439 "\x18\xD3\x8A\xA8\xDB\xF1\x92\x5A\xB9\x23\x86\xED\xD4\x00\x99\x23" },
11440 { GCRY_MD_BLAKE2B_512, "\x00",
11441 "\x96\x1f\x6d\xd1\xe4\xdd\x30\xf6\x39\x01\x69\x0c\x51\x2e\x78\xe4"
11442 "\xb4\x5e\x47\x42\xed\x19\x7c\x3c\x5e\x45\xc5\x49\xfd\x25\xf2\xe4"
11443 "\x18\x7b\x0b\xc9\xfe\x30\x49\x2b\x16\xb0\xd0\xbc\x4e\xf9\xb0\xf3"
11444 "\x4c\x70\x03\xfa\xc0\x9a\x5e\xf1\x53\x2e\x69\x43\x02\x34\xce\xbd",
11445 1, 64,
11446 "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
11447 "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f"
11448 "\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f"
11449 "\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f",
11450 64 },
11451 #include "./blake2b.h"
11452 { GCRY_MD_BLAKE2B_160,
11453 "",
11454 "\xad\x75\xea\xd7\x9f\x71\x21\xd1\xf0\x8a\xfe\x59\x99\x27\xa5\xa3"
11455 "\x8b\xe1\xb1\x79",
11456 0, 20,
11457 "\x65\x65\xcb\x30\xfb\x2c\x28\x54\x7c\xd0\x4c\x1d\x6a\x88\xf2\x7a"
11458 "\x6d\xe8\x55\x3d",
11459 20 },
11460 { GCRY_MD_BLAKE2B_160,
11461 "\x9c\x9c\x38",
11462 "\x82\x79\x9d\x7b\xe8\xf4\xd1\x69\xfb\x85\xe6\x63\x6a\x7b\x6c\x50"
11463 "\xa0\x1f\x70\xa2",
11464 3, 20,
11465 "\x65\x65\xcb\x30\xfb\x2c\x28\x54\x7c\xd0\x4c\x1d\x6a\x88\xf2\x7a"
11466 "\x6d\xe8\x55\x3d",
11467 20 },
11468 { GCRY_MD_BLAKE2B_256,
11469 "",
11470 "\x89\x36\x29\x47\x52\x79\xdf\xd8\x2a\x84\x1a\x8f\x21\xa3\x72\xed"
11471 "\x30\xcc\xb8\xae\x34\x62\xe1\x90\x7f\x50\x66\x3f\x3c\x03\x66\x83",
11472 0, 32,
11473 "\xd5\xd5\xab\x80\x2c\xad\xd9\x86\x60\xe7\x47\x2f\x77\xa6\x1d\xc4"
11474 "\xe2\xa6\x88\x2f\xb7\xe6\x9e\x85\x23\xa9\xcd\x76\x43\xb9\xfd\xb7",
11475 32 },
11476 { GCRY_MD_BLAKE2B_256,
11477 "\x9c\x9c\x38",
11478 "\x01\x6a\x18\xbb\x10\xe0\xc3\xa5\xe5\x9f\xce\xfd\x1a\x40\x7a\xb7"
11479 "\xf1\xc0\x36\x1b\x3f\x98\x34\x77\x42\x54\xd3\xf0\x4c\xda\x38\x98",
11480 3, 32,
11481 "\xd5\xd5\xab\x80\x2c\xad\xd9\x86\x60\xe7\x47\x2f\x77\xa6\x1d\xc4"
11482 "\xe2\xa6\x88\x2f\xb7\xe6\x9e\x85\x23\xa9\xcd\x76\x43\xb9\xfd\xb7",
11483 32 },
11484 { GCRY_MD_BLAKE2B_384,
11485 "",
11486 "\xd7\x2c\x9b\x4a\x73\x4e\xb2\x07\xe9\xdd\xbf\xf0\x0b\x10\xc3\x70"
11487 "\xc8\x9d\x67\xd7\x96\xc3\xa7\xb9\x68\x15\xa9\x53\x92\x1b\xb2\x97"
11488 "\x59\xd2\x9d\x25\x63\xf3\xda\x4d\x7f\x3e\xa4\xa6\xe3\x4c\x32\x6b",
11489 0, 48,
11490 "\xc0\xc0\x80\x41\xc2\x03\xc6\xca\x90\x5b\xeb\x46\x32\x79\xac\x26"
11491 "\xd3\xf9\xcc\xc6\x93\x5a\xed\x48\x35\x7d\xb3\x31\xe5\x16\xfb\x12"
11492 "\x0e\x21\x2f\x51\x80\xd1\x52\x24\x77\x9c\x13\xaf\xc3\x73\x37\xaa",
11493 48 },
11494 { GCRY_MD_BLAKE2B_384,
11495 "\x9c\x9c\x38",
11496 "\xef\x46\xfa\x54\xa2\xc2\x20\xda\x06\xa8\x4c\x77\x6e\x87\xdd\x0a"
11497 "\x21\xee\xb5\xe9\x40\x1a\x0a\x78\x11\x19\x74\x18\xfe\x92\x70\x15"
11498 "\x77\xd0\xa8\x53\x24\x48\xe8\xb8\x53\x6a\xa6\xc7\x42\xcd\x2c\x62",
11499 3, 48,
11500 "\xc0\xc0\x80\x41\xc2\x03\xc6\xca\x90\x5b\xeb\x46\x32\x79\xac\x26"
11501 "\xd3\xf9\xcc\xc6\x93\x5a\xed\x48\x35\x7d\xb3\x31\xe5\x16\xfb\x12"
11502 "\x0e\x21\x2f\x51\x80\xd1\x52\x24\x77\x9c\x13\xaf\xc3\x73\x37\xaa",
11503 48 },
11504 { GCRY_MD_BLAKE2B_512,
11505 "",
11506 "\xd7\x4b\xf3\x1e\x5c\xe5\xd8\xa2\x5d\x09\x21\x52\x53\xca\xd2\xf8"
11507 "\xd2\xfd\xa9\x10\x09\x30\x16\x05\xa6\x8c\xc3\x86\x5b\xb7\x93\x5b"
11508 "\xca\xff\x6f\x2a\xf6\x43\xa7\x76\x99\xe8\x02\x61\xa1\xfd\x2c\x80"
11509 "\xe8\x37\xb5\x62\x32\xf7\xb1\x46\x43\x4a\xa7\x4d\x71\x18\xbb\x16",
11510 0, 64,
11511 "\xab\xab\x56\x01\x58\x5a\xb3\x0d\xc1\xce\x8f\x5e\xee\x4d\x3b\x88"
11512 "\xc4\x4c\x11\x5e\x6f\xcd\x3d\x0a\x47\x52\x9a\xec\x86\x73\xfa\x6e"
11513 "\x68\xd6\x3f\x16\x55\x6b\xc1\x2d\xef\x1d\x0c\x29\x35\x5f\x94\xf3"
11514 "\x88\x7c\x04\x81\x86\x07\x8e\x95\x23\xb9\xdd\x97\x74\x0c\x80\x8c",
11515 64 },
11516 { GCRY_MD_BLAKE2B_512,
11517 "\x9c\x9c\x38",
11518 "\x70\xfc\x57\xe1\x49\x5f\xe4\x39\x0d\x38\xa1\xd3\x97\x05\xee\xf6"
11519 "\xaa\xbb\xd2\x64\xc7\xce\x66\x11\x8d\x0a\x87\xd4\x25\x94\xb3\x87"
11520 "\xdc\x50\x18\x8b\xba\x61\xf0\x91\xd6\xb3\x4f\xf5\x4e\x09\x1e\x70"
11521 "\x24\x01\x83\xcd\xb9\x21\x1f\x14\x39\x77\x5c\xc6\xe6\xe9\x35\x73",
11522 3, 64,
11523 "\xab\xab\x56\x01\x58\x5a\xb3\x0d\xc1\xce\x8f\x5e\xee\x4d\x3b\x88"
11524 "\xc4\x4c\x11\x5e\x6f\xcd\x3d\x0a\x47\x52\x9a\xec\x86\x73\xfa\x6e"
11525 "\x68\xd6\x3f\x16\x55\x6b\xc1\x2d\xef\x1d\x0c\x29\x35\x5f\x94\xf3"
11526 "\x88\x7c\x04\x81\x86\x07\x8e\x95\x23\xb9\xdd\x97\x74\x0c\x80\x8c",
11527 64 },
11528 { GCRY_MD_BLAKE2B_512, "!",
11529 "\x98\xfb\x3e\xfb\x72\x06\xfd\x19\xeb\xf6\x9b\x6f\x31\x2c\xf7\xb6"
11530 "\x4e\x3b\x94\xdb\xe1\xa1\x71\x07\x91\x39\x75\xa7\x93\xf1\x77\xe1"
11531 "\xd0\x77\x60\x9d\x7f\xba\x36\x3c\xbb\xa0\x0d\x05\xf7\xaa\x4e\x4f"
11532 "\xa8\x71\x5d\x64\x28\x10\x4c\x0a\x75\x64\x3b\x0f\xf3\xfd\x3e\xaf" },
11533 { GCRY_MD_BLAKE2B_512, "?",
11534 "\xae\x9c\xf5\x7a\xc2\xff\x7b\x37\x7a\x5b\xb5\xcc\x2e\x62\x92\x20"
11535 "\xa9\xba\x0a\x09\xc2\x2a\x0f\xdb\xd9\xa3\xae\xd6\x32\xc1\x72\x0e"
11536 "\x6d\x82\x9f\x74\x7f\xba\x12\xe8\x31\xa2\x45\x8d\xf0\x73\x4e\xe0"
11537 "\x12\x27\x52\xd3\xe2\x2c\x36\xc4\x42\x89\x3b\xcd\xd1\xbd\xd9\x08" },
11538 { GCRY_MD_BLAKE2B_384, "?",
11539 "\x22\x66\x8e\x05\x81\x44\x52\xa5\x23\x84\xce\x67\xd4\xad\x0e\x03"
11540 "\xdf\xe7\x1a\xc1\x56\x9d\x95\x4a\xd2\x22\x7a\x70\x2a\xfe\x6c\x68"
11541 "\x5c\x7d\x65\x30\x2b\xc0\xde\xc6\xea\x72\x1e\xdd\x46\xdf\xb2\x08" },
11542 { GCRY_MD_BLAKE2B_256, "?",
11543 "\xfa\x11\x30\xd8\xba\x8a\x4c\x5a\x0e\x6f\x4f\x4c\xd2\xd1\x38\x0c"
11544 "\xb9\x22\x2a\xbd\xf6\x20\x70\xf8\x02\x1b\x34\xdd\xd7\x24\x92\x1b" },
11545 { GCRY_MD_BLAKE2B_160, "?",
11546 "\xe7\x86\x08\x31\xf8\x96\x8d\x64\x9b\xe0\x15\x68\x33\xf3\xbd\x2a"
11547 "\x5f\x0b\xdb\x40" },
11548 { GCRY_MD_BLAKE2S_256, "abc",
11549 "\x50\x8C\x5E\x8C\x32\x7C\x14\xE2\xE1\xA7\x2B\xA3\x4E\xEB\x45\x2F"
11550 "\x37\x45\x8B\x20\x9E\xD6\x3A\x29\x4D\x99\x9B\x4C\x86\x67\x59\x82" },
11551 #include "./blake2s.h"
11552 { GCRY_MD_BLAKE2S_128,
11553 "",
11554 "\x84\x89\x68\xb3\x59\x01\xe9\x57\x9a\x4d\xbf\x28\xdf\x99\xec\x23",
11555 0, 16,
11556 "\xea\xea\xd5\xc0\x96\x56\xec\x43\x30\x73\xa3\x17\xbb\xd3\x8e\x62",
11557 16 },
11558 { GCRY_MD_BLAKE2S_128,
11559 "\x9c\x9c\x38",
11560 "\x2e\xbb\x18\x78\xda\x34\x05\xad\x98\x1a\x33\x06\x50\x35\xd3\x75",
11561 3, 16,
11562 "\xea\xea\xd5\xc0\x96\x56\xec\x43\x30\x73\xa3\x17\xbb\xd3\x8e\x62",
11563 16 },
11564 { GCRY_MD_BLAKE2S_128,
11565 "\xab\xab\x56\x01\x58\x5a\xb3\x0d\xc1\xce\x8f\x5e\xee\x4d\x3b\x88"
11566 "\xc4\x4c\x11\x5e\x6f\xcd\x3d\x0a\x47\x52\x9a\xec\x86\x73\xfa\x6e"
11567 "\x68\xd6\x3f\x16\x55\x6b\xc1\x2d\xef\x1d\x0c\x29\x35\x5f\x94\xf3"
11568 "\x88\x7c\x04\x81\x86\x07\x8e\x95\x23\xb9\xdd\x97\x74\x0c\x80\x8c",
11569 "\x3c\xd4\xea\xd7\x88\x0b\x8e\x82\xde\x07\x9c\x1f\xad\x34\x17\xd4",
11570 64, 16,
11571 "\xea\xea\xd5\xc0\x96\x56\xec\x43\x30\x73\xa3\x17\xbb\xd3\x8e\x62",
11572 16 },
11573 { GCRY_MD_BLAKE2S_128,
11574 "\x8a\x8a\x14\x9e\xb2\x50\x02\x52\x54\xa6\xfa\xa0\x9a\x3a\xd4\x0e"
11575 "\xe3\xf2\xd5\xc7\x9d\x64\x02\x66\x68\xcf\x38\x08\x41\x49\x8a\xd3"
11576 "\x5e\x32\x90\xc2\x53\x15\x68\x7e\xe6\x65\x4b\xb0\xfc\xad\xaa\x58"
11577 "\x02\x5b\x5e\xb9\x18\xd1\xe9\xbb\xa5\x61\x07\x68\x70\xd9\x49\x22"
11578 "\x6b",
11579 "\xee\x92\xc5\x25\x4c\x29\x7a\x88\xe6\x9a\x23\x69\x56\xb6\x7c\xee",
11580 65, 16,
11581 "\xea\xea\xd5\xc0\x96\x56\xec\x43\x30\x73\xa3\x17\xbb\xd3\x8e\x62",
11582 16 },
11583 { GCRY_MD_BLAKE2S_160,
11584 "",
11585 "\x68\x64\x48\x80\x0c\x80\xc6\xd0\x4f\xb7\x3f\xc1\x7f\xa0\x8c\xa2"
11586 "\x39\x03\xe1\xe9",
11587 0, 20,
11588 "\x65\x65\xcb\x30\xfb\x2c\x28\x54\x7c\xd0\x4c\x1d\x6a\x88\xf2\x7a"
11589 "\x6d\xe8\x55\x3d",
11590 20 },
11591 { GCRY_MD_BLAKE2S_160,
11592 "\x9c\x9c\x38",
11593 "\xba\xb3\x5b\x8c\x87\x04\x1a\x00\x24\x44\xa5\xca\x45\x13\x2d\x75"
11594 "\xef\xd3\x4c\xb9",
11595 3, 20,
11596 "\x65\x65\xcb\x30\xfb\x2c\x28\x54\x7c\xd0\x4c\x1d\x6a\x88\xf2\x7a"
11597 "\x6d\xe8\x55\x3d",
11598 20 },
11599 { GCRY_MD_BLAKE2S_160,
11600 "\xab\xab\x56\x01\x58\x5a\xb3\x0d\xc1\xce\x8f\x5e\xee\x4d\x3b\x88"
11601 "\xc4\x4c\x11\x5e\x6f\xcd\x3d\x0a\x47\x52\x9a\xec\x86\x73\xfa\x6e"
11602 "\x68\xd6\x3f\x16\x55\x6b\xc1\x2d\xef\x1d\x0c\x29\x35\x5f\x94\xf3"
11603 "\x88\x7c\x04\x81\x86\x07\x8e\x95\x23\xb9\xdd\x97\x74\x0c\x80\x8c",
11604 "\xe8\xc3\xf1\xdb\x1c\xf8\xe9\xd1\xb5\x4a\x54\x0a\xdc\xe7\x18\x13"
11605 "\x0f\xf4\x12\x98",
11606 64, 20,
11607 "\x65\x65\xcb\x30\xfb\x2c\x28\x54\x7c\xd0\x4c\x1d\x6a\x88\xf2\x7a"
11608 "\x6d\xe8\x55\x3d",
11609 20 },
11610 { GCRY_MD_BLAKE2S_160,
11611 "\x8a\x8a\x14\x9e\xb2\x50\x02\x52\x54\xa6\xfa\xa0\x9a\x3a\xd4\x0e"
11612 "\xe3\xf2\xd5\xc7\x9d\x64\x02\x66\x68\xcf\x38\x08\x41\x49\x8a\xd3"
11613 "\x5e\x32\x90\xc2\x53\x15\x68\x7e\xe6\x65\x4b\xb0\xfc\xad\xaa\x58"
11614 "\x02\x5b\x5e\xb9\x18\xd1\xe9\xbb\xa5\x61\x07\x68\x70\xd9\x49\x22"
11615 "\x6b",
11616 "\x59\x02\xf8\x38\x18\x77\x9c\xd8\x13\x40\x0f\xd6\xbb\x23\x04\x1b"
11617 "\x64\x9a\x57\xa7",
11618 65, 20,
11619 "\x65\x65\xcb\x30\xfb\x2c\x28\x54\x7c\xd0\x4c\x1d\x6a\x88\xf2\x7a"
11620 "\x6d\xe8\x55\x3d",
11621 20 },
11622 { GCRY_MD_BLAKE2S_224,
11623 "",
11624 "\xa8\x66\x86\x63\x35\x3a\xe0\x8f\x4e\x4b\x6b\x1e\xcb\x43\x19\xc8"
11625 "\x2b\x41\x3f\x5e\xe5\x43\x95\x9c\xa5\x9a\x73\x1b",
11626 0, 28,
11627 "\x5a\x5a\xb5\x10\xc6\xd7\x9e\x76\x14\x8a\x9e\x29\xc8\xf1\xba\xab"
11628 "\x65\x11\x77\x89\x00\x89\x8a\x14\x9f\xb4\x53\x07",
11629 28 },
11630 { GCRY_MD_BLAKE2S_224,
11631 "\x9c\x9c\x38",
11632 "\x1a\x34\x9d\xc1\x51\xbd\x8b\xa2\xa7\xa6\x6b\xe4\x93\x98\x51\x88"
11633 "\x33\x49\x71\x02\x09\xb1\x20\x85\x8c\x4c\x67\xb8",
11634 3, 28,
11635 "\x5a\x5a\xb5\x10\xc6\xd7\x9e\x76\x14\x8a\x9e\x29\xc8\xf1\xba\xab"
11636 "\x65\x11\x77\x89\x00\x89\x8a\x14\x9f\xb4\x53\x07",
11637 28 },
11638 { GCRY_MD_BLAKE2S_224,
11639 "\xab\xab\x56\x01\x58\x5a\xb3\x0d\xc1\xce\x8f\x5e\xee\x4d\x3b\x88"
11640 "\xc4\x4c\x11\x5e\x6f\xcd\x3d\x0a\x47\x52\x9a\xec\x86\x73\xfa\x6e"
11641 "\x68\xd6\x3f\x16\x55\x6b\xc1\x2d\xef\x1d\x0c\x29\x35\x5f\x94\xf3"
11642 "\x88\x7c\x04\x81\x86\x07\x8e\x95\x23\xb9\xdd\x97\x74\x0c\x80\x8c",
11643 "\x3a\x0e\xd5\x46\x95\x8c\xd6\xf9\x7c\x38\xd0\xe7\x1c\xfd\xd4\xc5"
11644 "\x67\x6d\x5c\xcc\x35\x06\xec\x87\x87\x09\x26\x39",
11645 64, 28,
11646 "\x5a\x5a\xb5\x10\xc6\xd7\x9e\x76\x14\x8a\x9e\x29\xc8\xf1\xba\xab"
11647 "\x65\x11\x77\x89\x00\x89\x8a\x14\x9f\xb4\x53\x07",
11648 28 },
11649 { GCRY_MD_BLAKE2S_224,
11650 "\x8a\x8a\x14\x9e\xb2\x50\x02\x52\x54\xa6\xfa\xa0\x9a\x3a\xd4\x0e"
11651 "\xe3\xf2\xd5\xc7\x9d\x64\x02\x66\x68\xcf\x38\x08\x41\x49\x8a\xd3"
11652 "\x5e\x32\x90\xc2\x53\x15\x68\x7e\xe6\x65\x4b\xb0\xfc\xad\xaa\x58"
11653 "\x02\x5b\x5e\xb9\x18\xd1\xe9\xbb\xa5\x61\x07\x68\x70\xd9\x49\x22"
11654 "\x6b",
11655 "\x63\xd7\x98\xcc\x8e\xe3\x00\x45\x2f\xd8\x19\x83\x02\x94\x7f\xf1"
11656 "\xb3\x82\x73\xaa\x19\xae\x72\x8b\x1f\x64\xbe\x88",
11657 65, 28,
11658 "\x5a\x5a\xb5\x10\xc6\xd7\x9e\x76\x14\x8a\x9e\x29\xc8\xf1\xba\xab"
11659 "\x65\x11\x77\x89\x00\x89\x8a\x14\x9f\xb4\x53\x07",
11660 28 },
11661 { GCRY_MD_BLAKE2S_256,
11662 "",
11663 "\x98\xf3\x21\xe5\x43\xb8\x07\x35\x27\x9c\x86\x1c\x36\x33\x9b\x43"
11664 "\x45\x50\xc6\x9d\x23\xc6\xc8\xff\x96\xbf\x4e\x03\x86\x10\x24\xfd",
11665 0, 32,
11666 "\xd5\xd5\xab\x80\x2c\xad\xd9\x86\x60\xe7\x47\x2f\x77\xa6\x1d\xc4"
11667 "\xe2\xa6\x88\x2f\xb7\xe6\x9e\x85\x23\xa9\xcd\x76\x43\xb9\xfd\xb7",
11668 32 },
11669 { GCRY_MD_BLAKE2S_256,
11670 "\x9c\x9c\x38",
11671 "\x7b\x10\xa3\x67\xb8\x5d\x29\x9a\x91\x27\x37\x05\x9d\x05\x9d\x3d"
11672 "\xe6\x42\xa3\x19\x04\x57\x01\xb6\x25\x0b\xfd\x3c\x6c\xb9\x4f\x87",
11673 3, 32,
11674 "\xd5\xd5\xab\x80\x2c\xad\xd9\x86\x60\xe7\x47\x2f\x77\xa6\x1d\xc4"
11675 "\xe2\xa6\x88\x2f\xb7\xe6\x9e\x85\x23\xa9\xcd\x76\x43\xb9\xfd\xb7",
11676 32 },
11677 { GCRY_MD_BLAKE2S_256,
11678 "\xab\xab\x56\x01\x58\x5a\xb3\x0d\xc1\xce\x8f\x5e\xee\x4d\x3b\x88"
11679 "\xc4\x4c\x11\x5e\x6f\xcd\x3d\x0a\x47\x52\x9a\xec\x86\x73\xfa\x6e"
11680 "\x68\xd6\x3f\x16\x55\x6b\xc1\x2d\xef\x1d\x0c\x29\x35\x5f\x94\xf3"
11681 "\x88\x7c\x04\x81\x86\x07\x8e\x95\x23\xb9\xdd\x97\x74\x0c\x80\x8c",
11682 "\xd7\x8b\x98\x28\x54\x4c\xc1\x62\x9e\xab\x7d\xfe\xb1\xfa\xdd\x2b"
11683 "\xed\x98\x1c\xe6\x5f\xef\xd8\x08\x42\x9a\x11\x1e\x97\x44\x92\xa3",
11684 64, 32,
11685 "\xd5\xd5\xab\x80\x2c\xad\xd9\x86\x60\xe7\x47\x2f\x77\xa6\x1d\xc4"
11686 "\xe2\xa6\x88\x2f\xb7\xe6\x9e\x85\x23\xa9\xcd\x76\x43\xb9\xfd\xb7",
11687 32 },
11688 { GCRY_MD_BLAKE2S_256,
11689 "\x8a\x8a\x14\x9e\xb2\x50\x02\x52\x54\xa6\xfa\xa0\x9a\x3a\xd4\x0e"
11690 "\xe3\xf2\xd5\xc7\x9d\x64\x02\x66\x68\xcf\x38\x08\x41\x49\x8a\xd3"
11691 "\x5e\x32\x90\xc2\x53\x15\x68\x7e\xe6\x65\x4b\xb0\xfc\xad\xaa\x58"
11692 "\x02\x5b\x5e\xb9\x18\xd1\xe9\xbb\xa5\x61\x07\x68\x70\xd9\x49\x22"
11693 "\x6b",
11694 "\x1b\x9e\x26\x9a\x90\xf8\x73\x51\x73\xbc\x4f\x65\xce\x29\x2c\x61"
11695 "\x16\x65\xc7\xb0\x72\x07\xa8\x0b\xfb\x2e\xea\x12\x7d\x97\xcd\x06",
11696 65, 32,
11697 "\xd5\xd5\xab\x80\x2c\xad\xd9\x86\x60\xe7\x47\x2f\x77\xa6\x1d\xc4"
11698 "\xe2\xa6\x88\x2f\xb7\xe6\x9e\x85\x23\xa9\xcd\x76\x43\xb9\xfd\xb7",
11699 32 },
11700 { GCRY_MD_BLAKE2S_256, "!",
11701 "\xbe\xc0\xc0\xe6\xcd\xe5\xb6\x7a\xcb\x73\xb8\x1f\x79\xa6\x7a\x40"
11702 "\x79\xae\x1c\x60\xda\xc9\xd2\x66\x1a\xf1\x8e\x9f\x8b\x50\xdf\xa5" },
11703 { GCRY_MD_BLAKE2S_256, "?",
11704 "\xdc\x5a\xe7\x1b\xd4\x63\xa1\xf8\x4d\x73\x33\x44\x63\x6b\xa6\x87"
11705 "\xe6\xbd\xf4\xba\xed\xc3\xef\xc8\xb3\x86\x55\xbb\x08\x56\x3e\xdb" },
11706 { GCRY_MD_BLAKE2S_224, "?",
11707 "\x2e\x34\x7d\x6b\xcc\x80\xbe\xc3\xf8\x61\x35\x6a\x88\x27\xcd\x84"
11708 "\x32\xd4\xd4\x05\xe0\x43\x20\x58\xc7\xb6\xda\xa3" },
11709 { GCRY_MD_BLAKE2S_160, "?",
11710 "\xaa\x83\xe1\xcd\x8d\x4e\x9c\xb7\xf4\x6b\x43\xe1\xbc\x6f\x73\x3b"
11711 "\x0e\xfc\x29\xde" },
11712 { GCRY_MD_BLAKE2S_128, "?",
11713 "\x70\x0b\x8a\x71\x1d\x34\x0a\xf0\x13\x93\x19\x93\x5e\xd7\x54\x9c" },
11714
11715 { GCRY_MD_SM3, "abc",
11716 "\x66\xc7\xf0\xf4\x62\xee\xed\xd9\xd1\xf2\xd4\x6b\xdc\x10\xe4\xe2"
11717 "\x41\x67\xc4\x87\x5c\xf2\xf7\xa2\x29\x7d\xa0\x2b\x8f\x4b\xa8\xe0" },
11718 { GCRY_MD_SM3,
11719 "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
11720 "\x63\x9b\x6c\xc5\xe6\x4d\x9e\x37\xa3\x90\xb1\x92\xdf\x4f\xa1\xea"
11721 "\x07\x20\xab\x74\x7f\xf6\x92\xb9\xf3\x8c\x4e\x66\xad\x7b\x8c\x05" },
11722 { GCRY_MD_SM3, "!",
11723 "\xc8\xaa\xf8\x94\x29\x55\x40\x29\xe2\x31\x94\x1a\x2a\xcc\x0a\xd6"
11724 "\x1f\xf2\xa5\xac\xd8\xfa\xdd\x25\x84\x7a\x3a\x73\x2b\x3b\x02\xc3" },
11725 { GCRY_MD_SM3, "?",
11726 "\x3a\x3f\x53\xfc\x96\xc2\xde\xb2\xd9\x12\x3a\x1b\xd8\x47\x71\x28"
11727 "\xbc\x5d\x5e\x94\xea\x08\x86\x3d\xfb\xe4\x00\x5a\xd9\xed\x79\x26" },
11728 { GCRY_MD_SM3,
11729 "Libgcrypt is free software; you can redistribute it and/or modif"
11730 "y it under the terms of the GNU Lesser general Public License as"
11731 " published by the Free Software Foundation; either version 2.1 o"
11732 "f the License, or (at your option) any later version.\nLibgcrypt"
11733 " is distributed in the hope that it will be useful, but WITHOUT "
11734 "ANY WARRANTY; without even the implied warranty of MERCHANTABILI"
11735 "TY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser Gene"
11736 "ral Public License for more details.",
11737 "\x8b\x91\x3f\x0e\x85\xae\x43\x25\x6d\x28\x38\x6c\x09\x5c\xc7\x72"
11738 "\xcc\x2e\x78\x89\x7e\x2e\x4e\x5a\x3d\xf6\x55\xfe\x87\xbe\xa6\xbc" },
11739
11740 { GCRY_MD_GOSTR3411_CP,
11741 "*",
11742 "\x72\xd7\xe3\xbf\xa0\x08\xc9\x62\xae\xa9\xc5\xd8\x93\x5f\x17\xd7"
11743 "\x3f\xf2\x52\xb4\xc1\x16\xcf\x63\xa4\xcc\x4a\x8c\x7f\xe5\x60\x2c" },
11744 { GCRY_MD_MD4,
11745 "*",
11746 "\xe8\xb9\xe4\x59\x61\x08\xc0\xfe\x54\xef\xc5\x8e\x20\x7c\x9b\x37" },
11747 { GCRY_MD_MD5,
11748 "*",
11749 "\x0b\x1e\xab\xa2\x5e\x48\x76\x92\xae\x16\x12\xde\x5f\xb3\x29\x41" },
11750 { GCRY_MD_RMD160,
11751 "*",
11752 "\x28\xfd\xd6\xa8\x95\x29\x43\x6b\x5e\xd9\xa0\x06\x82\xbb\xe6\x10"
11753 "\xd3\xcc\x79\x33" },
11754 { GCRY_MD_SHA1,
11755 "*",
11756 "\xd8\x37\x46\x1a\x46\xfe\x42\x11\x7d\x50\xca\xf7\x3d\x7e\x0c\x36"
11757 "\x42\x0c\x15\xb6" },
11758 { GCRY_MD_SHA224,
11759 "*",
11760 "\x2e\xba\x51\x6c\x71\x5a\x1d\xb8\x6b\x57\xfb\xf1\x46\xa0\xa7\x1d"
11761 "\x72\x66\xaf\x90\xb8\x01\x18\xc8\x58\x57\xa5\x63" },
11762 { GCRY_MD_SHA256,
11763 "*",
11764 "\x30\xed\xe4\x69\xf3\x1c\x70\x8a\x6d\x92\x00\xac\xd8\x08\x89\xea"
11765 "\x7e\x92\xff\x02\x0b\x72\x4a\xdf\xa9\x2b\x9f\x80\xba\xd0\x25\xd0" },
11766 { GCRY_MD_SHA384,
11767 "*",
11768 "\x21\xd7\x40\xdf\x34\x13\xcf\x56\xf7\x61\x0a\x1b\x11\xb7\x1e\x01"
11769 "\x87\xad\xbb\x3e\x9a\xe8\xaa\xaa\xbc\x3a\x89\x39\x0a\xa9\xcb\x4f"
11770 "\x09\x75\x4c\x44\x59\x42\xf5\x13\x5f\xe5\xa6\x2b\x16\xbe\xfc\xdf" },
11771 { GCRY_MD_SHA512,
11772 "*",
11773 "\x5c\xbe\x01\x03\xbd\x8d\xa1\x38\x5e\x87\x00\x94\x8d\x14\xd0\xb3"
11774 "\x2c\x88\xeb\xb8\xf6\xcc\x06\x44\x54\xb1\x58\x88\xa9\x67\xa0\xe3"
11775 "\x0d\x28\x8b\xf4\x2c\xc6\x7a\xdc\x1a\x35\xbf\x0c\xc8\x35\xf0\x24"
11776 "\x69\xb5\xfe\x15\x6f\x71\xbd\x87\x07\x52\x27\xcc\xdc\x21\x84\x21" },
11777 { GCRY_MD_SHA3_224,
11778 "*",
11779 "\x1a\xa6\x6f\x1a\x3c\x62\x14\x75\xea\x9d\x49\x4d\x39\x01\x2b\xbd"
11780 "\x4d\xe1\x58\xbc\x32\xac\x48\xcf\x6a\x1a\x54\x34" },
11781 { GCRY_MD_SHA3_256,
11782 "*",
11783 "\x87\xf8\x0e\x78\xc1\x7b\x0c\x36\x4c\xbb\x8d\xca\x5e\x77\xc3\xfd"
11784 "\x95\xbd\xaf\x94\x85\xc6\x0c\xe6\x22\x52\xeb\x22\x50\x32\x48\x57" },
11785 { GCRY_MD_SHA3_384,
11786 "*",
11787 "\x89\x5a\xd6\xc8\x60\x20\x66\xe7\x9e\xb3\x6d\x5c\x07\xd7\x5e\xd0"
11788 "\x48\x84\x9d\x51\x75\x14\x77\xdb\xcd\xbf\x70\x18\xdc\x64\x53\x85"
11789 "\x94\x95\xa5\xd3\x26\x9c\xf1\x63\x14\x8d\x11\xa0\xfc\xd8\x05\x9e" },
11790 { GCRY_MD_SHA3_512,
11791 "*",
11792 "\x53\x0b\x1c\xb7\xff\x2c\xaa\x7e\x62\x15\xa7\x57\x9a\xd0\xcf\x4f"
11793 "\xa5\xae\xe0\x05\x1c\x77\x0f\x29\x5b\x3f\xba\xab\x88\x0c\x0b\x8e"
11794 "\x10\xcf\x3d\xa9\x0d\x1e\x97\x98\x96\xeb\x24\x2e\x70\x30\xd0\x78"
11795 "\x2b\x9e\x30\xad\x5d\xcf\x56\xcf\xd0\xc1\x58\x95\x53\x09\x78\xd6" },
11796 { GCRY_MD_SM3,
11797 "*",
11798 "\xb6\xfc\x1e\xc4\xad\x9b\x88\xbd\x08\xaa\xf3\xb3\xfa\x4f\x1b\x9c"
11799 "\xd6\x9a\x32\x09\x28\x9e\xda\x3a\x99\xb6\x09\x8f\x35\x99\xa6\x11" },
11800 { GCRY_MD_STRIBOG256,
11801 "*",
11802 "\x35\x0b\xec\x46\x1f\x98\x19\xe7\x33\x12\xda\x9f\xaf\x3d\x32\xa6"
11803 "\xe4\xa5\x80\x38\x1b\x56\x68\x13\x2d\x0d\xa6\xfd\xfa\xe5\x3d\xf2" },
11804 { GCRY_MD_STRIBOG512,
11805 "*",
11806 "\x01\x4c\xbd\xd4\x3a\x1a\x51\x9e\xa8\x7c\x1f\xd2\xc3\x2e\x71\x78"
11807 "\x03\x46\xd0\x1b\x30\xdd\x07\xf6\x82\x2b\xa4\x43\x8f\x95\x44\x9d"
11808 "\x92\x3a\x17\x70\x1b\xdd\xfc\x8f\x71\x20\xc6\xa0\xd8\x6f\xb2\x06"
11809 "\xb6\x61\x27\x48\x45\x94\x96\xe7\xdc\xf5\x7a\x2f\x83\x82\x03\x08" },
11810 { GCRY_MD_TIGER1,
11811 "*",
11812 "\x95\xe1\x25\x8f\xc5\x4b\x82\x12\x69\x83\xfa\xfd\x79\x7d\x87\x38"
11813 "\x01\x4f\xf9\x24\xa2\xf0\x8f\x85" },
11814 { GCRY_MD_WHIRLPOOL,
11815 "*",
11816 "\x8e\x02\x8e\x8d\xeb\x03\xcc\x37\xf2\x67\x61\x4e\x16\x27\x06\x13"
11817 "\x26\x8c\x35\x17\x0c\xab\x3c\x8b\x25\xc3\x3a\x2b\x7d\x54\xbf\xcf"
11818 "\x7e\xa2\xe4\x4f\x8d\x67\xb7\x85\xfa\x54\x76\x7c\xb0\x24\x87\xd5"
11819 "\x0e\x7d\x3b\x02\x8f\x30\x9e\x91\x78\xea\xc6\xdc\x0e\xee\x71\xca" },
11820 { GCRY_MD_CRC24_RFC2440,
11821 "*",
11822 "\x44\x53\xd8" },
11823 { GCRY_MD_CRC32,
11824 "*",
11825 "\x96\x11\x46\x4d" },
11826 { GCRY_MD_TIGER,
11827 "*",
11828 "\x12\x82\x4b\xc5\x8f\x25\xe1\x95\x38\x87\x7d\x79\xfd\xfa\x83\x69"
11829 "\x85\x8f\xf0\xa2\x24\xf9\x4f\x01" },
11830 { GCRY_MD_TIGER2,
11831 "*",
11832 "\xc6\x8f\x98\x71\xee\xb3\x1a\xf6\x77\x50\x8e\x74\x98\x08\x6c\x42"
11833 "\xc0\x37\x43\xc2\x17\x89\x5f\x98" },
11834 { GCRY_MD_CRC32_RFC1510,
11835 "*",
11836 "\xf4\x45\xfd\x43" },
11837 { GCRY_MD_BLAKE2B_512,
11838 "*",
11839 "\xe0\xf7\x38\x87\x07\xf9\xfd\xeb\x58\x8d\xb9\xb8\xa4\x85\x21\x8e"
11840 "\x56\xa9\xe6\x8d\x64\x4d\xfb\xe8\x8a\x84\xa4\x45\xc7\x80\x4b\x1f"
11841 "\x63\x0b\x27\x84\x96\xd4\xeb\x99\x19\xcb\xc6\x37\x01\x42\xb9\x03"
11842 "\x50\x63\xdf\xb9\x5e\xc5\xb1\xda\x2d\x19\xeb\x65\x73\xd2\xfa\xfa" },
11843 { GCRY_MD_BLAKE2B_384,
11844 "*",
11845 "\x44\xde\xb8\x2b\x46\x22\xe5\xc6\xa5\x66\x8a\x88\x2b\xc3\x2c\x27"
11846 "\xc1\x4e\x4f\x6b\x70\x96\xcb\x1a\x99\x04\x67\x54\x8a\x0a\x55\xb4"
11847 "\xdb\x8b\xf6\x36\xfc\x2e\xf6\x2a\x6b\xe2\x1d\x09\x0e\x2f\x65\x33" },
11848 { GCRY_MD_BLAKE2B_256,
11849 "*",
11850 "\x75\xd1\x62\xad\x02\xf1\x3f\xa3\x95\x2f\x5f\x89\x13\x2c\xf4\x2f"
11851 "\xc3\x84\xd2\x46\xbc\x35\x2b\x13\x01\xe0\x9e\x46\x55\x92\x40\x5a" },
11852 { GCRY_MD_BLAKE2B_160,
11853 "*",
11854 "\x8c\x67\x38\x0e\xf8\xc7\xb6\x3e\x7f\x8e\x32\x73\x8a\xba\xa4\x71"
11855 "\x87\x9a\xb0\x4c" },
11856 { GCRY_MD_BLAKE2S_256,
11857 "*",
11858 "\x71\x4a\x6d\xe4\xbb\x6c\x9f\x22\xff\x50\x02\xba\x5f\x54\xa6\x39"
11859 "\x9d\x07\x95\x82\x38\x98\xac\x62\xab\xc6\x13\x12\x65\x64\x9e\x69" },
11860 { GCRY_MD_BLAKE2S_224,
11861 "*",
11862 "\x4c\x01\xe6\x67\xa2\x02\xd1\x62\x9b\xc3\x3b\xb5\x93\xc4\x3c\xa9"
11863 "\x90\x7b\x96\x70\xfd\xdf\xd1\xc3\xad\x09\xa9\xe7" },
11864 { GCRY_MD_BLAKE2S_160,
11865 "*",
11866 "\x21\xca\x18\x74\x76\x3c\x6b\xe4\x92\x01\xd6\xd5\x91\xd1\x53\xfb"
11867 "\x37\x73\x99\xb9" },
11868 { GCRY_MD_BLAKE2S_128,
11869 "*",
11870 "\x1d\x87\xfa\x69\xe0\x93\xd9\xcd\xb0\x3c\x52\x00\x35\xe1\xa3\xee" },
11871 { GCRY_MD_GOSTR3411_94,
11872 "*",
11873 "\x6e\xa9\x9e\x23\xde\x5f\x7a\xb7\x7f\xa7\xdc\xe1\xc8\x05\x46\xae"
11874 "\x1e\x7c\x76\xbb\x52\x0f\x52\x07\x78\x59\xd3\xc1\x64\xdb\x51\xac" },
11875 { 0 }
11876 };
11877 gcry_error_t err;
11878 int i;
11879
11880 if (verbose)
11881 fprintf (stderr, "Starting hash checks.\n");
11882
11883 for (i = 0; algos[i].md; i++)
11884 {
11885 if (gcry_md_test_algo (algos[i].md))
11886 {
11887 show_md_not_available (algos[i].md);
11888 continue;
11889 }
11890 if (gcry_md_test_algo (algos[i].md) && in_fips_mode)
11891 {
11892 if (verbose)
11893 fprintf (stderr, " algorithm %d not available in fips mode\n",
11894 algos[i].md);
11895 continue;
11896 }
11897
11898 if (!strcmp (algos[i].data, "*"))
11899 {
11900 if (verbose)
11901 fprintf (stderr, " checking %s [%i] for final handling\n",
11902 gcry_md_algo_name (algos[i].md),
11903 algos[i].md);
11904
11905 check_one_md_final (algos[i].md, algos[i].expect, algos[i].expectlen);
11906
11907 continue;
11908 }
11909
11910 if (verbose)
11911 fprintf (stderr, " checking %s [%i] for length %d\n",
11912 gcry_md_algo_name (algos[i].md),
11913 algos[i].md,
11914 (!strcmp (algos[i].data, "!") || !strcmp (algos[i].data, "?"))?
11915 1000000 : (int)strlen(algos[i].data));
11916
11917 check_one_md (algos[i].md, algos[i].data,
11918 algos[i].datalen > 0 ? algos[i].datalen
11919 : strlen (algos[i].data),
11920 algos[i].expect, algos[i].expectlen,
11921 algos[i].key, algos[i].keylen);
11922
11923 if (algos[i].key && algos[i].keylen)
11924 continue;
11925
11926 check_one_md_multi (algos[i].md, algos[i].data,
11927 algos[i].datalen > 0 ? algos[i].datalen
11928 : strlen (algos[i].data),
11929 algos[i].expect);
11930 }
11931
11932 /* Check the Whirlpool bug emulation. */
11933 if (!gcry_md_test_algo (GCRY_MD_WHIRLPOOL) && !in_fips_mode)
11934 {
11935 static const char expect[] =
11936 "\x35\x28\xd6\x4c\x56\x2c\x55\x2e\x3b\x91\x93\x95\x7b\xdd\xcc\x6e"
11937 "\x6f\xb7\xbf\x76\x22\x9c\xc6\x23\xda\x3e\x09\x9b\x36\xe8\x6d\x76"
11938 "\x2f\x94\x3b\x0c\x63\xa0\xba\xa3\x4d\x66\x71\xe6\x5d\x26\x67\x28"
11939 "\x36\x1f\x0e\x1a\x40\xf0\xce\x83\x50\x90\x1f\xfa\x3f\xed\x6f\xfd";
11940 gcry_md_hd_t hd;
11941 int algo = GCRY_MD_WHIRLPOOL;
11942 unsigned char *p;
11943 int mdlen;
11944
11945 err = gcry_md_open (&hd, GCRY_MD_WHIRLPOOL, GCRY_MD_FLAG_BUGEMU1);
11946 if (err)
11947 {
11948 fail ("algo %d, gcry_md_open failed: %s\n", algo, gpg_strerror (err));
11949 goto leave;
11950 }
11951
11952 mdlen = gcry_md_get_algo_dlen (algo);
11953 if (mdlen < 1 || mdlen > 500)
11954 {
11955 fail ("algo %d, gcry_md_get_algo_dlen failed: %d\n", algo, mdlen);
11956 gcry_md_close (hd);
11957 goto leave;
11958 }
11959
11960 /* Hash 62 byes in chunks. */
11961 gcry_md_write (hd, "1234567890", 10);
11962 gcry_md_write (hd, "1234567890123456789012345678901234567890123456789012",
11963 52);
11964
11965 p = gcry_md_read (hd, algo);
11966
11967 if (memcmp (p, expect, mdlen))
11968 {
11969 printf ("computed: ");
11970 for (i = 0; i < mdlen; i++)
11971 printf ("%02x ", p[i] & 0xFF);
11972 printf ("\nexpected: ");
11973 for (i = 0; i < mdlen; i++)
11974 printf ("%02x ", expect[i] & 0xFF);
11975 printf ("\n");
11976
11977 fail ("algo %d, digest mismatch\n", algo);
11978 }
11979
11980 gcry_md_close (hd);
11981 }
11982
11983 leave:
11984 if (verbose)
11985 fprintf (stderr, "Completed hash checks.\n");
11986 }
11987
11988 static void
check_one_hmac(int algo,const char * data,int datalen,const char * key,int keylen,const char * expect)11989 check_one_hmac (int algo, const char *data, int datalen,
11990 const char *key, int keylen, const char *expect)
11991 {
11992 gcry_md_hd_t hd, hd2;
11993 unsigned char *p;
11994 int mdlen;
11995 int i;
11996 gcry_error_t err = 0;
11997
11998 err = gcry_md_open (&hd, algo, GCRY_MD_FLAG_HMAC);
11999 if (err)
12000 {
12001 fail ("algo %d, gcry_md_open failed: %s\n", algo, gpg_strerror (err));
12002 return;
12003 }
12004
12005 mdlen = gcry_md_get_algo_dlen (algo);
12006 if (mdlen < 1 || mdlen > 500)
12007 {
12008 fail ("algo %d, gcry_md_get_algo_dlen failed: %d\n", algo, mdlen);
12009 return;
12010 }
12011
12012 gcry_md_setkey( hd, key, keylen );
12013
12014 gcry_md_write (hd, data, datalen);
12015
12016 err = gcry_md_copy (&hd2, hd);
12017
12018 gcry_md_close (hd);
12019
12020 if (err)
12021 {
12022 fail ("algo %d, gcry_md_copy failed: %s\n", algo, gpg_strerror (err));
12023 return;
12024 }
12025
12026 p = gcry_md_read (hd2, algo);
12027 if (!p)
12028 fail("algo %d, hmac gcry_md_read failed\n", algo);
12029 else if (memcmp (p, expect, mdlen))
12030 {
12031 printf ("computed: ");
12032 for (i = 0; i < mdlen; i++)
12033 printf ("%02x ", p[i] & 0xFF);
12034 printf ("\nexpected: ");
12035 for (i = 0; i < mdlen; i++)
12036 printf ("%02x ", expect[i] & 0xFF);
12037 printf ("\n");
12038
12039 fail ("algo %d, digest mismatch\n", algo);
12040 }
12041
12042 gcry_md_close (hd2);
12043 }
12044
12045 static void
check_hmac(void)12046 check_hmac (void)
12047 {
12048 static const struct algos
12049 {
12050 int md;
12051 const char *data;
12052 const char *key;
12053 const char *expect;
12054 } algos[] =
12055 {
12056 { GCRY_MD_MD5, "what do ya want for nothing?", "Jefe",
12057 "\x75\x0c\x78\x3e\x6a\xb0\xb5\x03\xea\xa8\x6e\x31\x0a\x5d\xb7\x38" },
12058 { GCRY_MD_MD5,
12059 "Hi There",
12060 "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b",
12061 "\x92\x94\x72\x7a\x36\x38\xbb\x1c\x13\xf4\x8e\xf8\x15\x8b\xfc\x9d" },
12062 { GCRY_MD_MD5,
12063 "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
12064 "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
12065 "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
12066 "\xdd\xdd\xdd\xdd\xdd",
12067 "\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA",
12068 "\x56\xbe\x34\x52\x1d\x14\x4c\x88\xdb\xb8\xc7\x33\xf0\xe8\xb3\xf6" },
12069 { GCRY_MD_MD5,
12070 "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
12071 "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
12072 "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
12073 "\xcd\xcd\xcd\xcd\xcd",
12074 "\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
12075 "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19",
12076 "\x69\x7e\xaf\x0a\xca\x3a\x3a\xea\x3a\x75\x16\x47\x46\xff\xaa\x79" },
12077 { GCRY_MD_MD5, "Test With Truncation",
12078 "\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c",
12079 "\x56\x46\x1e\xf2\x34\x2e\xdc\x00\xf9\xba\xb9\x95\x69\x0e\xfd\x4c" },
12080 { GCRY_MD_MD5, "Test Using Larger Than Block-Size Key - Hash Key First",
12081 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12082 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12083 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12084 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12085 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12086 "\xaa\xaa\xaa\xaa\xaa",
12087 "\x6b\x1a\xb7\xfe\x4b\xd7\xbf\x8f\x0b\x62\xe6\xce\x61\xb9\xd0\xcd" },
12088 { GCRY_MD_MD5,
12089 "Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data",
12090 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12091 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12092 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12093 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12094 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12095 "\xaa\xaa\xaa\xaa\xaa",
12096 "\x6f\x63\x0f\xad\x67\xcd\xa0\xee\x1f\xb1\xf5\x62\xdb\x3a\xa5\x3e", },
12097 { GCRY_MD_SHA256, "what do ya want for nothing?", "Jefe",
12098 "\x5b\xdc\xc1\x46\xbf\x60\x75\x4e\x6a\x04\x24\x26\x08\x95\x75\xc7\x5a"
12099 "\x00\x3f\x08\x9d\x27\x39\x83\x9d\xec\x58\xb9\x64\xec\x38\x43" },
12100 { GCRY_MD_SHA256,
12101 "Hi There",
12102 "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"
12103 "\x0b\x0b\x0b",
12104 "\xb0\x34\x4c\x61\xd8\xdb\x38\x53\x5c\xa8\xaf\xce\xaf\x0b\xf1\x2b\x88"
12105 "\x1d\xc2\x00\xc9\x83\x3d\xa7\x26\xe9\x37\x6c\x2e\x32\xcf\xf7" },
12106 { GCRY_MD_SHA256,
12107 "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
12108 "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
12109 "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
12110 "\xdd\xdd\xdd\xdd\xdd",
12111 "\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA"
12112 "\xAA\xAA\xAA\xAA",
12113 "\x77\x3e\xa9\x1e\x36\x80\x0e\x46\x85\x4d\xb8\xeb\xd0\x91\x81\xa7"
12114 "\x29\x59\x09\x8b\x3e\xf8\xc1\x22\xd9\x63\x55\x14\xce\xd5\x65\xfe" },
12115 { GCRY_MD_SHA256,
12116 "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
12117 "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
12118 "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
12119 "\xcd\xcd\xcd\xcd\xcd",
12120 "\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
12121 "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19",
12122 "\x82\x55\x8a\x38\x9a\x44\x3c\x0e\xa4\xcc\x81\x98\x99\xf2\x08"
12123 "\x3a\x85\xf0\xfa\xa3\xe5\x78\xf8\x07\x7a\x2e\x3f\xf4\x67\x29\x66\x5b" },
12124 { GCRY_MD_SHA256,
12125 "Test Using Larger Than Block-Size Key - Hash Key First",
12126 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12127 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12128 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12129 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12130 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12131 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12132 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12133 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12134 "\xaa\xaa\xaa",
12135 "\x60\xe4\x31\x59\x1e\xe0\xb6\x7f\x0d\x8a\x26\xaa\xcb\xf5\xb7\x7f"
12136 "\x8e\x0b\xc6\x21\x37\x28\xc5\x14\x05\x46\x04\x0f\x0e\xe3\x7f\x54" },
12137 { GCRY_MD_SHA256,
12138 "This is a test using a larger than block-size key and a larger than block-size data. The key needs to be hashed before being used by the HMAC algorithm.",
12139 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12140 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12141 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12142 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12143 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12144 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12145 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12146 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12147 "\xaa\xaa\xaa",
12148 "\x9b\x09\xff\xa7\x1b\x94\x2f\xcb\x27\x63\x5f\xbc\xd5\xb0\xe9\x44"
12149 "\xbf\xdc\x63\x64\x4f\x07\x13\x93\x8a\x7f\x51\x53\x5c\x3a\x35\xe2" },
12150 { GCRY_MD_SHA224, "what do ya want for nothing?", "Jefe",
12151 "\xa3\x0e\x01\x09\x8b\xc6\xdb\xbf\x45\x69\x0f\x3a\x7e\x9e\x6d\x0f"
12152 "\x8b\xbe\xa2\xa3\x9e\x61\x48\x00\x8f\xd0\x5e\x44" },
12153 { GCRY_MD_SHA224,
12154 "Hi There",
12155 "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"
12156 "\x0b\x0b\x0b",
12157 "\x89\x6f\xb1\x12\x8a\xbb\xdf\x19\x68\x32\x10\x7c\xd4\x9d\xf3\x3f\x47"
12158 "\xb4\xb1\x16\x99\x12\xba\x4f\x53\x68\x4b\x22" },
12159 { GCRY_MD_SHA224,
12160 "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
12161 "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
12162 "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
12163 "\xdd\xdd\xdd\xdd\xdd",
12164 "\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA"
12165 "\xAA\xAA\xAA\xAA",
12166 "\x7f\xb3\xcb\x35\x88\xc6\xc1\xf6\xff\xa9\x69\x4d\x7d\x6a\xd2\x64"
12167 "\x93\x65\xb0\xc1\xf6\x5d\x69\xd1\xec\x83\x33\xea" },
12168 { GCRY_MD_SHA224,
12169 "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
12170 "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
12171 "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
12172 "\xcd\xcd\xcd\xcd\xcd",
12173 "\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
12174 "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19",
12175 "\x6c\x11\x50\x68\x74\x01\x3c\xac\x6a\x2a\xbc\x1b\xb3\x82\x62"
12176 "\x7c\xec\x6a\x90\xd8\x6e\xfc\x01\x2d\xe7\xaf\xec\x5a" },
12177 { GCRY_MD_SHA224,
12178 "Test Using Larger Than Block-Size Key - Hash Key First",
12179 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12180 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12181 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12182 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12183 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12184 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12185 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12186 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12187 "\xaa\xaa\xaa",
12188 "\x95\xe9\xa0\xdb\x96\x20\x95\xad\xae\xbe\x9b\x2d\x6f\x0d\xbc\xe2"
12189 "\xd4\x99\xf1\x12\xf2\xd2\xb7\x27\x3f\xa6\x87\x0e" },
12190 { GCRY_MD_SHA224,
12191 "This is a test using a larger than block-size key and a larger than block-size data. The key needs to be hashed before being used by the HMAC algorithm.",
12192 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12193 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12194 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12195 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12196 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12197 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12198 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12199 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12200 "\xaa\xaa\xaa",
12201 "\x3a\x85\x41\x66\xac\x5d\x9f\x02\x3f\x54\xd5\x17\xd0\xb3\x9d\xbd"
12202 "\x94\x67\x70\xdb\x9c\x2b\x95\xc9\xf6\xf5\x65\xd1" },
12203 { GCRY_MD_SHA384, "what do ya want for nothing?", "Jefe",
12204 "\xaf\x45\xd2\xe3\x76\x48\x40\x31\x61\x7f\x78\xd2\xb5\x8a\x6b\x1b"
12205 "\x9c\x7e\xf4\x64\xf5\xa0\x1b\x47\xe4\x2e\xc3\x73\x63\x22\x44\x5e"
12206 "\x8e\x22\x40\xca\x5e\x69\xe2\xc7\x8b\x32\x39\xec\xfa\xb2\x16\x49" },
12207 { GCRY_MD_SHA384,
12208 "Hi There",
12209 "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"
12210 "\x0b\x0b\x0b",
12211 "\xaf\xd0\x39\x44\xd8\x48\x95\x62\x6b\x08\x25\xf4\xab\x46\x90\x7f\x15"
12212 "\xf9\xda\xdb\xe4\x10\x1e\xc6\x82\xaa\x03\x4c\x7c\xeb\xc5\x9c\xfa\xea"
12213 "\x9e\xa9\x07\x6e\xde\x7f\x4a\xf1\x52\xe8\xb2\xfa\x9c\xb6" },
12214 { GCRY_MD_SHA384,
12215 "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
12216 "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
12217 "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
12218 "\xdd\xdd\xdd\xdd\xdd",
12219 "\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA"
12220 "\xAA\xAA\xAA\xAA",
12221 "\x88\x06\x26\x08\xd3\xe6\xad\x8a\x0a\xa2\xac\xe0\x14\xc8\xa8\x6f"
12222 "\x0a\xa6\x35\xd9\x47\xac\x9f\xeb\xe8\x3e\xf4\xe5\x59\x66\x14\x4b"
12223 "\x2a\x5a\xb3\x9d\xc1\x38\x14\xb9\x4e\x3a\xb6\xe1\x01\xa3\x4f\x27" },
12224 { GCRY_MD_SHA384,
12225 "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
12226 "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
12227 "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
12228 "\xcd\xcd\xcd\xcd\xcd",
12229 "\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
12230 "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19",
12231 "\x3e\x8a\x69\xb7\x78\x3c\x25\x85\x19\x33\xab\x62\x90\xaf\x6c\xa7"
12232 "\x7a\x99\x81\x48\x08\x50\x00\x9c\xc5\x57\x7c\x6e\x1f\x57\x3b\x4e"
12233 "\x68\x01\xdd\x23\xc4\xa7\xd6\x79\xcc\xf8\xa3\x86\xc6\x74\xcf\xfb" },
12234 { GCRY_MD_SHA384,
12235 "Test Using Larger Than Block-Size Key - Hash Key First",
12236 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12237 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12238 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12239 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12240 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12241 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12242 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12243 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12244 "\xaa\xaa\xaa",
12245 "\x4e\xce\x08\x44\x85\x81\x3e\x90\x88\xd2\xc6\x3a\x04\x1b\xc5\xb4"
12246 "\x4f\x9e\xf1\x01\x2a\x2b\x58\x8f\x3c\xd1\x1f\x05\x03\x3a\xc4\xc6"
12247 "\x0c\x2e\xf6\xab\x40\x30\xfe\x82\x96\x24\x8d\xf1\x63\xf4\x49\x52" },
12248 { GCRY_MD_SHA384,
12249 "This is a test using a larger than block-size key and a larger than block-size data. The key needs to be hashed before being used by the HMAC algorithm.",
12250 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12251 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12252 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12253 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12254 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12255 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12256 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12257 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12258 "\xaa\xaa\xaa",
12259 "\x66\x17\x17\x8e\x94\x1f\x02\x0d\x35\x1e\x2f\x25\x4e\x8f\xd3\x2c"
12260 "\x60\x24\x20\xfe\xb0\xb8\xfb\x9a\xdc\xce\xbb\x82\x46\x1e\x99\xc5"
12261 "\xa6\x78\xcc\x31\xe7\x99\x17\x6d\x38\x60\xe6\x11\x0c\x46\x52\x3e" },
12262 { GCRY_MD_SHA512, "what do ya want for nothing?", "Jefe",
12263 "\x16\x4b\x7a\x7b\xfc\xf8\x19\xe2\xe3\x95\xfb\xe7\x3b\x56\xe0\xa3"
12264 "\x87\xbd\x64\x22\x2e\x83\x1f\xd6\x10\x27\x0c\xd7\xea\x25\x05\x54"
12265 "\x97\x58\xbf\x75\xc0\x5a\x99\x4a\x6d\x03\x4f\x65\xf8\xf0\xe6\xfd"
12266 "\xca\xea\xb1\xa3\x4d\x4a\x6b\x4b\x63\x6e\x07\x0a\x38\xbc\xe7\x37" },
12267 { GCRY_MD_SHA512,
12268 "Hi There",
12269 "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"
12270 "\x0b\x0b\x0b",
12271 "\x87\xaa\x7c\xde\xa5\xef\x61\x9d\x4f\xf0\xb4\x24\x1a\x1d\x6c\xb0"
12272 "\x23\x79\xf4\xe2\xce\x4e\xc2\x78\x7a\xd0\xb3\x05\x45\xe1\x7c\xde"
12273 "\xda\xa8\x33\xb7\xd6\xb8\xa7\x02\x03\x8b\x27\x4e\xae\xa3\xf4\xe4"
12274 "\xbe\x9d\x91\x4e\xeb\x61\xf1\x70\x2e\x69\x6c\x20\x3a\x12\x68\x54" },
12275 { GCRY_MD_SHA512,
12276 "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
12277 "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
12278 "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
12279 "\xdd\xdd\xdd\xdd\xdd",
12280 "\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA"
12281 "\xAA\xAA\xAA\xAA",
12282 "\xfa\x73\xb0\x08\x9d\x56\xa2\x84\xef\xb0\xf0\x75\x6c\x89\x0b\xe9"
12283 "\xb1\xb5\xdb\xdd\x8e\xe8\x1a\x36\x55\xf8\x3e\x33\xb2\x27\x9d\x39"
12284 "\xbf\x3e\x84\x82\x79\xa7\x22\xc8\x06\xb4\x85\xa4\x7e\x67\xc8\x07"
12285 "\xb9\x46\xa3\x37\xbe\xe8\x94\x26\x74\x27\x88\x59\xe1\x32\x92\xfb" },
12286 { GCRY_MD_SHA512,
12287 "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
12288 "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
12289 "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
12290 "\xcd\xcd\xcd\xcd\xcd",
12291 "\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
12292 "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19",
12293 "\xb0\xba\x46\x56\x37\x45\x8c\x69\x90\xe5\xa8\xc5\xf6\x1d\x4a\xf7"
12294 "\xe5\x76\xd9\x7f\xf9\x4b\x87\x2d\xe7\x6f\x80\x50\x36\x1e\xe3\xdb"
12295 "\xa9\x1c\xa5\xc1\x1a\xa2\x5e\xb4\xd6\x79\x27\x5c\xc5\x78\x80\x63"
12296 "\xa5\xf1\x97\x41\x12\x0c\x4f\x2d\xe2\xad\xeb\xeb\x10\xa2\x98\xdd" },
12297 { GCRY_MD_SHA512,
12298 "Test Using Larger Than Block-Size Key - Hash Key First",
12299 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12300 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12301 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12302 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12303 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12304 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12305 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12306 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12307 "\xaa\xaa\xaa",
12308 "\x80\xb2\x42\x63\xc7\xc1\xa3\xeb\xb7\x14\x93\xc1\xdd\x7b\xe8\xb4"
12309 "\x9b\x46\xd1\xf4\x1b\x4a\xee\xc1\x12\x1b\x01\x37\x83\xf8\xf3\x52"
12310 "\x6b\x56\xd0\x37\xe0\x5f\x25\x98\xbd\x0f\xd2\x21\x5d\x6a\x1e\x52"
12311 "\x95\xe6\x4f\x73\xf6\x3f\x0a\xec\x8b\x91\x5a\x98\x5d\x78\x65\x98" },
12312 { GCRY_MD_SHA512,
12313 "This is a test using a larger than block-size key and a larger than block-size data. The key needs to be hashed before being used by the HMAC algorithm.",
12314 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12315 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12316 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12317 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12318 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12319 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12320 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12321 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12322 "\xaa\xaa\xaa",
12323 "\xe3\x7b\x6a\x77\x5d\xc8\x7d\xba\xa4\xdf\xa9\xf9\x6e\x5e\x3f\xfd"
12324 "\xde\xbd\x71\xf8\x86\x72\x89\x86\x5d\xf5\xa3\x2d\x20\xcd\xc9\x44"
12325 "\xb6\x02\x2c\xac\x3c\x49\x82\xb1\x0d\x5e\xeb\x55\xc3\xe4\xde\x15"
12326 "\x13\x46\x76\xfb\x6d\xe0\x44\x60\x65\xc9\x74\x40\xfa\x8c\x6a\x58" },
12327 { 0 },
12328 };
12329 int i;
12330
12331 if (verbose)
12332 fprintf (stderr, "Starting hashed MAC checks.\n");
12333
12334 for (i = 0; algos[i].md; i++)
12335 {
12336 if (gcry_md_test_algo (algos[i].md))
12337 {
12338 show_old_hmac_not_available (algos[i].md);
12339 continue;
12340 }
12341 if (gcry_md_test_algo (algos[i].md) && in_fips_mode)
12342 {
12343 if (verbose)
12344 fprintf (stderr, " algorithm %d not available in fips mode\n",
12345 algos[i].md);
12346 continue;
12347 }
12348 if (verbose)
12349 fprintf (stderr,
12350 " checking %s [%i] for %d byte key and %d byte data\n",
12351 gcry_md_algo_name (algos[i].md),
12352 algos[i].md,
12353 (int)strlen(algos[i].key), (int)strlen(algos[i].data));
12354
12355 check_one_hmac (algos[i].md, algos[i].data, strlen (algos[i].data),
12356 algos[i].key, strlen(algos[i].key),
12357 algos[i].expect);
12358 }
12359
12360 if (verbose)
12361 fprintf (stderr, "Completed hashed MAC checks.\n");
12362 }
12363
12364
12365 static void
check_one_mac(int algo,const char * data,int datalen,const char * key,int keylen,const char * iv,int ivlen,const char * expect,int test_buffering)12366 check_one_mac (int algo, const char *data, int datalen,
12367 const char *key, int keylen, const char *iv, int ivlen,
12368 const char *expect, int test_buffering)
12369 {
12370 gcry_mac_hd_t hd;
12371 unsigned char *p;
12372 unsigned int maclen;
12373 size_t macoutlen;
12374 int i;
12375 gcry_error_t err = 0;
12376
12377 if (test_buffering)
12378 {
12379 if ((*data == '!' && !data[1]) ||
12380 (*data == '?' && !data[1]))
12381 {
12382 return; /* Skip. */
12383 }
12384 }
12385
12386 err = gcry_mac_open (&hd, algo, 0, NULL);
12387 if (err)
12388 {
12389 fail ("algo %d, gcry_mac_open failed: %s\n", algo, gpg_strerror (err));
12390 return;
12391 }
12392
12393 i = gcry_mac_get_algo (hd);
12394 if (i != algo)
12395 {
12396 fail ("algo %d, gcry_mac_get_algo failed: %d\n", algo, i);
12397 }
12398
12399 maclen = gcry_mac_get_algo_maclen (algo);
12400 if (maclen < 1 || maclen > 500)
12401 {
12402 fail ("algo %d, gcry_mac_get_algo_maclen failed: %d\n", algo, maclen);
12403 return;
12404 }
12405
12406 p = malloc(maclen);
12407 if (!p)
12408 {
12409 fail ("algo %d, could not malloc %d bytes\n", algo, maclen);
12410 return;
12411 }
12412
12413 clutter_vector_registers();
12414 err = gcry_mac_setkey (hd, key, keylen);
12415 if (err)
12416 fail("algo %d, mac gcry_mac_setkey failed: %s\n", algo, gpg_strerror (err));
12417 if (err)
12418 goto out;
12419
12420 if (ivlen && iv)
12421 {
12422 clutter_vector_registers();
12423 err = gcry_mac_setiv (hd, iv, ivlen);
12424 if (err)
12425 fail("algo %d, mac gcry_mac_ivkey failed: %s\n", algo,
12426 gpg_strerror (err));
12427 if (err)
12428 goto out;
12429 }
12430
12431 if (test_buffering)
12432 {
12433 for (i = 0; i < datalen; i++)
12434 {
12435 clutter_vector_registers();
12436 err = gcry_mac_write (hd, &data[i], 1);
12437 if (err)
12438 fail("algo %d, mac gcry_mac_write [buf-offset: %d] failed: %s\n",
12439 algo, i, gpg_strerror (err));
12440 if (err)
12441 goto out;
12442 }
12443 }
12444 else
12445 {
12446 if ((*data == '!' && !data[1]) || /* hash one million times a "a" */
12447 (*data == '?' && !data[1])) /* hash million byte data-set with byte pattern 0x00,0x01,0x02,... */
12448 {
12449 char aaa[1000];
12450 size_t left = 1000 * 1000;
12451 size_t startlen = 1;
12452 size_t piecelen = startlen;
12453
12454 if (*data == '!')
12455 memset (aaa, 'a', 1000);
12456
12457 /* Write in chuck with all sizes 1 to 1000 (500500 bytes) */
12458 for (i = 1; i <= 1000 && left > 0; i++)
12459 {
12460 piecelen = i;
12461 if (piecelen > sizeof(aaa))
12462 piecelen = sizeof(aaa);
12463 if (piecelen > left)
12464 piecelen = left;
12465
12466 if (*data == '?')
12467 fillbuf_count(aaa, piecelen, 1000 * 1000 - left);
12468
12469 clutter_vector_registers();
12470 gcry_mac_write (hd, aaa, piecelen);
12471
12472 left -= piecelen;
12473 }
12474
12475 /* Write in odd size chunks so that we test the buffering. */
12476 while (left > 0)
12477 {
12478 if (piecelen > sizeof(aaa))
12479 piecelen = sizeof(aaa);
12480 if (piecelen > left)
12481 piecelen = left;
12482
12483 if (*data == '?')
12484 fillbuf_count(aaa, piecelen, 1000 * 1000 - left);
12485
12486 clutter_vector_registers();
12487 gcry_mac_write (hd, aaa, piecelen);
12488
12489 left -= piecelen;
12490
12491 if (piecelen == sizeof(aaa))
12492 piecelen = ++startlen;
12493 else
12494 piecelen = piecelen * 2 - ((piecelen != startlen) ? startlen : 0);
12495 }
12496 }
12497 else
12498 {
12499 clutter_vector_registers();
12500 err = gcry_mac_write (hd, data, datalen);
12501 }
12502
12503 if (err)
12504 fail("algo %d, mac gcry_mac_write failed: %s\n", algo, gpg_strerror (err));
12505 if (err)
12506 goto out;
12507 }
12508
12509 clutter_vector_registers();
12510 err = gcry_mac_verify (hd, expect, maclen);
12511 if (err)
12512 fail("algo %d, mac gcry_mac_verify failed: %s\n", algo, gpg_strerror (err));
12513
12514 macoutlen = maclen;
12515 clutter_vector_registers();
12516 err = gcry_mac_read (hd, p, &macoutlen);
12517 if (err)
12518 fail("algo %d, mac gcry_mac_read failed: %s\n", algo, gpg_strerror (err));
12519 if (err)
12520 goto out;
12521
12522 if (memcmp (p, expect, maclen))
12523 {
12524 printf ("computed: ");
12525 for (i = 0; i < maclen; i++)
12526 printf ("%02x ", p[i] & 0xFF);
12527 printf ("\nexpected: ");
12528 for (i = 0; i < maclen; i++)
12529 printf ("%02x ", expect[i] & 0xFF);
12530 printf ("\n");
12531
12532 fail ("algo %d, digest mismatch\n", algo);
12533 }
12534 if (err)
12535 goto out;
12536
12537 out:
12538 free (p);
12539 gcry_mac_close (hd);
12540 }
12541
12542 static void
check_mac(void)12543 check_mac (void)
12544 {
12545 static const struct algos
12546 {
12547 int algo;
12548 const char *data;
12549 const char *key;
12550 const char *expect;
12551 const char *iv;
12552 unsigned int dlen;
12553 unsigned int klen;
12554 } algos[] =
12555 {
12556 { GCRY_MAC_HMAC_MD5, "what do ya want for nothing?", "Jefe",
12557 "\x75\x0c\x78\x3e\x6a\xb0\xb5\x03\xea\xa8\x6e\x31\x0a\x5d\xb7\x38" },
12558 { GCRY_MAC_HMAC_MD5,
12559 "Hi There",
12560 "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b",
12561 "\x92\x94\x72\x7a\x36\x38\xbb\x1c\x13\xf4\x8e\xf8\x15\x8b\xfc\x9d" },
12562 { GCRY_MAC_HMAC_MD5,
12563 "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
12564 "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
12565 "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
12566 "\xdd\xdd\xdd\xdd\xdd",
12567 "\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA",
12568 "\x56\xbe\x34\x52\x1d\x14\x4c\x88\xdb\xb8\xc7\x33\xf0\xe8\xb3\xf6" },
12569 { GCRY_MAC_HMAC_MD5,
12570 "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
12571 "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
12572 "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
12573 "\xcd\xcd\xcd\xcd\xcd",
12574 "\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
12575 "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19",
12576 "\x69\x7e\xaf\x0a\xca\x3a\x3a\xea\x3a\x75\x16\x47\x46\xff\xaa\x79" },
12577 { GCRY_MAC_HMAC_MD5, "Test With Truncation",
12578 "\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c",
12579 "\x56\x46\x1e\xf2\x34\x2e\xdc\x00\xf9\xba\xb9\x95\x69\x0e\xfd\x4c" },
12580 { GCRY_MAC_HMAC_MD5, "Test Using Larger Than Block-Size Key - Hash Key First",
12581 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12582 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12583 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12584 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12585 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12586 "\xaa\xaa\xaa\xaa\xaa",
12587 "\x6b\x1a\xb7\xfe\x4b\xd7\xbf\x8f\x0b\x62\xe6\xce\x61\xb9\xd0\xcd" },
12588 { GCRY_MAC_HMAC_MD5,
12589 "Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data",
12590 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12591 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12592 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12593 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12594 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12595 "\xaa\xaa\xaa\xaa\xaa",
12596 "\x6f\x63\x0f\xad\x67\xcd\xa0\xee\x1f\xb1\xf5\x62\xdb\x3a\xa5\x3e", },
12597 { GCRY_MAC_HMAC_MD5, "?", "????????????????",
12598 "\x7e\x28\xf8\x8e\xf4\x6c\x48\x30\xa2\x0c\xe3\xe1\x42\xd4\xb5\x6b" },
12599 { GCRY_MAC_HMAC_SHA256, "what do ya want for nothing?", "Jefe",
12600 "\x5b\xdc\xc1\x46\xbf\x60\x75\x4e\x6a\x04\x24\x26\x08\x95\x75\xc7\x5a"
12601 "\x00\x3f\x08\x9d\x27\x39\x83\x9d\xec\x58\xb9\x64\xec\x38\x43" },
12602 { GCRY_MAC_HMAC_SHA256,
12603 "Hi There",
12604 "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"
12605 "\x0b\x0b\x0b",
12606 "\xb0\x34\x4c\x61\xd8\xdb\x38\x53\x5c\xa8\xaf\xce\xaf\x0b\xf1\x2b\x88"
12607 "\x1d\xc2\x00\xc9\x83\x3d\xa7\x26\xe9\x37\x6c\x2e\x32\xcf\xf7" },
12608 { GCRY_MAC_HMAC_SHA256,
12609 "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
12610 "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
12611 "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
12612 "\xdd\xdd\xdd\xdd\xdd",
12613 "\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA"
12614 "\xAA\xAA\xAA\xAA",
12615 "\x77\x3e\xa9\x1e\x36\x80\x0e\x46\x85\x4d\xb8\xeb\xd0\x91\x81\xa7"
12616 "\x29\x59\x09\x8b\x3e\xf8\xc1\x22\xd9\x63\x55\x14\xce\xd5\x65\xfe" },
12617 { GCRY_MAC_HMAC_SHA256,
12618 "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
12619 "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
12620 "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
12621 "\xcd\xcd\xcd\xcd\xcd",
12622 "\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
12623 "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19",
12624 "\x82\x55\x8a\x38\x9a\x44\x3c\x0e\xa4\xcc\x81\x98\x99\xf2\x08"
12625 "\x3a\x85\xf0\xfa\xa3\xe5\x78\xf8\x07\x7a\x2e\x3f\xf4\x67\x29\x66\x5b" },
12626 { GCRY_MAC_HMAC_SHA256,
12627 "Test Using Larger Than Block-Size Key - Hash Key First",
12628 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12629 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12630 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12631 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12632 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12633 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12634 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12635 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12636 "\xaa\xaa\xaa",
12637 "\x60\xe4\x31\x59\x1e\xe0\xb6\x7f\x0d\x8a\x26\xaa\xcb\xf5\xb7\x7f"
12638 "\x8e\x0b\xc6\x21\x37\x28\xc5\x14\x05\x46\x04\x0f\x0e\xe3\x7f\x54" },
12639 { GCRY_MAC_HMAC_SHA256,
12640 "This is a test using a larger than block-size key and a larger than block-size data. The key needs to be hashed before being used by the HMAC algorithm.",
12641 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12642 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12643 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12644 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12645 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12646 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12647 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12648 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12649 "\xaa\xaa\xaa",
12650 "\x9b\x09\xff\xa7\x1b\x94\x2f\xcb\x27\x63\x5f\xbc\xd5\xb0\xe9\x44"
12651 "\xbf\xdc\x63\x64\x4f\x07\x13\x93\x8a\x7f\x51\x53\x5c\x3a\x35\xe2" },
12652 { GCRY_MAC_HMAC_SHA256, "?", "????????????????",
12653 "\x1c\x0e\x57\xad\x4a\x02\xd2\x30\xce\x7e\xf8\x08\x23\x25\x71\x5e"
12654 "\x16\x9b\x30\xca\xc3\xf4\x99\xc5\x1d\x4c\x25\x32\xa9\xf2\x15\x28" },
12655 { GCRY_MAC_HMAC_SHA224, "what do ya want for nothing?", "Jefe",
12656 "\xa3\x0e\x01\x09\x8b\xc6\xdb\xbf\x45\x69\x0f\x3a\x7e\x9e\x6d\x0f"
12657 "\x8b\xbe\xa2\xa3\x9e\x61\x48\x00\x8f\xd0\x5e\x44" },
12658 { GCRY_MAC_HMAC_SHA224,
12659 "Hi There",
12660 "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"
12661 "\x0b\x0b\x0b",
12662 "\x89\x6f\xb1\x12\x8a\xbb\xdf\x19\x68\x32\x10\x7c\xd4\x9d\xf3\x3f\x47"
12663 "\xb4\xb1\x16\x99\x12\xba\x4f\x53\x68\x4b\x22" },
12664 { GCRY_MAC_HMAC_SHA224,
12665 "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
12666 "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
12667 "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
12668 "\xdd\xdd\xdd\xdd\xdd",
12669 "\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA"
12670 "\xAA\xAA\xAA\xAA",
12671 "\x7f\xb3\xcb\x35\x88\xc6\xc1\xf6\xff\xa9\x69\x4d\x7d\x6a\xd2\x64"
12672 "\x93\x65\xb0\xc1\xf6\x5d\x69\xd1\xec\x83\x33\xea" },
12673 { GCRY_MAC_HMAC_SHA224,
12674 "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
12675 "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
12676 "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
12677 "\xcd\xcd\xcd\xcd\xcd",
12678 "\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
12679 "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19",
12680 "\x6c\x11\x50\x68\x74\x01\x3c\xac\x6a\x2a\xbc\x1b\xb3\x82\x62"
12681 "\x7c\xec\x6a\x90\xd8\x6e\xfc\x01\x2d\xe7\xaf\xec\x5a" },
12682 { GCRY_MAC_HMAC_SHA224,
12683 "Test Using Larger Than Block-Size Key - Hash Key First",
12684 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12685 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12686 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12687 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12688 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12689 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12690 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12691 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12692 "\xaa\xaa\xaa",
12693 "\x95\xe9\xa0\xdb\x96\x20\x95\xad\xae\xbe\x9b\x2d\x6f\x0d\xbc\xe2"
12694 "\xd4\x99\xf1\x12\xf2\xd2\xb7\x27\x3f\xa6\x87\x0e" },
12695 { GCRY_MAC_HMAC_SHA224,
12696 "This is a test using a larger than block-size key and a larger than block-size data. The key needs to be hashed before being used by the HMAC algorithm.",
12697 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12698 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12699 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12700 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12701 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12702 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12703 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12704 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12705 "\xaa\xaa\xaa",
12706 "\x3a\x85\x41\x66\xac\x5d\x9f\x02\x3f\x54\xd5\x17\xd0\xb3\x9d\xbd"
12707 "\x94\x67\x70\xdb\x9c\x2b\x95\xc9\xf6\xf5\x65\xd1" },
12708 { GCRY_MAC_HMAC_SHA224, "?", "????????????????",
12709 "\xc1\x88\xaf\xcf\xce\x51\xa2\x14\x3d\xc1\xaf\x93\xcc\x2b\xe9\x4d"
12710 "\x39\x55\x90\x4c\x46\x70\xfc\xc2\x04\xcf\xab\xfa" },
12711 { GCRY_MAC_HMAC_SHA384, "what do ya want for nothing?", "Jefe",
12712 "\xaf\x45\xd2\xe3\x76\x48\x40\x31\x61\x7f\x78\xd2\xb5\x8a\x6b\x1b"
12713 "\x9c\x7e\xf4\x64\xf5\xa0\x1b\x47\xe4\x2e\xc3\x73\x63\x22\x44\x5e"
12714 "\x8e\x22\x40\xca\x5e\x69\xe2\xc7\x8b\x32\x39\xec\xfa\xb2\x16\x49" },
12715 { GCRY_MAC_HMAC_SHA384,
12716 "Hi There",
12717 "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"
12718 "\x0b\x0b\x0b",
12719 "\xaf\xd0\x39\x44\xd8\x48\x95\x62\x6b\x08\x25\xf4\xab\x46\x90\x7f\x15"
12720 "\xf9\xda\xdb\xe4\x10\x1e\xc6\x82\xaa\x03\x4c\x7c\xeb\xc5\x9c\xfa\xea"
12721 "\x9e\xa9\x07\x6e\xde\x7f\x4a\xf1\x52\xe8\xb2\xfa\x9c\xb6" },
12722 { GCRY_MAC_HMAC_SHA384,
12723 "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
12724 "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
12725 "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
12726 "\xdd\xdd\xdd\xdd\xdd",
12727 "\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA"
12728 "\xAA\xAA\xAA\xAA",
12729 "\x88\x06\x26\x08\xd3\xe6\xad\x8a\x0a\xa2\xac\xe0\x14\xc8\xa8\x6f"
12730 "\x0a\xa6\x35\xd9\x47\xac\x9f\xeb\xe8\x3e\xf4\xe5\x59\x66\x14\x4b"
12731 "\x2a\x5a\xb3\x9d\xc1\x38\x14\xb9\x4e\x3a\xb6\xe1\x01\xa3\x4f\x27" },
12732 { GCRY_MAC_HMAC_SHA384,
12733 "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
12734 "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
12735 "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
12736 "\xcd\xcd\xcd\xcd\xcd",
12737 "\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
12738 "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19",
12739 "\x3e\x8a\x69\xb7\x78\x3c\x25\x85\x19\x33\xab\x62\x90\xaf\x6c\xa7"
12740 "\x7a\x99\x81\x48\x08\x50\x00\x9c\xc5\x57\x7c\x6e\x1f\x57\x3b\x4e"
12741 "\x68\x01\xdd\x23\xc4\xa7\xd6\x79\xcc\xf8\xa3\x86\xc6\x74\xcf\xfb" },
12742 { GCRY_MAC_HMAC_SHA384,
12743 "Test Using Larger Than Block-Size Key - Hash Key First",
12744 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12745 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12746 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12747 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12748 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12749 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12750 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12751 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12752 "\xaa\xaa\xaa",
12753 "\x4e\xce\x08\x44\x85\x81\x3e\x90\x88\xd2\xc6\x3a\x04\x1b\xc5\xb4"
12754 "\x4f\x9e\xf1\x01\x2a\x2b\x58\x8f\x3c\xd1\x1f\x05\x03\x3a\xc4\xc6"
12755 "\x0c\x2e\xf6\xab\x40\x30\xfe\x82\x96\x24\x8d\xf1\x63\xf4\x49\x52" },
12756 { GCRY_MAC_HMAC_SHA384,
12757 "This is a test using a larger than block-size key and a larger than block-size data. The key needs to be hashed before being used by the HMAC algorithm.",
12758 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12759 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12760 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12761 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12762 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12763 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12764 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12765 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12766 "\xaa\xaa\xaa",
12767 "\x66\x17\x17\x8e\x94\x1f\x02\x0d\x35\x1e\x2f\x25\x4e\x8f\xd3\x2c"
12768 "\x60\x24\x20\xfe\xb0\xb8\xfb\x9a\xdc\xce\xbb\x82\x46\x1e\x99\xc5"
12769 "\xa6\x78\xcc\x31\xe7\x99\x17\x6d\x38\x60\xe6\x11\x0c\x46\x52\x3e" },
12770 { GCRY_MAC_HMAC_SHA384, "?", "????????????????",
12771 "\xe7\x96\x29\xa3\x40\x5f\x1e\x6e\x92\xa5\xdb\xa5\xc6\xe9\x60\xa8"
12772 "\xf5\xd1\x6d\xcb\x10\xec\x30\x2f\x6b\x9c\x37\xe0\xea\xf1\x53\x28"
12773 "\x08\x01\x9b\xe3\x4a\x43\xc6\xc2\x2b\x0c\xd9\x43\x64\x35\x25\x78" },
12774 { GCRY_MAC_HMAC_SHA512, "what do ya want for nothing?", "Jefe",
12775 "\x16\x4b\x7a\x7b\xfc\xf8\x19\xe2\xe3\x95\xfb\xe7\x3b\x56\xe0\xa3"
12776 "\x87\xbd\x64\x22\x2e\x83\x1f\xd6\x10\x27\x0c\xd7\xea\x25\x05\x54"
12777 "\x97\x58\xbf\x75\xc0\x5a\x99\x4a\x6d\x03\x4f\x65\xf8\xf0\xe6\xfd"
12778 "\xca\xea\xb1\xa3\x4d\x4a\x6b\x4b\x63\x6e\x07\x0a\x38\xbc\xe7\x37" },
12779 { GCRY_MAC_HMAC_SHA512,
12780 "Hi There",
12781 "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"
12782 "\x0b\x0b\x0b",
12783 "\x87\xaa\x7c\xde\xa5\xef\x61\x9d\x4f\xf0\xb4\x24\x1a\x1d\x6c\xb0"
12784 "\x23\x79\xf4\xe2\xce\x4e\xc2\x78\x7a\xd0\xb3\x05\x45\xe1\x7c\xde"
12785 "\xda\xa8\x33\xb7\xd6\xb8\xa7\x02\x03\x8b\x27\x4e\xae\xa3\xf4\xe4"
12786 "\xbe\x9d\x91\x4e\xeb\x61\xf1\x70\x2e\x69\x6c\x20\x3a\x12\x68\x54" },
12787 { GCRY_MAC_HMAC_SHA512,
12788 "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
12789 "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
12790 "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
12791 "\xdd\xdd\xdd\xdd\xdd",
12792 "\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA"
12793 "\xAA\xAA\xAA\xAA",
12794 "\xfa\x73\xb0\x08\x9d\x56\xa2\x84\xef\xb0\xf0\x75\x6c\x89\x0b\xe9"
12795 "\xb1\xb5\xdb\xdd\x8e\xe8\x1a\x36\x55\xf8\x3e\x33\xb2\x27\x9d\x39"
12796 "\xbf\x3e\x84\x82\x79\xa7\x22\xc8\x06\xb4\x85\xa4\x7e\x67\xc8\x07"
12797 "\xb9\x46\xa3\x37\xbe\xe8\x94\x26\x74\x27\x88\x59\xe1\x32\x92\xfb" },
12798 { GCRY_MAC_HMAC_SHA512,
12799 "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
12800 "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
12801 "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
12802 "\xcd\xcd\xcd\xcd\xcd",
12803 "\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
12804 "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19",
12805 "\xb0\xba\x46\x56\x37\x45\x8c\x69\x90\xe5\xa8\xc5\xf6\x1d\x4a\xf7"
12806 "\xe5\x76\xd9\x7f\xf9\x4b\x87\x2d\xe7\x6f\x80\x50\x36\x1e\xe3\xdb"
12807 "\xa9\x1c\xa5\xc1\x1a\xa2\x5e\xb4\xd6\x79\x27\x5c\xc5\x78\x80\x63"
12808 "\xa5\xf1\x97\x41\x12\x0c\x4f\x2d\xe2\xad\xeb\xeb\x10\xa2\x98\xdd" },
12809 { GCRY_MAC_HMAC_SHA512,
12810 "Test Using Larger Than Block-Size Key - Hash Key First",
12811 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12812 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12813 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12814 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12815 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12816 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12817 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12818 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12819 "\xaa\xaa\xaa",
12820 "\x80\xb2\x42\x63\xc7\xc1\xa3\xeb\xb7\x14\x93\xc1\xdd\x7b\xe8\xb4"
12821 "\x9b\x46\xd1\xf4\x1b\x4a\xee\xc1\x12\x1b\x01\x37\x83\xf8\xf3\x52"
12822 "\x6b\x56\xd0\x37\xe0\x5f\x25\x98\xbd\x0f\xd2\x21\x5d\x6a\x1e\x52"
12823 "\x95\xe6\x4f\x73\xf6\x3f\x0a\xec\x8b\x91\x5a\x98\x5d\x78\x65\x98" },
12824 { GCRY_MAC_HMAC_SHA512,
12825 "This is a test using a larger than block-size key and a larger than block-size data. The key needs to be hashed before being used by the HMAC algorithm.",
12826 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12827 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12828 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12829 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12830 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12831 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12832 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12833 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12834 "\xaa\xaa\xaa",
12835 "\xe3\x7b\x6a\x77\x5d\xc8\x7d\xba\xa4\xdf\xa9\xf9\x6e\x5e\x3f\xfd"
12836 "\xde\xbd\x71\xf8\x86\x72\x89\x86\x5d\xf5\xa3\x2d\x20\xcd\xc9\x44"
12837 "\xb6\x02\x2c\xac\x3c\x49\x82\xb1\x0d\x5e\xeb\x55\xc3\xe4\xde\x15"
12838 "\x13\x46\x76\xfb\x6d\xe0\x44\x60\x65\xc9\x74\x40\xfa\x8c\x6a\x58" },
12839 { GCRY_MAC_HMAC_SHA512, "?", "????????????????",
12840 "\xd4\x43\x61\xfa\x3d\x3d\x57\xd6\xac\xc3\x9f\x1c\x3d\xd9\x26\x84"
12841 "\x1f\xfc\x4d\xf2\xbf\x78\x87\x72\x5e\x6c\x3e\x00\x6d\x39\x5f\xfa"
12842 "\xd7\x3a\xf7\x83\xb7\xb5\x61\xbd\xfb\x33\xe0\x03\x97\xa7\x72\x79"
12843 "\x66\x66\xbf\xbd\x44\xfa\x04\x01\x1b\xc1\x48\x1d\x9e\xde\x5b\x8e" },
12844 /* HMAC-SHA3 test vectors from
12845 * http://wolfgang-ehrhardt.de/hmac-sha3-testvectors.html */
12846 { GCRY_MAC_HMAC_SHA3_224,
12847 "Hi There",
12848 "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"
12849 "\x0b\x0b\x0b",
12850 "\x3b\x16\x54\x6b\xbc\x7b\xe2\x70\x6a\x03\x1d\xca\xfd\x56\x37\x3d"
12851 "\x98\x84\x36\x76\x41\xd8\xc5\x9a\xf3\xc8\x60\xf7" },
12852 { GCRY_MAC_HMAC_SHA3_256,
12853 "Hi There",
12854 "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"
12855 "\x0b\x0b\x0b",
12856 "\xba\x85\x19\x23\x10\xdf\xfa\x96\xe2\xa3\xa4\x0e\x69\x77\x43\x51"
12857 "\x14\x0b\xb7\x18\x5e\x12\x02\xcd\xcc\x91\x75\x89\xf9\x5e\x16\xbb" },
12858 { GCRY_MAC_HMAC_SHA3_512,
12859 "Hi There",
12860 "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"
12861 "\x0b\x0b\x0b",
12862 "\xeb\x3f\xbd\x4b\x2e\xaa\xb8\xf5\xc5\x04\xbd\x3a\x41\x46\x5a\xac"
12863 "\xec\x15\x77\x0a\x7c\xab\xac\x53\x1e\x48\x2f\x86\x0b\x5e\xc7\xba"
12864 "\x47\xcc\xb2\xc6\xf2\xaf\xce\x8f\x88\xd2\x2b\x6d\xc6\x13\x80\xf2"
12865 "\x3a\x66\x8f\xd3\x88\x8b\xb8\x05\x37\xc0\xa0\xb8\x64\x07\x68\x9e" },
12866 { GCRY_MAC_HMAC_SHA3_224, "what do ya want for nothing?", "Jefe",
12867 "\x7f\xdb\x8d\xd8\x8b\xd2\xf6\x0d\x1b\x79\x86\x34\xad\x38\x68\x11"
12868 "\xc2\xcf\xc8\x5b\xfa\xf5\xd5\x2b\xba\xce\x5e\x66" },
12869 { GCRY_MAC_HMAC_SHA3_256, "what do ya want for nothing?", "Jefe",
12870 "\xc7\xd4\x07\x2e\x78\x88\x77\xae\x35\x96\xbb\xb0\xda\x73\xb8\x87"
12871 "\xc9\x17\x1f\x93\x09\x5b\x29\x4a\xe8\x57\xfb\xe2\x64\x5e\x1b\xa5" },
12872 { GCRY_MAC_HMAC_SHA3_384, "what do ya want for nothing?", "Jefe",
12873 "\xf1\x10\x1f\x8c\xbf\x97\x66\xfd\x67\x64\xd2\xed\x61\x90\x3f\x21"
12874 "\xca\x9b\x18\xf5\x7c\xf3\xe1\xa2\x3c\xa1\x35\x08\xa9\x32\x43\xce"
12875 "\x48\xc0\x45\xdc\x00\x7f\x26\xa2\x1b\x3f\x5e\x0e\x9d\xf4\xc2\x0a" },
12876 { GCRY_MAC_HMAC_SHA3_512, "what do ya want for nothing?", "Jefe",
12877 "\x5a\x4b\xfe\xab\x61\x66\x42\x7c\x7a\x36\x47\xb7\x47\x29\x2b\x83"
12878 "\x84\x53\x7c\xdb\x89\xaf\xb3\xbf\x56\x65\xe4\xc5\xe7\x09\x35\x0b"
12879 "\x28\x7b\xae\xc9\x21\xfd\x7c\xa0\xee\x7a\x0c\x31\xd0\x22\xa9\x5e"
12880 "\x1f\xc9\x2b\xa9\xd7\x7d\xf8\x83\x96\x02\x75\xbe\xb4\xe6\x20\x24" },
12881 { GCRY_MAC_HMAC_SHA3_224,
12882 "Test Using Larger Than Block-Size Key - Hash Key First",
12883 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12884 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12885 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12886 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12887 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12888 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12889 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12890 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12891 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12892 "\xaa\xaa\xaa",
12893 "\xb9\x6d\x73\x0c\x14\x8c\x2d\xaa\xd8\x64\x9d\x83\xde\xfa\xa3\x71"
12894 "\x97\x38\xd3\x47\x75\x39\x7b\x75\x71\xc3\x85\x15" },
12895 { GCRY_MAC_HMAC_SHA3_256,
12896 "Test Using Larger Than Block-Size Key - Hash Key First",
12897 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12898 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12899 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12900 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12901 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12902 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12903 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12904 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12905 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12906 "\xaa\xaa\xaa",
12907 "\xa6\x07\x2f\x86\xde\x52\xb3\x8b\xb3\x49\xfe\x84\xcd\x6d\x97\xfb"
12908 "\x6a\x37\xc4\xc0\xf6\x2a\xae\x93\x98\x11\x93\xa7\x22\x9d\x34\x67" },
12909 { GCRY_MAC_HMAC_SHA3_384,
12910 "Test Using Larger Than Block-Size Key - Hash Key First",
12911 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12912 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12913 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12914 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12915 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12916 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12917 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12918 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12919 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12920 "\xaa\xaa\xaa",
12921 "\x71\x3d\xff\x03\x02\xc8\x50\x86\xec\x5a\xd0\x76\x8d\xd6\x5a\x13"
12922 "\xdd\xd7\x90\x68\xd8\xd4\xc6\x21\x2b\x71\x2e\x41\x64\x94\x49\x11"
12923 "\x14\x80\x23\x00\x44\x18\x5a\x99\x10\x3e\xd8\x20\x04\xdd\xbf\xcc" },
12924 { GCRY_MAC_HMAC_SHA3_512,
12925 "Test Using Larger Than Block-Size Key - Hash Key First",
12926 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12927 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12928 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12929 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12930 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12931 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12932 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12933 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12934 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12935 "\xaa\xaa\xaa",
12936 "\xb1\x48\x35\xc8\x19\xa2\x90\xef\xb0\x10\xac\xe6\xd8\x56\x8d\xc6"
12937 "\xb8\x4d\xe6\x0b\xc4\x9b\x00\x4c\x3b\x13\xed\xa7\x63\x58\x94\x51"
12938 "\xe5\xdd\x74\x29\x28\x84\xd1\xbd\xce\x64\xe6\xb9\x19\xdd\x61\xdc"
12939 "\x9c\x56\xa2\x82\xa8\x1c\x0b\xd1\x4f\x1f\x36\x5b\x49\xb8\x3a\x5b" },
12940 { GCRY_MAC_HMAC_SHA3_224,
12941 "This is a test using a larger than block-size key and a larger "
12942 "than block-size data. The key needs to be hashed before being "
12943 "used by the HMAC algorithm.",
12944 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12945 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12946 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12947 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12948 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12949 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12950 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12951 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12952 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12953 "\xaa\xaa\xaa",
12954 "\xc7\x9c\x9b\x09\x34\x24\xe5\x88\xa9\x87\x8b\xbc\xb0\x89\xe0\x18"
12955 "\x27\x00\x96\xe9\xb4\xb1\xa9\xe8\x22\x0c\x86\x6a" },
12956 { GCRY_MAC_HMAC_SHA3_256,
12957 "This is a test using a larger than block-size key and a larger "
12958 "than block-size data. The key needs to be hashed before being "
12959 "used by the HMAC algorithm.",
12960 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12961 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12962 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12963 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12964 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12965 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12966 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12967 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12968 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12969 "\xaa\xaa\xaa",
12970 "\xe6\xa3\x6d\x9b\x91\x5f\x86\xa0\x93\xca\xc7\xd1\x10\xe9\xe0\x4c"
12971 "\xf1\xd6\x10\x0d\x30\x47\x55\x09\xc2\x47\x5f\x57\x1b\x75\x8b\x5a" },
12972 { GCRY_MAC_HMAC_SHA3_384,
12973 "This is a test using a larger than block-size key and a larger "
12974 "than block-size data. The key needs to be hashed before being "
12975 "used by the HMAC algorithm.",
12976 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12977 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12978 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12979 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12980 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12981 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12982 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12983 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12984 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12985 "\xaa\xaa\xaa",
12986 "\xca\xd1\x8a\x8f\xf6\xc4\xcc\x3a\xd4\x87\xb9\x5f\x97\x69\xe9\xb6"
12987 "\x1c\x06\x2a\xef\xd6\x95\x25\x69\xe6\xe6\x42\x18\x97\x05\x4c\xfc"
12988 "\x70\xb5\xfd\xc6\x60\x5c\x18\x45\x71\x12\xfc\x6a\xaa\xd4\x55\x85" },
12989 { GCRY_MAC_HMAC_SHA3_512,
12990 "This is a test using a larger than block-size key and a larger "
12991 "than block-size data. The key needs to be hashed before being "
12992 "used by the HMAC algorithm.",
12993 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12994 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12995 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12996 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12997 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12998 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
12999 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
13000 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
13001 "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
13002 "\xaa\xaa\xaa",
13003 "\xdc\x03\x0e\xe7\x88\x70\x34\xf3\x2c\xf4\x02\xdf\x34\x62\x2f\x31"
13004 "\x1f\x3e\x6c\xf0\x48\x60\xc6\xbb\xd7\xfa\x48\x86\x74\x78\x2b\x46"
13005 "\x59\xfd\xbd\xf3\xfd\x87\x78\x52\x88\x5c\xfe\x6e\x22\x18\x5f\xe7"
13006 "\xb2\xee\x95\x20\x43\x62\x9b\xc9\xd5\xf3\x29\x8a\x41\xd0\x2c\x66" },
13007 { GCRY_MAC_HMAC_SHA3_224, "?", "????????????????",
13008 "\x80\x2b\x3c\x84\xfe\x3e\x01\x22\x14\xf8\xba\x74\x79\xfd\xb5\x02"
13009 "\xea\x0c\x06\xa4\x7e\x01\xe3\x2c\xc7\x24\x89\xc3" },
13010 { GCRY_MAC_HMAC_SHA3_256, "?", "????????????????",
13011 "\x6c\x7c\x96\x5b\x19\xba\xcd\x61\x69\x8a\x2c\x7a\x2b\x96\xa1\xc3"
13012 "\x33\xa0\x3c\x5d\x54\x87\x37\x60\xc8\x2f\xa2\xa6\x12\x38\x8d\x1b" },
13013 { GCRY_MAC_HMAC_SHA3_384, "?", "????????????????",
13014 "\xc0\x20\xd0\x9b\xa7\xb9\xd5\xb8\xa6\xa4\xba\x20\x55\xd9\x0b\x35"
13015 "\x8b\xe0\xb7\xec\x1e\x9f\xe6\xb9\xbd\xd5\xe9\x9b\xfc\x0a\x11\x3a"
13016 "\x15\x41\xed\xfd\xef\x30\x8d\x03\xb8\xca\x3a\xa8\xc7\x2d\x89\x32" },
13017 { GCRY_MAC_HMAC_SHA3_512, "?", "????????????????",
13018 "\xb4\xef\x24\xd2\x07\xa7\x01\xb3\xe1\x81\x11\x22\x93\x83\x64\xe0"
13019 "\x5e\xad\x03\xb7\x43\x4f\x87\xa1\x14\x8e\x17\x8f\x2a\x97\x7d\xe8"
13020 "\xbd\xb0\x37\x3b\x67\xb9\x97\x36\xa5\x82\x9b\xdc\x0d\xe4\x5a\x8c"
13021 "\x5e\xda\xb5\xca\xea\xa9\xb4\x6e\xba\xca\x25\xc8\xbf\xa1\x0e\xb0" },
13022 { GCRY_MAC_HMAC_STRIBOG256,
13023 "\x01\x26\xbd\xb8\x78\x00\xaf\x21\x43\x41\x45\x65\x63\x78\x01\x00",
13024 "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
13025 "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f",
13026 "\xa1\xaa\x5f\x7d\xe4\x02\xd7\xb3\xd3\x23\xf2\x99\x1c\x8d\x45\x34"
13027 "\x01\x31\x37\x01\x0a\x83\x75\x4f\xd0\xaf\x6d\x7c\xd4\x92\x2e\xd9",
13028 NULL, 16, 32 },
13029 { GCRY_MAC_HMAC_STRIBOG512,
13030 "\x01\x26\xbd\xb8\x78\x00\xaf\x21\x43\x41\x45\x65\x63\x78\x01\x00",
13031 "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
13032 "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f",
13033 "\xa5\x9b\xab\x22\xec\xae\x19\xc6\x5f\xbd\xe6\xe5\xf4\xe9\xf5\xd8"
13034 "\x54\x9d\x31\xf0\x37\xf9\xdf\x9b\x90\x55\x00\xe1\x71\x92\x3a\x77"
13035 "\x3d\x5f\x15\x30\xf2\xed\x7e\x96\x4c\xb2\xee\xdc\x29\xe9\xad\x2f"
13036 "\x3a\xfe\x93\xb2\x81\x4f\x79\xf5\x00\x0f\xfc\x03\x66\xc2\x51\xe6",
13037 NULL, 16, 32 },
13038 /* CMAC AES and DES test vectors from
13039 http://web.archive.org/web/20130930212819/http://csrc.nist.gov/publica\
13040 tions/nistpubs/800-38B/Updated_CMAC_Examples.pdf */
13041 { GCRY_MAC_CMAC_AES,
13042 "",
13043 "\x2b\x7e\x15\x16\x28\xae\xd2\xa6\xab\xf7\x15\x88\x09\xcf\x4f\x3c",
13044 "\xbb\x1d\x69\x29\xe9\x59\x37\x28\x7f\xa3\x7d\x12\x9b\x75\x67\x46" },
13045 { GCRY_MAC_CMAC_AES,
13046 "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96\xe9\x3d\x7e\x11\x73\x93\x17\x2a",
13047 "\x2b\x7e\x15\x16\x28\xae\xd2\xa6\xab\xf7\x15\x88\x09\xcf\x4f\x3c",
13048 "\x07\x0a\x16\xb4\x6b\x4d\x41\x44\xf7\x9b\xdd\x9d\xd0\x4a\x28\x7c" },
13049 { GCRY_MAC_CMAC_AES,
13050 "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96\xe9\x3d\x7e\x11\x73\x93\x17\x2a"
13051 "\xae\x2d\x8a\x57\x1e\x03\xac\x9c\x9e\xb7\x6f\xac\x45\xaf\x8e\x51"
13052 "\x30\xc8\x1c\x46\xa3\x5c\xe4\x11",
13053 "\x2b\x7e\x15\x16\x28\xae\xd2\xa6\xab\xf7\x15\x88\x09\xcf\x4f\x3c",
13054 "\xdf\xa6\x67\x47\xde\x9a\xe6\x30\x30\xca\x32\x61\x14\x97\xc8\x27" },
13055 { GCRY_MAC_CMAC_AES,
13056 "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96\xe9\x3d\x7e\x11\x73\x93\x17\x2a"
13057 "\xae\x2d\x8a\x57\x1e\x03\xac\x9c\x9e\xb7\x6f\xac\x45\xaf\x8e\x51"
13058 "\x30\xc8\x1c\x46\xa3\x5c\xe4\x11\xe5\xfb\xc1\x19\x1a\x0a\x52\xef"
13059 "\xf6\x9f\x24\x45\xdf\x4f\x9b\x17\xad\x2b\x41\x7b\xe6\x6c\x37\x10",
13060 "\x2b\x7e\x15\x16\x28\xae\xd2\xa6\xab\xf7\x15\x88\x09\xcf\x4f\x3c",
13061 "\x51\xf0\xbe\xbf\x7e\x3b\x9d\x92\xfc\x49\x74\x17\x79\x36\x3c\xfe" },
13062 { GCRY_MAC_CMAC_AES,
13063 "",
13064 "\x8e\x73\xb0\xf7\xda\x0e\x64\x52\xc8\x10\xf3\x2b\x80\x90\x79\xe5"
13065 "\x62\xf8\xea\xd2\x52\x2c\x6b\x7b",
13066 "\xd1\x7d\xdf\x46\xad\xaa\xcd\xe5\x31\xca\xc4\x83\xde\x7a\x93\x67" },
13067 { GCRY_MAC_CMAC_AES,
13068 "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96\xe9\x3d\x7e\x11\x73\x93\x17\x2a",
13069 "\x8e\x73\xb0\xf7\xda\x0e\x64\x52\xc8\x10\xf3\x2b\x80\x90\x79\xe5"
13070 "\x62\xf8\xea\xd2\x52\x2c\x6b\x7b",
13071 "\x9e\x99\xa7\xbf\x31\xe7\x10\x90\x06\x62\xf6\x5e\x61\x7c\x51\x84" },
13072 { GCRY_MAC_CMAC_AES,
13073 "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96\xe9\x3d\x7e\x11\x73\x93\x17\x2a"
13074 "\xae\x2d\x8a\x57\x1e\x03\xac\x9c\x9e\xb7\x6f\xac\x45\xaf\x8e\x51"
13075 "\x30\xc8\x1c\x46\xa3\x5c\xe4\x11",
13076 "\x8e\x73\xb0\xf7\xda\x0e\x64\x52\xc8\x10\xf3\x2b\x80\x90\x79\xe5"
13077 "\x62\xf8\xea\xd2\x52\x2c\x6b\x7b",
13078 "\x8a\x1d\xe5\xbe\x2e\xb3\x1a\xad\x08\x9a\x82\xe6\xee\x90\x8b\x0e" },
13079 { GCRY_MAC_CMAC_AES,
13080 "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96\xe9\x3d\x7e\x11\x73\x93\x17\x2a"
13081 "\xae\x2d\x8a\x57\x1e\x03\xac\x9c\x9e\xb7\x6f\xac\x45\xaf\x8e\x51"
13082 "\x30\xc8\x1c\x46\xa3\x5c\xe4\x11\xe5\xfb\xc1\x19\x1a\x0a\x52\xef"
13083 "\xf6\x9f\x24\x45\xdf\x4f\x9b\x17\xad\x2b\x41\x7b\xe6\x6c\x37\x10",
13084 "\x8e\x73\xb0\xf7\xda\x0e\x64\x52\xc8\x10\xf3\x2b\x80\x90\x79\xe5"
13085 "\x62\xf8\xea\xd2\x52\x2c\x6b\x7b",
13086 "\xa1\xd5\xdf\x0e\xed\x79\x0f\x79\x4d\x77\x58\x96\x59\xf3\x9a\x11" },
13087 { GCRY_MAC_CMAC_AES,
13088 "",
13089 "\x60\x3d\xeb\x10\x15\xca\x71\xbe\x2b\x73\xae\xf0\x85\x7d\x77\x81"
13090 "\x1f\x35\x2c\x07\x3b\x61\x08\xd7\x2d\x98\x10\xa3\x09\x14\xdf\xf4",
13091 "\x02\x89\x62\xf6\x1b\x7b\xf8\x9e\xfc\x6b\x55\x1f\x46\x67\xd9\x83" },
13092 { GCRY_MAC_CMAC_AES,
13093 "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96\xe9\x3d\x7e\x11\x73\x93\x17\x2a",
13094 "\x60\x3d\xeb\x10\x15\xca\x71\xbe\x2b\x73\xae\xf0\x85\x7d\x77\x81"
13095 "\x1f\x35\x2c\x07\x3b\x61\x08\xd7\x2d\x98\x10\xa3\x09\x14\xdf\xf4",
13096 "\x28\xa7\x02\x3f\x45\x2e\x8f\x82\xbd\x4b\xf2\x8d\x8c\x37\xc3\x5c" },
13097 { GCRY_MAC_CMAC_AES,
13098 "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96\xe9\x3d\x7e\x11\x73\x93\x17\x2a"
13099 "\xae\x2d\x8a\x57\x1e\x03\xac\x9c\x9e\xb7\x6f\xac\x45\xaf\x8e\x51"
13100 "\x30\xc8\x1c\x46\xa3\x5c\xe4\x11",
13101 "\x60\x3d\xeb\x10\x15\xca\x71\xbe\x2b\x73\xae\xf0\x85\x7d\x77\x81"
13102 "\x1f\x35\x2c\x07\x3b\x61\x08\xd7\x2d\x98\x10\xa3\x09\x14\xdf\xf4",
13103 "\xaa\xf3\xd8\xf1\xde\x56\x40\xc2\x32\xf5\xb1\x69\xb9\xc9\x11\xe6" },
13104 { GCRY_MAC_CMAC_AES,
13105 "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96\xe9\x3d\x7e\x11\x73\x93\x17\x2a"
13106 "\xae\x2d\x8a\x57\x1e\x03\xac\x9c\x9e\xb7\x6f\xac\x45\xaf\x8e\x51"
13107 "\x30\xc8\x1c\x46\xa3\x5c\xe4\x11\xe5\xfb\xc1\x19\x1a\x0a\x52\xef"
13108 "\xf6\x9f\x24\x45\xdf\x4f\x9b\x17\xad\x2b\x41\x7b\xe6\x6c\x37\x10",
13109 "\x60\x3d\xeb\x10\x15\xca\x71\xbe\x2b\x73\xae\xf0\x85\x7d\x77\x81"
13110 "\x1f\x35\x2c\x07\x3b\x61\x08\xd7\x2d\x98\x10\xa3\x09\x14\xdf\xf4",
13111 "\xe1\x99\x21\x90\x54\x9f\x6e\xd5\x69\x6a\x2c\x05\x6c\x31\x54\x10" },
13112 { GCRY_MAC_CMAC_AES, "?", "????????????????????????????????",
13113 "\x9f\x72\x73\x68\xb0\x49\x2e\xb1\x35\xa0\x1d\xf9\xa8\x0a\xf6\xee" },
13114 { GCRY_MAC_CMAC_3DES,
13115 "",
13116 "\x8a\xa8\x3b\xf8\xcb\xda\x10\x62\x0b\xc1\xbf\x19\xfb\xb6\xcd\x58"
13117 "\xbc\x31\x3d\x4a\x37\x1c\xa8\xb5",
13118 "\xb7\xa6\x88\xe1\x22\xff\xaf\x95" },
13119 { GCRY_MAC_CMAC_3DES,
13120 "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96",
13121 "\x8a\xa8\x3b\xf8\xcb\xda\x10\x62\x0b\xc1\xbf\x19\xfb\xb6\xcd\x58"
13122 "\xbc\x31\x3d\x4a\x37\x1c\xa8\xb5",
13123 "\x8e\x8f\x29\x31\x36\x28\x37\x97" },
13124 { GCRY_MAC_CMAC_3DES,
13125 "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96\xe9\x3d\x7e\x11\x73\x93\x17\x2a"
13126 "\xae\x2d\x8a\x57",
13127 "\x8a\xa8\x3b\xf8\xcb\xda\x10\x62\x0b\xc1\xbf\x19\xfb\xb6\xcd\x58"
13128 "\xbc\x31\x3d\x4a\x37\x1c\xa8\xb5",
13129 "\x74\x3d\xdb\xe0\xce\x2d\xc2\xed" },
13130 { GCRY_MAC_CMAC_3DES,
13131 "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96\xe9\x3d\x7e\x11\x73\x93\x17\x2a"
13132 "\xae\x2d\x8a\x57\x1e\x03\xac\x9c\x9e\xb7\x6f\xac\x45\xaf\x8e\x51",
13133 "\x8a\xa8\x3b\xf8\xcb\xda\x10\x62\x0b\xc1\xbf\x19\xfb\xb6\xcd\x58"
13134 "\xbc\x31\x3d\x4a\x37\x1c\xa8\xb5",
13135 "\x33\xe6\xb1\x09\x24\x00\xea\xe5" },
13136 { GCRY_MAC_CMAC_3DES,
13137 "",
13138 "\x4c\xf1\x51\x34\xa2\x85\x0d\xd5\x8a\x3d\x10\xba\x80\x57\x0d\x38"
13139 "\x4c\xf1\x51\x34\xa2\x85\x0d\xd5",
13140 "\xbd\x2e\xbf\x9a\x3b\xa0\x03\x61" },
13141 { GCRY_MAC_CMAC_3DES,
13142 "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96",
13143 "\x4c\xf1\x51\x34\xa2\x85\x0d\xd5\x8a\x3d\x10\xba\x80\x57\x0d\x38"
13144 "\x4c\xf1\x51\x34\xa2\x85\x0d\xd5",
13145 "\x4f\xf2\xab\x81\x3c\x53\xce\x83" },
13146 { GCRY_MAC_CMAC_3DES,
13147 "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96\xe9\x3d\x7e\x11\x73\x93\x17\x2a"
13148 "\xae\x2d\x8a\x57",
13149 "\x4c\xf1\x51\x34\xa2\x85\x0d\xd5\x8a\x3d\x10\xba\x80\x57\x0d\x38"
13150 "\x4c\xf1\x51\x34\xa2\x85\x0d\xd5",
13151 "\x62\xdd\x1b\x47\x19\x02\xbd\x4e" },
13152 { GCRY_MAC_CMAC_3DES,
13153 "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96\xe9\x3d\x7e\x11\x73\x93\x17\x2a"
13154 "\xae\x2d\x8a\x57\x1e\x03\xac\x9c\x9e\xb7\x6f\xac\x45\xaf\x8e\x51",
13155 "\x4c\xf1\x51\x34\xa2\x85\x0d\xd5\x8a\x3d\x10\xba\x80\x57\x0d\x38"
13156 "\x4c\xf1\x51\x34\xa2\x85\x0d\xd5",
13157 "\x31\xb1\xe4\x31\xda\xbc\x4e\xb8" },
13158 { GCRY_MAC_CMAC_3DES, "?", "????????????????????????",
13159 "\xc1\x38\x13\xb2\x31\x8f\x3a\xdf" },
13160 /* CMAC Camellia test vectors from
13161 http://tools.ietf.org/html/draft-kato-ipsec-camellia-cmac96and128-05 */
13162 { GCRY_MAC_CMAC_CAMELLIA,
13163 "",
13164 "\x2b\x7e\x15\x16\x28\xae\xd2\xa6\xab\xf7\x15\x88\x09\xcf\x4f\x3c",
13165 "\xba\x92\x57\x82\xaa\xa1\xf5\xd9\xa0\x0f\x89\x64\x80\x94\xfc\x71" },
13166 { GCRY_MAC_CMAC_CAMELLIA,
13167 "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96\xe9\x3d\x7e\x11\x73\x93\x17\x2a",
13168 "\x2b\x7e\x15\x16\x28\xae\xd2\xa6\xab\xf7\x15\x88\x09\xcf\x4f\x3c",
13169 "\x6d\x96\x28\x54\xa3\xb9\xfd\xa5\x6d\x7d\x45\xa9\x5e\xe1\x79\x93" },
13170 { GCRY_MAC_CMAC_CAMELLIA,
13171 "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96\xe9\x3d\x7e\x11\x73\x93\x17\x2a"
13172 "\xae\x2d\x8a\x57\x1e\x03\xac\x9c\x9e\xb7\x6f\xac\x45\xaf\x8e\x51"
13173 "\x30\xc8\x1c\x46\xa3\x5c\xe4\x11",
13174 "\x2b\x7e\x15\x16\x28\xae\xd2\xa6\xab\xf7\x15\x88\x09\xcf\x4f\x3c",
13175 "\x5c\x18\xd1\x19\xcc\xd6\x76\x61\x44\xac\x18\x66\x13\x1d\x9f\x22" },
13176 { GCRY_MAC_CMAC_CAMELLIA,
13177 "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96\xe9\x3d\x7e\x11\x73\x93\x17\x2a"
13178 "\xae\x2d\x8a\x57\x1e\x03\xac\x9c\x9e\xb7\x6f\xac\x45\xaf\x8e\x51"
13179 "\x30\xc8\x1c\x46\xa3\x5c\xe4\x11\xe5\xfb\xc1\x19\x1a\x0a\x52\xef"
13180 "\xf6\x9f\x24\x45\xdf\x4f\x9b\x17\xad\x2b\x41\x7b\xe6\x6c\x37\x10",
13181 "\x2b\x7e\x15\x16\x28\xae\xd2\xa6\xab\xf7\x15\x88\x09\xcf\x4f\x3c",
13182 "\xc2\x69\x9a\x6e\xba\x55\xce\x9d\x93\x9a\x8a\x4e\x19\x46\x6e\xe9" },
13183 { GCRY_MAC_CMAC_CAMELLIA, "?", "????????????????????????????????",
13184 "\xba\x8a\x5a\x8d\xa7\x54\x26\x83\x3e\xb1\x20\xb5\x45\xd0\x9f\x4e" },
13185 /* http://csrc.nist.gov/groups/STM/cavp/documents/mac/gcmtestvectors.zip */
13186 { GCRY_MAC_GMAC_AES,
13187 "",
13188 "\x11\x75\x4c\xd7\x2a\xec\x30\x9b\xf5\x2f\x76\x87\x21\x2e\x89\x57",
13189 "\x25\x03\x27\xc6\x74\xaa\xf4\x77\xae\xf2\x67\x57\x48\xcf\x69\x71",
13190 "\x3c\x81\x9d\x9a\x9b\xed\x08\x76\x15\x03\x0b\x65" },
13191 { GCRY_MAC_GMAC_AES,
13192 "\x2b\x63\x26\x64\x29\x67\x4a\xb5\xe2\xea\xff\x63\x9c\x23\x14\x66"
13193 "\x2f\x92\x57\x4b\x29\x8f\x57\x7a\xcf\x7d\x6f\x99\x1a\x87\x92\x1f"
13194 "\xc2\x32\xea\xfc\xc7\xb1\x46\x48\x96\x63\x2d\x6c\x8a\xbe\x88\xc2"
13195 "\xcc\xa4\x04\xdb\xf8\x7c\x20\x6a\x19\xd3\x73\xed\x99\x50\x17\x34"
13196 "\x69\x13\x4d\x7c\x14\xc2\x84\x7d\xf2\x4a\x88\xc1\xc5\x3b\x4d\xe4"
13197 "\x9d\xb3\x66\x39\x2b\x6d\xc6\x51\x27\x6e",
13198 "\x0f\x3b\x17\xde\xae\x62\x13\x64\x55\x4a\xe5\x39\xdb\x09\xde\x11",
13199 "\xff\xb0\xbb\x6d\xfc\x23\x58\x75\x4f\x17\x78\x48\x5b\x59\x65\x7f",
13200 "\xa7\xf6\x07\x4c\xda\x56\x1c\xd2\xaa\x15\xba\x8c\x2f\xa6\x39\x42"
13201 "\x59\x3e\x7c\xcf\x45\xc2\x9a\x57\xda\xd8\xa6\xe2\xea\x63\x54\xce"
13202 "\x8a\xde\x39\xdd\xde\x4a\xc4\x5b\xbd\xc6\x63\xf0\xa5\x37\xc9\x48"
13203 "\x18\x23\x5a\x73\xd8\xa0\x8b\xd8\x98\xab\xd0\x99\xe1\x5c\x08\x8c"
13204 "\x6e\x21\x17\x5a\xf4\xe9\xa4\x99\x70\x12\x82\xed\x32\x81\x50\xa6"
13205 "\xd9\x90\xe8\xec\x87\x85\xce\x26\x1b\xe1\xb8\x3f\xd8\x59\x1e\x57"
13206 "\x76\x5f\x3d\xc1\x11\x3f\xd0\x2a\x40\xf5\x01\x6a\xd0\xd0\xed\xc4"
13207 "\x92\x9a\x02\xe0\x17\xb2\xc5\xf4\x18\xd2\x96\xab\xd6\xc2\xea\x2e" },
13208 { GCRY_MAC_GMAC_AES,
13209 "\x61\x14\x60\x11\x90\xf6\xef\x5e\x59\x23\x5d\xc0\x42\x8c\x09\xe3"
13210 "\x27\x0b\x19\xea",
13211 "\x15\xa4\x14\x46\x6a\x7f\x90\xea\x32\xbf\xd7\xf6\xe5\x8b\xfa\x06"
13212 "\xe9\x07\xfc\x41\x66\x89\xd9\x60\x39\x45\xd7\x94\x54\xd4\x23\x17",
13213 "\x19\x6e\x0e\x01\x0f\x08\x56\xf9\x82\xb4\x08\x92\x41\xd6\x24\x84",
13214 "\xab" },
13215 { GCRY_MAC_GMAC_AES,
13216 "\x8b\x5c\x12\x4b\xef\x6e\x2f\x0f\xe4\xd8\xc9\x5c\xd5\xfa\x4c\xf1",
13217 "\x41\xc5\xda\x86\x67\xef\x72\x52\x20\xff\xe3\x9a\xe0\xac\x59\x0a"
13218 "\xc9\xfc\xa7\x29\xab\x60\xad\xa0",
13219 "\x20\x4b\xdb\x1b\xd6\x21\x54\xbf\x08\x92\x2a\xaa\x54\xee\xd7\x05",
13220 "\x05\xad\x13\xa5\xe2\xc2\xab\x66\x7e\x1a\x6f\xbc" },
13221 { GCRY_MAC_GMAC_AES, "?", "????????????????????????????????",
13222 "\x84\x37\xc3\x42\xae\xf5\xd0\x40\xd3\x73\x90\xa9\x36\xed\x8a\x12" },
13223 /* from NaCl */
13224 { GCRY_MAC_POLY1305,
13225 "\x8e\x99\x3b\x9f\x48\x68\x12\x73\xc2\x96\x50\xba\x32\xfc\x76\xce"
13226 "\x48\x33\x2e\xa7\x16\x4d\x96\xa4\x47\x6f\xb8\xc5\x31\xa1\x18\x6a"
13227 "\xc0\xdf\xc1\x7c\x98\xdc\xe8\x7b\x4d\xa7\xf0\x11\xec\x48\xc9\x72"
13228 "\x71\xd2\xc2\x0f\x9b\x92\x8f\xe2\x27\x0d\x6f\xb8\x63\xd5\x17\x38"
13229 "\xb4\x8e\xee\xe3\x14\xa7\xcc\x8a\xb9\x32\x16\x45\x48\xe5\x26\xae"
13230 "\x90\x22\x43\x68\x51\x7a\xcf\xea\xbd\x6b\xb3\x73\x2b\xc0\xe9\xda"
13231 "\x99\x83\x2b\x61\xca\x01\xb6\xde\x56\x24\x4a\x9e\x88\xd5\xf9\xb3"
13232 "\x79\x73\xf6\x22\xa4\x3d\x14\xa6\x59\x9b\x1f\x65\x4c\xb4\x5a\x74"
13233 "\xe3\x55\xa5",
13234 "\xee\xa6\xa7\x25\x1c\x1e\x72\x91\x6d\x11\xc2\xcb\x21\x4d\x3c\x25"
13235 "\x25\x39\x12\x1d\x8e\x23\x4e\x65\x2d\x65\x1f\xa4\xc8\xcf\xf8\x80",
13236 "\xf3\xff\xc7\x70\x3f\x94\x00\xe5\x2a\x7d\xfb\x4b\x3d\x33\x05\xd9" },
13237 /* from draft-nir-cfrg-chacha20-poly1305-03 */
13238 { GCRY_MAC_POLY1305,
13239 "Cryptographic Forum Research Group",
13240 "\x85\xd6\xbe\x78\x57\x55\x6d\x33\x7f\x44\x52\xfe\x42\xd5\x06\xa8"
13241 "\x01\x03\x80\x8a\xfb\x0d\xb2\xfd\x4a\xbf\xf6\xaf\x41\x49\xf5\x1b",
13242 "\xa8\x06\x1d\xc1\x30\x51\x36\xc6\xc2\x2b\x8b\xaf\x0c\x01\x27\xa9" },
13243 { GCRY_MAC_POLY1305,
13244 "'Twas brillig, and the slithy toves\n"
13245 "Did gyre and gimble in the wabe:\n"
13246 "All mimsy were the borogoves,\n"
13247 "And the mome raths outgrabe.",
13248 "\x1c\x92\x40\xa5\xeb\x55\xd3\x8a\xf3\x33\x88\x86\x04\xf6\xb5\xf0"
13249 "\x47\x39\x17\xc1\x40\x2b\x80\x09\x9d\xca\x5c\xbc\x20\x70\x75\xc0",
13250 "\x45\x41\x66\x9a\x7e\xaa\xee\x61\xe7\x08\xdc\x7c\xbc\xc5\xeb\x62" },
13251 { GCRY_MAC_POLY1305,
13252 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
13253 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
13254 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
13255 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
13256 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
13257 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
13258 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
13259 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
13260 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
13261 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
13262 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
13263 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
13264 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
13265 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
13266 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
13267 NULL,
13268 191, 32 },
13269 { GCRY_MAC_POLY1305,
13270 "Any submission to the IETF intended by the Contributor for "
13271 "publication as all or part of an IETF Internet-Draft or RFC and "
13272 "any statement made within the context of an IETF activity is "
13273 "considered an \"IETF Contribution\". Such statements include "
13274 "oral statements in IETF sessions, as well as written and "
13275 "electronic communications made at any time or place, which are "
13276 "addressed to",
13277 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
13278 "\x36\xe5\xf6\xb5\xc5\xe0\x60\x70\xf0\xef\xca\x96\x22\x7a\x86\x3e",
13279 "\x36\xe5\xf6\xb5\xc5\xe0\x60\x70\xf0\xef\xca\x96\x22\x7a\x86\x3e",
13280 NULL,
13281 0, 32 },
13282 { GCRY_MAC_POLY1305,
13283 "Any submission to the IETF intended by the Contributor for "
13284 "publication as all or part of an IETF Internet-Draft or RFC and "
13285 "any statement made within the context of an IETF activity is "
13286 "considered an \"IETF Contribution\". Such statements include "
13287 "oral statements in IETF sessions, as well as written and "
13288 "electronic communications made at any time or place, which are "
13289 "addressed to",
13290 "\x36\xe5\xf6\xb5\xc5\xe0\x60\x70\xf0\xef\xca\x96\x22\x7a\x86\x3e"
13291 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
13292 "\xf3\x47\x7e\x7c\xd9\x54\x17\xaf\x89\xa6\xb8\x79\x4c\x31\x0c\xf0",
13293 NULL,
13294 0, 32 },
13295 /* draft-irtf-cfrg-chacha20-poly1305-01 */
13296 /* TV#5 */
13297 { GCRY_MAC_POLY1305,
13298 "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF",
13299 "\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
13300 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
13301 "\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
13302 NULL,
13303 16, 32 },
13304 /* TV#6 */
13305 { GCRY_MAC_POLY1305,
13306 "\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
13307 "\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
13308 "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF",
13309 "\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
13310 NULL,
13311 16, 32 },
13312 /* TV#7 */
13313 { GCRY_MAC_POLY1305,
13314 "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF"
13315 "\xF0\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF"
13316 "\x11\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
13317 "\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
13318 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
13319 "\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
13320 NULL,
13321 48, 32 },
13322 /* TV#8 */
13323 { GCRY_MAC_POLY1305,
13324 "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF"
13325 "\xFB\xFE\xFE\xFE\xFE\xFE\xFE\xFE\xFE\xFE\xFE\xFE\xFE\xFE\xFE\xFE"
13326 "\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01",
13327 "\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
13328 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
13329 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
13330 NULL,
13331 48, 32 },
13332 /* TV#9 */
13333 { GCRY_MAC_POLY1305,
13334 "\xFD\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF",
13335 "\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
13336 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
13337 "\xFA\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF",
13338 NULL,
13339 16, 32 },
13340 /* TV#10 */
13341 { GCRY_MAC_POLY1305,
13342 "\xE3\x35\x94\xD7\x50\x5E\x43\xB9\x00\x00\x00\x00\x00\x00\x00\x00"
13343 "\x33\x94\xD7\x50\x5E\x43\x79\xCD\x01\x00\x00\x00\x00\x00\x00\x00"
13344 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
13345 "\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
13346 "\x01\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00"
13347 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
13348 "\x14\x00\x00\x00\x00\x00\x00\x00\x55\x00\x00\x00\x00\x00\x00\x00",
13349 NULL,
13350 64, 32 },
13351 /* TV#11 */
13352 { GCRY_MAC_POLY1305,
13353 "\xE3\x35\x94\xD7\x50\x5E\x43\xB9\x00\x00\x00\x00\x00\x00\x00\x00"
13354 "\x33\x94\xD7\x50\x5E\x43\x79\xCD\x01\x00\x00\x00\x00\x00\x00\x00"
13355 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
13356 "\x01\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00"
13357 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
13358 "\x13\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
13359 NULL,
13360 48, 32 },
13361 /* from http://cr.yp.to/mac/poly1305-20050329.pdf */
13362 { GCRY_MAC_POLY1305,
13363 "\xf3\xf6",
13364 "\x85\x1f\xc4\x0c\x34\x67\xac\x0b\xe0\x5c\xc2\x04\x04\xf3\xf7\x00"
13365 "\x58\x0b\x3b\x0f\x94\x47\xbb\x1e\x69\xd0\x95\xb5\x92\x8b\x6d\xbc",
13366 "\xf4\xc6\x33\xc3\x04\x4f\xc1\x45\xf8\x4f\x33\x5c\xb8\x19\x53\xde",
13367 NULL,
13368 0, 32 },
13369 { GCRY_MAC_POLY1305,
13370 "",
13371 "\xa0\xf3\x08\x00\x00\xf4\x64\x00\xd0\xc7\xe9\x07\x6c\x83\x44\x03"
13372 "\xdd\x3f\xab\x22\x51\xf1\x1a\xc7\x59\xf0\x88\x71\x29\xcc\x2e\xe7",
13373 "\xdd\x3f\xab\x22\x51\xf1\x1a\xc7\x59\xf0\x88\x71\x29\xcc\x2e\xe7",
13374 NULL,
13375 0, 32 },
13376 { GCRY_MAC_POLY1305,
13377 "\x66\x3c\xea\x19\x0f\xfb\x83\xd8\x95\x93\xf3\xf4\x76\xb6\xbc\x24"
13378 "\xd7\xe6\x79\x10\x7e\xa2\x6a\xdb\x8c\xaf\x66\x52\xd0\x65\x61\x36",
13379 "\x48\x44\x3d\x0b\xb0\xd2\x11\x09\xc8\x9a\x10\x0b\x5c\xe2\xc2\x08"
13380 "\x83\x14\x9c\x69\xb5\x61\xdd\x88\x29\x8a\x17\x98\xb1\x07\x16\xef",
13381 "\x0e\xe1\xc1\x6b\xb7\x3f\x0f\x4f\xd1\x98\x81\x75\x3c\x01\xcd\xbe",
13382 NULL,
13383 0, 32 },
13384 { GCRY_MAC_POLY1305,
13385 "\xab\x08\x12\x72\x4a\x7f\x1e\x34\x27\x42\xcb\xed\x37\x4d\x94\xd1"
13386 "\x36\xc6\xb8\x79\x5d\x45\xb3\x81\x98\x30\xf2\xc0\x44\x91\xfa\xf0"
13387 "\x99\x0c\x62\xe4\x8b\x80\x18\xb2\xc3\xe4\xa0\xfa\x31\x34\xcb\x67"
13388 "\xfa\x83\xe1\x58\xc9\x94\xd9\x61\xc4\xcb\x21\x09\x5c\x1b\xf9",
13389 "\x12\x97\x6a\x08\xc4\x42\x6d\x0c\xe8\xa8\x24\x07\xc4\xf4\x82\x07"
13390 "\x80\xf8\xc2\x0a\xa7\x12\x02\xd1\xe2\x91\x79\xcb\xcb\x55\x5a\x57",
13391 "\x51\x54\xad\x0d\x2c\xb2\x6e\x01\x27\x4f\xc5\x11\x48\x49\x1f\x1b" },
13392 { GCRY_MAC_POLY1305, "?", "????????????????????????????????",
13393 "\xc3\x88\xce\x8a\x52\xd6\xe7\x21\x86\xfa\xaa\x5d\x2d\x16\xf9\xa3" },
13394 /* from http://cr.yp.to/mac/poly1305-20050329.pdf */
13395 { GCRY_MAC_POLY1305_AES,
13396 "\xf3\xf6",
13397 "\xec\x07\x4c\x83\x55\x80\x74\x17\x01\x42\x5b\x62\x32\x35\xad\xd6"
13398 "\x85\x1f\xc4\x0c\x34\x67\xac\x0b\xe0\x5c\xc2\x04\x04\xf3\xf7\x00",
13399 "\xf4\xc6\x33\xc3\x04\x4f\xc1\x45\xf8\x4f\x33\x5c\xb8\x19\x53\xde",
13400 "\xfb\x44\x73\x50\xc4\xe8\x68\xc5\x2a\xc3\x27\x5c\xf9\xd4\x32\x7e",
13401 0, 32 },
13402 { GCRY_MAC_POLY1305_AES,
13403 "",
13404 "\x75\xde\xaa\x25\xc0\x9f\x20\x8e\x1d\xc4\xce\x6b\x5c\xad\x3f\xbf"
13405 "\xa0\xf3\x08\x00\x00\xf4\x64\x00\xd0\xc7\xe9\x07\x6c\x83\x44\x03",
13406 "\xdd\x3f\xab\x22\x51\xf1\x1a\xc7\x59\xf0\x88\x71\x29\xcc\x2e\xe7",
13407 "\x61\xee\x09\x21\x8d\x29\xb0\xaa\xed\x7e\x15\x4a\x2c\x55\x09\xcc",
13408 0, 32 },
13409 { GCRY_MAC_POLY1305_AES,
13410 "\x66\x3c\xea\x19\x0f\xfb\x83\xd8\x95\x93\xf3\xf4\x76\xb6\xbc\x24"
13411 "\xd7\xe6\x79\x10\x7e\xa2\x6a\xdb\x8c\xaf\x66\x52\xd0\x65\x61\x36",
13412 "\x6a\xcb\x5f\x61\xa7\x17\x6d\xd3\x20\xc5\xc1\xeb\x2e\xdc\xdc\x74"
13413 "\x48\x44\x3d\x0b\xb0\xd2\x11\x09\xc8\x9a\x10\x0b\x5c\xe2\xc2\x08",
13414 "\x0e\xe1\xc1\x6b\xb7\x3f\x0f\x4f\xd1\x98\x81\x75\x3c\x01\xcd\xbe",
13415 "\xae\x21\x2a\x55\x39\x97\x29\x59\x5d\xea\x45\x8b\xc6\x21\xff\x0e",
13416 0, 32 },
13417 { GCRY_MAC_POLY1305_AES,
13418 "\xab\x08\x12\x72\x4a\x7f\x1e\x34\x27\x42\xcb\xed\x37\x4d\x94\xd1"
13419 "\x36\xc6\xb8\x79\x5d\x45\xb3\x81\x98\x30\xf2\xc0\x44\x91\xfa\xf0"
13420 "\x99\x0c\x62\xe4\x8b\x80\x18\xb2\xc3\xe4\xa0\xfa\x31\x34\xcb\x67"
13421 "\xfa\x83\xe1\x58\xc9\x94\xd9\x61\xc4\xcb\x21\x09\x5c\x1b\xf9",
13422 "\xe1\xa5\x66\x8a\x4d\x5b\x66\xa5\xf6\x8c\xc5\x42\x4e\xd5\x98\x2d"
13423 "\x12\x97\x6a\x08\xc4\x42\x6d\x0c\xe8\xa8\x24\x07\xc4\xf4\x82\x07",
13424 "\x51\x54\xad\x0d\x2c\xb2\x6e\x01\x27\x4f\xc5\x11\x48\x49\x1f\x1b",
13425 "\x9a\xe8\x31\xe7\x43\x97\x8d\x3a\x23\x52\x7c\x71\x28\x14\x9e\x3a",
13426 0, 32 },
13427 { GCRY_MAC_POLY1305_AES, "?", "????????????????????????????????",
13428 "\x9d\xeb\xb0\xcd\x24\x90\xd3\x9b\x47\x78\x37\x0a\x81\xf2\x83\x2a",
13429 "\x61\xee\x09\x21\x8d\x29\xb0\xaa\xed\x7e\x15\x4a\x2c\x55\x09\xcc",
13430 0, 32 },
13431 { GCRY_MAC_GOST28147_IMIT,
13432 "\xb5\xa1\xf0\xe3\xce\x2f\x02\x1d\x67\x61\x94\x34\x5c\x41\xe3\x6e",
13433 "\x9d\x05\xb7\x9e\x90\xca\xd0\x0a\x2c\xda\xd2\x2e\xf4\xe8\x6f\x5c"
13434 "\xf5\xdc\x37\x68\x19\x85\xb3\xbf\xaa\x18\xc1\xc3\x05\x0a\x91\xa2",
13435 "\xf8\x1f\x08\xa3",
13436 NULL,
13437 16, 32 },
13438 { 0 },
13439 };
13440 int i;
13441
13442 if (verbose)
13443 fprintf (stderr, "Starting MAC checks.\n");
13444
13445 for (i = 0; algos[i].algo; i++)
13446 {
13447 size_t klen, dlen;
13448
13449 if (gcry_mac_test_algo (algos[i].algo))
13450 {
13451 show_mac_not_available (algos[i].algo);
13452 continue;
13453 }
13454 if (gcry_mac_test_algo (algos[i].algo) && in_fips_mode)
13455 {
13456 if (verbose)
13457 fprintf (stderr, " algorithm %d not available in fips mode\n",
13458 algos[i].algo);
13459 continue;
13460 }
13461 if (verbose)
13462 fprintf (stderr,
13463 " checking %s [%i] for %d byte key and %d byte data\n",
13464 gcry_mac_algo_name (algos[i].algo),
13465 algos[i].algo, (int)strlen(algos[i].key),
13466 (!strcmp(algos[i].data, "!") || !strcmp(algos[i].data, "?"))
13467 ? 1000000 : (int)strlen(algos[i].data));
13468
13469 klen = algos[i].klen ? algos[i].klen : strlen(algos[i].key);
13470 dlen = algos[i].dlen ? algos[i].dlen : strlen (algos[i].data);
13471
13472 check_one_mac (algos[i].algo, algos[i].data, dlen, algos[i].key, klen,
13473 algos[i].iv, algos[i].iv ? strlen(algos[i].iv) : 0,
13474 algos[i].expect, 0);
13475 check_one_mac (algos[i].algo, algos[i].data, dlen, algos[i].key, klen,
13476 algos[i].iv, algos[i].iv ? strlen(algos[i].iv) : 0,
13477 algos[i].expect, 1);
13478 }
13479
13480 if (verbose)
13481 fprintf (stderr, "Completed MAC checks.\n");
13482 }
13483
13484 /* Check that the signature SIG matches the hash HASH. PKEY is the
13485 public key used for the verification. BADHASH is a hash value which
13486 should result in a bad signature status. */
13487 static void
verify_one_signature(gcry_sexp_t pkey,gcry_sexp_t hash,gcry_sexp_t badhash,gcry_sexp_t sig)13488 verify_one_signature (gcry_sexp_t pkey, gcry_sexp_t hash,
13489 gcry_sexp_t badhash, gcry_sexp_t sig)
13490 {
13491 gcry_error_t rc;
13492
13493 rc = gcry_pk_verify (sig, hash, pkey);
13494 if (rc)
13495 fail ("gcry_pk_verify failed: %s\n", gpg_strerror (rc));
13496 rc = gcry_pk_verify (sig, badhash, pkey);
13497 if (gcry_err_code (rc) != GPG_ERR_BAD_SIGNATURE)
13498 fail ("gcry_pk_verify failed to detect a bad signature: %s\n",
13499 gpg_strerror (rc));
13500 }
13501
13502
13503 /* Test the public key sign function using the private key SKEY. PKEY
13504 is used for verification. */
13505 static void
check_pubkey_sign(int n,gcry_sexp_t skey,gcry_sexp_t pkey,int algo)13506 check_pubkey_sign (int n, gcry_sexp_t skey, gcry_sexp_t pkey, int algo)
13507 {
13508 gcry_error_t rc;
13509 gcry_sexp_t sig, badhash, hash;
13510 int dataidx;
13511 static const char baddata[] =
13512 "(data\n (flags pkcs1)\n"
13513 " (hash sha1 #11223344556677889900AABBCCDDEEFF10203041#))\n";
13514 static const struct
13515 {
13516 const char *data;
13517 int algo;
13518 int expected_rc;
13519 } datas[] =
13520 {
13521 { "(data\n (flags pkcs1)\n"
13522 " (hash sha1 #11223344556677889900AABBCCDDEEFF10203040#))\n",
13523 GCRY_PK_RSA,
13524 0 },
13525 { "(data\n (flags pkcs1-raw)\n"
13526 " (hash sha1 #11223344556677889900AABBCCDDEEFF10203040#))\n",
13527 GCRY_PK_RSA,
13528 GPG_ERR_CONFLICT },
13529 { "(data\n (flags oaep)\n"
13530 " (hash sha1 #11223344556677889900AABBCCDDEEFF10203040#))\n",
13531 0,
13532 GPG_ERR_CONFLICT },
13533 /* This test is to see whether hash algorithms not hard wired in
13534 pubkey.c are detected: */
13535 { "(data\n (flags pkcs1)\n"
13536 " (hash oid.1.3.14.3.2.29 "
13537 " #11223344556677889900AABBCCDDEEFF10203040#))\n",
13538 GCRY_PK_RSA,
13539 0 },
13540 { "(data\n (flags )\n"
13541 " (hash sha1 #11223344556677889900AABBCCDDEEFF10203040#))\n",
13542 0,
13543 GPG_ERR_CONFLICT },
13544 { "(data\n (flags pkcs1)\n"
13545 " (hash foo #11223344556677889900AABBCCDDEEFF10203040#))\n",
13546 GCRY_PK_RSA,
13547 GPG_ERR_DIGEST_ALGO },
13548 { "(data\n (flags )\n" " (value #11223344556677889900AA#))\n",
13549 0,
13550 0 },
13551 { "(data\n (flags )\n" " (value #0090223344556677889900AA#))\n",
13552 0,
13553 0 },
13554 { "(data\n (flags raw)\n" " (value #11223344556677889900AA#))\n",
13555 0,
13556 0 },
13557 { "(data\n (flags pkcs1)\n"
13558 " (value #11223344556677889900AA#))\n",
13559 GCRY_PK_RSA,
13560 GPG_ERR_CONFLICT },
13561 { "(data\n (flags pkcs1-raw)\n"
13562 " (value #11223344556677889900AA#))\n",
13563 GCRY_PK_RSA,
13564 0 },
13565 { "(data\n (flags raw foo)\n"
13566 " (value #11223344556677889900AA#))\n",
13567 0,
13568 GPG_ERR_INV_FLAG },
13569 { "(data\n (flags pss)\n"
13570 " (hash sha1 #11223344556677889900AABBCCDDEEFF10203040#))\n",
13571 GCRY_PK_RSA,
13572 0 },
13573 { "(data\n (flags pss)\n"
13574 " (hash sha1 #11223344556677889900AABBCCDDEEFF10203040#)\n"
13575 " (random-override #4253647587980912233445566778899019283747#))\n",
13576 GCRY_PK_RSA,
13577 0 },
13578 { NULL }
13579 };
13580
13581 rc = gcry_sexp_sscan (&badhash, NULL, baddata, strlen (baddata));
13582 if (rc)
13583 die ("converting data failed: %s\n", gpg_strerror (rc));
13584
13585 for (dataidx = 0; datas[dataidx].data; dataidx++)
13586 {
13587 if (datas[dataidx].algo && datas[dataidx].algo != algo)
13588 continue;
13589
13590 if (verbose)
13591 fprintf (stderr, " test %d, signature test %d (%s)\n",
13592 n, dataidx, gcry_pk_algo_name (algo));
13593
13594 rc = gcry_sexp_sscan (&hash, NULL, datas[dataidx].data,
13595 strlen (datas[dataidx].data));
13596 if (rc)
13597 die ("converting data failed: %s\n", gpg_strerror (rc));
13598
13599 rc = gcry_pk_sign (&sig, hash, skey);
13600 if (gcry_err_code (rc) != datas[dataidx].expected_rc)
13601 fail ("gcry_pk_sign failed: %s\n", gpg_strerror (rc));
13602
13603 if (!rc)
13604 verify_one_signature (pkey, hash, badhash, sig);
13605
13606 gcry_sexp_release (sig);
13607 sig = NULL;
13608 gcry_sexp_release (hash);
13609 hash = NULL;
13610 }
13611
13612 gcry_sexp_release (badhash);
13613 }
13614
13615
13616 /* Test the public key sign function using the private key SKEY. PKEY
13617 is used for verification. This variant is only used for ECDSA. */
13618 static void
check_pubkey_sign_ecdsa(int n,gcry_sexp_t skey,gcry_sexp_t pkey)13619 check_pubkey_sign_ecdsa (int n, gcry_sexp_t skey, gcry_sexp_t pkey)
13620 {
13621 gcry_error_t rc;
13622 gcry_sexp_t sig, badhash, hash;
13623 unsigned int nbits;
13624 int dataidx;
13625 static const struct
13626 {
13627 unsigned int nbits;
13628 const char *data;
13629 int expected_rc;
13630 const char *baddata;
13631 int dummy;
13632 } datas[] =
13633 {
13634 { 192,
13635 "(data (flags raw)\n"
13636 " (value #00112233445566778899AABBCCDDEEFF0001020304050607#))",
13637 0,
13638 "(data (flags raw)\n"
13639 " (value #80112233445566778899AABBCCDDEEFF0001020304050607#))",
13640 0
13641 },
13642 { 256,
13643 "(data (flags raw)\n"
13644 " (value #00112233445566778899AABBCCDDEEFF"
13645 /* */ "000102030405060708090A0B0C0D0E0F#))",
13646 0,
13647 "(data (flags raw)\n"
13648 " (value #80112233445566778899AABBCCDDEEFF"
13649 /* */ "000102030405060708090A0B0C0D0E0F#))",
13650 0
13651 },
13652 { 256,
13653 "(data (flags raw)\n"
13654 " (hash sha256 #00112233445566778899AABBCCDDEEFF"
13655 /* */ "000102030405060708090A0B0C0D0E0F#))",
13656 0,
13657 "(data (flags raw)\n"
13658 " (hash sha256 #80112233445566778899AABBCCDDEEFF"
13659 /* */ "000102030405060708090A0B0C0D0E0F#))",
13660 0
13661 },
13662 { 256,
13663 "(data (flags gost)\n"
13664 " (value #00112233445566778899AABBCCDDEEFF"
13665 /* */ "000102030405060708090A0B0C0D0E0F#))",
13666 0,
13667 "(data (flags gost)\n"
13668 " (value #80112233445566778899AABBCCDDEEFF"
13669 /* */ "000102030405060708090A0B0C0D0E0F#))",
13670 0
13671 },
13672 { 512,
13673 "(data (flags gost)\n"
13674 " (value #00112233445566778899AABBCCDDEEFF"
13675 /* */ "000102030405060708090A0B0C0D0E0F"
13676 /* */ "000102030405060708090A0B0C0D0E0F"
13677 /* */ "000102030405060708090A0B0C0D0E0F#))",
13678 0,
13679 "(data (flags gost)\n"
13680 " (value #80112233445566778899AABBCCDDEEFF"
13681 /* */ "000102030405060708090A0B0C0D0E0F"
13682 /* */ "000102030405060708090A0B0C0D0E0F"
13683 /* */ "000102030405060708090A0B0C0D0E0F#))",
13684 0
13685 },
13686 { 256,
13687 "(data (flags sm2)\n"
13688 " (hash sm3 #112233445566778899AABBCCDDEEFF00"
13689 /* */ "123456789ABCDEF0123456789ABCDEF0#))",
13690 0,
13691 "(data (flags sm2)\n"
13692 " (hash sm3 #B524F552CD82B8B028476E005C377FB1"
13693 /* */ "9A87E6FC682D48BB5D42E3D9B9EFFE76#))",
13694 0
13695 },
13696 { 0, NULL }
13697 };
13698
13699 nbits = gcry_pk_get_nbits (skey);
13700
13701 for (dataidx = 0; datas[dataidx].data; dataidx++)
13702 {
13703 if (datas[dataidx].nbits != nbits)
13704 continue;
13705
13706 if (verbose)
13707 fprintf (stderr, " test %d, signature test %d (%u bit ecdsa)\n",
13708 n, dataidx, nbits);
13709
13710 rc = gcry_sexp_sscan (&hash, NULL, datas[dataidx].data,
13711 strlen (datas[dataidx].data));
13712 if (rc)
13713 die ("converting data failed: %s\n", gpg_strerror (rc));
13714 rc = gcry_sexp_sscan (&badhash, NULL, datas[dataidx].baddata,
13715 strlen (datas[dataidx].baddata));
13716 if (rc)
13717 die ("converting data failed: %s\n", gpg_strerror (rc));
13718
13719 rc = gcry_pk_sign (&sig, hash, skey);
13720 if (gcry_err_code (rc) != datas[dataidx].expected_rc)
13721 fail ("gcry_pk_sign failed: %s\n", gpg_strerror (rc));
13722
13723 if (!rc && verbose > 1)
13724 show_sexp ("ECDSA signature:\n", sig);
13725
13726 if (!rc)
13727 verify_one_signature (pkey, hash, badhash, sig);
13728
13729 gcry_sexp_release (sig);
13730 sig = NULL;
13731 gcry_sexp_release (badhash);
13732 badhash = NULL;
13733 gcry_sexp_release (hash);
13734 hash = NULL;
13735 }
13736 }
13737
13738
13739 static void
check_pubkey_crypt(int n,gcry_sexp_t skey,gcry_sexp_t pkey,int algo)13740 check_pubkey_crypt (int n, gcry_sexp_t skey, gcry_sexp_t pkey, int algo)
13741 {
13742 gcry_error_t rc;
13743 gcry_sexp_t plain = NULL;
13744 gcry_sexp_t ciph = NULL;
13745 gcry_sexp_t data = NULL;
13746 int dataidx;
13747 static const struct
13748 {
13749 int algo; /* If not 0 run test only if ALGO matches. */
13750 const char *data;
13751 const char *hint;
13752 int unpadded;
13753 int encrypt_expected_rc;
13754 int decrypt_expected_rc;
13755 int special;
13756 } datas[] =
13757 {
13758 { GCRY_PK_RSA,
13759 "(data\n (flags pkcs1)\n"
13760 " (value #11223344556677889900AA#))\n",
13761 NULL,
13762 0,
13763 0,
13764 0 },
13765 { GCRY_PK_RSA,
13766 "(data\n (flags pkcs1)\n"
13767 " (value #11223344556677889900AA#))\n",
13768 "(flags pkcs1)",
13769 1,
13770 0,
13771 0 },
13772 { GCRY_PK_RSA,
13773 "(data\n (flags oaep)\n"
13774 " (value #11223344556677889900AA#))\n",
13775 "(flags oaep)",
13776 1,
13777 0,
13778 0 },
13779 { GCRY_PK_RSA,
13780 "(data\n (flags oaep)\n (hash-algo sha1)\n"
13781 " (value #11223344556677889900AA#))\n",
13782 "(flags oaep)(hash-algo sha1)",
13783 1,
13784 0,
13785 0 },
13786 { GCRY_PK_RSA,
13787 "(data\n (flags oaep)\n (hash-algo sha1)\n (label \"test\")\n"
13788 " (value #11223344556677889900AA#))\n",
13789 "(flags oaep)(hash-algo sha1)(label \"test\")",
13790 1,
13791 0,
13792 0 },
13793 { GCRY_PK_RSA,
13794 "(data\n (flags oaep)\n (hash-algo sha1)\n (label \"test\")\n"
13795 " (value #11223344556677889900AA#)\n"
13796 " (random-override #4253647587980912233445566778899019283747#))\n",
13797 "(flags oaep)(hash-algo sha1)(label \"test\")",
13798 1,
13799 0,
13800 0 },
13801 { 0,
13802 "(data\n (flags )\n" " (value #11223344556677889900AA#))\n",
13803 NULL,
13804 1,
13805 0,
13806 0 },
13807 { 0,
13808 "(data\n (flags )\n" " (value #0090223344556677889900AA#))\n",
13809 NULL,
13810 1,
13811 0,
13812 0 },
13813 { 0,
13814 "(data\n (flags raw)\n" " (value #11223344556677889900AA#))\n",
13815 NULL,
13816 1,
13817 0,
13818 0 },
13819 { GCRY_PK_RSA,
13820 "(data\n (flags pkcs1)\n"
13821 " (hash sha1 #11223344556677889900AABBCCDDEEFF10203040#))\n",
13822 NULL,
13823 0,
13824 GPG_ERR_CONFLICT,
13825 0},
13826 { 0,
13827 "(data\n (flags raw foo)\n"
13828 " (hash sha1 #11223344556677889900AABBCCDDEEFF10203040#))\n",
13829 NULL,
13830 0,
13831 GPG_ERR_INV_FLAG,
13832 0},
13833 { 0,
13834 "(data\n (flags raw)\n"
13835 " (value #11223344556677889900AA#))\n",
13836 "(flags oaep)",
13837 1,
13838 0,
13839 GPG_ERR_ENCODING_PROBLEM, 1 },
13840 { GCRY_PK_RSA,
13841 "(data\n (flags oaep)\n"
13842 " (value #11223344556677889900AA#))\n",
13843 "(flags pkcs1)",
13844 1,
13845 0,
13846 GPG_ERR_ENCODING_PROBLEM, 1 },
13847 { 0,
13848 "(data\n (flags pss)\n"
13849 " (value #11223344556677889900AA#))\n",
13850 NULL,
13851 0,
13852 GPG_ERR_CONFLICT },
13853 { 0, NULL }
13854 };
13855
13856 (void)n;
13857
13858 for (dataidx = 0; datas[dataidx].data; dataidx++)
13859 {
13860 if (datas[dataidx].algo && datas[dataidx].algo != algo)
13861 continue;
13862
13863 if (verbose)
13864 fprintf (stderr, " encryption/decryption test %d (algo %d)\n",
13865 dataidx, algo);
13866
13867 rc = gcry_sexp_sscan (&data, NULL, datas[dataidx].data,
13868 strlen (datas[dataidx].data));
13869 if (rc)
13870 die ("converting data failed: %s\n", gpg_strerror (rc));
13871
13872 rc = gcry_pk_encrypt (&ciph, data, pkey);
13873 if (gcry_err_code (rc) != datas[dataidx].encrypt_expected_rc)
13874 fail ("gcry_pk_encrypt failed: %s\n", gpg_strerror (rc));
13875
13876 if (!rc)
13877 {
13878 int expect_mismatch = 0;
13879
13880 /* Insert decoding hint to CIPH. */
13881 if (datas[dataidx].hint)
13882 {
13883 size_t hint_len, len;
13884 char *hint, *buf;
13885 gcry_sexp_t list;
13886
13887 /* Convert decoding hint into canonical sexp. */
13888 gcry_sexp_new (&list, datas[dataidx].hint,
13889 strlen (datas[dataidx].hint), 1);
13890 hint_len = gcry_sexp_sprint (list, GCRYSEXP_FMT_CANON, NULL, 0);
13891 hint = gcry_malloc (hint_len);
13892 if (!hint)
13893 die ("can't allocate memory\n");
13894 hint_len = gcry_sexp_sprint (list, GCRYSEXP_FMT_CANON, hint,
13895 hint_len);
13896 gcry_sexp_release (list);
13897
13898 /* Convert CIPH into canonical sexp. */
13899 len = gcry_sexp_sprint (ciph, GCRYSEXP_FMT_CANON, NULL, 0);
13900 buf = gcry_malloc (len + hint_len);
13901 if (!buf)
13902 die ("can't allocate memory\n");
13903 len = gcry_sexp_sprint (ciph, GCRYSEXP_FMT_CANON, buf, len);
13904 /* assert (!strcmp (buf, "(7:enc-val", 10)); */
13905
13906 /* Copy decoding hint into CIPH. */
13907 memmove (buf + 10 + hint_len, buf + 10, len - 10);
13908 memcpy (buf + 10, hint, hint_len);
13909 gcry_free (hint);
13910 gcry_sexp_new (&list, buf, len + hint_len, 1);
13911 gcry_free (buf);
13912 gcry_sexp_release (ciph);
13913 ciph = list;
13914 }
13915 rc = gcry_pk_decrypt (&plain, ciph, skey);
13916 if (!rc && datas[dataidx].special == 1)
13917 {
13918 /* It may happen that OAEP formatted data which is
13919 decrypted as pkcs#1 data returns a valid pkcs#1
13920 frame. However, the returned value will not be
13921 identical - thus we expect a mismatch and test further on
13922 whether this mismatch actually happened. */
13923 expect_mismatch = 1;
13924 }
13925 else if (gcry_err_code (rc) != datas[dataidx].decrypt_expected_rc)
13926 {
13927 if (verbose)
13928 {
13929 show_sexp (" data:\n", data);
13930 show_sexp (" ciph:\n", ciph);
13931 show_sexp (" key:\n", skey);
13932 }
13933 fail ("gcry_pk_decrypt failed: expected %d (%s), got %d (%s)\n",
13934 datas[dataidx].decrypt_expected_rc,
13935 gpg_strerror (datas[dataidx].decrypt_expected_rc),
13936 rc, gpg_strerror (rc));
13937 }
13938
13939 if (!rc && datas[dataidx].unpadded)
13940 {
13941 gcry_sexp_t p1, p2;
13942
13943 p1 = gcry_sexp_find_token (data, "value", 0);
13944 p2 = gcry_sexp_find_token (plain, "value", 0);
13945 if (p1 && p2)
13946 {
13947 const char *s1, *s2;
13948 size_t n1, n2;
13949
13950 s1 = gcry_sexp_nth_data (p1, 1, &n1);
13951 s2 = gcry_sexp_nth_data (p2, 1, &n2);
13952 if (n1 != n2 || memcmp (s1, s2, n1))
13953 {
13954 if (expect_mismatch)
13955 expect_mismatch = 0;
13956 else
13957 fail ("gcry_pk_encrypt/gcry_pk_decrypt "
13958 "do not roundtrip\n");
13959 }
13960 }
13961
13962 if (expect_mismatch)
13963 fail ("gcry_pk_encrypt/gcry_pk_decrypt "
13964 "expected mismatch did not happen\n");
13965
13966 gcry_sexp_release (p1);
13967 gcry_sexp_release (p2);
13968 }
13969 }
13970
13971 gcry_sexp_release (plain);
13972 plain = NULL;
13973 gcry_sexp_release (ciph);
13974 ciph = NULL;
13975 gcry_sexp_release (data);
13976 data = NULL;
13977 }
13978 }
13979
13980 static void
check_pubkey_grip(int n,const unsigned char * grip,gcry_sexp_t skey,gcry_sexp_t pkey,int algo)13981 check_pubkey_grip (int n, const unsigned char *grip,
13982 gcry_sexp_t skey, gcry_sexp_t pkey, int algo)
13983 {
13984 unsigned char sgrip[20], pgrip[20];
13985
13986 (void)algo;
13987
13988 if (!gcry_pk_get_keygrip (skey, sgrip))
13989 die ("get keygrip for private RSA key failed\n");
13990 if (!gcry_pk_get_keygrip (pkey, pgrip))
13991 die ("[%i] get keygrip for public RSA key failed\n", n);
13992 if (memcmp (sgrip, pgrip, 20))
13993 fail ("[%i] keygrips don't match\n", n);
13994 if (memcmp (sgrip, grip, 20))
13995 fail ("wrong keygrip for RSA key\n");
13996 }
13997
13998 static void
do_check_one_pubkey(int n,gcry_sexp_t skey,gcry_sexp_t pkey,const unsigned char * grip,int algo,int flags)13999 do_check_one_pubkey (int n, gcry_sexp_t skey, gcry_sexp_t pkey,
14000 const unsigned char *grip, int algo, int flags)
14001 {
14002 if (flags & FLAG_SIGN)
14003 {
14004 if (algo == GCRY_PK_ECDSA)
14005 check_pubkey_sign_ecdsa (n, skey, pkey);
14006 else
14007 check_pubkey_sign (n, skey, pkey, algo);
14008 }
14009 if (flags & FLAG_CRYPT)
14010 check_pubkey_crypt (n, skey, pkey, algo);
14011 if (grip && (flags & FLAG_GRIP))
14012 check_pubkey_grip (n, grip, skey, pkey, algo);
14013 }
14014
14015 static void
check_one_pubkey(int n,test_spec_pubkey_t spec)14016 check_one_pubkey (int n, test_spec_pubkey_t spec)
14017 {
14018 gcry_error_t err = GPG_ERR_NO_ERROR;
14019 gcry_sexp_t skey, pkey;
14020
14021 err = gcry_sexp_sscan (&skey, NULL, spec.key.secret,
14022 strlen (spec.key.secret));
14023 if (!err)
14024 err = gcry_sexp_sscan (&pkey, NULL, spec.key.public,
14025 strlen (spec.key.public));
14026 if (err)
14027 die ("converting sample key failed: %s\n", gpg_strerror (err));
14028
14029 do_check_one_pubkey (n, skey, pkey,
14030 (const unsigned char*)spec.key.grip,
14031 spec.id, spec.flags);
14032
14033 gcry_sexp_release (skey);
14034 gcry_sexp_release (pkey);
14035 }
14036
14037 static void
get_keys_new(gcry_sexp_t * pkey,gcry_sexp_t * skey)14038 get_keys_new (gcry_sexp_t *pkey, gcry_sexp_t *skey)
14039 {
14040 gcry_sexp_t key_spec, key, pub_key, sec_key;
14041 int rc;
14042 if (verbose)
14043 fprintf (stderr, " generating RSA key:");
14044 rc = gcry_sexp_new (&key_spec,
14045 in_fips_mode ? "(genkey (rsa (nbits 4:2048)))"
14046 : "(genkey (rsa (nbits 4:1024)(transient-key)))",
14047 0, 1);
14048 if (rc)
14049 die ("error creating S-expression: %s\n", gpg_strerror (rc));
14050 rc = gcry_pk_genkey (&key, key_spec);
14051 gcry_sexp_release (key_spec);
14052 if (rc)
14053 die ("error generating RSA key: %s\n", gpg_strerror (rc));
14054
14055 pub_key = gcry_sexp_find_token (key, "public-key", 0);
14056 if (! pub_key)
14057 die ("public part missing in key\n");
14058
14059 sec_key = gcry_sexp_find_token (key, "private-key", 0);
14060 if (! sec_key)
14061 die ("private part missing in key\n");
14062
14063 gcry_sexp_release (key);
14064 *pkey = pub_key;
14065 *skey = sec_key;
14066 }
14067
14068 static void
check_one_pubkey_new(int n)14069 check_one_pubkey_new (int n)
14070 {
14071 gcry_sexp_t skey, pkey;
14072
14073 get_keys_new (&pkey, &skey);
14074 do_check_one_pubkey (n, skey, pkey, NULL,
14075 GCRY_PK_RSA, FLAG_SIGN | FLAG_CRYPT);
14076 gcry_sexp_release (pkey);
14077 gcry_sexp_release (skey);
14078 }
14079
14080 /* Run all tests for the public key functions. */
14081 static void
check_pubkey(void)14082 check_pubkey (void)
14083 {
14084 static const test_spec_pubkey_t pubkeys[] = {
14085 {
14086 GCRY_PK_RSA, FLAG_CRYPT | FLAG_SIGN | FLAG_GRIP,
14087 {
14088 "(private-key\n"
14089 " (rsa\n"
14090 " (n #00e0ce96f90b6c9e02f3922beada93fe50a875eac6bcc18bb9a9cf2e84965caa"
14091 " 2d1ff95a7f542465c6c0c19d276e4526ce048868a7a914fd343cc3a87dd74291"
14092 " ffc565506d5bbb25cbac6a0e2dd1f8bcaab0d4a29c2f37c950f363484bf269f7"
14093 " 891440464baf79827e03a36e70b814938eebdc63e964247be75dc58b014b7ea2"
14094 " 51#)\n"
14095 " (e #010001#)\n"
14096 " (d #046129F2489D71579BE0A75FE029BD6CDB574EBF57EA8A5B0FDA942CAB943B11"
14097 " 7D7BB95E5D28875E0F9FC5FCC06A72F6D502464DABDED78EF6B716177B83D5BD"
14098 " C543DC5D3FED932E59F5897E92E6F58A0F33424106A3B6FA2CBF877510E4AC21"
14099 " C3EE47851E97D12996222AC3566D4CCB0B83D164074ABF7DE655FC2446DA1781"
14100 " #)\n"
14101 " (p #00e861b700e17e8afe6837e7512e35b6ca11d0ae47d8b85161c67baf64377213"
14102 " fe52d772f2035b3ca830af41d8a4120e1c1c70d12cc22f00d28d31dd48a8d424"
14103 " f1#)\n"
14104 " (q #00f7a7ca5367c661f8e62df34f0d05c10c88e5492348dd7bddc942c9a8f369f9"
14105 " 35a07785d2db805215ed786e4285df1658eed3ce84f469b81b50d358407b4ad3"
14106 " 61#)\n"
14107 " (u #304559a9ead56d2309d203811a641bb1a09626bc8eb36fffa23c968ec5bd891e"
14108 " ebbafc73ae666e01ba7c8990bae06cc2bbe10b75e69fcacb353a6473079d8e9b"
14109 " #)))\n",
14110
14111 "(public-key\n"
14112 " (rsa\n"
14113 " (n #00e0ce96f90b6c9e02f3922beada93fe50a875eac6bcc18bb9a9cf2e84965caa"
14114 " 2d1ff95a7f542465c6c0c19d276e4526ce048868a7a914fd343cc3a87dd74291"
14115 " ffc565506d5bbb25cbac6a0e2dd1f8bcaab0d4a29c2f37c950f363484bf269f7"
14116 " 891440464baf79827e03a36e70b814938eebdc63e964247be75dc58b014b7ea2"
14117 " 51#)\n"
14118 " (e #010001#)))\n",
14119
14120 "\x32\x10\x0c\x27\x17\x3e\xf6\xe9\xc4\xe9"
14121 "\xa2\x5d\x3d\x69\xf8\x6d\x37\xa4\xf9\x39"}
14122 },
14123 {
14124 GCRY_PK_DSA, FLAG_SIGN | FLAG_GRIP,
14125 {
14126 "(private-key\n"
14127 " (DSA\n"
14128 " (p #00AD7C0025BA1A15F775F3F2D673718391D00456978D347B33D7B49E7F32EDAB"
14129 " 96273899DD8B2BB46CD6ECA263FAF04A28903503D59062A8865D2AE8ADFB5191"
14130 " CF36FFB562D0E2F5809801A1F675DAE59698A9E01EFE8D7DCFCA084F4C6F5A44"
14131 " 44D499A06FFAEA5E8EF5E01F2FD20A7B7EF3F6968AFBA1FB8D91F1559D52D877"
14132 " 7B#)\n"
14133 " (q #00EB7B5751D25EBBB7BD59D920315FD840E19AEBF9#)\n"
14134 " (g #1574363387FDFD1DDF38F4FBE135BB20C7EE4772FB94C337AF86EA8E49666503"
14135 " AE04B6BE81A2F8DD095311E0217ACA698A11E6C5D33CCDAE71498ED35D13991E"
14136 " B02F09AB40BD8F4C5ED8C75DA779D0AE104BC34C960B002377068AB4B5A1F984"
14137 " 3FBA91F537F1B7CAC4D8DD6D89B0D863AF7025D549F9C765D2FC07EE208F8D15"
14138 " #)\n"
14139 " (y #64B11EF8871BE4AB572AA810D5D3CA11A6CDBC637A8014602C72960DB135BF46"
14140 " A1816A724C34F87330FC9E187C5D66897A04535CC2AC9164A7150ABFA8179827"
14141 " 6E45831AB811EEE848EBB24D9F5F2883B6E5DDC4C659DEF944DCFD80BF4D0A20"
14142 " 42CAA7DC289F0C5A9D155F02D3D551DB741A81695B74D4C8F477F9C7838EB0FB"
14143 " #)\n"
14144 " (x #11D54E4ADBD3034160F2CED4B7CD292A4EBF3EC0#)))\n",
14145
14146 "(public-key\n"
14147 " (DSA\n"
14148 " (p #00AD7C0025BA1A15F775F3F2D673718391D00456978D347B33D7B49E7F32EDAB"
14149 " 96273899DD8B2BB46CD6ECA263FAF04A28903503D59062A8865D2AE8ADFB5191"
14150 " CF36FFB562D0E2F5809801A1F675DAE59698A9E01EFE8D7DCFCA084F4C6F5A44"
14151 " 44D499A06FFAEA5E8EF5E01F2FD20A7B7EF3F6968AFBA1FB8D91F1559D52D877"
14152 " 7B#)\n"
14153 " (q #00EB7B5751D25EBBB7BD59D920315FD840E19AEBF9#)\n"
14154 " (g #1574363387FDFD1DDF38F4FBE135BB20C7EE4772FB94C337AF86EA8E49666503"
14155 " AE04B6BE81A2F8DD095311E0217ACA698A11E6C5D33CCDAE71498ED35D13991E"
14156 " B02F09AB40BD8F4C5ED8C75DA779D0AE104BC34C960B002377068AB4B5A1F984"
14157 " 3FBA91F537F1B7CAC4D8DD6D89B0D863AF7025D549F9C765D2FC07EE208F8D15"
14158 " #)\n"
14159 " (y #64B11EF8871BE4AB572AA810D5D3CA11A6CDBC637A8014602C72960DB135BF46"
14160 " A1816A724C34F87330FC9E187C5D66897A04535CC2AC9164A7150ABFA8179827"
14161 " 6E45831AB811EEE848EBB24D9F5F2883B6E5DDC4C659DEF944DCFD80BF4D0A20"
14162 " 42CAA7DC289F0C5A9D155F02D3D551DB741A81695B74D4C8F477F9C7838EB0FB"
14163 " #)))\n",
14164
14165 "\xc6\x39\x83\x1a\x43\xe5\x05\x5d\xc6\xd8"
14166 "\x4a\xa6\xf9\xeb\x23\xbf\xa9\x12\x2d\x5b" }
14167 },
14168 {
14169 GCRY_PK_ELG, FLAG_SIGN | FLAG_CRYPT | FLAG_GRIP,
14170 {
14171 "(private-key\n"
14172 " (ELG\n"
14173 " (p #00B93B93386375F06C2D38560F3B9C6D6D7B7506B20C1773F73F8DE56E6CD65D"
14174 " F48DFAAA1E93F57A2789B168362A0F787320499F0B2461D3A4268757A7B27517"
14175 " B7D203654A0CD484DEC6AF60C85FEB84AAC382EAF2047061FE5DAB81A20A0797"
14176 " 6E87359889BAE3B3600ED718BE61D4FC993CC8098A703DD0DC942E965E8F18D2"
14177 " A7#)\n"
14178 " (g #05#)\n"
14179 " (y #72DAB3E83C9F7DD9A931FDECDC6522C0D36A6F0A0FEC955C5AC3C09175BBFF2B"
14180 " E588DB593DC2E420201BEB3AC17536918417C497AC0F8657855380C1FCF11C5B"
14181 " D20DB4BEE9BDF916648DE6D6E419FA446C513AAB81C30CB7B34D6007637BE675"
14182 " 56CE6473E9F9EE9B9FADD275D001563336F2186F424DEC6199A0F758F6A00FF4"
14183 " #)\n"
14184 " (x #03C28900087B38DABF4A0AB98ACEA39BB674D6557096C01D72E31C16BDD32214"
14185 " #)))\n",
14186
14187 "(public-key\n"
14188 " (ELG\n"
14189 " (p #00B93B93386375F06C2D38560F3B9C6D6D7B7506B20C1773F73F8DE56E6CD65D"
14190 " F48DFAAA1E93F57A2789B168362A0F787320499F0B2461D3A4268757A7B27517"
14191 " B7D203654A0CD484DEC6AF60C85FEB84AAC382EAF2047061FE5DAB81A20A0797"
14192 " 6E87359889BAE3B3600ED718BE61D4FC993CC8098A703DD0DC942E965E8F18D2"
14193 " A7#)\n"
14194 " (g #05#)\n"
14195 " (y #72DAB3E83C9F7DD9A931FDECDC6522C0D36A6F0A0FEC955C5AC3C09175BBFF2B"
14196 " E588DB593DC2E420201BEB3AC17536918417C497AC0F8657855380C1FCF11C5B"
14197 " D20DB4BEE9BDF916648DE6D6E419FA446C513AAB81C30CB7B34D6007637BE675"
14198 " 56CE6473E9F9EE9B9FADD275D001563336F2186F424DEC6199A0F758F6A00FF4"
14199 " #)))\n",
14200
14201 "\xa7\x99\x61\xeb\x88\x83\xd2\xf4\x05\xc8"
14202 "\x4f\xba\x06\xf8\x78\x09\xbc\x1e\x20\xe5" }
14203 },
14204 { /* ECDSA test. */
14205 GCRY_PK_ECDSA, FLAG_SIGN,
14206 {
14207 "(private-key\n"
14208 " (ecdsa\n"
14209 " (curve nistp192)\n"
14210 " (q #048532093BA023F4D55C0424FA3AF9367E05F309DC34CDC3FE"
14211 " C13CA9E617C6C8487BFF6A726E3C4F277913D97117939966#)\n"
14212 " (d #00D4EF27E32F8AD8E2A1C6DDEBB1D235A69E3CEF9BCE90273D#)))\n",
14213
14214 "(public-key\n"
14215 " (ecdsa\n"
14216 " (curve nistp192)\n"
14217 " (q #028532093BA023F4D55C0424FA3AF9367E05F309DC34CDC3FE#)))\n",
14218
14219 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
14220 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }
14221 },
14222 { /* ECDSA test with the public key algorithm given as "ecc". */
14223 GCRY_PK_ECDSA, FLAG_SIGN,
14224 {
14225 "(private-key\n"
14226 " (ecdsa\n"
14227 " (curve nistp192)\n"
14228 " (q #048532093BA023F4D55C0424FA3AF9367E05F309DC34CDC3FE"
14229 " C13CA9E617C6C8487BFF6A726E3C4F277913D97117939966#)\n"
14230 " (d #00D4EF27E32F8AD8E2A1C6DDEBB1D235A69E3CEF9BCE90273D#)))\n",
14231
14232 "(public-key\n"
14233 " (ecc\n"
14234 " (curve nistp192)\n"
14235 " (q #048532093BA023F4D55C0424FA3AF9367E05F309DC34CDC3FE"
14236 " C13CA9E617C6C8487BFF6A726E3C4F277913D97117939966#)))\n",
14237
14238 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
14239 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }
14240 },
14241 { /* ECDSA test with the private key algorithm given as "ecc". */
14242 GCRY_PK_ECDSA, FLAG_SIGN,
14243 {
14244 "(private-key\n"
14245 " (ecc\n"
14246 " (curve nistp192)\n"
14247 " (q #048532093BA023F4D55C0424FA3AF9367E05F309DC34CDC3FE"
14248 " C13CA9E617C6C8487BFF6A726E3C4F277913D97117939966#)\n"
14249 " (d #00D4EF27E32F8AD8E2A1C6DDEBB1D235A69E3CEF9BCE90273D#)))\n",
14250
14251 "(public-key\n"
14252 " (ecdsa\n"
14253 " (curve nistp192)\n"
14254 " (q #048532093BA023F4D55C0424FA3AF9367E05F309DC34CDC3FE"
14255 " C13CA9E617C6C8487BFF6A726E3C4F277913D97117939966#)))\n",
14256
14257 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
14258 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }
14259 },
14260 { /* ECDSA test with the key algorithms given as "ecc". */
14261 GCRY_PK_ECDSA, FLAG_SIGN,
14262 {
14263 "(private-key\n"
14264 " (ecc\n"
14265 " (curve nistp192)\n"
14266 " (q #048532093BA023F4D55C0424FA3AF9367E05F309DC34CDC3FE"
14267 " C13CA9E617C6C8487BFF6A726E3C4F277913D97117939966#)\n"
14268 " (d #00D4EF27E32F8AD8E2A1C6DDEBB1D235A69E3CEF9BCE90273D#)))\n",
14269
14270 "(public-key\n"
14271 " (ecc\n"
14272 " (curve nistp192)\n"
14273 " (q #048532093BA023F4D55C0424FA3AF9367E05F309DC34CDC3FE"
14274 " C13CA9E617C6C8487BFF6A726E3C4F277913D97117939966#)))\n",
14275
14276 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
14277 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }
14278 },
14279 { /* ECDSA test 256 bit. */
14280 GCRY_PK_ECDSA, FLAG_SIGN,
14281 {
14282 "(private-key\n"
14283 " (ecc\n"
14284 " (curve nistp256)\n"
14285 " (q #04D4F6A6738D9B8D3A7075C1E4EE95015FC0C9B7E4272D2B"
14286 " EB6644D3609FC781B71F9A8072F58CB66AE2F89BB1245187"
14287 " 3ABF7D91F9E1FBF96BF2F70E73AAC9A283#)\n"
14288 " (d #5A1EF0035118F19F3110FB81813D3547BCE1E5BCE77D1F74"
14289 " 4715E1D5BBE70378#)))\n",
14290
14291 "(public-key\n"
14292 " (ecc\n"
14293 " (curve nistp256)\n"
14294 " (q #03D4F6A6738D9B8D3A7075C1E4EE95015FC0C9B7E4272D2B"
14295 " EB6644D3609FC781B7#)))\n",
14296
14297 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
14298 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }
14299 },
14300 { /* GOST R 34.10-2001/2012 test 256 bit. */
14301 GCRY_PK_ECDSA, FLAG_SIGN,
14302 {
14303 "(private-key\n"
14304 " (ecc\n"
14305 " (curve GOST2001-test)\n"
14306 " (q #047F2B49E270DB6D90D8595BEC458B50C58585BA1D4E9B78"
14307 " 8F6689DBD8E56FD80B26F1B489D6701DD185C8413A977B3C"
14308 " BBAF64D1C593D26627DFFB101A87FF77DA#)\n"
14309 " (d #7A929ADE789BB9BE10ED359DD39A72C11B60961F49397EEE"
14310 " 1D19CE9891EC3B28#)))\n",
14311
14312 "(public-key\n"
14313 " (ecc\n"
14314 " (curve GOST2001-test)\n"
14315 " (q #047F2B49E270DB6D90D8595BEC458B50C58585BA1D4E9B78"
14316 " 8F6689DBD8E56FD80B26F1B489D6701DD185C8413A977B3C"
14317 " BBAF64D1C593D26627DFFB101A87FF77DA#)))\n",
14318
14319 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
14320 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }
14321 },
14322 { /* GOST R 34.10-2012 test 512 bit. */
14323 GCRY_PK_ECDSA, FLAG_SIGN,
14324 {
14325 "(private-key\n"
14326 " (ecc\n"
14327 " (curve GOST2012-512-test)\n"
14328 " (q #04115DC5BC96760C7B48598D8AB9E740D4C4A85A65BE33C1"
14329 " 815B5C320C854621DD5A515856D13314AF69BC5B924C8B"
14330 " 4DDFF75C45415C1D9DD9DD33612CD530EFE137C7C90CD4"
14331 " 0B0F5621DC3AC1B751CFA0E2634FA0503B3D52639F5D7F"
14332 " B72AFD61EA199441D943FFE7F0C70A2759A3CDB84C114E"
14333 " 1F9339FDF27F35ECA93677BEEC#)\n"
14334 " (d #0BA6048AADAE241BA40936D47756D7C93091A0E851466970"
14335 " 0EE7508E508B102072E8123B2200A0563322DAD2827E2714"
14336 " A2636B7BFD18AADFC62967821FA18DD4#)))\n",
14337
14338 "(public-key\n"
14339 " (ecc\n"
14340 " (curve GOST2012-512-test)\n"
14341 " (q #04115DC5BC96760C7B48598D8AB9E740D4C4A85A65BE33C1"
14342 " 815B5C320C854621DD5A515856D13314AF69BC5B924C8B"
14343 " 4DDFF75C45415C1D9DD9DD33612CD530EFE137C7C90CD4"
14344 " 0B0F5621DC3AC1B751CFA0E2634FA0503B3D52639F5D7F"
14345 " B72AFD61EA199441D943FFE7F0C70A2759A3CDB84C114E"
14346 " 1F9339FDF27F35ECA93677BEEC#)))\n",
14347
14348 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
14349 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }
14350 },
14351 { /* secp256k1 test 256 bit. */
14352 GCRY_PK_ECDSA, FLAG_SIGN,
14353 {
14354 "(private-key\n"
14355 " (ecc\n"
14356 " (curve secp256k1)\n"
14357 " (q #0439A36013301597DAEF41FBE593A02CC513D0B55527EC2D"
14358 " F1050E2E8FF49C85C23CBE7DED0E7CE6A594896B8F62888F"
14359 " DBC5C8821305E2EA42BF01E37300116281#)\n"
14360 " (d #E8F32E723DECF4051AEFAC8E2C93C9C5B214313817CDB01A"
14361 " 1494B917C8436B35#)))\n",
14362
14363 "(public-key\n"
14364 " (ecc\n"
14365 " (curve secp256k1)\n"
14366 " (q #0439A36013301597DAEF41FBE593A02CC513D0B55527EC2D"
14367 " F1050E2E8FF49C85C23CBE7DED0E7CE6A594896B8F62888F"
14368 " DBC5C8821305E2EA42BF01E37300116281#)))\n",
14369
14370 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
14371 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }
14372 },
14373 { /* sm2 test */
14374 GCRY_PK_ECDSA, FLAG_SIGN,
14375 {
14376 "(private-key\n"
14377 " (ecc\n"
14378 " (curve sm2p256v1)\n"
14379 " (q #04"
14380 " 8759389A34AAAD07ECF4E0C8C2650A4459C8D926EE2378324E0261C52538CB47"
14381 " 7528106B1E0B7C8DD5FF29A9C86A89065656EB33154BC0556091EF8AC9D17D78#)"
14382 " (d #41EBDBA9C98CBECCE7249CF18BFD427FF8EA0B2FAB7B9D305D9D9BF4DB6ADFC2#)"
14383 "))",
14384
14385 "(public-key\n"
14386 " (ecc\n"
14387 " (curve sm2p256v1)\n"
14388 " (q #04"
14389 " 8759389A34AAAD07ECF4E0C8C2650A4459C8D926EE2378324E0261C52538CB47"
14390 " 7528106B1E0B7C8DD5FF29A9C86A89065656EB33154BC0556091EF8AC9D17D78#)"
14391 "))",
14392
14393 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
14394 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" }
14395 }
14396 };
14397 int i;
14398
14399 if (verbose)
14400 fprintf (stderr, "Starting public key checks.\n");
14401 for (i = 0; i < sizeof (pubkeys) / sizeof (*pubkeys); i++)
14402 if (pubkeys[i].id)
14403 {
14404 if (gcry_pk_test_algo (pubkeys[i].id) && in_fips_mode)
14405 {
14406 if (verbose)
14407 fprintf (stderr, " algorithm %d not available in fips mode\n",
14408 pubkeys[i].id);
14409 continue;
14410 }
14411 check_one_pubkey (i, pubkeys[i]);
14412 }
14413 if (verbose)
14414 fprintf (stderr, "Completed public key checks.\n");
14415
14416 if (verbose)
14417 fprintf (stderr, "Starting additional public key checks.\n");
14418 for (i = 0; i < sizeof (pubkeys) / sizeof (*pubkeys); i++)
14419 if (pubkeys[i].id)
14420 {
14421 if (gcry_pk_test_algo (pubkeys[i].id) && in_fips_mode)
14422 {
14423 if (verbose)
14424 fprintf (stderr, " algorithm %d not available in fips mode\n",
14425 pubkeys[i].id);
14426 continue;
14427 }
14428 check_one_pubkey_new (i);
14429 }
14430 if (verbose)
14431 fprintf (stderr, "Completed additional public key checks.\n");
14432
14433 }
14434
14435 int
main(int argc,char ** argv)14436 main (int argc, char **argv)
14437 {
14438 gpg_error_t err;
14439 int last_argc = -1;
14440 int use_fips = 0;
14441 int selftest_only = 0;
14442 int pubkey_only = 0;
14443 int cipher_modes_only = 0;
14444 int loop = 0;
14445 unsigned int loopcount = 0;
14446
14447 if (argc)
14448 { argc--; argv++; }
14449
14450 while (argc && last_argc != argc )
14451 {
14452 last_argc = argc;
14453 if (!strcmp (*argv, "--"))
14454 {
14455 argc--; argv++;
14456 break;
14457 }
14458 else if (!strcmp (*argv, "--verbose"))
14459 {
14460 verbose++;
14461 argc--; argv++;
14462 }
14463 else if (!strcmp (*argv, "--debug"))
14464 {
14465 verbose = debug = 1;
14466 argc--; argv++;
14467 }
14468 else if (!strcmp (*argv, "--fips"))
14469 {
14470 use_fips = 1;
14471 argc--; argv++;
14472 }
14473 else if (!strcmp (*argv, "--selftest"))
14474 {
14475 selftest_only = 1;
14476 verbose += 2;
14477 argc--; argv++;
14478 }
14479 else if (!strcmp (*argv, "--pubkey"))
14480 {
14481 pubkey_only = 1;
14482 argc--; argv++;
14483 }
14484 else if (!strcmp (*argv, "--cipher-modes"))
14485 {
14486 cipher_modes_only = 1;
14487 argc--; argv++;
14488 }
14489 else if (!strcmp (*argv, "--die"))
14490 {
14491 die_on_error = 1;
14492 argc--; argv++;
14493 }
14494 else if (!strcmp (*argv, "--loop"))
14495 {
14496 argc--; argv++;
14497 if (argc)
14498 {
14499 loop = atoi (*argv);
14500 argc--; argv++;
14501 }
14502 }
14503 else if (!strcmp (*argv, "--disable-hwf"))
14504 {
14505 argc--;
14506 argv++;
14507 if (argc)
14508 {
14509 if (gcry_control (GCRYCTL_DISABLE_HWF, *argv, NULL))
14510 fprintf (stderr,
14511 PGM
14512 ": unknown hardware feature `%s' - option ignored\n",
14513 *argv);
14514 argc--;
14515 argv++;
14516 }
14517 }
14518 }
14519
14520 xgcry_control ((GCRYCTL_SET_VERBOSITY, (int)verbose));
14521
14522 if (use_fips)
14523 xgcry_control ((GCRYCTL_FORCE_FIPS_MODE, 0));
14524
14525 /* Check that we test exactly our version - including the patchlevel. */
14526 if (strcmp (GCRYPT_VERSION, gcry_check_version (NULL)))
14527 die ("version mismatch; pgm=%s, library=%s\n",
14528 GCRYPT_VERSION,gcry_check_version (NULL));
14529
14530 if ( gcry_fips_mode_active () )
14531 in_fips_mode = 1;
14532
14533 if (!in_fips_mode)
14534 xgcry_control ((GCRYCTL_DISABLE_SECMEM, 0));
14535
14536 if (verbose)
14537 gcry_set_progress_handler (progress_handler, NULL);
14538
14539 xgcry_control ((GCRYCTL_INITIALIZATION_FINISHED, 0));
14540 if (debug)
14541 xgcry_control ((GCRYCTL_SET_DEBUG_FLAGS, 1u, 0));
14542 /* No valuable keys are create, so we can speed up our RNG. */
14543 xgcry_control ((GCRYCTL_ENABLE_QUICK_RANDOM, 0));
14544
14545 do
14546 {
14547 if (pubkey_only)
14548 check_pubkey ();
14549 else if (cipher_modes_only)
14550 {
14551 check_ciphers ();
14552 check_cipher_modes ();
14553 }
14554 else if (!selftest_only)
14555 {
14556 check_ciphers ();
14557 check_cipher_modes ();
14558 check_bulk_cipher_modes ();
14559 check_digests ();
14560 check_hmac ();
14561 check_mac ();
14562 check_pubkey ();
14563 }
14564 loopcount++;
14565 if (loop)
14566 {
14567 fprintf (stderr, "Test iteration %u completed.\n", loopcount);
14568 if (loop != -1)
14569 loop--;
14570 }
14571 }
14572 while (loop);
14573
14574 if (in_fips_mode && !selftest_only)
14575 {
14576 /* If we are in fips mode do some more tests. */
14577 gcry_md_hd_t md;
14578
14579 /* First trigger a self-test. */
14580 xgcry_control ((GCRYCTL_FORCE_FIPS_MODE, 0));
14581 if (!gcry_control (GCRYCTL_OPERATIONAL_P, 0))
14582 fail ("not in operational state after self-test\n");
14583
14584 /* Get us into the error state. */
14585 err = gcry_md_open (&md, GCRY_MD_SHA1, 0);
14586 if (err)
14587 fail ("failed to open SHA-1 hash context: %s\n", gpg_strerror (err));
14588 else
14589 {
14590 err = gcry_md_enable (md, GCRY_MD_SHA256);
14591 if (err)
14592 fail ("failed to add SHA-256 hash context: %s\n",
14593 gpg_strerror (err));
14594 else
14595 {
14596 /* gcry_md_get_algo is only defined for a context with
14597 just one digest algorithm. With our setup it should
14598 put the oibrary intoerror state. */
14599 fputs ("Note: Two lines with error messages follow "
14600 "- this is expected\n", stderr);
14601 gcry_md_get_algo (md);
14602 gcry_md_close (md);
14603 if (gcry_control (GCRYCTL_OPERATIONAL_P, 0))
14604 fail ("expected error state but still in operational state\n");
14605 else
14606 {
14607 /* Now run a self-test and to get back into
14608 operational state. */
14609 xgcry_control ((GCRYCTL_FORCE_FIPS_MODE, 0));
14610 if (!gcry_control (GCRYCTL_OPERATIONAL_P, 0))
14611 fail ("did not reach operational after error "
14612 "and self-test\n");
14613 }
14614 }
14615 }
14616
14617 }
14618 else
14619 {
14620 /* If in standard mode, run selftests. */
14621 if (gcry_control (GCRYCTL_SELFTEST, 0))
14622 fail ("running self-test failed\n");
14623 }
14624
14625 if (verbose)
14626 fprintf (stderr, "\nAll tests completed. Errors: %i\n", error_count);
14627
14628 if (in_fips_mode && !gcry_fips_mode_active ())
14629 fprintf (stderr, "FIPS mode is not anymore active\n");
14630
14631 return error_count ? 1 : 0;
14632 }
14633