Root/crypto/testmgr.h

1/*
2 * Algorithm testing framework and tests.
3 *
4 * Copyright (c) 2002 James Morris <jmorris@intercode.com.au>
5 * Copyright (c) 2002 Jean-Francois Dive <jef@linuxbe.org>
6 * Copyright (c) 2007 Nokia Siemens Networks
7 * Copyright (c) 2008 Herbert Xu <herbert@gondor.apana.org.au>
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the Free
11 * Software Foundation; either version 2 of the License, or (at your option)
12 * any later version.
13 *
14 */
15#ifndef _CRYPTO_TESTMGR_H
16#define _CRYPTO_TESTMGR_H
17
18#include <linux/netlink.h>
19#include <linux/zlib.h>
20
21#include <crypto/compress.h>
22
23#define MAX_DIGEST_SIZE 64
24#define MAX_TAP 8
25
26#define MAX_KEYLEN 56
27#define MAX_IVLEN 32
28
29struct hash_testvec {
30    /* only used with keyed hash algorithms */
31    char *key;
32    char *plaintext;
33    char *digest;
34    unsigned char tap[MAX_TAP];
35    unsigned char psize;
36    unsigned char np;
37    unsigned char ksize;
38};
39
40struct cipher_testvec {
41    char *key;
42    char *iv;
43    char *input;
44    char *result;
45    unsigned short tap[MAX_TAP];
46    int np;
47    unsigned char fail;
48    unsigned char wk; /* weak key flag */
49    unsigned char klen;
50    unsigned short ilen;
51    unsigned short rlen;
52};
53
54struct aead_testvec {
55    char *key;
56    char *iv;
57    char *input;
58    char *assoc;
59    char *result;
60    unsigned char tap[MAX_TAP];
61    unsigned char atap[MAX_TAP];
62    int np;
63    int anp;
64    unsigned char fail;
65    unsigned char novrfy; /* ccm dec verification failure expected */
66    unsigned char wk; /* weak key flag */
67    unsigned char klen;
68    unsigned short ilen;
69    unsigned short alen;
70    unsigned short rlen;
71};
72
73struct cprng_testvec {
74    char *key;
75    char *dt;
76    char *v;
77    char *result;
78    unsigned char klen;
79    unsigned short dtlen;
80    unsigned short vlen;
81    unsigned short rlen;
82    unsigned short loops;
83};
84
85static char zeroed_string[48];
86
87/*
88 * MD4 test vectors from RFC1320
89 */
90#define MD4_TEST_VECTORS 7
91
92static struct hash_testvec md4_tv_template [] = {
93    {
94        .plaintext = "",
95        .digest = "\x31\xd6\xcf\xe0\xd1\x6a\xe9\x31"
96              "\xb7\x3c\x59\xd7\xe0\xc0\x89\xc0",
97    }, {
98        .plaintext = "a",
99        .psize = 1,
100        .digest = "\xbd\xe5\x2c\xb3\x1d\xe3\x3e\x46"
101              "\x24\x5e\x05\xfb\xdb\xd6\xfb\x24",
102    }, {
103        .plaintext = "abc",
104        .psize = 3,
105        .digest = "\xa4\x48\x01\x7a\xaf\x21\xd8\x52"
106              "\x5f\xc1\x0a\xe8\x7a\xa6\x72\x9d",
107    }, {
108        .plaintext = "message digest",
109        .psize = 14,
110        .digest = "\xd9\x13\x0a\x81\x64\x54\x9f\xe8"
111            "\x18\x87\x48\x06\xe1\xc7\x01\x4b",
112    }, {
113        .plaintext = "abcdefghijklmnopqrstuvwxyz",
114        .psize = 26,
115        .digest = "\xd7\x9e\x1c\x30\x8a\xa5\xbb\xcd"
116              "\xee\xa8\xed\x63\xdf\x41\x2d\xa9",
117        .np = 2,
118        .tap = { 13, 13 },
119    }, {
120        .plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
121        .psize = 62,
122        .digest = "\x04\x3f\x85\x82\xf2\x41\xdb\x35"
123              "\x1c\xe6\x27\xe1\x53\xe7\xf0\xe4",
124    }, {
125        .plaintext = "123456789012345678901234567890123456789012345678901234567890123"
126               "45678901234567890",
127        .psize = 80,
128        .digest = "\xe3\x3b\x4d\xdc\x9c\x38\xf2\x19"
129              "\x9c\x3e\x7b\x16\x4f\xcc\x05\x36",
130    },
131};
132
133/*
134 * MD5 test vectors from RFC1321
135 */
136#define MD5_TEST_VECTORS 7
137
138static struct hash_testvec md5_tv_template[] = {
139    {
140        .digest = "\xd4\x1d\x8c\xd9\x8f\x00\xb2\x04"
141              "\xe9\x80\x09\x98\xec\xf8\x42\x7e",
142    }, {
143        .plaintext = "a",
144        .psize = 1,
145        .digest = "\x0c\xc1\x75\xb9\xc0\xf1\xb6\xa8"
146              "\x31\xc3\x99\xe2\x69\x77\x26\x61",
147    }, {
148        .plaintext = "abc",
149        .psize = 3,
150        .digest = "\x90\x01\x50\x98\x3c\xd2\x4f\xb0"
151              "\xd6\x96\x3f\x7d\x28\xe1\x7f\x72",
152    }, {
153        .plaintext = "message digest",
154        .psize = 14,
155        .digest = "\xf9\x6b\x69\x7d\x7c\xb7\x93\x8d"
156              "\x52\x5a\x2f\x31\xaa\xf1\x61\xd0",
157    }, {
158        .plaintext = "abcdefghijklmnopqrstuvwxyz",
159        .psize = 26,
160        .digest = "\xc3\xfc\xd3\xd7\x61\x92\xe4\x00"
161              "\x7d\xfb\x49\x6c\xca\x67\xe1\x3b",
162        .np = 2,
163        .tap = {13, 13}
164    }, {
165        .plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
166        .psize = 62,
167        .digest = "\xd1\x74\xab\x98\xd2\x77\xd9\xf5"
168              "\xa5\x61\x1c\x2c\x9f\x41\x9d\x9f",
169    }, {
170        .plaintext = "12345678901234567890123456789012345678901234567890123456789012"
171               "345678901234567890",
172        .psize = 80,
173        .digest = "\x57\xed\xf4\xa2\x2b\xe3\xc9\x55"
174              "\xac\x49\xda\x2e\x21\x07\xb6\x7a",
175    }
176
177};
178
179/*
180 * RIPEMD-128 test vectors from ISO/IEC 10118-3:2004(E)
181 */
182#define RMD128_TEST_VECTORS 10
183
184static struct hash_testvec rmd128_tv_template[] = {
185    {
186        .digest = "\xcd\xf2\x62\x13\xa1\x50\xdc\x3e"
187              "\xcb\x61\x0f\x18\xf6\xb3\x8b\x46",
188    }, {
189        .plaintext = "a",
190        .psize = 1,
191        .digest = "\x86\xbe\x7a\xfa\x33\x9d\x0f\xc7"
192              "\xcf\xc7\x85\xe7\x2f\x57\x8d\x33",
193    }, {
194        .plaintext = "abc",
195        .psize = 3,
196        .digest = "\xc1\x4a\x12\x19\x9c\x66\xe4\xba"
197              "\x84\x63\x6b\x0f\x69\x14\x4c\x77",
198    }, {
199        .plaintext = "message digest",
200        .psize = 14,
201        .digest = "\x9e\x32\x7b\x3d\x6e\x52\x30\x62"
202              "\xaf\xc1\x13\x2d\x7d\xf9\xd1\xb8",
203    }, {
204        .plaintext = "abcdefghijklmnopqrstuvwxyz",
205        .psize = 26,
206        .digest = "\xfd\x2a\xa6\x07\xf7\x1d\xc8\xf5"
207              "\x10\x71\x49\x22\xb3\x71\x83\x4e",
208    }, {
209        .plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcde"
210                 "fghijklmnopqrstuvwxyz0123456789",
211        .psize = 62,
212        .digest = "\xd1\xe9\x59\xeb\x17\x9c\x91\x1f"
213              "\xae\xa4\x62\x4c\x60\xc5\xc7\x02",
214    }, {
215        .plaintext = "1234567890123456789012345678901234567890"
216                 "1234567890123456789012345678901234567890",
217        .psize = 80,
218        .digest = "\x3f\x45\xef\x19\x47\x32\xc2\xdb"
219              "\xb2\xc4\xa2\xc7\x69\x79\x5f\xa3",
220    }, {
221        .plaintext = "abcdbcdecdefdefgefghfghighij"
222                 "hijkijkljklmklmnlmnomnopnopq",
223        .psize = 56,
224        .digest = "\xa1\xaa\x06\x89\xd0\xfa\xfa\x2d"
225              "\xdc\x22\xe8\x8b\x49\x13\x3a\x06",
226        .np = 2,
227        .tap = { 28, 28 },
228    }, {
229        .plaintext = "abcdefghbcdefghicdefghijdefghijkefghijklfghi"
230                 "jklmghijklmnhijklmnoijklmnopjklmnopqklmnopqr"
231                 "lmnopqrsmnopqrstnopqrstu",
232        .psize = 112,
233        .digest = "\xd4\xec\xc9\x13\xe1\xdf\x77\x6b"
234              "\xf4\x8d\xe9\xd5\x5b\x1f\x25\x46",
235    }, {
236        .plaintext = "abcdbcdecdefdefgefghfghighijhijk",
237        .psize = 32,
238        .digest = "\x13\xfc\x13\xe8\xef\xff\x34\x7d"
239              "\xe1\x93\xff\x46\xdb\xac\xcf\xd4",
240    }
241};
242
243/*
244 * RIPEMD-160 test vectors from ISO/IEC 10118-3:2004(E)
245 */
246#define RMD160_TEST_VECTORS 10
247
248static struct hash_testvec rmd160_tv_template[] = {
249    {
250        .digest = "\x9c\x11\x85\xa5\xc5\xe9\xfc\x54\x61\x28"
251              "\x08\x97\x7e\xe8\xf5\x48\xb2\x25\x8d\x31",
252    }, {
253        .plaintext = "a",
254        .psize = 1,
255        .digest = "\x0b\xdc\x9d\x2d\x25\x6b\x3e\xe9\xda\xae"
256              "\x34\x7b\xe6\xf4\xdc\x83\x5a\x46\x7f\xfe",
257    }, {
258        .plaintext = "abc",
259        .psize = 3,
260        .digest = "\x8e\xb2\x08\xf7\xe0\x5d\x98\x7a\x9b\x04"
261              "\x4a\x8e\x98\xc6\xb0\x87\xf1\x5a\x0b\xfc",
262    }, {
263        .plaintext = "message digest",
264        .psize = 14,
265        .digest = "\x5d\x06\x89\xef\x49\xd2\xfa\xe5\x72\xb8"
266              "\x81\xb1\x23\xa8\x5f\xfa\x21\x59\x5f\x36",
267    }, {
268        .plaintext = "abcdefghijklmnopqrstuvwxyz",
269        .psize = 26,
270        .digest = "\xf7\x1c\x27\x10\x9c\x69\x2c\x1b\x56\xbb"
271              "\xdc\xeb\x5b\x9d\x28\x65\xb3\x70\x8d\xbc",
272    }, {
273        .plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcde"
274                 "fghijklmnopqrstuvwxyz0123456789",
275        .psize = 62,
276        .digest = "\xb0\xe2\x0b\x6e\x31\x16\x64\x02\x86\xed"
277              "\x3a\x87\xa5\x71\x30\x79\xb2\x1f\x51\x89",
278    }, {
279        .plaintext = "1234567890123456789012345678901234567890"
280                 "1234567890123456789012345678901234567890",
281        .psize = 80,
282        .digest = "\x9b\x75\x2e\x45\x57\x3d\x4b\x39\xf4\xdb"
283              "\xd3\x32\x3c\xab\x82\xbf\x63\x32\x6b\xfb",
284    }, {
285        .plaintext = "abcdbcdecdefdefgefghfghighij"
286                 "hijkijkljklmklmnlmnomnopnopq",
287        .psize = 56,
288        .digest = "\x12\xa0\x53\x38\x4a\x9c\x0c\x88\xe4\x05"
289              "\xa0\x6c\x27\xdc\xf4\x9a\xda\x62\xeb\x2b",
290        .np = 2,
291        .tap = { 28, 28 },
292    }, {
293        .plaintext = "abcdefghbcdefghicdefghijdefghijkefghijklfghi"
294                 "jklmghijklmnhijklmnoijklmnopjklmnopqklmnopqr"
295                 "lmnopqrsmnopqrstnopqrstu",
296        .psize = 112,
297        .digest = "\x6f\x3f\xa3\x9b\x6b\x50\x3c\x38\x4f\x91"
298              "\x9a\x49\xa7\xaa\x5c\x2c\x08\xbd\xfb\x45",
299    }, {
300        .plaintext = "abcdbcdecdefdefgefghfghighijhijk",
301        .psize = 32,
302        .digest = "\x94\xc2\x64\x11\x54\x04\xe6\x33\x79\x0d"
303              "\xfc\xc8\x7b\x58\x7d\x36\x77\x06\x7d\x9f",
304    }
305};
306
307/*
308 * RIPEMD-256 test vectors
309 */
310#define RMD256_TEST_VECTORS 8
311
312static struct hash_testvec rmd256_tv_template[] = {
313    {
314        .digest = "\x02\xba\x4c\x4e\x5f\x8e\xcd\x18"
315              "\x77\xfc\x52\xd6\x4d\x30\xe3\x7a"
316              "\x2d\x97\x74\xfb\x1e\x5d\x02\x63"
317              "\x80\xae\x01\x68\xe3\xc5\x52\x2d",
318    }, {
319        .plaintext = "a",
320        .psize = 1,
321        .digest = "\xf9\x33\x3e\x45\xd8\x57\xf5\xd9"
322              "\x0a\x91\xba\xb7\x0a\x1e\xba\x0c"
323              "\xfb\x1b\xe4\xb0\x78\x3c\x9a\xcf"
324              "\xcd\x88\x3a\x91\x34\x69\x29\x25",
325    }, {
326        .plaintext = "abc",
327        .psize = 3,
328        .digest = "\xaf\xbd\x6e\x22\x8b\x9d\x8c\xbb"
329              "\xce\xf5\xca\x2d\x03\xe6\xdb\xa1"
330              "\x0a\xc0\xbc\x7d\xcb\xe4\x68\x0e"
331              "\x1e\x42\xd2\xe9\x75\x45\x9b\x65",
332    }, {
333        .plaintext = "message digest",
334        .psize = 14,
335        .digest = "\x87\xe9\x71\x75\x9a\x1c\xe4\x7a"
336              "\x51\x4d\x5c\x91\x4c\x39\x2c\x90"
337              "\x18\xc7\xc4\x6b\xc1\x44\x65\x55"
338              "\x4a\xfc\xdf\x54\xa5\x07\x0c\x0e",
339    }, {
340        .plaintext = "abcdefghijklmnopqrstuvwxyz",
341        .psize = 26,
342        .digest = "\x64\x9d\x30\x34\x75\x1e\xa2\x16"
343              "\x77\x6b\xf9\xa1\x8a\xcc\x81\xbc"
344              "\x78\x96\x11\x8a\x51\x97\x96\x87"
345              "\x82\xdd\x1f\xd9\x7d\x8d\x51\x33",
346    }, {
347        .plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcde"
348                 "fghijklmnopqrstuvwxyz0123456789",
349        .psize = 62,
350        .digest = "\x57\x40\xa4\x08\xac\x16\xb7\x20"
351              "\xb8\x44\x24\xae\x93\x1c\xbb\x1f"
352              "\xe3\x63\xd1\xd0\xbf\x40\x17\xf1"
353              "\xa8\x9f\x7e\xa6\xde\x77\xa0\xb8",
354    }, {
355        .plaintext = "1234567890123456789012345678901234567890"
356                 "1234567890123456789012345678901234567890",
357        .psize = 80,
358        .digest = "\x06\xfd\xcc\x7a\x40\x95\x48\xaa"
359              "\xf9\x13\x68\xc0\x6a\x62\x75\xb5"
360              "\x53\xe3\xf0\x99\xbf\x0e\xa4\xed"
361              "\xfd\x67\x78\xdf\x89\xa8\x90\xdd",
362    }, {
363        .plaintext = "abcdbcdecdefdefgefghfghighij"
364                 "hijkijkljklmklmnlmnomnopnopq",
365        .psize = 56,
366        .digest = "\x38\x43\x04\x55\x83\xaa\xc6\xc8"
367              "\xc8\xd9\x12\x85\x73\xe7\xa9\x80"
368              "\x9a\xfb\x2a\x0f\x34\xcc\xc3\x6e"
369              "\xa9\xe7\x2f\x16\xf6\x36\x8e\x3f",
370        .np = 2,
371        .tap = { 28, 28 },
372    }
373};
374
375/*
376 * RIPEMD-320 test vectors
377 */
378#define RMD320_TEST_VECTORS 8
379
380static struct hash_testvec rmd320_tv_template[] = {
381    {
382        .digest = "\x22\xd6\x5d\x56\x61\x53\x6c\xdc\x75\xc1"
383              "\xfd\xf5\xc6\xde\x7b\x41\xb9\xf2\x73\x25"
384              "\xeb\xc6\x1e\x85\x57\x17\x7d\x70\x5a\x0e"
385              "\xc8\x80\x15\x1c\x3a\x32\xa0\x08\x99\xb8",
386    }, {
387        .plaintext = "a",
388        .psize = 1,
389        .digest = "\xce\x78\x85\x06\x38\xf9\x26\x58\xa5\xa5"
390              "\x85\x09\x75\x79\x92\x6d\xda\x66\x7a\x57"
391              "\x16\x56\x2c\xfc\xf6\xfb\xe7\x7f\x63\x54"
392              "\x2f\x99\xb0\x47\x05\xd6\x97\x0d\xff\x5d",
393    }, {
394        .plaintext = "abc",
395        .psize = 3,
396        .digest = "\xde\x4c\x01\xb3\x05\x4f\x89\x30\xa7\x9d"
397              "\x09\xae\x73\x8e\x92\x30\x1e\x5a\x17\x08"
398              "\x5b\xef\xfd\xc1\xb8\xd1\x16\x71\x3e\x74"
399              "\xf8\x2f\xa9\x42\xd6\x4c\xdb\xc4\x68\x2d",
400    }, {
401        .plaintext = "message digest",
402        .psize = 14,
403        .digest = "\x3a\x8e\x28\x50\x2e\xd4\x5d\x42\x2f\x68"
404              "\x84\x4f\x9d\xd3\x16\xe7\xb9\x85\x33\xfa"
405              "\x3f\x2a\x91\xd2\x9f\x84\xd4\x25\xc8\x8d"
406              "\x6b\x4e\xff\x72\x7d\xf6\x6a\x7c\x01\x97",
407    }, {
408        .plaintext = "abcdefghijklmnopqrstuvwxyz",
409        .psize = 26,
410        .digest = "\xca\xbd\xb1\x81\x0b\x92\x47\x0a\x20\x93"
411              "\xaa\x6b\xce\x05\x95\x2c\x28\x34\x8c\xf4"
412              "\x3f\xf6\x08\x41\x97\x51\x66\xbb\x40\xed"
413              "\x23\x40\x04\xb8\x82\x44\x63\xe6\xb0\x09",
414    }, {
415        .plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcde"
416                 "fghijklmnopqrstuvwxyz0123456789",
417        .psize = 62,
418        .digest = "\xed\x54\x49\x40\xc8\x6d\x67\xf2\x50\xd2"
419              "\x32\xc3\x0b\x7b\x3e\x57\x70\xe0\xc6\x0c"
420              "\x8c\xb9\xa4\xca\xfe\x3b\x11\x38\x8a\xf9"
421              "\x92\x0e\x1b\x99\x23\x0b\x84\x3c\x86\xa4",
422    }, {
423        .plaintext = "1234567890123456789012345678901234567890"
424                 "1234567890123456789012345678901234567890",
425        .psize = 80,
426        .digest = "\x55\x78\x88\xaf\x5f\x6d\x8e\xd6\x2a\xb6"
427              "\x69\x45\xc6\xd2\xa0\xa4\x7e\xcd\x53\x41"
428              "\xe9\x15\xeb\x8f\xea\x1d\x05\x24\x95\x5f"
429              "\x82\x5d\xc7\x17\xe4\xa0\x08\xab\x2d\x42",
430    }, {
431        .plaintext = "abcdbcdecdefdefgefghfghighij"
432                 "hijkijkljklmklmnlmnomnopnopq",
433        .psize = 56,
434        .digest = "\xd0\x34\xa7\x95\x0c\xf7\x22\x02\x1b\xa4"
435              "\xb8\x4d\xf7\x69\xa5\xde\x20\x60\xe2\x59"
436              "\xdf\x4c\x9b\xb4\xa4\x26\x8c\x0e\x93\x5b"
437              "\xbc\x74\x70\xa9\x69\xc9\xd0\x72\xa1\xac",
438        .np = 2,
439        .tap = { 28, 28 },
440    }
441};
442
443/*
444 * SHA1 test vectors from from FIPS PUB 180-1
445 */
446#define SHA1_TEST_VECTORS 2
447
448static struct hash_testvec sha1_tv_template[] = {
449    {
450        .plaintext = "abc",
451        .psize = 3,
452        .digest = "\xa9\x99\x3e\x36\x47\x06\x81\x6a\xba\x3e"
453              "\x25\x71\x78\x50\xc2\x6c\x9c\xd0\xd8\x9d",
454    }, {
455        .plaintext = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
456        .psize = 56,
457        .digest = "\x84\x98\x3e\x44\x1c\x3b\xd2\x6e\xba\xae"
458              "\x4a\xa1\xf9\x51\x29\xe5\xe5\x46\x70\xf1",
459        .np = 2,
460        .tap = { 28, 28 }
461    }
462};
463
464
465/*
466 * SHA224 test vectors from from FIPS PUB 180-2
467 */
468#define SHA224_TEST_VECTORS 2
469
470static struct hash_testvec sha224_tv_template[] = {
471    {
472        .plaintext = "abc",
473        .psize = 3,
474        .digest = "\x23\x09\x7D\x22\x34\x05\xD8\x22"
475              "\x86\x42\xA4\x77\xBD\xA2\x55\xB3"
476              "\x2A\xAD\xBC\xE4\xBD\xA0\xB3\xF7"
477              "\xE3\x6C\x9D\xA7",
478    }, {
479        .plaintext =
480        "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
481        .psize = 56,
482        .digest = "\x75\x38\x8B\x16\x51\x27\x76\xCC"
483              "\x5D\xBA\x5D\xA1\xFD\x89\x01\x50"
484              "\xB0\xC6\x45\x5C\xB4\xF5\x8B\x19"
485              "\x52\x52\x25\x25",
486        .np = 2,
487        .tap = { 28, 28 }
488    }
489};
490
491/*
492 * SHA256 test vectors from from NIST
493 */
494#define SHA256_TEST_VECTORS 2
495
496static struct hash_testvec sha256_tv_template[] = {
497    {
498        .plaintext = "abc",
499        .psize = 3,
500        .digest = "\xba\x78\x16\xbf\x8f\x01\xcf\xea"
501              "\x41\x41\x40\xde\x5d\xae\x22\x23"
502              "\xb0\x03\x61\xa3\x96\x17\x7a\x9c"
503              "\xb4\x10\xff\x61\xf2\x00\x15\xad",
504    }, {
505        .plaintext = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
506        .psize = 56,
507        .digest = "\x24\x8d\x6a\x61\xd2\x06\x38\xb8"
508              "\xe5\xc0\x26\x93\x0c\x3e\x60\x39"
509              "\xa3\x3c\xe4\x59\x64\xff\x21\x67"
510              "\xf6\xec\xed\xd4\x19\xdb\x06\xc1",
511        .np = 2,
512        .tap = { 28, 28 }
513    },
514};
515
516/*
517 * SHA384 test vectors from from NIST and kerneli
518 */
519#define SHA384_TEST_VECTORS 4
520
521static struct hash_testvec sha384_tv_template[] = {
522    {
523        .plaintext= "abc",
524        .psize = 3,
525        .digest = "\xcb\x00\x75\x3f\x45\xa3\x5e\x8b"
526              "\xb5\xa0\x3d\x69\x9a\xc6\x50\x07"
527              "\x27\x2c\x32\xab\x0e\xde\xd1\x63"
528              "\x1a\x8b\x60\x5a\x43\xff\x5b\xed"
529              "\x80\x86\x07\x2b\xa1\xe7\xcc\x23"
530              "\x58\xba\xec\xa1\x34\xc8\x25\xa7",
531    }, {
532        .plaintext = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
533        .psize = 56,
534        .digest = "\x33\x91\xfd\xdd\xfc\x8d\xc7\x39"
535              "\x37\x07\xa6\x5b\x1b\x47\x09\x39"
536              "\x7c\xf8\xb1\xd1\x62\xaf\x05\xab"
537              "\xfe\x8f\x45\x0d\xe5\xf3\x6b\xc6"
538              "\xb0\x45\x5a\x85\x20\xbc\x4e\x6f"
539              "\x5f\xe9\x5b\x1f\xe3\xc8\x45\x2b",
540    }, {
541        .plaintext = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmn"
542               "hijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu",
543        .psize = 112,
544        .digest = "\x09\x33\x0c\x33\xf7\x11\x47\xe8"
545              "\x3d\x19\x2f\xc7\x82\xcd\x1b\x47"
546              "\x53\x11\x1b\x17\x3b\x3b\x05\xd2"
547              "\x2f\xa0\x80\x86\xe3\xb0\xf7\x12"
548              "\xfc\xc7\xc7\x1a\x55\x7e\x2d\xb9"
549              "\x66\xc3\xe9\xfa\x91\x74\x60\x39",
550    }, {
551        .plaintext = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcd"
552               "efghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz",
553        .psize = 104,
554        .digest = "\x3d\x20\x89\x73\xab\x35\x08\xdb"
555              "\xbd\x7e\x2c\x28\x62\xba\x29\x0a"
556              "\xd3\x01\x0e\x49\x78\xc1\x98\xdc"
557              "\x4d\x8f\xd0\x14\xe5\x82\x82\x3a"
558              "\x89\xe1\x6f\x9b\x2a\x7b\xbc\x1a"
559              "\xc9\x38\xe2\xd1\x99\xe8\xbe\xa4",
560        .np = 4,
561        .tap = { 26, 26, 26, 26 }
562    },
563};
564
565/*
566 * SHA512 test vectors from from NIST and kerneli
567 */
568#define SHA512_TEST_VECTORS 4
569
570static struct hash_testvec sha512_tv_template[] = {
571    {
572        .plaintext = "abc",
573        .psize = 3,
574        .digest = "\xdd\xaf\x35\xa1\x93\x61\x7a\xba"
575              "\xcc\x41\x73\x49\xae\x20\x41\x31"
576              "\x12\xe6\xfa\x4e\x89\xa9\x7e\xa2"
577              "\x0a\x9e\xee\xe6\x4b\x55\xd3\x9a"
578              "\x21\x92\x99\x2a\x27\x4f\xc1\xa8"
579              "\x36\xba\x3c\x23\xa3\xfe\xeb\xbd"
580              "\x45\x4d\x44\x23\x64\x3c\xe8\x0e"
581              "\x2a\x9a\xc9\x4f\xa5\x4c\xa4\x9f",
582    }, {
583        .plaintext = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
584        .psize = 56,
585        .digest = "\x20\x4a\x8f\xc6\xdd\xa8\x2f\x0a"
586              "\x0c\xed\x7b\xeb\x8e\x08\xa4\x16"
587              "\x57\xc1\x6e\xf4\x68\xb2\x28\xa8"
588              "\x27\x9b\xe3\x31\xa7\x03\xc3\x35"
589              "\x96\xfd\x15\xc1\x3b\x1b\x07\xf9"
590              "\xaa\x1d\x3b\xea\x57\x78\x9c\xa0"
591              "\x31\xad\x85\xc7\xa7\x1d\xd7\x03"
592              "\x54\xec\x63\x12\x38\xca\x34\x45",
593    }, {
594        .plaintext = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmn"
595               "hijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu",
596        .psize = 112,
597        .digest = "\x8e\x95\x9b\x75\xda\xe3\x13\xda"
598              "\x8c\xf4\xf7\x28\x14\xfc\x14\x3f"
599              "\x8f\x77\x79\xc6\xeb\x9f\x7f\xa1"
600              "\x72\x99\xae\xad\xb6\x88\x90\x18"
601              "\x50\x1d\x28\x9e\x49\x00\xf7\xe4"
602              "\x33\x1b\x99\xde\xc4\xb5\x43\x3a"
603              "\xc7\xd3\x29\xee\xb6\xdd\x26\x54"
604              "\x5e\x96\xe5\x5b\x87\x4b\xe9\x09",
605    }, {
606        .plaintext = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcd"
607               "efghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz",
608        .psize = 104,
609        .digest = "\x93\x0d\x0c\xef\xcb\x30\xff\x11"
610              "\x33\xb6\x89\x81\x21\xf1\xcf\x3d"
611              "\x27\x57\x8a\xfc\xaf\xe8\x67\x7c"
612              "\x52\x57\xcf\x06\x99\x11\xf7\x5d"
613              "\x8f\x58\x31\xb5\x6e\xbf\xda\x67"
614              "\xb2\x78\xe6\x6d\xff\x8b\x84\xfe"
615              "\x2b\x28\x70\xf7\x42\xa5\x80\xd8"
616              "\xed\xb4\x19\x87\x23\x28\x50\xc9",
617        .np = 4,
618        .tap = { 26, 26, 26, 26 }
619    },
620};
621
622
623/*
624 * WHIRLPOOL test vectors from Whirlpool package
625 * by Vincent Rijmen and Paulo S. L. M. Barreto as part of the NESSIE
626 * submission
627 */
628#define WP512_TEST_VECTORS 8
629
630static struct hash_testvec wp512_tv_template[] = {
631    {
632        .plaintext = "",
633        .psize = 0,
634        .digest = "\x19\xFA\x61\xD7\x55\x22\xA4\x66"
635              "\x9B\x44\xE3\x9C\x1D\x2E\x17\x26"
636              "\xC5\x30\x23\x21\x30\xD4\x07\xF8"
637              "\x9A\xFE\xE0\x96\x49\x97\xF7\xA7"
638              "\x3E\x83\xBE\x69\x8B\x28\x8F\xEB"
639              "\xCF\x88\xE3\xE0\x3C\x4F\x07\x57"
640              "\xEA\x89\x64\xE5\x9B\x63\xD9\x37"
641              "\x08\xB1\x38\xCC\x42\xA6\x6E\xB3",
642
643
644    }, {
645        .plaintext = "a",
646        .psize = 1,
647        .digest = "\x8A\xCA\x26\x02\x79\x2A\xEC\x6F"
648              "\x11\xA6\x72\x06\x53\x1F\xB7\xD7"
649              "\xF0\xDF\xF5\x94\x13\x14\x5E\x69"
650              "\x73\xC4\x50\x01\xD0\x08\x7B\x42"
651              "\xD1\x1B\xC6\x45\x41\x3A\xEF\xF6"
652              "\x3A\x42\x39\x1A\x39\x14\x5A\x59"
653              "\x1A\x92\x20\x0D\x56\x01\x95\xE5"
654              "\x3B\x47\x85\x84\xFD\xAE\x23\x1A",
655    }, {
656        .plaintext = "abc",
657        .psize = 3,
658        .digest = "\x4E\x24\x48\xA4\xC6\xF4\x86\xBB"
659              "\x16\xB6\x56\x2C\x73\xB4\x02\x0B"
660              "\xF3\x04\x3E\x3A\x73\x1B\xCE\x72"
661              "\x1A\xE1\xB3\x03\xD9\x7E\x6D\x4C"
662              "\x71\x81\xEE\xBD\xB6\xC5\x7E\x27"
663              "\x7D\x0E\x34\x95\x71\x14\xCB\xD6"
664              "\xC7\x97\xFC\x9D\x95\xD8\xB5\x82"
665              "\xD2\x25\x29\x20\x76\xD4\xEE\xF5",
666    }, {
667        .plaintext = "message digest",
668        .psize = 14,
669        .digest = "\x37\x8C\x84\xA4\x12\x6E\x2D\xC6"
670              "\xE5\x6D\xCC\x74\x58\x37\x7A\xAC"
671              "\x83\x8D\x00\x03\x22\x30\xF5\x3C"
672              "\xE1\xF5\x70\x0C\x0F\xFB\x4D\x3B"
673              "\x84\x21\x55\x76\x59\xEF\x55\xC1"
674              "\x06\xB4\xB5\x2A\xC5\xA4\xAA\xA6"
675              "\x92\xED\x92\x00\x52\x83\x8F\x33"
676              "\x62\xE8\x6D\xBD\x37\xA8\x90\x3E",
677    }, {
678        .plaintext = "abcdefghijklmnopqrstuvwxyz",
679        .psize = 26,
680        .digest = "\xF1\xD7\x54\x66\x26\x36\xFF\xE9"
681              "\x2C\x82\xEB\xB9\x21\x2A\x48\x4A"
682              "\x8D\x38\x63\x1E\xAD\x42\x38\xF5"
683              "\x44\x2E\xE1\x3B\x80\x54\xE4\x1B"
684              "\x08\xBF\x2A\x92\x51\xC3\x0B\x6A"
685              "\x0B\x8A\xAE\x86\x17\x7A\xB4\xA6"
686              "\xF6\x8F\x67\x3E\x72\x07\x86\x5D"
687              "\x5D\x98\x19\xA3\xDB\xA4\xEB\x3B",
688    }, {
689        .plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
690               "abcdefghijklmnopqrstuvwxyz0123456789",
691        .psize = 62,
692        .digest = "\xDC\x37\xE0\x08\xCF\x9E\xE6\x9B"
693              "\xF1\x1F\x00\xED\x9A\xBA\x26\x90"
694              "\x1D\xD7\xC2\x8C\xDE\xC0\x66\xCC"
695              "\x6A\xF4\x2E\x40\xF8\x2F\x3A\x1E"
696              "\x08\xEB\xA2\x66\x29\x12\x9D\x8F"
697              "\xB7\xCB\x57\x21\x1B\x92\x81\xA6"
698              "\x55\x17\xCC\x87\x9D\x7B\x96\x21"
699              "\x42\xC6\x5F\x5A\x7A\xF0\x14\x67",
700    }, {
701        .plaintext = "1234567890123456789012345678901234567890"
702               "1234567890123456789012345678901234567890",
703        .psize = 80,
704        .digest = "\x46\x6E\xF1\x8B\xAB\xB0\x15\x4D"
705              "\x25\xB9\xD3\x8A\x64\x14\xF5\xC0"
706              "\x87\x84\x37\x2B\xCC\xB2\x04\xD6"
707              "\x54\x9C\x4A\xFA\xDB\x60\x14\x29"
708              "\x4D\x5B\xD8\xDF\x2A\x6C\x44\xE5"
709              "\x38\xCD\x04\x7B\x26\x81\xA5\x1A"
710              "\x2C\x60\x48\x1E\x88\xC5\xA2\x0B"
711              "\x2C\x2A\x80\xCF\x3A\x9A\x08\x3B",
712    }, {
713        .plaintext = "abcdbcdecdefdefgefghfghighijhijk",
714        .psize = 32,
715        .digest = "\x2A\x98\x7E\xA4\x0F\x91\x70\x61"
716              "\xF5\xD6\xF0\xA0\xE4\x64\x4F\x48"
717              "\x8A\x7A\x5A\x52\xDE\xEE\x65\x62"
718              "\x07\xC5\x62\xF9\x88\xE9\x5C\x69"
719              "\x16\xBD\xC8\x03\x1B\xC5\xBE\x1B"
720              "\x7B\x94\x76\x39\xFE\x05\x0B\x56"
721              "\x93\x9B\xAA\xA0\xAD\xFF\x9A\xE6"
722              "\x74\x5B\x7B\x18\x1C\x3B\xE3\xFD",
723    },
724};
725
726#define WP384_TEST_VECTORS 8
727
728static struct hash_testvec wp384_tv_template[] = {
729    {
730        .plaintext = "",
731        .psize = 0,
732        .digest = "\x19\xFA\x61\xD7\x55\x22\xA4\x66"
733              "\x9B\x44\xE3\x9C\x1D\x2E\x17\x26"
734              "\xC5\x30\x23\x21\x30\xD4\x07\xF8"
735              "\x9A\xFE\xE0\x96\x49\x97\xF7\xA7"
736              "\x3E\x83\xBE\x69\x8B\x28\x8F\xEB"
737              "\xCF\x88\xE3\xE0\x3C\x4F\x07\x57",
738
739
740    }, {
741        .plaintext = "a",
742        .psize = 1,
743        .digest = "\x8A\xCA\x26\x02\x79\x2A\xEC\x6F"
744              "\x11\xA6\x72\x06\x53\x1F\xB7\xD7"
745              "\xF0\xDF\xF5\x94\x13\x14\x5E\x69"
746              "\x73\xC4\x50\x01\xD0\x08\x7B\x42"
747              "\xD1\x1B\xC6\x45\x41\x3A\xEF\xF6"
748              "\x3A\x42\x39\x1A\x39\x14\x5A\x59",
749    }, {
750        .plaintext = "abc",
751        .psize = 3,
752        .digest = "\x4E\x24\x48\xA4\xC6\xF4\x86\xBB"
753              "\x16\xB6\x56\x2C\x73\xB4\x02\x0B"
754              "\xF3\x04\x3E\x3A\x73\x1B\xCE\x72"
755              "\x1A\xE1\xB3\x03\xD9\x7E\x6D\x4C"
756              "\x71\x81\xEE\xBD\xB6\xC5\x7E\x27"
757              "\x7D\x0E\x34\x95\x71\x14\xCB\xD6",
758    }, {
759        .plaintext = "message digest",
760        .psize = 14,
761        .digest = "\x37\x8C\x84\xA4\x12\x6E\x2D\xC6"
762              "\xE5\x6D\xCC\x74\x58\x37\x7A\xAC"
763              "\x83\x8D\x00\x03\x22\x30\xF5\x3C"
764              "\xE1\xF5\x70\x0C\x0F\xFB\x4D\x3B"
765              "\x84\x21\x55\x76\x59\xEF\x55\xC1"
766              "\x06\xB4\xB5\x2A\xC5\xA4\xAA\xA6",
767    }, {
768        .plaintext = "abcdefghijklmnopqrstuvwxyz",
769        .psize = 26,
770        .digest = "\xF1\xD7\x54\x66\x26\x36\xFF\xE9"
771              "\x2C\x82\xEB\xB9\x21\x2A\x48\x4A"
772              "\x8D\x38\x63\x1E\xAD\x42\x38\xF5"
773              "\x44\x2E\xE1\x3B\x80\x54\xE4\x1B"
774              "\x08\xBF\x2A\x92\x51\xC3\x0B\x6A"
775              "\x0B\x8A\xAE\x86\x17\x7A\xB4\xA6",
776    }, {
777        .plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
778               "abcdefghijklmnopqrstuvwxyz0123456789",
779        .psize = 62,
780        .digest = "\xDC\x37\xE0\x08\xCF\x9E\xE6\x9B"
781              "\xF1\x1F\x00\xED\x9A\xBA\x26\x90"
782              "\x1D\xD7\xC2\x8C\xDE\xC0\x66\xCC"
783              "\x6A\xF4\x2E\x40\xF8\x2F\x3A\x1E"
784              "\x08\xEB\xA2\x66\x29\x12\x9D\x8F"
785              "\xB7\xCB\x57\x21\x1B\x92\x81\xA6",
786    }, {
787        .plaintext = "1234567890123456789012345678901234567890"
788               "1234567890123456789012345678901234567890",
789        .psize = 80,
790        .digest = "\x46\x6E\xF1\x8B\xAB\xB0\x15\x4D"
791              "\x25\xB9\xD3\x8A\x64\x14\xF5\xC0"
792              "\x87\x84\x37\x2B\xCC\xB2\x04\xD6"
793              "\x54\x9C\x4A\xFA\xDB\x60\x14\x29"
794              "\x4D\x5B\xD8\xDF\x2A\x6C\x44\xE5"
795              "\x38\xCD\x04\x7B\x26\x81\xA5\x1A",
796    }, {
797        .plaintext = "abcdbcdecdefdefgefghfghighijhijk",
798        .psize = 32,
799        .digest = "\x2A\x98\x7E\xA4\x0F\x91\x70\x61"
800              "\xF5\xD6\xF0\xA0\xE4\x64\x4F\x48"
801              "\x8A\x7A\x5A\x52\xDE\xEE\x65\x62"
802              "\x07\xC5\x62\xF9\x88\xE9\x5C\x69"
803              "\x16\xBD\xC8\x03\x1B\xC5\xBE\x1B"
804              "\x7B\x94\x76\x39\xFE\x05\x0B\x56",
805    },
806};
807
808#define WP256_TEST_VECTORS 8
809
810static struct hash_testvec wp256_tv_template[] = {
811    {
812        .plaintext = "",
813        .psize = 0,
814        .digest = "\x19\xFA\x61\xD7\x55\x22\xA4\x66"
815              "\x9B\x44\xE3\x9C\x1D\x2E\x17\x26"
816              "\xC5\x30\x23\x21\x30\xD4\x07\xF8"
817              "\x9A\xFE\xE0\x96\x49\x97\xF7\xA7",
818
819
820    }, {
821        .plaintext = "a",
822        .psize = 1,
823        .digest = "\x8A\xCA\x26\x02\x79\x2A\xEC\x6F"
824              "\x11\xA6\x72\x06\x53\x1F\xB7\xD7"
825              "\xF0\xDF\xF5\x94\x13\x14\x5E\x69"
826              "\x73\xC4\x50\x01\xD0\x08\x7B\x42",
827    }, {
828        .plaintext = "abc",
829        .psize = 3,
830        .digest = "\x4E\x24\x48\xA4\xC6\xF4\x86\xBB"
831              "\x16\xB6\x56\x2C\x73\xB4\x02\x0B"
832              "\xF3\x04\x3E\x3A\x73\x1B\xCE\x72"
833              "\x1A\xE1\xB3\x03\xD9\x7E\x6D\x4C",
834    }, {
835        .plaintext = "message digest",
836        .psize = 14,
837        .digest = "\x37\x8C\x84\xA4\x12\x6E\x2D\xC6"
838              "\xE5\x6D\xCC\x74\x58\x37\x7A\xAC"
839              "\x83\x8D\x00\x03\x22\x30\xF5\x3C"
840              "\xE1\xF5\x70\x0C\x0F\xFB\x4D\x3B",
841    }, {
842        .plaintext = "abcdefghijklmnopqrstuvwxyz",
843        .psize = 26,
844        .digest = "\xF1\xD7\x54\x66\x26\x36\xFF\xE9"
845              "\x2C\x82\xEB\xB9\x21\x2A\x48\x4A"
846              "\x8D\x38\x63\x1E\xAD\x42\x38\xF5"
847              "\x44\x2E\xE1\x3B\x80\x54\xE4\x1B",
848    }, {
849        .plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
850               "abcdefghijklmnopqrstuvwxyz0123456789",
851        .psize = 62,
852        .digest = "\xDC\x37\xE0\x08\xCF\x9E\xE6\x9B"
853              "\xF1\x1F\x00\xED\x9A\xBA\x26\x90"
854              "\x1D\xD7\xC2\x8C\xDE\xC0\x66\xCC"
855              "\x6A\xF4\x2E\x40\xF8\x2F\x3A\x1E",
856    }, {
857        .plaintext = "1234567890123456789012345678901234567890"
858               "1234567890123456789012345678901234567890",
859        .psize = 80,
860        .digest = "\x46\x6E\xF1\x8B\xAB\xB0\x15\x4D"
861              "\x25\xB9\xD3\x8A\x64\x14\xF5\xC0"
862              "\x87\x84\x37\x2B\xCC\xB2\x04\xD6"
863              "\x54\x9C\x4A\xFA\xDB\x60\x14\x29",
864    }, {
865        .plaintext = "abcdbcdecdefdefgefghfghighijhijk",
866        .psize = 32,
867        .digest = "\x2A\x98\x7E\xA4\x0F\x91\x70\x61"
868              "\xF5\xD6\xF0\xA0\xE4\x64\x4F\x48"
869              "\x8A\x7A\x5A\x52\xDE\xEE\x65\x62"
870              "\x07\xC5\x62\xF9\x88\xE9\x5C\x69",
871    },
872};
873
874/*
875 * TIGER test vectors from Tiger website
876 */
877#define TGR192_TEST_VECTORS 6
878
879static struct hash_testvec tgr192_tv_template[] = {
880    {
881        .plaintext = "",
882        .psize = 0,
883        .digest = "\x24\xf0\x13\x0c\x63\xac\x93\x32"
884              "\x16\x16\x6e\x76\xb1\xbb\x92\x5f"
885              "\xf3\x73\xde\x2d\x49\x58\x4e\x7a",
886    }, {
887        .plaintext = "abc",
888        .psize = 3,
889        .digest = "\xf2\x58\xc1\xe8\x84\x14\xab\x2a"
890              "\x52\x7a\xb5\x41\xff\xc5\xb8\xbf"
891              "\x93\x5f\x7b\x95\x1c\x13\x29\x51",
892    }, {
893        .plaintext = "Tiger",
894        .psize = 5,
895        .digest = "\x9f\x00\xf5\x99\x07\x23\x00\xdd"
896              "\x27\x6a\xbb\x38\xc8\xeb\x6d\xec"
897              "\x37\x79\x0c\x11\x6f\x9d\x2b\xdf",
898    }, {
899        .plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-",
900        .psize = 64,
901        .digest = "\x87\xfb\x2a\x90\x83\x85\x1c\xf7"
902              "\x47\x0d\x2c\xf8\x10\xe6\xdf\x9e"
903              "\xb5\x86\x44\x50\x34\xa5\xa3\x86",
904    }, {
905        .plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZ=abcdefghijklmnopqrstuvwxyz+0123456789",
906        .psize = 64,
907        .digest = "\x46\x7d\xb8\x08\x63\xeb\xce\x48"
908              "\x8d\xf1\xcd\x12\x61\x65\x5d\xe9"
909              "\x57\x89\x65\x65\x97\x5f\x91\x97",
910    }, {
911        .plaintext = "Tiger - A Fast New Hash Function, "
912               "by Ross Anderson and Eli Biham, "
913               "proceedings of Fast Software Encryption 3, "
914               "Cambridge, 1996.",
915        .psize = 125,
916        .digest = "\x3d\x9a\xeb\x03\xd1\xbd\x1a\x63"
917              "\x57\xb2\x77\x4d\xfd\x6d\x5b\x24"
918              "\xdd\x68\x15\x1d\x50\x39\x74\xfc",
919    },
920};
921
922#define TGR160_TEST_VECTORS 6
923
924static struct hash_testvec tgr160_tv_template[] = {
925    {
926        .plaintext = "",
927        .psize = 0,
928        .digest = "\x24\xf0\x13\x0c\x63\xac\x93\x32"
929              "\x16\x16\x6e\x76\xb1\xbb\x92\x5f"
930              "\xf3\x73\xde\x2d",
931    }, {
932        .plaintext = "abc",
933        .psize = 3,
934        .digest = "\xf2\x58\xc1\xe8\x84\x14\xab\x2a"
935              "\x52\x7a\xb5\x41\xff\xc5\xb8\xbf"
936              "\x93\x5f\x7b\x95",
937    }, {
938        .plaintext = "Tiger",
939        .psize = 5,
940        .digest = "\x9f\x00\xf5\x99\x07\x23\x00\xdd"
941              "\x27\x6a\xbb\x38\xc8\xeb\x6d\xec"
942              "\x37\x79\x0c\x11",
943    }, {
944        .plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-",
945        .psize = 64,
946        .digest = "\x87\xfb\x2a\x90\x83\x85\x1c\xf7"
947              "\x47\x0d\x2c\xf8\x10\xe6\xdf\x9e"
948              "\xb5\x86\x44\x50",
949    }, {
950        .plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZ=abcdefghijklmnopqrstuvwxyz+0123456789",
951        .psize = 64,
952        .digest = "\x46\x7d\xb8\x08\x63\xeb\xce\x48"
953              "\x8d\xf1\xcd\x12\x61\x65\x5d\xe9"
954              "\x57\x89\x65\x65",
955    }, {
956        .plaintext = "Tiger - A Fast New Hash Function, "
957               "by Ross Anderson and Eli Biham, "
958               "proceedings of Fast Software Encryption 3, "
959               "Cambridge, 1996.",
960        .psize = 125,
961        .digest = "\x3d\x9a\xeb\x03\xd1\xbd\x1a\x63"
962              "\x57\xb2\x77\x4d\xfd\x6d\x5b\x24"
963              "\xdd\x68\x15\x1d",
964    },
965};
966
967#define TGR128_TEST_VECTORS 6
968
969static struct hash_testvec tgr128_tv_template[] = {
970    {
971        .plaintext = "",
972        .psize = 0,
973        .digest = "\x24\xf0\x13\x0c\x63\xac\x93\x32"
974              "\x16\x16\x6e\x76\xb1\xbb\x92\x5f",
975    }, {
976        .plaintext = "abc",
977        .psize = 3,
978        .digest = "\xf2\x58\xc1\xe8\x84\x14\xab\x2a"
979              "\x52\x7a\xb5\x41\xff\xc5\xb8\xbf",
980    }, {
981        .plaintext = "Tiger",
982        .psize = 5,
983        .digest = "\x9f\x00\xf5\x99\x07\x23\x00\xdd"
984              "\x27\x6a\xbb\x38\xc8\xeb\x6d\xec",
985    }, {
986        .plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-",
987        .psize = 64,
988        .digest = "\x87\xfb\x2a\x90\x83\x85\x1c\xf7"
989              "\x47\x0d\x2c\xf8\x10\xe6\xdf\x9e",
990    }, {
991        .plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZ=abcdefghijklmnopqrstuvwxyz+0123456789",
992        .psize = 64,
993        .digest = "\x46\x7d\xb8\x08\x63\xeb\xce\x48"
994              "\x8d\xf1\xcd\x12\x61\x65\x5d\xe9",
995    }, {
996        .plaintext = "Tiger - A Fast New Hash Function, "
997               "by Ross Anderson and Eli Biham, "
998               "proceedings of Fast Software Encryption 3, "
999               "Cambridge, 1996.",
1000        .psize = 125,
1001        .digest = "\x3d\x9a\xeb\x03\xd1\xbd\x1a\x63"
1002              "\x57\xb2\x77\x4d\xfd\x6d\x5b\x24",
1003    },
1004};
1005
1006#define GHASH_TEST_VECTORS 1
1007
1008static struct hash_testvec ghash_tv_template[] =
1009{
1010    {
1011
1012        .key = "\xdf\xa6\xbf\x4d\xed\x81\xdb\x03\xff\xca\xff\x95\xf8\x30\xf0\x61",
1013        .ksize = 16,
1014        .plaintext = "\x95\x2b\x2a\x56\xa5\x60\x04a\xc0\xb3\x2b\x66\x56\xa0\x5b\x40\xb6",
1015        .psize = 16,
1016        .digest = "\xda\x53\xeb\x0a\xd2\xc5\x5b\xb6"
1017              "\x4f\xc4\x80\x2c\xc3\xfe\xda\x60",
1018    },
1019};
1020
1021/*
1022 * HMAC-MD5 test vectors from RFC2202
1023 * (These need to be fixed to not use strlen).
1024 */
1025#define HMAC_MD5_TEST_VECTORS 7
1026
1027static struct hash_testvec hmac_md5_tv_template[] =
1028{
1029    {
1030        .key = "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b",
1031        .ksize = 16,
1032        .plaintext = "Hi There",
1033        .psize = 8,
1034        .digest = "\x92\x94\x72\x7a\x36\x38\xbb\x1c"
1035              "\x13\xf4\x8e\xf8\x15\x8b\xfc\x9d",
1036    }, {
1037        .key = "Jefe",
1038        .ksize = 4,
1039        .plaintext = "what do ya want for nothing?",
1040        .psize = 28,
1041        .digest = "\x75\x0c\x78\x3e\x6a\xb0\xb5\x03"
1042              "\xea\xa8\x6e\x31\x0a\x5d\xb7\x38",
1043        .np = 2,
1044        .tap = {14, 14}
1045    }, {
1046        .key = "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa",
1047        .ksize = 16,
1048        .plaintext = "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
1049            "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
1050            "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
1051            "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd",
1052        .psize = 50,
1053        .digest = "\x56\xbe\x34\x52\x1d\x14\x4c\x88"
1054              "\xdb\xb8\xc7\x33\xf0\xe8\xb3\xf6",
1055    }, {
1056        .key = "\x01\x02\x03\x04\x05\x06\x07\x08"
1057              "\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10"
1058              "\x11\x12\x13\x14\x15\x16\x17\x18\x19",
1059        .ksize = 25,
1060        .plaintext = "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
1061            "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
1062            "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
1063            "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd",
1064        .psize = 50,
1065        .digest = "\x69\x7e\xaf\x0a\xca\x3a\x3a\xea"
1066              "\x3a\x75\x16\x47\x46\xff\xaa\x79",
1067    }, {
1068        .key = "\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c",
1069        .ksize = 16,
1070        .plaintext = "Test With Truncation",
1071        .psize = 20,
1072        .digest = "\x56\x46\x1e\xf2\x34\x2e\xdc\x00"
1073              "\xf9\xba\xb9\x95\x69\x0e\xfd\x4c",
1074    }, {
1075        .key = "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1076            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1077            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1078            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1079            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1080            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1081            "\xaa\xaa",
1082        .ksize = 80,
1083        .plaintext = "Test Using Larger Than Block-Size Key - Hash Key First",
1084        .psize = 54,
1085        .digest = "\x6b\x1a\xb7\xfe\x4b\xd7\xbf\x8f"
1086              "\x0b\x62\xe6\xce\x61\xb9\xd0\xcd",
1087    }, {
1088        .key = "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1089            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1090            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1091            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1092            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1093            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1094            "\xaa\xaa",
1095        .ksize = 80,
1096        .plaintext = "Test Using Larger Than Block-Size Key and Larger Than One "
1097               "Block-Size Data",
1098        .psize = 73,
1099        .digest = "\x6f\x63\x0f\xad\x67\xcd\xa0\xee"
1100              "\x1f\xb1\xf5\x62\xdb\x3a\xa5\x3e",
1101    },
1102};
1103
1104/*
1105 * HMAC-RIPEMD128 test vectors from RFC2286
1106 */
1107#define HMAC_RMD128_TEST_VECTORS 7
1108
1109static struct hash_testvec hmac_rmd128_tv_template[] = {
1110    {
1111        .key = "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b",
1112        .ksize = 16,
1113        .plaintext = "Hi There",
1114        .psize = 8,
1115        .digest = "\xfb\xf6\x1f\x94\x92\xaa\x4b\xbf"
1116              "\x81\xc1\x72\xe8\x4e\x07\x34\xdb",
1117    }, {
1118        .key = "Jefe",
1119        .ksize = 4,
1120        .plaintext = "what do ya want for nothing?",
1121        .psize = 28,
1122        .digest = "\x87\x5f\x82\x88\x62\xb6\xb3\x34"
1123              "\xb4\x27\xc5\x5f\x9f\x7f\xf0\x9b",
1124        .np = 2,
1125        .tap = { 14, 14 },
1126    }, {
1127        .key = "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa",
1128        .ksize = 16,
1129        .plaintext = "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
1130            "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
1131            "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
1132            "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd",
1133        .psize = 50,
1134        .digest = "\x09\xf0\xb2\x84\x6d\x2f\x54\x3d"
1135              "\xa3\x63\xcb\xec\x8d\x62\xa3\x8d",
1136    }, {
1137        .key = "\x01\x02\x03\x04\x05\x06\x07\x08"
1138              "\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10"
1139              "\x11\x12\x13\x14\x15\x16\x17\x18\x19",
1140        .ksize = 25,
1141        .plaintext = "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
1142            "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
1143            "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
1144            "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd",
1145        .psize = 50,
1146        .digest = "\xbd\xbb\xd7\xcf\x03\xe4\x4b\x5a"
1147              "\xa6\x0a\xf8\x15\xbe\x4d\x22\x94",
1148    }, {
1149        .key = "\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c",
1150        .ksize = 16,
1151        .plaintext = "Test With Truncation",
1152        .psize = 20,
1153        .digest = "\xe7\x98\x08\xf2\x4b\x25\xfd\x03"
1154              "\x1c\x15\x5f\x0d\x55\x1d\x9a\x3a",
1155    }, {
1156        .key = "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1157            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1158            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1159            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1160            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1161            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1162            "\xaa\xaa",
1163        .ksize = 80,
1164        .plaintext = "Test Using Larger Than Block-Size Key - Hash Key First",
1165        .psize = 54,
1166        .digest = "\xdc\x73\x29\x28\xde\x98\x10\x4a"
1167              "\x1f\x59\xd3\x73\xc1\x50\xac\xbb",
1168    }, {
1169        .key = "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1170            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1171            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1172            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1173            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1174            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1175            "\xaa\xaa",
1176        .ksize = 80,
1177        .plaintext = "Test Using Larger Than Block-Size Key and Larger Than One "
1178               "Block-Size Data",
1179        .psize = 73,
1180        .digest = "\x5c\x6b\xec\x96\x79\x3e\x16\xd4"
1181              "\x06\x90\xc2\x37\x63\x5f\x30\xc5",
1182    },
1183};
1184
1185/*
1186 * HMAC-RIPEMD160 test vectors from RFC2286
1187 */
1188#define HMAC_RMD160_TEST_VECTORS 7
1189
1190static struct hash_testvec hmac_rmd160_tv_template[] = {
1191    {
1192        .key = "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b",
1193        .ksize = 20,
1194        .plaintext = "Hi There",
1195        .psize = 8,
1196        .digest = "\x24\xcb\x4b\xd6\x7d\x20\xfc\x1a\x5d\x2e"
1197              "\xd7\x73\x2d\xcc\x39\x37\x7f\x0a\x56\x68",
1198    }, {
1199        .key = "Jefe",
1200        .ksize = 4,
1201        .plaintext = "what do ya want for nothing?",
1202        .psize = 28,
1203        .digest = "\xdd\xa6\xc0\x21\x3a\x48\x5a\x9e\x24\xf4"
1204              "\x74\x20\x64\xa7\xf0\x33\xb4\x3c\x40\x69",
1205        .np = 2,
1206        .tap = { 14, 14 },
1207    }, {
1208        .key = "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa",
1209        .ksize = 20,
1210        .plaintext = "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
1211            "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
1212            "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
1213            "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd",
1214        .psize = 50,
1215        .digest = "\xb0\xb1\x05\x36\x0d\xe7\x59\x96\x0a\xb4"
1216              "\xf3\x52\x98\xe1\x16\xe2\x95\xd8\xe7\xc1",
1217    }, {
1218        .key = "\x01\x02\x03\x04\x05\x06\x07\x08"
1219              "\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10"
1220              "\x11\x12\x13\x14\x15\x16\x17\x18\x19",
1221        .ksize = 25,
1222        .plaintext = "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
1223            "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
1224            "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
1225            "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd",
1226        .psize = 50,
1227        .digest = "\xd5\xca\x86\x2f\x4d\x21\xd5\xe6\x10\xe1"
1228              "\x8b\x4c\xf1\xbe\xb9\x7a\x43\x65\xec\xf4",
1229    }, {
1230        .key = "\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c",
1231        .ksize = 20,
1232        .plaintext = "Test With Truncation",
1233        .psize = 20,
1234        .digest = "\x76\x19\x69\x39\x78\xf9\x1d\x90\x53\x9a"
1235              "\xe7\x86\x50\x0f\xf3\xd8\xe0\x51\x8e\x39",
1236    }, {
1237        .key = "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1238            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1239            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1240            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1241            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1242            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1243            "\xaa\xaa",
1244        .ksize = 80,
1245        .plaintext = "Test Using Larger Than Block-Size Key - Hash Key First",
1246        .psize = 54,
1247        .digest = "\x64\x66\xca\x07\xac\x5e\xac\x29\xe1\xbd"
1248              "\x52\x3e\x5a\xda\x76\x05\xb7\x91\xfd\x8b",
1249    }, {
1250        .key = "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1251            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1252            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1253            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1254            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1255            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1256            "\xaa\xaa",
1257        .ksize = 80,
1258        .plaintext = "Test Using Larger Than Block-Size Key and Larger Than One "
1259               "Block-Size Data",
1260        .psize = 73,
1261        .digest = "\x69\xea\x60\x79\x8d\x71\x61\x6c\xce\x5f"
1262              "\xd0\x87\x1e\x23\x75\x4c\xd7\x5d\x5a\x0a",
1263    },
1264};
1265
1266/*
1267 * HMAC-SHA1 test vectors from RFC2202
1268 */
1269#define HMAC_SHA1_TEST_VECTORS 7
1270
1271static struct hash_testvec hmac_sha1_tv_template[] = {
1272    {
1273        .key = "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b",
1274        .ksize = 20,
1275        .plaintext = "Hi There",
1276        .psize = 8,
1277        .digest = "\xb6\x17\x31\x86\x55\x05\x72\x64"
1278              "\xe2\x8b\xc0\xb6\xfb\x37\x8c\x8e\xf1"
1279              "\x46\xbe",
1280    }, {
1281        .key = "Jefe",
1282        .ksize = 4,
1283        .plaintext = "what do ya want for nothing?",
1284        .psize = 28,
1285        .digest = "\xef\xfc\xdf\x6a\xe5\xeb\x2f\xa2\xd2\x74"
1286              "\x16\xd5\xf1\x84\xdf\x9c\x25\x9a\x7c\x79",
1287        .np = 2,
1288        .tap = { 14, 14 }
1289    }, {
1290        .key = "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa",
1291        .ksize = 20,
1292        .plaintext = "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
1293            "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
1294            "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
1295            "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd",
1296        .psize = 50,
1297        .digest = "\x12\x5d\x73\x42\xb9\xac\x11\xcd\x91\xa3"
1298              "\x9a\xf4\x8a\xa1\x7b\x4f\x63\xf1\x75\xd3",
1299    }, {
1300        .key = "\x01\x02\x03\x04\x05\x06\x07\x08"
1301              "\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10"
1302              "\x11\x12\x13\x14\x15\x16\x17\x18\x19",
1303        .ksize = 25,
1304        .plaintext = "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
1305            "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
1306            "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
1307            "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd",
1308        .psize = 50,
1309        .digest = "\x4c\x90\x07\xf4\x02\x62\x50\xc6\xbc\x84"
1310              "\x14\xf9\xbf\x50\xc8\x6c\x2d\x72\x35\xda",
1311    }, {
1312        .key = "\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c",
1313        .ksize = 20,
1314        .plaintext = "Test With Truncation",
1315        .psize = 20,
1316        .digest = "\x4c\x1a\x03\x42\x4b\x55\xe0\x7f\xe7\xf2"
1317              "\x7b\xe1\xd5\x8b\xb9\x32\x4a\x9a\x5a\x04",
1318    }, {
1319        .key = "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1320            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1321            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1322            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1323            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1324            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1325            "\xaa\xaa",
1326        .ksize = 80,
1327        .plaintext = "Test Using Larger Than Block-Size Key - Hash Key First",
1328        .psize = 54,
1329        .digest = "\xaa\x4a\xe5\xe1\x52\x72\xd0\x0e\x95\x70"
1330              "\x56\x37\xce\x8a\x3b\x55\xed\x40\x21\x12",
1331    }, {
1332        .key = "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1333            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1334            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1335            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1336            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1337            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1338            "\xaa\xaa",
1339        .ksize = 80,
1340        .plaintext = "Test Using Larger Than Block-Size Key and Larger Than One "
1341               "Block-Size Data",
1342        .psize = 73,
1343        .digest = "\xe8\xe9\x9d\x0f\x45\x23\x7d\x78\x6d\x6b"
1344              "\xba\xa7\x96\x5c\x78\x08\xbb\xff\x1a\x91",
1345    },
1346};
1347
1348
1349/*
1350 * SHA224 HMAC test vectors from RFC4231
1351 */
1352#define HMAC_SHA224_TEST_VECTORS 4
1353
1354static struct hash_testvec hmac_sha224_tv_template[] = {
1355    {
1356        .key = "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"
1357            "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"
1358            "\x0b\x0b\x0b\x0b",
1359        .ksize = 20,
1360        /* ("Hi There") */
1361        .plaintext = "\x48\x69\x20\x54\x68\x65\x72\x65",
1362        .psize = 8,
1363        .digest = "\x89\x6f\xb1\x12\x8a\xbb\xdf\x19"
1364            "\x68\x32\x10\x7c\xd4\x9d\xf3\x3f"
1365            "\x47\xb4\xb1\x16\x99\x12\xba\x4f"
1366            "\x53\x68\x4b\x22",
1367    }, {
1368        .key = "Jefe",
1369        .ksize = 4,
1370        /* ("what do ya want for nothing?") */
1371        .plaintext = "\x77\x68\x61\x74\x20\x64\x6f\x20"
1372            "\x79\x61\x20\x77\x61\x6e\x74\x20"
1373            "\x66\x6f\x72\x20\x6e\x6f\x74\x68"
1374            "\x69\x6e\x67\x3f",
1375        .psize = 28,
1376        .digest = "\xa3\x0e\x01\x09\x8b\xc6\xdb\xbf"
1377            "\x45\x69\x0f\x3a\x7e\x9e\x6d\x0f"
1378            "\x8b\xbe\xa2\xa3\x9e\x61\x48\x00"
1379            "\x8f\xd0\x5e\x44",
1380        .np = 4,
1381        .tap = { 7, 7, 7, 7 }
1382    }, {
1383        .key = "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1384            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1385            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1386            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1387            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1388            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1389            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1390            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1391            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1392            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1393            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1394            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1395            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1396            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1397            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1398            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1399            "\xaa\xaa\xaa",
1400        .ksize = 131,
1401        /* ("Test Using Larger Than Block-Size Key - Hash Key First") */
1402        .plaintext = "\x54\x65\x73\x74\x20\x55\x73\x69"
1403            "\x6e\x67\x20\x4c\x61\x72\x67\x65"
1404            "\x72\x20\x54\x68\x61\x6e\x20\x42"
1405            "\x6c\x6f\x63\x6b\x2d\x53\x69\x7a"
1406            "\x65\x20\x4b\x65\x79\x20\x2d\x20"
1407            "\x48\x61\x73\x68\x20\x4b\x65\x79"
1408            "\x20\x46\x69\x72\x73\x74",
1409        .psize = 54,
1410        .digest = "\x95\xe9\xa0\xdb\x96\x20\x95\xad"
1411            "\xae\xbe\x9b\x2d\x6f\x0d\xbc\xe2"
1412            "\xd4\x99\xf1\x12\xf2\xd2\xb7\x27"
1413            "\x3f\xa6\x87\x0e",
1414    }, {
1415        .key = "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1416            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1417            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1418            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1419            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1420            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1421            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1422            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1423            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1424            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1425            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1426            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1427            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1428            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1429            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1430            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1431            "\xaa\xaa\xaa",
1432        .ksize = 131,
1433        /* ("This is a test using a larger than block-size key and a")
1434        (" larger than block-size data. The key needs to be")
1435            (" hashed before being used by the HMAC algorithm.") */
1436        .plaintext = "\x54\x68\x69\x73\x20\x69\x73\x20"
1437            "\x61\x20\x74\x65\x73\x74\x20\x75"
1438            "\x73\x69\x6e\x67\x20\x61\x20\x6c"
1439            "\x61\x72\x67\x65\x72\x20\x74\x68"
1440            "\x61\x6e\x20\x62\x6c\x6f\x63\x6b"
1441            "\x2d\x73\x69\x7a\x65\x20\x6b\x65"
1442            "\x79\x20\x61\x6e\x64\x20\x61\x20"
1443            "\x6c\x61\x72\x67\x65\x72\x20\x74"
1444            "\x68\x61\x6e\x20\x62\x6c\x6f\x63"
1445            "\x6b\x2d\x73\x69\x7a\x65\x20\x64"
1446            "\x61\x74\x61\x2e\x20\x54\x68\x65"
1447            "\x20\x6b\x65\x79\x20\x6e\x65\x65"
1448            "\x64\x73\x20\x74\x6f\x20\x62\x65"
1449            "\x20\x68\x61\x73\x68\x65\x64\x20"
1450            "\x62\x65\x66\x6f\x72\x65\x20\x62"
1451            "\x65\x69\x6e\x67\x20\x75\x73\x65"
1452            "\x64\x20\x62\x79\x20\x74\x68\x65"
1453            "\x20\x48\x4d\x41\x43\x20\x61\x6c"
1454            "\x67\x6f\x72\x69\x74\x68\x6d\x2e",
1455        .psize = 152,
1456        .digest = "\x3a\x85\x41\x66\xac\x5d\x9f\x02"
1457            "\x3f\x54\xd5\x17\xd0\xb3\x9d\xbd"
1458            "\x94\x67\x70\xdb\x9c\x2b\x95\xc9"
1459            "\xf6\xf5\x65\xd1",
1460    },
1461};
1462
1463/*
1464 * HMAC-SHA256 test vectors from
1465 * draft-ietf-ipsec-ciph-sha-256-01.txt
1466 */
1467#define HMAC_SHA256_TEST_VECTORS 10
1468
1469static struct hash_testvec hmac_sha256_tv_template[] = {
1470    {
1471        .key = "\x01\x02\x03\x04\x05\x06\x07\x08"
1472              "\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10"
1473              "\x11\x12\x13\x14\x15\x16\x17\x18"
1474              "\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20",
1475        .ksize = 32,
1476        .plaintext = "abc",
1477        .psize = 3,
1478        .digest = "\xa2\x1b\x1f\x5d\x4c\xf4\xf7\x3a"
1479              "\x4d\xd9\x39\x75\x0f\x7a\x06\x6a"
1480              "\x7f\x98\xcc\x13\x1c\xb1\x6a\x66"
1481              "\x92\x75\x90\x21\xcf\xab\x81\x81",
1482    }, {
1483        .key = "\x01\x02\x03\x04\x05\x06\x07\x08"
1484              "\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10"
1485              "\x11\x12\x13\x14\x15\x16\x17\x18"
1486              "\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20",
1487        .ksize = 32,
1488        .plaintext = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
1489        .psize = 56,
1490        .digest = "\x10\x4f\xdc\x12\x57\x32\x8f\x08"
1491              "\x18\x4b\xa7\x31\x31\xc5\x3c\xae"
1492              "\xe6\x98\xe3\x61\x19\x42\x11\x49"
1493              "\xea\x8c\x71\x24\x56\x69\x7d\x30",
1494    }, {
1495        .key = "\x01\x02\x03\x04\x05\x06\x07\x08"
1496              "\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10"
1497              "\x11\x12\x13\x14\x15\x16\x17\x18"
1498              "\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20",
1499        .ksize = 32,
1500        .plaintext = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"
1501               "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
1502        .psize = 112,
1503        .digest = "\x47\x03\x05\xfc\x7e\x40\xfe\x34"
1504              "\xd3\xee\xb3\xe7\x73\xd9\x5a\xab"
1505              "\x73\xac\xf0\xfd\x06\x04\x47\xa5"
1506              "\xeb\x45\x95\xbf\x33\xa9\xd1\xa3",
1507    }, {
1508        .key = "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"
1509            "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"
1510            "\x0b\x0b\x0b\x0b\x0b\x0b",
1511        .ksize = 32,
1512        .plaintext = "Hi There",
1513        .psize = 8,
1514        .digest = "\x19\x8a\x60\x7e\xb4\x4b\xfb\xc6"
1515              "\x99\x03\xa0\xf1\xcf\x2b\xbd\xc5"
1516              "\xba\x0a\xa3\xf3\xd9\xae\x3c\x1c"
1517              "\x7a\x3b\x16\x96\xa0\xb6\x8c\xf7",
1518    }, {
1519        .key = "Jefe",
1520        .ksize = 4,
1521        .plaintext = "what do ya want for nothing?",
1522        .psize = 28,
1523        .digest = "\x5b\xdc\xc1\x46\xbf\x60\x75\x4e"
1524              "\x6a\x04\x24\x26\x08\x95\x75\xc7"
1525              "\x5a\x00\x3f\x08\x9d\x27\x39\x83"
1526              "\x9d\xec\x58\xb9\x64\xec\x38\x43",
1527        .np = 2,
1528        .tap = { 14, 14 }
1529    }, {
1530        .key = "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1531            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1532            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa",
1533        .ksize = 32,
1534        .plaintext = "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
1535            "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
1536            "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd"
1537            "\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd\xdd",
1538        .psize = 50,
1539        .digest = "\xcd\xcb\x12\x20\xd1\xec\xcc\xea"
1540              "\x91\xe5\x3a\xba\x30\x92\xf9\x62"
1541              "\xe5\x49\xfe\x6c\xe9\xed\x7f\xdc"
1542              "\x43\x19\x1f\xbd\xe4\x5c\x30\xb0",
1543    }, {
1544        .key = "\x01\x02\x03\x04\x05\x06\x07\x08"
1545              "\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10"
1546              "\x11\x12\x13\x14\x15\x16\x17\x18"
1547              "\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20"
1548              "\x21\x22\x23\x24\x25",
1549        .ksize = 37,
1550        .plaintext = "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
1551            "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
1552            "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd"
1553            "\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd\xcd",
1554        .psize = 50,
1555        .digest = "\xd4\x63\x3c\x17\xf6\xfb\x8d\x74"
1556              "\x4c\x66\xde\xe0\xf8\xf0\x74\x55"
1557              "\x6e\xc4\xaf\x55\xef\x07\x99\x85"
1558              "\x41\x46\x8e\xb4\x9b\xd2\xe9\x17",
1559    }, {
1560        .key = "\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c"
1561            "\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c\x0c"
1562            "\x0c\x0c\x0c\x0c\x0c\x0c",
1563        .ksize = 32,
1564        .plaintext = "Test With Truncation",
1565        .psize = 20,
1566        .digest = "\x75\x46\xaf\x01\x84\x1f\xc0\x9b"
1567              "\x1a\xb9\xc3\x74\x9a\x5f\x1c\x17"
1568              "\xd4\xf5\x89\x66\x8a\x58\x7b\x27"
1569              "\x00\xa9\xc9\x7c\x11\x93\xcf\x42",
1570    }, {
1571        .key = "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1572            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1573            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1574            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1575            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1576            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1577            "\xaa\xaa",
1578        .ksize = 80,
1579        .plaintext = "Test Using Larger Than Block-Size Key - Hash Key First",
1580        .psize = 54,
1581        .digest = "\x69\x53\x02\x5e\xd9\x6f\x0c\x09"
1582              "\xf8\x0a\x96\xf7\x8e\x65\x38\xdb"
1583              "\xe2\xe7\xb8\x20\xe3\xdd\x97\x0e"
1584              "\x7d\xdd\x39\x09\x1b\x32\x35\x2f",
1585    }, {
1586        .key = "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1587            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1588            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1589            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1590            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1591            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1592            "\xaa\xaa",
1593        .ksize = 80,
1594        .plaintext = "Test Using Larger Than Block-Size Key and Larger Than "
1595               "One Block-Size Data",
1596        .psize = 73,
1597        .digest = "\x63\x55\xac\x22\xe8\x90\xd0\xa3"
1598              "\xc8\x48\x1a\x5c\xa4\x82\x5b\xc8"
1599              "\x84\xd3\xe7\xa1\xff\x98\xa2\xfc"
1600              "\x2a\xc7\xd8\xe0\x64\xc3\xb2\xe6",
1601    },
1602};
1603
1604#define XCBC_AES_TEST_VECTORS 6
1605
1606static struct hash_testvec aes_xcbc128_tv_template[] = {
1607    {
1608        .key = "\x00\x01\x02\x03\x04\x05\x06\x07"
1609              "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
1610        .plaintext = zeroed_string,
1611        .digest = "\x75\xf0\x25\x1d\x52\x8a\xc0\x1c"
1612              "\x45\x73\xdf\xd5\x84\xd7\x9f\x29",
1613        .psize = 0,
1614        .ksize = 16,
1615    }, {
1616        .key = "\x00\x01\x02\x03\x04\x05\x06\x07"
1617              "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
1618        .plaintext = "\x00\x01\x02",
1619        .digest = "\x5b\x37\x65\x80\xae\x2f\x19\xaf"
1620              "\xe7\x21\x9c\xee\xf1\x72\x75\x6f",
1621        .psize = 3,
1622        .ksize = 16,
1623    } , {
1624        .key = "\x00\x01\x02\x03\x04\x05\x06\x07"
1625              "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
1626        .plaintext = "\x00\x01\x02\x03\x04\x05\x06\x07"
1627                 "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
1628        .digest = "\xd2\xa2\x46\xfa\x34\x9b\x68\xa7"
1629              "\x99\x98\xa4\x39\x4f\xf7\xa2\x63",
1630        .psize = 16,
1631        .ksize = 16,
1632    }, {
1633        .key = "\x00\x01\x02\x03\x04\x05\x06\x07"
1634              "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
1635        .plaintext = "\x00\x01\x02\x03\x04\x05\x06\x07"
1636                 "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
1637                 "\x10\x11\x12\x13",
1638        .digest = "\x47\xf5\x1b\x45\x64\x96\x62\x15"
1639              "\xb8\x98\x5c\x63\x05\x5e\xd3\x08",
1640        .tap = { 10, 10 },
1641        .psize = 20,
1642        .np = 2,
1643        .ksize = 16,
1644    }, {
1645        .key = "\x00\x01\x02\x03\x04\x05\x06\x07"
1646              "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
1647        .plaintext = "\x00\x01\x02\x03\x04\x05\x06\x07"
1648                 "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
1649                 "\x10\x11\x12\x13\x14\x15\x16\x17"
1650                 "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f",
1651        .digest = "\xf5\x4f\x0e\xc8\xd2\xb9\xf3\xd3"
1652              "\x68\x07\x73\x4b\xd5\x28\x3f\xd4",
1653        .psize = 32,
1654        .ksize = 16,
1655    }, {
1656        .key = "\x00\x01\x02\x03\x04\x05\x06\x07"
1657              "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
1658        .plaintext = "\x00\x01\x02\x03\x04\x05\x06\x07"
1659                 "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
1660                 "\x10\x11\x12\x13\x14\x15\x16\x17"
1661                 "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f"
1662                 "\x20\x21",
1663        .digest = "\xbe\xcb\xb3\xbc\xcd\xb5\x18\xa3"
1664              "\x06\x77\xd5\x48\x1f\xb6\xb4\xd8",
1665        .tap = { 17, 17 },
1666        .psize = 34,
1667        .np = 2,
1668        .ksize = 16,
1669    }
1670};
1671
1672#define VMAC_AES_TEST_VECTORS 1
1673static char vmac_string[128] = {'\x01', '\x01', '\x01', '\x01',
1674                '\x02', '\x03', '\x02', '\x02',
1675                '\x02', '\x04', '\x01', '\x07',
1676                '\x04', '\x01', '\x04', '\x03',};
1677static struct hash_testvec aes_vmac128_tv_template[] = {
1678    {
1679        .key = "\x00\x01\x02\x03\x04\x05\x06\x07"
1680              "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
1681        .plaintext = vmac_string,
1682        .digest = "\xcb\xd7\x8a\xfd\xb7\x33\x79\xe7",
1683        .psize = 128,
1684        .ksize = 16,
1685    },
1686};
1687
1688/*
1689 * SHA384 HMAC test vectors from RFC4231
1690 */
1691
1692#define HMAC_SHA384_TEST_VECTORS 4
1693
1694static struct hash_testvec hmac_sha384_tv_template[] = {
1695    {
1696        .key = "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"
1697              "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"
1698              "\x0b\x0b\x0b\x0b",
1699        .ksize = 20,
1700        .plaintext = "Hi There",
1701        .psize = 8,
1702        .digest = "\xaf\xd0\x39\x44\xd8\x48\x95\x62"
1703              "\x6b\x08\x25\xf4\xab\x46\x90\x7f"
1704              "\x15\xf9\xda\xdb\xe4\x10\x1e\xc6"
1705              "\x82\xaa\x03\x4c\x7c\xeb\xc5\x9c"
1706              "\xfa\xea\x9e\xa9\x07\x6e\xde\x7f"
1707              "\x4a\xf1\x52\xe8\xb2\xfa\x9c\xb6",
1708    }, {
1709        .key = "Jefe",
1710        .ksize = 4,
1711        .plaintext = "what do ya want for nothing?",
1712        .psize = 28,
1713        .digest = "\xaf\x45\xd2\xe3\x76\x48\x40\x31"
1714              "\x61\x7f\x78\xd2\xb5\x8a\x6b\x1b"
1715              "\x9c\x7e\xf4\x64\xf5\xa0\x1b\x47"
1716              "\xe4\x2e\xc3\x73\x63\x22\x44\x5e"
1717              "\x8e\x22\x40\xca\x5e\x69\xe2\xc7"
1718              "\x8b\x32\x39\xec\xfa\xb2\x16\x49",
1719        .np = 4,
1720        .tap = { 7, 7, 7, 7 }
1721    }, {
1722        .key = "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1723              "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1724              "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1725              "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1726              "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1727              "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1728              "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1729              "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1730              "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1731              "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1732              "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1733              "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1734              "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1735              "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1736              "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1737              "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1738              "\xaa\xaa\xaa",
1739        .ksize = 131,
1740        .plaintext = "Test Using Larger Than Block-Siz"
1741               "e Key - Hash Key First",
1742        .psize = 54,
1743        .digest = "\x4e\xce\x08\x44\x85\x81\x3e\x90"
1744              "\x88\xd2\xc6\x3a\x04\x1b\xc5\xb4"
1745              "\x4f\x9e\xf1\x01\x2a\x2b\x58\x8f"
1746              "\x3c\xd1\x1f\x05\x03\x3a\xc4\xc6"
1747              "\x0c\x2e\xf6\xab\x40\x30\xfe\x82"
1748              "\x96\x24\x8d\xf1\x63\xf4\x49\x52",
1749    }, {
1750        .key = "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1751              "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1752              "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1753              "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1754              "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1755              "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1756              "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1757              "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1758              "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1759              "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1760              "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1761              "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1762              "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1763              "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1764              "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1765              "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1766              "\xaa\xaa\xaa",
1767        .ksize = 131,
1768        .plaintext = "This is a test u"
1769               "sing a larger th"
1770               "an block-size ke"
1771               "y and a larger t"
1772               "han block-size d"
1773               "ata. The key nee"
1774               "ds to be hashed "
1775               "before being use"
1776               "d by the HMAC al"
1777               "gorithm.",
1778        .psize = 152,
1779        .digest = "\x66\x17\x17\x8e\x94\x1f\x02\x0d"
1780              "\x35\x1e\x2f\x25\x4e\x8f\xd3\x2c"
1781              "\x60\x24\x20\xfe\xb0\xb8\xfb\x9a"
1782              "\xdc\xce\xbb\x82\x46\x1e\x99\xc5"
1783              "\xa6\x78\xcc\x31\xe7\x99\x17\x6d"
1784              "\x38\x60\xe6\x11\x0c\x46\x52\x3e",
1785    },
1786};
1787
1788/*
1789 * SHA512 HMAC test vectors from RFC4231
1790 */
1791
1792#define HMAC_SHA512_TEST_VECTORS 4
1793
1794static struct hash_testvec hmac_sha512_tv_template[] = {
1795    {
1796        .key = "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"
1797              "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"
1798              "\x0b\x0b\x0b\x0b",
1799        .ksize = 20,
1800        .plaintext = "Hi There",
1801        .psize = 8,
1802        .digest = "\x87\xaa\x7c\xde\xa5\xef\x61\x9d"
1803              "\x4f\xf0\xb4\x24\x1a\x1d\x6c\xb0"
1804              "\x23\x79\xf4\xe2\xce\x4e\xc2\x78"
1805              "\x7a\xd0\xb3\x05\x45\xe1\x7c\xde"
1806              "\xda\xa8\x33\xb7\xd6\xb8\xa7\x02"
1807              "\x03\x8b\x27\x4e\xae\xa3\xf4\xe4"
1808              "\xbe\x9d\x91\x4e\xeb\x61\xf1\x70"
1809              "\x2e\x69\x6c\x20\x3a\x12\x68\x54",
1810    }, {
1811        .key = "Jefe",
1812        .ksize = 4,
1813        .plaintext = "what do ya want for nothing?",
1814        .psize = 28,
1815        .digest = "\x16\x4b\x7a\x7b\xfc\xf8\x19\xe2"
1816              "\xe3\x95\xfb\xe7\x3b\x56\xe0\xa3"
1817              "\x87\xbd\x64\x22\x2e\x83\x1f\xd6"
1818              "\x10\x27\x0c\xd7\xea\x25\x05\x54"
1819              "\x97\x58\xbf\x75\xc0\x5a\x99\x4a"
1820              "\x6d\x03\x4f\x65\xf8\xf0\xe6\xfd"
1821              "\xca\xea\xb1\xa3\x4d\x4a\x6b\x4b"
1822              "\x63\x6e\x07\x0a\x38\xbc\xe7\x37",
1823        .np = 4,
1824        .tap = { 7, 7, 7, 7 }
1825    }, {
1826        .key = "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1827              "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1828              "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1829              "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1830              "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1831              "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1832              "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1833              "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1834              "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1835              "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1836              "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1837              "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1838              "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1839              "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1840              "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1841              "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1842              "\xaa\xaa\xaa",
1843        .ksize = 131,
1844        .plaintext = "Test Using Large"
1845               "r Than Block-Siz"
1846               "e Key - Hash Key"
1847               " First",
1848        .psize = 54,
1849        .digest = "\x80\xb2\x42\x63\xc7\xc1\xa3\xeb"
1850            "\xb7\x14\x93\xc1\xdd\x7b\xe8\xb4"
1851            "\x9b\x46\xd1\xf4\x1b\x4a\xee\xc1"
1852            "\x12\x1b\x01\x37\x83\xf8\xf3\x52"
1853            "\x6b\x56\xd0\x37\xe0\x5f\x25\x98"
1854            "\xbd\x0f\xd2\x21\x5d\x6a\x1e\x52"
1855            "\x95\xe6\x4f\x73\xf6\x3f\x0a\xec"
1856            "\x8b\x91\x5a\x98\x5d\x78\x65\x98",
1857    }, {
1858        .key = "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1859            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1860            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1861            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1862            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1863            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1864            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1865            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1866            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1867            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1868            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1869            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1870            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1871            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1872            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1873            "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa"
1874            "\xaa\xaa\xaa",
1875        .ksize = 131,
1876        .plaintext =
1877              "This is a test u"
1878              "sing a larger th"
1879              "an block-size ke"
1880              "y and a larger t"
1881              "han block-size d"
1882              "ata. The key nee"
1883              "ds to be hashed "
1884              "before being use"
1885              "d by the HMAC al"
1886              "gorithm.",
1887        .psize = 152,
1888        .digest = "\xe3\x7b\x6a\x77\x5d\xc8\x7d\xba"
1889            "\xa4\xdf\xa9\xf9\x6e\x5e\x3f\xfd"
1890            "\xde\xbd\x71\xf8\x86\x72\x89\x86"
1891            "\x5d\xf5\xa3\x2d\x20\xcd\xc9\x44"
1892            "\xb6\x02\x2c\xac\x3c\x49\x82\xb1"
1893            "\x0d\x5e\xeb\x55\xc3\xe4\xde\x15"
1894            "\x13\x46\x76\xfb\x6d\xe0\x44\x60"
1895            "\x65\xc9\x74\x40\xfa\x8c\x6a\x58",
1896    },
1897};
1898
1899/*
1900 * DES test vectors.
1901 */
1902#define DES_ENC_TEST_VECTORS 10
1903#define DES_DEC_TEST_VECTORS 4
1904#define DES_CBC_ENC_TEST_VECTORS 5
1905#define DES_CBC_DEC_TEST_VECTORS 4
1906#define DES3_EDE_ENC_TEST_VECTORS 3
1907#define DES3_EDE_DEC_TEST_VECTORS 3
1908#define DES3_EDE_CBC_ENC_TEST_VECTORS 1
1909#define DES3_EDE_CBC_DEC_TEST_VECTORS 1
1910
1911static struct cipher_testvec des_enc_tv_template[] = {
1912    { /* From Applied Cryptography */
1913        .key = "\x01\x23\x45\x67\x89\xab\xcd\xef",
1914        .klen = 8,
1915        .input = "\x01\x23\x45\x67\x89\xab\xcd\xe7",
1916        .ilen = 8,
1917        .result = "\xc9\x57\x44\x25\x6a\x5e\xd3\x1d",
1918        .rlen = 8,
1919    }, { /* Same key, different plaintext block */
1920        .key = "\x01\x23\x45\x67\x89\xab\xcd\xef",
1921        .klen = 8,
1922        .input = "\x22\x33\x44\x55\x66\x77\x88\x99",
1923        .ilen = 8,
1924        .result = "\xf7\x9c\x89\x2a\x33\x8f\x4a\x8b",
1925        .rlen = 8,
1926    }, { /* Sbox test from NBS */
1927        .key = "\x7c\xa1\x10\x45\x4a\x1a\x6e\x57",
1928        .klen = 8,
1929        .input = "\x01\xa1\xd6\xd0\x39\x77\x67\x42",
1930        .ilen = 8,
1931        .result = "\x69\x0f\x5b\x0d\x9a\x26\x93\x9b",
1932        .rlen = 8,
1933    }, { /* Three blocks */
1934        .key = "\x01\x23\x45\x67\x89\xab\xcd\xef",
1935        .klen = 8,
1936        .input = "\x01\x23\x45\x67\x89\xab\xcd\xe7"
1937              "\x22\x33\x44\x55\x66\x77\x88\x99"
1938              "\xca\xfe\xba\xbe\xfe\xed\xbe\xef",
1939        .ilen = 24,
1940        .result = "\xc9\x57\x44\x25\x6a\x5e\xd3\x1d"
1941              "\xf7\x9c\x89\x2a\x33\x8f\x4a\x8b"
1942              "\xb4\x99\x26\xf7\x1f\xe1\xd4\x90",
1943        .rlen = 24,
1944    }, { /* Weak key */
1945        .fail = 1,
1946        .wk = 1,
1947        .key = "\x01\x01\x01\x01\x01\x01\x01\x01",
1948        .klen = 8,
1949        .input = "\x01\x23\x45\x67\x89\xab\xcd\xe7",
1950        .ilen = 8,
1951        .result = "\xc9\x57\x44\x25\x6a\x5e\xd3\x1d",
1952        .rlen = 8,
1953    }, { /* Two blocks -- for testing encryption across pages */
1954        .key = "\x01\x23\x45\x67\x89\xab\xcd\xef",
1955        .klen = 8,
1956        .input = "\x01\x23\x45\x67\x89\xab\xcd\xe7"
1957              "\x22\x33\x44\x55\x66\x77\x88\x99",
1958        .ilen = 16,
1959        .result = "\xc9\x57\x44\x25\x6a\x5e\xd3\x1d"
1960              "\xf7\x9c\x89\x2a\x33\x8f\x4a\x8b",
1961        .rlen = 16,
1962        .np = 2,
1963        .tap = { 8, 8 }
1964    }, { /* Four blocks -- for testing encryption with chunking */
1965        .key = "\x01\x23\x45\x67\x89\xab\xcd\xef",
1966        .klen = 8,
1967        .input = "\x01\x23\x45\x67\x89\xab\xcd\xe7"
1968              "\x22\x33\x44\x55\x66\x77\x88\x99"
1969              "\xca\xfe\xba\xbe\xfe\xed\xbe\xef"
1970              "\x22\x33\x44\x55\x66\x77\x88\x99",
1971        .ilen = 32,
1972        .result = "\xc9\x57\x44\x25\x6a\x5e\xd3\x1d"
1973              "\xf7\x9c\x89\x2a\x33\x8f\x4a\x8b"
1974              "\xb4\x99\x26\xf7\x1f\xe1\xd4\x90"
1975              "\xf7\x9c\x89\x2a\x33\x8f\x4a\x8b",
1976        .rlen = 32,
1977        .np = 3,
1978        .tap = { 14, 10, 8 }
1979    }, {
1980        .key = "\x01\x23\x45\x67\x89\xab\xcd\xef",
1981        .klen = 8,
1982        .input = "\x01\x23\x45\x67\x89\xab\xcd\xe7"
1983              "\x22\x33\x44\x55\x66\x77\x88\x99"
1984              "\xca\xfe\xba\xbe\xfe\xed\xbe\xef",
1985        .ilen = 24,
1986        .result = "\xc9\x57\x44\x25\x6a\x5e\xd3\x1d"
1987              "\xf7\x9c\x89\x2a\x33\x8f\x4a\x8b"
1988              "\xb4\x99\x26\xf7\x1f\xe1\xd4\x90",
1989        .rlen = 24,
1990        .np = 4,
1991        .tap = { 2, 1, 3, 18 }
1992    }, {
1993        .key = "\x01\x23\x45\x67\x89\xab\xcd\xef",
1994        .klen = 8,
1995        .input = "\x01\x23\x45\x67\x89\xab\xcd\xe7"
1996              "\x22\x33\x44\x55\x66\x77\x88\x99",
1997        .ilen = 16,
1998        .result = "\xc9\x57\x44\x25\x6a\x5e\xd3\x1d"
1999              "\xf7\x9c\x89\x2a\x33\x8f\x4a\x8b",
2000        .rlen = 16,
2001        .np = 5,
2002        .tap = { 2, 2, 2, 2, 8 }
2003    }, {
2004        .key = "\x01\x23\x45\x67\x89\xab\xcd\xef",
2005        .klen = 8,
2006        .input = "\x01\x23\x45\x67\x89\xab\xcd\xe7",
2007        .ilen = 8,
2008        .result = "\xc9\x57\x44\x25\x6a\x5e\xd3\x1d",
2009        .rlen = 8,
2010        .np = 8,
2011        .tap = { 1, 1, 1, 1, 1, 1, 1, 1 }
2012    },
2013};
2014
2015static struct cipher_testvec des_dec_tv_template[] = {
2016    { /* From Applied Cryptography */
2017        .key = "\x01\x23\x45\x67\x89\xab\xcd\xef",
2018        .klen = 8,
2019        .input = "\xc9\x57\x44\x25\x6a\x5e\xd3\x1d",
2020        .ilen = 8,
2021        .result = "\x01\x23\x45\x67\x89\xab\xcd\xe7",
2022        .rlen = 8,
2023    }, { /* Sbox test from NBS */
2024        .key = "\x7c\xa1\x10\x45\x4a\x1a\x6e\x57",
2025        .klen = 8,
2026        .input = "\x69\x0f\x5b\x0d\x9a\x26\x93\x9b",
2027        .ilen = 8,
2028        .result = "\x01\xa1\xd6\xd0\x39\x77\x67\x42",
2029        .rlen = 8,
2030    }, { /* Two blocks, for chunking test */
2031        .key = "\x01\x23\x45\x67\x89\xab\xcd\xef",
2032        .klen = 8,
2033        .input = "\xc9\x57\x44\x25\x6a\x5e\xd3\x1d"
2034              "\x69\x0f\x5b\x0d\x9a\x26\x93\x9b",
2035        .ilen = 16,
2036        .result = "\x01\x23\x45\x67\x89\xab\xcd\xe7"
2037              "\xa3\x99\x7b\xca\xaf\x69\xa0\xf5",
2038        .rlen = 16,
2039        .np = 2,
2040        .tap = { 8, 8 }
2041    }, {
2042        .key = "\x01\x23\x45\x67\x89\xab\xcd\xef",
2043        .klen = 8,
2044        .input = "\xc9\x57\x44\x25\x6a\x5e\xd3\x1d"
2045              "\x69\x0f\x5b\x0d\x9a\x26\x93\x9b",
2046        .ilen = 16,
2047        .result = "\x01\x23\x45\x67\x89\xab\xcd\xe7"
2048              "\xa3\x99\x7b\xca\xaf\x69\xa0\xf5",
2049        .rlen = 16,
2050        .np = 3,
2051        .tap = { 3, 12, 1 }
2052    },
2053};
2054
2055static struct cipher_testvec des_cbc_enc_tv_template[] = {
2056    { /* From OpenSSL */
2057        .key = "\x01\x23\x45\x67\x89\xab\xcd\xef",
2058        .klen = 8,
2059        .iv = "\xfe\xdc\xba\x98\x76\x54\x32\x10",
2060        .input = "\x37\x36\x35\x34\x33\x32\x31\x20"
2061              "\x4e\x6f\x77\x20\x69\x73\x20\x74"
2062              "\x68\x65\x20\x74\x69\x6d\x65\x20",
2063        .ilen = 24,
2064        .result = "\xcc\xd1\x73\xff\xab\x20\x39\xf4"
2065              "\xac\xd8\xae\xfd\xdf\xd8\xa1\xeb"
2066              "\x46\x8e\x91\x15\x78\x88\xba\x68",
2067        .rlen = 24,
2068    }, { /* FIPS Pub 81 */
2069        .key = "\x01\x23\x45\x67\x89\xab\xcd\xef",
2070        .klen = 8,
2071        .iv = "\x12\x34\x56\x78\x90\xab\xcd\xef",
2072        .input = "\x4e\x6f\x77\x20\x69\x73\x20\x74",
2073        .ilen = 8,
2074        .result = "\xe5\xc7\xcd\xde\x87\x2b\xf2\x7c",
2075        .rlen = 8,
2076    }, {
2077        .key = "\x01\x23\x45\x67\x89\xab\xcd\xef",
2078        .klen = 8,
2079        .iv = "\xe5\xc7\xcd\xde\x87\x2b\xf2\x7c",
2080        .input = "\x68\x65\x20\x74\x69\x6d\x65\x20",
2081        .ilen = 8,
2082        .result = "\x43\xe9\x34\x00\x8c\x38\x9c\x0f",
2083        .rlen = 8,
2084    }, {
2085        .key = "\x01\x23\x45\x67\x89\xab\xcd\xef",
2086        .klen = 8,
2087        .iv = "\x43\xe9\x34\x00\x8c\x38\x9c\x0f",
2088        .input = "\x66\x6f\x72\x20\x61\x6c\x6c\x20",
2089        .ilen = 8,
2090        .result = "\x68\x37\x88\x49\x9a\x7c\x05\xf6",
2091        .rlen = 8,
2092    }, { /* Copy of openssl vector for chunk testing */
2093         /* From OpenSSL */
2094        .key = "\x01\x23\x45\x67\x89\xab\xcd\xef",
2095        .klen = 8,
2096        .iv = "\xfe\xdc\xba\x98\x76\x54\x32\x10",
2097        .input = "\x37\x36\x35\x34\x33\x32\x31\x20"
2098              "\x4e\x6f\x77\x20\x69\x73\x20\x74"
2099              "\x68\x65\x20\x74\x69\x6d\x65\x20",
2100        .ilen = 24,
2101        .result = "\xcc\xd1\x73\xff\xab\x20\x39\xf4"
2102              "\xac\xd8\xae\xfd\xdf\xd8\xa1\xeb"
2103              "\x46\x8e\x91\x15\x78\x88\xba\x68",
2104        .rlen = 24,
2105        .np = 2,
2106        .tap = { 13, 11 }
2107    },
2108};
2109
2110static struct cipher_testvec des_cbc_dec_tv_template[] = {
2111    { /* FIPS Pub 81 */
2112        .key = "\x01\x23\x45\x67\x89\xab\xcd\xef",
2113        .klen = 8,
2114        .iv = "\x12\x34\x56\x78\x90\xab\xcd\xef",
2115        .input = "\xe5\xc7\xcd\xde\x87\x2b\xf2\x7c",
2116        .ilen = 8,
2117        .result = "\x4e\x6f\x77\x20\x69\x73\x20\x74",
2118        .rlen = 8,
2119    }, {
2120        .key = "\x01\x23\x45\x67\x89\xab\xcd\xef",
2121        .klen = 8,
2122        .iv = "\xe5\xc7\xcd\xde\x87\x2b\xf2\x7c",
2123        .input = "\x43\xe9\x34\x00\x8c\x38\x9c\x0f",
2124        .ilen = 8,
2125        .result = "\x68\x65\x20\x74\x69\x6d\x65\x20",
2126        .rlen = 8,
2127    }, {
2128        .key = "\x01\x23\x45\x67\x89\xab\xcd\xef",
2129        .klen = 8,
2130        .iv = "\x43\xe9\x34\x00\x8c\x38\x9c\x0f",
2131        .input = "\x68\x37\x88\x49\x9a\x7c\x05\xf6",
2132        .ilen = 8,
2133        .result = "\x66\x6f\x72\x20\x61\x6c\x6c\x20",
2134        .rlen = 8,
2135    }, { /* Copy of above, for chunk testing */
2136        .key = "\x01\x23\x45\x67\x89\xab\xcd\xef",
2137        .klen = 8,
2138        .iv = "\x43\xe9\x34\x00\x8c\x38\x9c\x0f",
2139        .input = "\x68\x37\x88\x49\x9a\x7c\x05\xf6",
2140        .ilen = 8,
2141        .result = "\x66\x6f\x72\x20\x61\x6c\x6c\x20",
2142        .rlen = 8,
2143        .np = 2,
2144        .tap = { 4, 4 }
2145    },
2146};
2147
2148static struct cipher_testvec des3_ede_enc_tv_template[] = {
2149    { /* These are from openssl */
2150        .key = "\x01\x23\x45\x67\x89\xab\xcd\xef"
2151              "\x55\x55\x55\x55\x55\x55\x55\x55"
2152              "\xfe\xdc\xba\x98\x76\x54\x32\x10",
2153        .klen = 24,
2154        .input = "\x73\x6f\x6d\x65\x64\x61\x74\x61",
2155        .ilen = 8,
2156        .result = "\x18\xd7\x48\xe5\x63\x62\x05\x72",
2157        .rlen = 8,
2158    }, {
2159        .key = "\x03\x52\x02\x07\x67\x20\x82\x17"
2160              "\x86\x02\x87\x66\x59\x08\x21\x98"
2161              "\x64\x05\x6a\xbd\xfe\xa9\x34\x57",
2162        .klen = 24,
2163        .input = "\x73\x71\x75\x69\x67\x67\x6c\x65",
2164        .ilen = 8,
2165        .result = "\xc0\x7d\x2a\x0f\xa5\x66\xfa\x30",
2166        .rlen = 8,
2167    }, {
2168        .key = "\x10\x46\x10\x34\x89\x98\x80\x20"
2169              "\x91\x07\xd0\x15\x89\x19\x01\x01"
2170              "\x19\x07\x92\x10\x98\x1a\x01\x01",
2171        .klen = 24,
2172        .input = "\x00\x00\x00\x00\x00\x00\x00\x00",
2173        .ilen = 8,
2174        .result = "\xe1\xef\x62\xc3\x32\xfe\x82\x5b",
2175        .rlen = 8,
2176    },
2177};
2178
2179static struct cipher_testvec des3_ede_dec_tv_template[] = {
2180    { /* These are from openssl */
2181        .key = "\x01\x23\x45\x67\x89\xab\xcd\xef"
2182              "\x55\x55\x55\x55\x55\x55\x55\x55"
2183              "\xfe\xdc\xba\x98\x76\x54\x32\x10",
2184        .klen = 24,
2185        .input = "\x18\xd7\x48\xe5\x63\x62\x05\x72",
2186        .ilen = 8,
2187        .result = "\x73\x6f\x6d\x65\x64\x61\x74\x61",
2188        .rlen = 8,
2189    }, {
2190        .key = "\x03\x52\x02\x07\x67\x20\x82\x17"
2191              "\x86\x02\x87\x66\x59\x08\x21\x98"
2192              "\x64\x05\x6a\xbd\xfe\xa9\x34\x57",
2193        .klen = 24,
2194        .input = "\xc0\x7d\x2a\x0f\xa5\x66\xfa\x30",
2195        .ilen = 8,
2196        .result = "\x73\x71\x75\x69\x67\x67\x6c\x65",
2197        .rlen = 8,
2198    }, {
2199        .key = "\x10\x46\x10\x34\x89\x98\x80\x20"
2200              "\x91\x07\xd0\x15\x89\x19\x01\x01"
2201              "\x19\x07\x92\x10\x98\x1a\x01\x01",
2202        .klen = 24,
2203        .input = "\xe1\xef\x62\xc3\x32\xfe\x82\x5b",
2204        .ilen = 8,
2205        .result = "\x00\x00\x00\x00\x00\x00\x00\x00",
2206        .rlen = 8,
2207    },
2208};
2209
2210static struct cipher_testvec des3_ede_cbc_enc_tv_template[] = {
2211    { /* Generated from openssl */
2212        .key = "\xE9\xC0\xFF\x2E\x76\x0B\x64\x24"
2213              "\x44\x4D\x99\x5A\x12\xD6\x40\xC0"
2214              "\xEA\xC2\x84\xE8\x14\x95\xDB\xE8",
2215        .klen = 24,
2216        .iv = "\x7D\x33\x88\x93\x0F\x93\xB2\x42",
2217        .input = "\x6f\x54\x20\x6f\x61\x4d\x79\x6e"
2218              "\x53\x20\x63\x65\x65\x72\x73\x74"
2219              "\x54\x20\x6f\x6f\x4d\x20\x6e\x61"
2220              "\x20\x79\x65\x53\x72\x63\x74\x65"
2221              "\x20\x73\x6f\x54\x20\x6f\x61\x4d"
2222              "\x79\x6e\x53\x20\x63\x65\x65\x72"
2223              "\x73\x74\x54\x20\x6f\x6f\x4d\x20"
2224              "\x6e\x61\x20\x79\x65\x53\x72\x63"
2225              "\x74\x65\x20\x73\x6f\x54\x20\x6f"
2226              "\x61\x4d\x79\x6e\x53\x20\x63\x65"
2227              "\x65\x72\x73\x74\x54\x20\x6f\x6f"
2228              "\x4d\x20\x6e\x61\x20\x79\x65\x53"
2229              "\x72\x63\x74\x65\x20\x73\x6f\x54"
2230              "\x20\x6f\x61\x4d\x79\x6e\x53\x20"
2231              "\x63\x65\x65\x72\x73\x74\x54\x20"
2232              "\x6f\x6f\x4d\x20\x6e\x61\x0a\x79",
2233        .ilen = 128,
2234        .result = "\x0e\x2d\xb6\x97\x3c\x56\x33\xf4"
2235              "\x67\x17\x21\xc7\x6e\x8a\xd5\x49"
2236              "\x74\xb3\x49\x05\xc5\x1c\xd0\xed"
2237              "\x12\x56\x5c\x53\x96\xb6\x00\x7d"
2238              "\x90\x48\xfc\xf5\x8d\x29\x39\xcc"
2239              "\x8a\xd5\x35\x18\x36\x23\x4e\xd7"
2240              "\x76\xd1\xda\x0c\x94\x67\xbb\x04"
2241              "\x8b\xf2\x03\x6c\xa8\xcf\xb6\xea"
2242              "\x22\x64\x47\xaa\x8f\x75\x13\xbf"
2243              "\x9f\xc2\xc3\xf0\xc9\x56\xc5\x7a"
2244              "\x71\x63\x2e\x89\x7b\x1e\x12\xca"
2245              "\xe2\x5f\xaf\xd8\xa4\xf8\xc9\x7a"
2246              "\xd6\xf9\x21\x31\x62\x44\x45\xa6"
2247              "\xd6\xbc\x5a\xd3\x2d\x54\x43\xcc"
2248              "\x9d\xde\xa5\x70\xe9\x42\x45\x8a"
2249              "\x6b\xfa\xb1\x91\x13\xb0\xd9\x19",
2250        .rlen = 128,
2251    },
2252};
2253
2254static struct cipher_testvec des3_ede_cbc_dec_tv_template[] = {
2255    { /* Generated from openssl */
2256        .key = "\xE9\xC0\xFF\x2E\x76\x0B\x64\x24"
2257              "\x44\x4D\x99\x5A\x12\xD6\x40\xC0"
2258              "\xEA\xC2\x84\xE8\x14\x95\xDB\xE8",
2259        .klen = 24,
2260        .iv = "\x7D\x33\x88\x93\x0F\x93\xB2\x42",
2261        .input = "\x0e\x2d\xb6\x97\x3c\x56\x33\xf4"
2262              "\x67\x17\x21\xc7\x6e\x8a\xd5\x49"
2263              "\x74\xb3\x49\x05\xc5\x1c\xd0\xed"
2264              "\x12\x56\x5c\x53\x96\xb6\x00\x7d"
2265              "\x90\x48\xfc\xf5\x8d\x29\x39\xcc"
2266              "\x8a\xd5\x35\x18\x36\x23\x4e\xd7"
2267              "\x76\xd1\xda\x0c\x94\x67\xbb\x04"
2268              "\x8b\xf2\x03\x6c\xa8\xcf\xb6\xea"
2269              "\x22\x64\x47\xaa\x8f\x75\x13\xbf"
2270              "\x9f\xc2\xc3\xf0\xc9\x56\xc5\x7a"
2271              "\x71\x63\x2e\x89\x7b\x1e\x12\xca"
2272              "\xe2\x5f\xaf\xd8\xa4\xf8\xc9\x7a"
2273              "\xd6\xf9\x21\x31\x62\x44\x45\xa6"
2274              "\xd6\xbc\x5a\xd3\x2d\x54\x43\xcc"
2275              "\x9d\xde\xa5\x70\xe9\x42\x45\x8a"
2276              "\x6b\xfa\xb1\x91\x13\xb0\xd9\x19",
2277        .ilen = 128,
2278        .result = "\x6f\x54\x20\x6f\x61\x4d\x79\x6e"
2279              "\x53\x20\x63\x65\x65\x72\x73\x74"
2280              "\x54\x20\x6f\x6f\x4d\x20\x6e\x61"
2281              "\x20\x79\x65\x53\x72\x63\x74\x65"
2282              "\x20\x73\x6f\x54\x20\x6f\x61\x4d"
2283              "\x79\x6e\x53\x20\x63\x65\x65\x72"
2284              "\x73\x74\x54\x20\x6f\x6f\x4d\x20"
2285              "\x6e\x61\x20\x79\x65\x53\x72\x63"
2286              "\x74\x65\x20\x73\x6f\x54\x20\x6f"
2287              "\x61\x4d\x79\x6e\x53\x20\x63\x65"
2288              "\x65\x72\x73\x74\x54\x20\x6f\x6f"
2289              "\x4d\x20\x6e\x61\x20\x79\x65\x53"
2290              "\x72\x63\x74\x65\x20\x73\x6f\x54"
2291              "\x20\x6f\x61\x4d\x79\x6e\x53\x20"
2292              "\x63\x65\x65\x72\x73\x74\x54\x20"
2293              "\x6f\x6f\x4d\x20\x6e\x61\x0a\x79",
2294        .rlen = 128,
2295    },
2296};
2297
2298/*
2299 * Blowfish test vectors.
2300 */
2301#define BF_ENC_TEST_VECTORS 6
2302#define BF_DEC_TEST_VECTORS 6
2303#define BF_CBC_ENC_TEST_VECTORS 1
2304#define BF_CBC_DEC_TEST_VECTORS 1
2305
2306static struct cipher_testvec bf_enc_tv_template[] = {
2307    { /* DES test vectors from OpenSSL */
2308        .key = "\x00\x00\x00\x00\x00\x00\x00\x00",
2309        .klen = 8,
2310        .input = "\x00\x00\x00\x00\x00\x00\x00\x00",
2311        .ilen = 8,
2312        .result = "\x4e\xf9\x97\x45\x61\x98\xdd\x78",
2313        .rlen = 8,
2314    }, {
2315        .key = "\x1f\x1f\x1f\x1f\x0e\x0e\x0e\x0e",
2316        .klen = 8,
2317        .input = "\x01\x23\x45\x67\x89\xab\xcd\xef",
2318        .ilen = 8,
2319        .result = "\xa7\x90\x79\x51\x08\xea\x3c\xae",
2320        .rlen = 8,
2321    }, {
2322        .key = "\xf0\xe1\xd2\xc3\xb4\xa5\x96\x87",
2323        .klen = 8,
2324        .input = "\xfe\xdc\xba\x98\x76\x54\x32\x10",
2325        .ilen = 8,
2326        .result = "\xe8\x7a\x24\x4e\x2c\xc8\x5e\x82",
2327        .rlen = 8,
2328    }, { /* Vary the keylength... */
2329        .key = "\xf0\xe1\xd2\xc3\xb4\xa5\x96\x87"
2330              "\x78\x69\x5a\x4b\x3c\x2d\x1e\x0f",
2331        .klen = 16,
2332        .input = "\xfe\xdc\xba\x98\x76\x54\x32\x10",
2333        .ilen = 8,
2334        .result = "\x93\x14\x28\x87\xee\x3b\xe1\x5c",
2335        .rlen = 8,
2336    }, {
2337        .key = "\xf0\xe1\xd2\xc3\xb4\xa5\x96\x87"
2338              "\x78\x69\x5a\x4b\x3c\x2d\x1e\x0f"
2339              "\x00\x11\x22\x33\x44",
2340        .klen = 21,
2341        .input = "\xfe\xdc\xba\x98\x76\x54\x32\x10",
2342        .ilen = 8,
2343        .result = "\xe6\xf5\x1e\xd7\x9b\x9d\xb2\x1f",
2344        .rlen = 8,
2345    }, { /* Generated with bf488 */
2346        .key = "\xf0\xe1\xd2\xc3\xb4\xa5\x96\x87"
2347              "\x78\x69\x5a\x4b\x3c\x2d\x1e\x0f"
2348              "\x00\x11\x22\x33\x44\x55\x66\x77"
2349              "\x04\x68\x91\x04\xc2\xfd\x3b\x2f"
2350              "\x58\x40\x23\x64\x1a\xba\x61\x76"
2351              "\x1f\x1f\x1f\x1f\x0e\x0e\x0e\x0e"
2352              "\xff\xff\xff\xff\xff\xff\xff\xff",
2353        .klen = 56,
2354        .input = "\xfe\xdc\xba\x98\x76\x54\x32\x10",
2355        .ilen = 8,
2356        .result = "\xc0\x45\x04\x01\x2e\x4e\x1f\x53",
2357        .rlen = 8,
2358    },
2359};
2360
2361static struct cipher_testvec bf_dec_tv_template[] = {
2362    { /* DES test vectors from OpenSSL */
2363        .key = "\x00\x00\x00\x00\x00\x00\x00\x00",
2364        .klen = 8,
2365        .input = "\x4e\xf9\x97\x45\x61\x98\xdd\x78",
2366        .ilen = 8,
2367        .result = "\x00\x00\x00\x00\x00\x00\x00\x00",
2368        .rlen = 8,
2369    }, {
2370        .key = "\x1f\x1f\x1f\x1f\x0e\x0e\x0e\x0e",
2371        .klen = 8,
2372        .input = "\xa7\x90\x79\x51\x08\xea\x3c\xae",
2373        .ilen = 8,
2374        .result = "\x01\x23\x45\x67\x89\xab\xcd\xef",
2375        .rlen = 8,
2376    }, {
2377        .key = "\xf0\xe1\xd2\xc3\xb4\xa5\x96\x87",
2378        .klen = 8,
2379        .input = "\xe8\x7a\x24\x4e\x2c\xc8\x5e\x82",
2380        .ilen = 8,
2381        .result = "\xfe\xdc\xba\x98\x76\x54\x32\x10",
2382        .rlen = 8,
2383    }, { /* Vary the keylength... */
2384        .key = "\xf0\xe1\xd2\xc3\xb4\xa5\x96\x87"
2385              "\x78\x69\x5a\x4b\x3c\x2d\x1e\x0f",
2386        .klen = 16,
2387        .input = "\x93\x14\x28\x87\xee\x3b\xe1\x5c",
2388        .ilen = 8,
2389        .result = "\xfe\xdc\xba\x98\x76\x54\x32\x10",
2390        .rlen = 8,
2391    }, {
2392        .key = "\xf0\xe1\xd2\xc3\xb4\xa5\x96\x87"
2393              "\x78\x69\x5a\x4b\x3c\x2d\x1e\x0f"
2394              "\x00\x11\x22\x33\x44",
2395        .klen = 21,
2396        .input = "\xe6\xf5\x1e\xd7\x9b\x9d\xb2\x1f",
2397        .ilen = 8,
2398        .result = "\xfe\xdc\xba\x98\x76\x54\x32\x10",
2399        .rlen = 8,
2400    }, { /* Generated with bf488, using OpenSSL, Libgcrypt and Nettle */
2401        .key = "\xf0\xe1\xd2\xc3\xb4\xa5\x96\x87"
2402              "\x78\x69\x5a\x4b\x3c\x2d\x1e\x0f"
2403              "\x00\x11\x22\x33\x44\x55\x66\x77"
2404              "\x04\x68\x91\x04\xc2\xfd\x3b\x2f"
2405              "\x58\x40\x23\x64\x1a\xba\x61\x76"
2406              "\x1f\x1f\x1f\x1f\x0e\x0e\x0e\x0e"
2407              "\xff\xff\xff\xff\xff\xff\xff\xff",
2408        .klen = 56,
2409        .input = "\xc0\x45\x04\x01\x2e\x4e\x1f\x53",
2410        .ilen = 8,
2411        .result = "\xfe\xdc\xba\x98\x76\x54\x32\x10",
2412        .rlen = 8,
2413    },
2414};
2415
2416static struct cipher_testvec bf_cbc_enc_tv_template[] = {
2417    { /* From OpenSSL */
2418        .key = "\x01\x23\x45\x67\x89\xab\xcd\xef"
2419              "\xf0\xe1\xd2\xc3\xb4\xa5\x96\x87",
2420        .klen = 16,
2421        .iv = "\xfe\xdc\xba\x98\x76\x54\x32\x10",
2422        .input = "\x37\x36\x35\x34\x33\x32\x31\x20"
2423              "\x4e\x6f\x77\x20\x69\x73\x20\x74"
2424              "\x68\x65\x20\x74\x69\x6d\x65\x20"
2425              "\x66\x6f\x72\x20\x00\x00\x00\x00",
2426        .ilen = 32,
2427        .result = "\x6b\x77\xb4\xd6\x30\x06\xde\xe6"
2428              "\x05\xb1\x56\xe2\x74\x03\x97\x93"
2429              "\x58\xde\xb9\xe7\x15\x46\x16\xd9"
2430              "\x59\xf1\x65\x2b\xd5\xff\x92\xcc",
2431        .rlen = 32,
2432    },
2433};
2434
2435static struct cipher_testvec bf_cbc_dec_tv_template[] = {
2436    { /* From OpenSSL */
2437        .key = "\x01\x23\x45\x67\x89\xab\xcd\xef"
2438              "\xf0\xe1\xd2\xc3\xb4\xa5\x96\x87",
2439        .klen = 16,
2440        .iv = "\xfe\xdc\xba\x98\x76\x54\x32\x10",
2441        .input = "\x6b\x77\xb4\xd6\x30\x06\xde\xe6"
2442              "\x05\xb1\x56\xe2\x74\x03\x97\x93"
2443              "\x58\xde\xb9\xe7\x15\x46\x16\xd9"
2444              "\x59\xf1\x65\x2b\xd5\xff\x92\xcc",
2445        .ilen = 32,
2446        .result = "\x37\x36\x35\x34\x33\x32\x31\x20"
2447              "\x4e\x6f\x77\x20\x69\x73\x20\x74"
2448              "\x68\x65\x20\x74\x69\x6d\x65\x20"
2449              "\x66\x6f\x72\x20\x00\x00\x00\x00",
2450        .rlen = 32,
2451    },
2452};
2453
2454/*
2455 * Twofish test vectors.
2456 */
2457#define TF_ENC_TEST_VECTORS 3
2458#define TF_DEC_TEST_VECTORS 3
2459#define TF_CBC_ENC_TEST_VECTORS 4
2460#define TF_CBC_DEC_TEST_VECTORS 4
2461
2462static struct cipher_testvec tf_enc_tv_template[] = {
2463    {
2464        .key = zeroed_string,
2465        .klen = 16,
2466        .input = zeroed_string,
2467        .ilen = 16,
2468        .result = "\x9f\x58\x9f\x5c\xf6\x12\x2c\x32"
2469              "\xb6\xbf\xec\x2f\x2a\xe8\xc3\x5a",
2470        .rlen = 16,
2471    }, {
2472        .key = "\x01\x23\x45\x67\x89\xab\xcd\xef"
2473              "\xfe\xdc\xba\x98\x76\x54\x32\x10"
2474              "\x00\x11\x22\x33\x44\x55\x66\x77",
2475        .klen = 24,
2476        .input = zeroed_string,
2477        .ilen = 16,
2478        .result = "\xcf\xd1\xd2\xe5\xa9\xbe\x9c\xdf"
2479              "\x50\x1f\x13\xb8\x92\xbd\x22\x48",
2480        .rlen = 16,
2481    }, {
2482        .key = "\x01\x23\x45\x67\x89\xab\xcd\xef"
2483              "\xfe\xdc\xba\x98\x76\x54\x32\x10"
2484              "\x00\x11\x22\x33\x44\x55\x66\x77"
2485              "\x88\x99\xaa\xbb\xcc\xdd\xee\xff",
2486        .klen = 32,
2487        .input = zeroed_string,
2488        .ilen = 16,
2489        .result = "\x37\x52\x7b\xe0\x05\x23\x34\xb8"
2490              "\x9f\x0c\xfc\xca\xe8\x7c\xfa\x20",
2491        .rlen = 16,
2492    },
2493};
2494
2495static struct cipher_testvec tf_dec_tv_template[] = {
2496    {
2497        .key = zeroed_string,
2498        .klen = 16,
2499        .input = "\x9f\x58\x9f\x5c\xf6\x12\x2c\x32"
2500              "\xb6\xbf\xec\x2f\x2a\xe8\xc3\x5a",
2501        .ilen = 16,
2502        .result = zeroed_string,
2503        .rlen = 16,
2504    }, {
2505        .key = "\x01\x23\x45\x67\x89\xab\xcd\xef"
2506              "\xfe\xdc\xba\x98\x76\x54\x32\x10"
2507              "\x00\x11\x22\x33\x44\x55\x66\x77",
2508        .klen = 24,
2509        .input = "\xcf\xd1\xd2\xe5\xa9\xbe\x9c\xdf"
2510              "\x50\x1f\x13\xb8\x92\xbd\x22\x48",
2511        .ilen = 16,
2512        .result = zeroed_string,
2513        .rlen = 16,
2514    }, {
2515        .key = "\x01\x23\x45\x67\x89\xab\xcd\xef"
2516              "\xfe\xdc\xba\x98\x76\x54\x32\x10"
2517              "\x00\x11\x22\x33\x44\x55\x66\x77"
2518              "\x88\x99\xaa\xbb\xcc\xdd\xee\xff",
2519        .klen = 32,
2520        .input = "\x37\x52\x7b\xe0\x05\x23\x34\xb8"
2521              "\x9f\x0c\xfc\xca\xe8\x7c\xfa\x20",
2522        .ilen = 16,
2523        .result = zeroed_string,
2524        .rlen = 16,
2525    },
2526};
2527
2528static struct cipher_testvec tf_cbc_enc_tv_template[] = {
2529    { /* Generated with Nettle */
2530        .key = zeroed_string,
2531        .klen = 16,
2532        .iv = zeroed_string,
2533        .input = zeroed_string,
2534        .ilen = 16,
2535        .result = "\x9f\x58\x9f\x5c\xf6\x12\x2c\x32"
2536              "\xb6\xbf\xec\x2f\x2a\xe8\xc3\x5a",
2537        .rlen = 16,
2538    }, {
2539        .key = zeroed_string,
2540        .klen = 16,
2541        .iv = "\x9f\x58\x9f\x5c\xf6\x12\x2c\x32"
2542              "\xb6\xbf\xec\x2f\x2a\xe8\xc3\x5a",
2543        .input = zeroed_string,
2544        .ilen = 16,
2545        .result = "\xd4\x91\xdb\x16\xe7\xb1\xc3\x9e"
2546              "\x86\xcb\x08\x6b\x78\x9f\x54\x19",
2547        .rlen = 16,
2548    }, {
2549        .key = zeroed_string,
2550        .klen = 16,
2551        .iv = "\xd4\x91\xdb\x16\xe7\xb1\xc3\x9e"
2552              "\x86\xcb\x08\x6b\x78\x9f\x54\x19",
2553        .input = zeroed_string,
2554        .ilen = 16,
2555        .result = "\x05\xef\x8c\x61\xa8\x11\x58\x26"
2556              "\x34\xba\x5c\xb7\x10\x6a\xa6\x41",
2557        .rlen = 16,
2558    }, {
2559        .key = zeroed_string,
2560        .klen = 16,
2561        .iv = zeroed_string,
2562        .input = zeroed_string,
2563        .ilen = 48,
2564        .result = "\x9f\x58\x9f\x5c\xf6\x12\x2c\x32"
2565              "\xb6\xbf\xec\x2f\x2a\xe8\xc3\x5a"
2566              "\xd4\x91\xdb\x16\xe7\xb1\xc3\x9e"
2567              "\x86\xcb\x08\x6b\x78\x9f\x54\x19"
2568              "\x05\xef\x8c\x61\xa8\x11\x58\x26"
2569              "\x34\xba\x5c\xb7\x10\x6a\xa6\x41",
2570        .rlen = 48,
2571    },
2572};
2573
2574static struct cipher_testvec tf_cbc_dec_tv_template[] = {
2575    { /* Reverse of the first four above */
2576        .key = zeroed_string,
2577        .klen = 16,
2578        .iv = zeroed_string,
2579        .input = "\x9f\x58\x9f\x5c\xf6\x12\x2c\x32"
2580              "\xb6\xbf\xec\x2f\x2a\xe8\xc3\x5a",
2581        .ilen = 16,
2582        .result = zeroed_string,
2583        .rlen = 16,
2584    }, {
2585        .key = zeroed_string,
2586        .klen = 16,
2587        .iv = "\x9f\x58\x9f\x5c\xf6\x12\x2c\x32"
2588              "\xb6\xbf\xec\x2f\x2a\xe8\xc3\x5a",
2589        .input = "\xd4\x91\xdb\x16\xe7\xb1\xc3\x9e"
2590              "\x86\xcb\x08\x6b\x78\x9f\x54\x19",
2591        .ilen = 16,
2592        .result = zeroed_string,
2593        .rlen = 16,
2594    }, {
2595        .key = zeroed_string,
2596        .klen = 16,
2597        .iv = "\xd4\x91\xdb\x16\xe7\xb1\xc3\x9e"
2598              "\x86\xcb\x08\x6b\x78\x9f\x54\x19",
2599        .input = "\x05\xef\x8c\x61\xa8\x11\x58\x26"
2600              "\x34\xba\x5c\xb7\x10\x6a\xa6\x41",
2601        .ilen = 16,
2602        .result = zeroed_string,
2603        .rlen = 16,
2604    }, {
2605        .key = zeroed_string,
2606        .klen = 16,
2607        .iv = zeroed_string,
2608        .input = "\x9f\x58\x9f\x5c\xf6\x12\x2c\x32"
2609              "\xb6\xbf\xec\x2f\x2a\xe8\xc3\x5a"
2610              "\xd4\x91\xdb\x16\xe7\xb1\xc3\x9e"
2611              "\x86\xcb\x08\x6b\x78\x9f\x54\x19"
2612              "\x05\xef\x8c\x61\xa8\x11\x58\x26"
2613              "\x34\xba\x5c\xb7\x10\x6a\xa6\x41",
2614        .ilen = 48,
2615        .result = zeroed_string,
2616        .rlen = 48,
2617    },
2618};
2619
2620/*
2621 * Serpent test vectors. These are backwards because Serpent writes
2622 * octet sequences in right-to-left mode.
2623 */
2624#define SERPENT_ENC_TEST_VECTORS 4
2625#define SERPENT_DEC_TEST_VECTORS 4
2626
2627#define TNEPRES_ENC_TEST_VECTORS 4
2628#define TNEPRES_DEC_TEST_VECTORS 4
2629
2630static struct cipher_testvec serpent_enc_tv_template[] = {
2631    {
2632        .input = "\x00\x01\x02\x03\x04\x05\x06\x07"
2633              "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
2634        .ilen = 16,
2635        .result = "\x12\x07\xfc\xce\x9b\xd0\xd6\x47"
2636              "\x6a\xe9\x8f\xbe\xd1\x43\xa0\xe2",
2637        .rlen = 16,
2638    }, {
2639        .key = "\x00\x01\x02\x03\x04\x05\x06\x07"
2640              "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
2641        .klen = 16,
2642        .input = "\x00\x01\x02\x03\x04\x05\x06\x07"
2643              "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
2644        .ilen = 16,
2645        .result = "\x4c\x7d\x8a\x32\x80\x72\xa2\x2c"
2646              "\x82\x3e\x4a\x1f\x3a\xcd\xa1\x6d",
2647        .rlen = 16,
2648    }, {
2649        .key = "\x00\x01\x02\x03\x04\x05\x06\x07"
2650              "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
2651              "\x10\x11\x12\x13\x14\x15\x16\x17"
2652              "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f",
2653        .klen = 32,
2654        .input = "\x00\x01\x02\x03\x04\x05\x06\x07"
2655              "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
2656        .ilen = 16,
2657        .result = "\xde\x26\x9f\xf8\x33\xe4\x32\xb8"
2658              "\x5b\x2e\x88\xd2\x70\x1c\xe7\x5c",
2659        .rlen = 16,
2660    }, {
2661        .key = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80",
2662        .klen = 16,
2663        .input = zeroed_string,
2664        .ilen = 16,
2665        .result = "\xdd\xd2\x6b\x98\xa5\xff\xd8\x2c"
2666              "\x05\x34\x5a\x9d\xad\xbf\xaf\x49",
2667        .rlen = 16,
2668    },
2669};
2670
2671static struct cipher_testvec tnepres_enc_tv_template[] = {
2672    { /* KeySize=128, PT=0, I=1 */
2673        .input = "\x00\x00\x00\x00\x00\x00\x00\x00"
2674              "\x00\x00\x00\x00\x00\x00\x00\x00",
2675        .key = "\x80\x00\x00\x00\x00\x00\x00\x00"
2676              "\x00\x00\x00\x00\x00\x00\x00\x00",
2677        .klen = 16,
2678        .ilen = 16,
2679        .result = "\x49\xaf\xbf\xad\x9d\x5a\x34\x05"
2680              "\x2c\xd8\xff\xa5\x98\x6b\xd2\xdd",
2681        .rlen = 16,
2682    }, { /* KeySize=192, PT=0, I=1 */
2683        .key = "\x80\x00\x00\x00\x00\x00\x00\x00"
2684              "\x00\x00\x00\x00\x00\x00\x00\x00"
2685              "\x00\x00\x00\x00\x00\x00\x00\x00",
2686        .klen = 24,
2687        .input = "\x00\x00\x00\x00\x00\x00\x00\x00"
2688              "\x00\x00\x00\x00\x00\x00\x00\x00",
2689        .ilen = 16,
2690        .result = "\xe7\x8e\x54\x02\xc7\x19\x55\x68"
2691              "\xac\x36\x78\xf7\xa3\xf6\x0c\x66",
2692        .rlen = 16,
2693    }, { /* KeySize=256, PT=0, I=1 */
2694        .key = "\x80\x00\x00\x00\x00\x00\x00\x00"
2695              "\x00\x00\x00\x00\x00\x00\x00\x00"
2696              "\x00\x00\x00\x00\x00\x00\x00\x00"
2697              "\x00\x00\x00\x00\x00\x00\x00\x00",
2698        .klen = 32,
2699        .input = "\x00\x00\x00\x00\x00\x00\x00\x00"
2700              "\x00\x00\x00\x00\x00\x00\x00\x00",
2701        .ilen = 16,
2702        .result = "\xab\xed\x96\xe7\x66\xbf\x28\xcb"
2703              "\xc0\xeb\xd2\x1a\x82\xef\x08\x19",
2704        .rlen = 16,
2705    }, { /* KeySize=256, I=257 */
2706        .key = "\x1f\x1e\x1d\x1c\x1b\x1a\x19\x18"
2707              "\x17\x16\x15\x14\x13\x12\x11\x10"
2708              "\x0f\x0e\x0d\x0c\x0b\x0a\x09\x08"
2709              "\x07\x06\x05\x04\x03\x02\x01\x00",
2710        .klen = 32,
2711        .input = "\x0f\x0e\x0d\x0c\x0b\x0a\x09\x08"
2712              "\x07\x06\x05\x04\x03\x02\x01\x00",
2713        .ilen = 16,
2714        .result = "\x5c\xe7\x1c\x70\xd2\x88\x2e\x5b"
2715              "\xb8\x32\xe4\x33\xf8\x9f\x26\xde",
2716        .rlen = 16,
2717    },
2718};
2719
2720
2721static struct cipher_testvec serpent_dec_tv_template[] = {
2722    {
2723        .input = "\x12\x07\xfc\xce\x9b\xd0\xd6\x47"
2724              "\x6a\xe9\x8f\xbe\xd1\x43\xa0\xe2",
2725        .ilen = 16,
2726        .result = "\x00\x01\x02\x03\x04\x05\x06\x07"
2727              "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
2728        .rlen = 16,
2729    }, {
2730        .key = "\x00\x01\x02\x03\x04\x05\x06\x07"
2731              "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
2732        .klen = 16,
2733        .input = "\x4c\x7d\x8a\x32\x80\x72\xa2\x2c"
2734              "\x82\x3e\x4a\x1f\x3a\xcd\xa1\x6d",
2735        .ilen = 16,
2736        .result = "\x00\x01\x02\x03\x04\x05\x06\x07"
2737              "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
2738        .rlen = 16,
2739    }, {
2740        .key = "\x00\x01\x02\x03\x04\x05\x06\x07"
2741              "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
2742              "\x10\x11\x12\x13\x14\x15\x16\x17"
2743              "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f",
2744        .klen = 32,
2745        .input = "\xde\x26\x9f\xf8\x33\xe4\x32\xb8"
2746              "\x5b\x2e\x88\xd2\x70\x1c\xe7\x5c",
2747        .ilen = 16,
2748        .result = "\x00\x01\x02\x03\x04\x05\x06\x07"
2749              "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
2750        .rlen = 16,
2751    }, {
2752        .key = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80",
2753        .klen = 16,
2754        .input = "\xdd\xd2\x6b\x98\xa5\xff\xd8\x2c"
2755              "\x05\x34\x5a\x9d\xad\xbf\xaf\x49",
2756        .ilen = 16,
2757        .result = zeroed_string,
2758        .rlen = 16,
2759    },
2760};
2761
2762static struct cipher_testvec tnepres_dec_tv_template[] = {
2763    {
2764        .input = "\x41\xcc\x6b\x31\x59\x31\x45\x97"
2765              "\x6d\x6f\xbb\x38\x4b\x37\x21\x28",
2766        .ilen = 16,
2767        .result = "\x00\x01\x02\x03\x04\x05\x06\x07"
2768              "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
2769        .rlen = 16,
2770    }, {
2771        .key = "\x00\x01\x02\x03\x04\x05\x06\x07"
2772              "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
2773        .klen = 16,
2774        .input = "\xea\xf4\xd7\xfc\xd8\x01\x34\x47"
2775              "\x81\x45\x0b\xfa\x0c\xd6\xad\x6e",
2776        .ilen = 16,
2777        .result = "\x00\x01\x02\x03\x04\x05\x06\x07"
2778              "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
2779        .rlen = 16,
2780    }, {
2781        .key = "\x00\x01\x02\x03\x04\x05\x06\x07"
2782              "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
2783              "\x10\x11\x12\x13\x14\x15\x16\x17"
2784              "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f",
2785        .klen = 32,
2786        .input = "\x64\xa9\x1a\x37\xed\x9f\xe7\x49"
2787              "\xa8\x4e\x76\xd6\xf5\x0d\x78\xee",
2788        .ilen = 16,
2789        .result = "\x00\x01\x02\x03\x04\x05\x06\x07"
2790              "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
2791        .rlen = 16,
2792    }, { /* KeySize=128, I=121 */
2793        .key = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80",
2794        .klen = 16,
2795        .input = "\x3d\xda\xbf\xc0\x06\xda\xab\x06"
2796              "\x46\x2a\xf4\xef\x81\x54\x4e\x26",
2797        .ilen = 16,
2798        .result = zeroed_string,
2799        .rlen = 16,
2800    },
2801};
2802
2803
2804/* Cast6 test vectors from RFC 2612 */
2805#define CAST6_ENC_TEST_VECTORS 3
2806#define CAST6_DEC_TEST_VECTORS 3
2807
2808static struct cipher_testvec cast6_enc_tv_template[] = {
2809    {
2810        .key = "\x23\x42\xbb\x9e\xfa\x38\x54\x2c"
2811              "\x0a\xf7\x56\x47\xf2\x9f\x61\x5d",
2812        .klen = 16,
2813        .input = zeroed_string,
2814        .ilen = 16,
2815        .result = "\xc8\x42\xa0\x89\x72\xb4\x3d\x20"
2816              "\x83\x6c\x91\xd1\xb7\x53\x0f\x6b",
2817        .rlen = 16,
2818    }, {
2819        .key = "\x23\x42\xbb\x9e\xfa\x38\x54\x2c"
2820              "\xbe\xd0\xac\x83\x94\x0a\xc2\x98"
2821              "\xba\xc7\x7a\x77\x17\x94\x28\x63",
2822        .klen = 24,
2823        .input = zeroed_string,
2824        .ilen = 16,
2825        .result = "\x1b\x38\x6c\x02\x10\xdc\xad\xcb"
2826              "\xdd\x0e\x41\xaa\x08\xa7\xa7\xe8",
2827        .rlen = 16,
2828    }, {
2829        .key = "\x23\x42\xbb\x9e\xfa\x38\x54\x2c"
2830              "\xbe\xd0\xac\x83\x94\x0a\xc2\x98"
2831              "\x8d\x7c\x47\xce\x26\x49\x08\x46"
2832              "\x1c\xc1\xb5\x13\x7a\xe6\xb6\x04",
2833        .klen = 32,
2834        .input = zeroed_string,
2835        .ilen = 16,
2836        .result = "\x4f\x6a\x20\x38\x28\x68\x97\xb9"
2837              "\xc9\x87\x01\x36\x55\x33\x17\xfa",
2838        .rlen = 16,
2839    },
2840};
2841
2842static struct cipher_testvec cast6_dec_tv_template[] = {
2843    {
2844        .key = "\x23\x42\xbb\x9e\xfa\x38\x54\x2c"
2845              "\x0a\xf7\x56\x47\xf2\x9f\x61\x5d",
2846        .klen = 16,
2847        .input = "\xc8\x42\xa0\x89\x72\xb4\x3d\x20"
2848              "\x83\x6c\x91\xd1\xb7\x53\x0f\x6b",
2849        .ilen = 16,
2850        .result = zeroed_string,
2851        .rlen = 16,
2852    }, {
2853        .key = "\x23\x42\xbb\x9e\xfa\x38\x54\x2c"
2854              "\xbe\xd0\xac\x83\x94\x0a\xc2\x98"
2855              "\xba\xc7\x7a\x77\x17\x94\x28\x63",
2856        .klen = 24,
2857        .input = "\x1b\x38\x6c\x02\x10\xdc\xad\xcb"
2858              "\xdd\x0e\x41\xaa\x08\xa7\xa7\xe8",
2859        .ilen = 16,
2860        .result = zeroed_string,
2861        .rlen = 16,
2862    }, {
2863        .key = "\x23\x42\xbb\x9e\xfa\x38\x54\x2c"
2864              "\xbe\xd0\xac\x83\x94\x0a\xc2\x98"
2865              "\x8d\x7c\x47\xce\x26\x49\x08\x46"
2866              "\x1c\xc1\xb5\x13\x7a\xe6\xb6\x04",
2867        .klen = 32,
2868        .input = "\x4f\x6a\x20\x38\x28\x68\x97\xb9"
2869              "\xc9\x87\x01\x36\x55\x33\x17\xfa",
2870        .ilen = 16,
2871        .result = zeroed_string,
2872        .rlen = 16,
2873    },
2874};
2875
2876
2877/*
2878 * AES test vectors.
2879 */
2880#define AES_ENC_TEST_VECTORS 3
2881#define AES_DEC_TEST_VECTORS 3
2882#define AES_CBC_ENC_TEST_VECTORS 4
2883#define AES_CBC_DEC_TEST_VECTORS 4
2884#define AES_LRW_ENC_TEST_VECTORS 8
2885#define AES_LRW_DEC_TEST_VECTORS 8
2886#define AES_XTS_ENC_TEST_VECTORS 4
2887#define AES_XTS_DEC_TEST_VECTORS 4
2888#define AES_CTR_ENC_TEST_VECTORS 3
2889#define AES_CTR_DEC_TEST_VECTORS 3
2890#define AES_CTR_3686_ENC_TEST_VECTORS 7
2891#define AES_CTR_3686_DEC_TEST_VECTORS 6
2892#define AES_GCM_ENC_TEST_VECTORS 9
2893#define AES_GCM_DEC_TEST_VECTORS 8
2894#define AES_CCM_ENC_TEST_VECTORS 7
2895#define AES_CCM_DEC_TEST_VECTORS 7
2896#define AES_CCM_4309_ENC_TEST_VECTORS 7
2897#define AES_CCM_4309_DEC_TEST_VECTORS 10
2898
2899static struct cipher_testvec aes_enc_tv_template[] = {
2900    { /* From FIPS-197 */
2901        .key = "\x00\x01\x02\x03\x04\x05\x06\x07"
2902              "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
2903        .klen = 16,
2904        .input = "\x00\x11\x22\x33\x44\x55\x66\x77"
2905              "\x88\x99\xaa\xbb\xcc\xdd\xee\xff",
2906        .ilen = 16,
2907        .result = "\x69\xc4\xe0\xd8\x6a\x7b\x04\x30"
2908              "\xd8\xcd\xb7\x80\x70\xb4\xc5\x5a",
2909        .rlen = 16,
2910    }, {
2911        .key = "\x00\x01\x02\x03\x04\x05\x06\x07"
2912              "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
2913              "\x10\x11\x12\x13\x14\x15\x16\x17",
2914        .klen = 24,
2915        .input = "\x00\x11\x22\x33\x44\x55\x66\x77"
2916              "\x88\x99\xaa\xbb\xcc\xdd\xee\xff",
2917        .ilen = 16,
2918        .result = "\xdd\xa9\x7c\xa4\x86\x4c\xdf\xe0"
2919              "\x6e\xaf\x70\xa0\xec\x0d\x71\x91",
2920        .rlen = 16,
2921    }, {
2922        .key = "\x00\x01\x02\x03\x04\x05\x06\x07"
2923              "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
2924              "\x10\x11\x12\x13\x14\x15\x16\x17"
2925              "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f",
2926        .klen = 32,
2927        .input = "\x00\x11\x22\x33\x44\x55\x66\x77"
2928              "\x88\x99\xaa\xbb\xcc\xdd\xee\xff",
2929        .ilen = 16,
2930        .result = "\x8e\xa2\xb7\xca\x51\x67\x45\xbf"
2931              "\xea\xfc\x49\x90\x4b\x49\x60\x89",
2932        .rlen = 16,
2933    },
2934};
2935
2936static struct cipher_testvec aes_dec_tv_template[] = {
2937    { /* From FIPS-197 */
2938        .key = "\x00\x01\x02\x03\x04\x05\x06\x07"
2939              "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
2940        .klen = 16,
2941        .input = "\x69\xc4\xe0\xd8\x6a\x7b\x04\x30"
2942              "\xd8\xcd\xb7\x80\x70\xb4\xc5\x5a",
2943        .ilen = 16,
2944        .result = "\x00\x11\x22\x33\x44\x55\x66\x77"
2945              "\x88\x99\xaa\xbb\xcc\xdd\xee\xff",
2946        .rlen = 16,
2947    }, {
2948        .key = "\x00\x01\x02\x03\x04\x05\x06\x07"
2949              "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
2950              "\x10\x11\x12\x13\x14\x15\x16\x17",
2951        .klen = 24,
2952        .input = "\xdd\xa9\x7c\xa4\x86\x4c\xdf\xe0"
2953              "\x6e\xaf\x70\xa0\xec\x0d\x71\x91",
2954        .ilen = 16,
2955        .result = "\x00\x11\x22\x33\x44\x55\x66\x77"
2956              "\x88\x99\xaa\xbb\xcc\xdd\xee\xff",
2957        .rlen = 16,
2958    }, {
2959        .key = "\x00\x01\x02\x03\x04\x05\x06\x07"
2960              "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
2961              "\x10\x11\x12\x13\x14\x15\x16\x17"
2962              "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f",
2963        .klen = 32,
2964        .input = "\x8e\xa2\xb7\xca\x51\x67\x45\xbf"
2965              "\xea\xfc\x49\x90\x4b\x49\x60\x89",
2966        .ilen = 16,
2967        .result = "\x00\x11\x22\x33\x44\x55\x66\x77"
2968              "\x88\x99\xaa\xbb\xcc\xdd\xee\xff",
2969        .rlen = 16,
2970    },
2971};
2972
2973static struct cipher_testvec aes_cbc_enc_tv_template[] = {
2974    { /* From RFC 3602 */
2975        .key = "\x06\xa9\x21\x40\x36\xb8\xa1\x5b"
2976              "\x51\x2e\x03\xd5\x34\x12\x00\x06",
2977        .klen = 16,
2978        .iv = "\x3d\xaf\xba\x42\x9d\x9e\xb4\x30"
2979              "\xb4\x22\xda\x80\x2c\x9f\xac\x41",
2980        .input = "Single block msg",
2981        .ilen = 16,
2982        .result = "\xe3\x53\x77\x9c\x10\x79\xae\xb8"
2983              "\x27\x08\x94\x2d\xbe\x77\x18\x1a",
2984        .rlen = 16,
2985    }, {
2986        .key = "\xc2\x86\x69\x6d\x88\x7c\x9a\xa0"
2987              "\x61\x1b\xbb\x3e\x20\x25\xa4\x5a",
2988        .klen = 16,
2989        .iv = "\x56\x2e\x17\x99\x6d\x09\x3d\x28"
2990              "\xdd\xb3\xba\x69\x5a\x2e\x6f\x58",
2991        .input = "\x00\x01\x02\x03\x04\x05\x06\x07"
2992              "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
2993              "\x10\x11\x12\x13\x14\x15\x16\x17"
2994              "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f",
2995        .ilen = 32,
2996        .result = "\xd2\x96\xcd\x94\xc2\xcc\xcf\x8a"
2997              "\x3a\x86\x30\x28\xb5\xe1\xdc\x0a"
2998              "\x75\x86\x60\x2d\x25\x3c\xff\xf9"
2999              "\x1b\x82\x66\xbe\xa6\xd6\x1a\xb1",
3000        .rlen = 32,
3001    }, { /* From NIST SP800-38A */
3002        .key = "\x8e\x73\xb0\xf7\xda\x0e\x64\x52"
3003              "\xc8\x10\xf3\x2b\x80\x90\x79\xe5"
3004              "\x62\xf8\xea\xd2\x52\x2c\x6b\x7b",
3005        .klen = 24,
3006        .iv = "\x00\x01\x02\x03\x04\x05\x06\x07"
3007              "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
3008        .input = "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96"
3009              "\xe9\x3d\x7e\x11\x73\x93\x17\x2a"
3010              "\xae\x2d\x8a\x57\x1e\x03\xac\x9c"
3011              "\x9e\xb7\x6f\xac\x45\xaf\x8e\x51"
3012              "\x30\xc8\x1c\x46\xa3\x5c\xe4\x11"
3013              "\xe5\xfb\xc1\x19\x1a\x0a\x52\xef"
3014              "\xf6\x9f\x24\x45\xdf\x4f\x9b\x17"
3015              "\xad\x2b\x41\x7b\xe6\x6c\x37\x10",
3016        .ilen = 64,
3017        .result = "\x4f\x02\x1d\xb2\x43\xbc\x63\x3d"
3018              "\x71\x78\x18\x3a\x9f\xa0\x71\xe8"
3019              "\xb4\xd9\xad\xa9\xad\x7d\xed\xf4"
3020              "\xe5\xe7\x38\x76\x3f\x69\x14\x5a"
3021              "\x57\x1b\x24\x20\x12\xfb\x7a\xe0"
3022              "\x7f\xa9\xba\xac\x3d\xf1\x02\xe0"
3023              "\x08\xb0\xe2\x79\x88\x59\x88\x81"
3024              "\xd9\x20\xa9\xe6\x4f\x56\x15\xcd",
3025        .rlen = 64,
3026    }, {
3027        .key = "\x60\x3d\xeb\x10\x15\xca\x71\xbe"
3028              "\x2b\x73\xae\xf0\x85\x7d\x77\x81"
3029              "\x1f\x35\x2c\x07\x3b\x61\x08\xd7"
3030              "\x2d\x98\x10\xa3\x09\x14\xdf\xf4",
3031        .klen = 32,
3032        .iv = "\x00\x01\x02\x03\x04\x05\x06\x07"
3033              "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
3034        .input = "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96"
3035              "\xe9\x3d\x7e\x11\x73\x93\x17\x2a"
3036              "\xae\x2d\x8a\x57\x1e\x03\xac\x9c"
3037              "\x9e\xb7\x6f\xac\x45\xaf\x8e\x51"
3038              "\x30\xc8\x1c\x46\xa3\x5c\xe4\x11"
3039              "\xe5\xfb\xc1\x19\x1a\x0a\x52\xef"
3040              "\xf6\x9f\x24\x45\xdf\x4f\x9b\x17"
3041              "\xad\x2b\x41\x7b\xe6\x6c\x37\x10",
3042        .ilen = 64,
3043        .result = "\xf5\x8c\x4c\x04\xd6\xe5\xf1\xba"
3044              "\x77\x9e\xab\xfb\x5f\x7b\xfb\xd6"
3045              "\x9c\xfc\x4e\x96\x7e\xdb\x80\x8d"
3046              "\x67\x9f\x77\x7b\xc6\x70\x2c\x7d"
3047              "\x39\xf2\x33\x69\xa9\xd9\xba\xcf"
3048              "\xa5\x30\xe2\x63\x04\x23\x14\x61"
3049              "\xb2\xeb\x05\xe2\xc3\x9b\xe9\xfc"
3050              "\xda\x6c\x19\x07\x8c\x6a\x9d\x1b",
3051        .rlen = 64,
3052    },
3053};
3054
3055static struct cipher_testvec aes_cbc_dec_tv_template[] = {
3056    { /* From RFC 3602 */
3057        .key = "\x06\xa9\x21\x40\x36\xb8\xa1\x5b"
3058              "\x51\x2e\x03\xd5\x34\x12\x00\x06",
3059        .klen = 16,
3060        .iv = "\x3d\xaf\xba\x42\x9d\x9e\xb4\x30"
3061              "\xb4\x22\xda\x80\x2c\x9f\xac\x41",
3062        .input = "\xe3\x53\x77\x9c\x10\x79\xae\xb8"
3063              "\x27\x08\x94\x2d\xbe\x77\x18\x1a",
3064        .ilen = 16,
3065        .result = "Single block msg",
3066        .rlen = 16,
3067    }, {
3068        .key = "\xc2\x86\x69\x6d\x88\x7c\x9a\xa0"
3069              "\x61\x1b\xbb\x3e\x20\x25\xa4\x5a",
3070        .klen = 16,
3071        .iv = "\x56\x2e\x17\x99\x6d\x09\x3d\x28"
3072              "\xdd\xb3\xba\x69\x5a\x2e\x6f\x58",
3073        .input = "\xd2\x96\xcd\x94\xc2\xcc\xcf\x8a"
3074              "\x3a\x86\x30\x28\xb5\xe1\xdc\x0a"
3075              "\x75\x86\x60\x2d\x25\x3c\xff\xf9"
3076              "\x1b\x82\x66\xbe\xa6\xd6\x1a\xb1",
3077        .ilen = 32,
3078        .result = "\x00\x01\x02\x03\x04\x05\x06\x07"
3079              "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
3080              "\x10\x11\x12\x13\x14\x15\x16\x17"
3081              "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f",
3082        .rlen = 32,
3083    }, { /* From NIST SP800-38A */
3084        .key = "\x8e\x73\xb0\xf7\xda\x0e\x64\x52"
3085              "\xc8\x10\xf3\x2b\x80\x90\x79\xe5"
3086              "\x62\xf8\xea\xd2\x52\x2c\x6b\x7b",
3087        .klen = 24,
3088        .iv = "\x00\x01\x02\x03\x04\x05\x06\x07"
3089              "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
3090        .input = "\x4f\x02\x1d\xb2\x43\xbc\x63\x3d"
3091              "\x71\x78\x18\x3a\x9f\xa0\x71\xe8"
3092              "\xb4\xd9\xad\xa9\xad\x7d\xed\xf4"
3093              "\xe5\xe7\x38\x76\x3f\x69\x14\x5a"
3094              "\x57\x1b\x24\x20\x12\xfb\x7a\xe0"
3095              "\x7f\xa9\xba\xac\x3d\xf1\x02\xe0"
3096              "\x08\xb0\xe2\x79\x88\x59\x88\x81"
3097              "\xd9\x20\xa9\xe6\x4f\x56\x15\xcd",
3098        .ilen = 64,
3099        .result = "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96"
3100              "\xe9\x3d\x7e\x11\x73\x93\x17\x2a"
3101              "\xae\x2d\x8a\x57\x1e\x03\xac\x9c"
3102              "\x9e\xb7\x6f\xac\x45\xaf\x8e\x51"
3103              "\x30\xc8\x1c\x46\xa3\x5c\xe4\x11"
3104              "\xe5\xfb\xc1\x19\x1a\x0a\x52\xef"
3105              "\xf6\x9f\x24\x45\xdf\x4f\x9b\x17"
3106              "\xad\x2b\x41\x7b\xe6\x6c\x37\x10",
3107        .rlen = 64,
3108    }, {
3109        .key = "\x60\x3d\xeb\x10\x15\xca\x71\xbe"
3110              "\x2b\x73\xae\xf0\x85\x7d\x77\x81"
3111              "\x1f\x35\x2c\x07\x3b\x61\x08\xd7"
3112              "\x2d\x98\x10\xa3\x09\x14\xdf\xf4",
3113        .klen = 32,
3114        .iv = "\x00\x01\x02\x03\x04\x05\x06\x07"
3115              "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
3116        .input = "\xf5\x8c\x4c\x04\xd6\xe5\xf1\xba"
3117              "\x77\x9e\xab\xfb\x5f\x7b\xfb\xd6"
3118              "\x9c\xfc\x4e\x96\x7e\xdb\x80\x8d"
3119              "\x67\x9f\x77\x7b\xc6\x70\x2c\x7d"
3120              "\x39\xf2\x33\x69\xa9\xd9\xba\xcf"
3121              "\xa5\x30\xe2\x63\x04\x23\x14\x61"
3122              "\xb2\xeb\x05\xe2\xc3\x9b\xe9\xfc"
3123              "\xda\x6c\x19\x07\x8c\x6a\x9d\x1b",
3124        .ilen = 64,
3125        .result = "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96"
3126              "\xe9\x3d\x7e\x11\x73\x93\x17\x2a"
3127              "\xae\x2d\x8a\x57\x1e\x03\xac\x9c"
3128              "\x9e\xb7\x6f\xac\x45\xaf\x8e\x51"
3129              "\x30\xc8\x1c\x46\xa3\x5c\xe4\x11"
3130              "\xe5\xfb\xc1\x19\x1a\x0a\x52\xef"
3131              "\xf6\x9f\x24\x45\xdf\x4f\x9b\x17"
3132              "\xad\x2b\x41\x7b\xe6\x6c\x37\x10",
3133        .rlen = 64,
3134    },
3135};
3136
3137static struct cipher_testvec aes_lrw_enc_tv_template[] = {
3138    /* from http://grouper.ieee.org/groups/1619/email/pdf00017.pdf */
3139    { /* LRW-32-AES 1 */
3140        .key = "\x45\x62\xac\x25\xf8\x28\x17\x6d"
3141              "\x4c\x26\x84\x14\xb5\x68\x01\x85"
3142              "\x25\x8e\x2a\x05\xe7\x3e\x9d\x03"
3143              "\xee\x5a\x83\x0c\xcc\x09\x4c\x87",
3144        .klen = 32,
3145        .iv = "\x00\x00\x00\x00\x00\x00\x00\x00"
3146              "\x00\x00\x00\x00\x00\x00\x00\x01",
3147        .input = "\x30\x31\x32\x33\x34\x35\x36\x37"
3148              "\x38\x39\x41\x42\x43\x44\x45\x46",
3149        .ilen = 16,
3150        .result = "\xf1\xb2\x73\xcd\x65\xa3\xdf\x5f"
3151              "\xe9\x5d\x48\x92\x54\x63\x4e\xb8",
3152        .rlen = 16,
3153    }, { /* LRW-32-AES 2 */
3154        .key = "\x59\x70\x47\x14\xf5\x57\x47\x8c"
3155              "\xd7\x79\xe8\x0f\x54\x88\x79\x44"
3156              "\x0d\x48\xf0\xb7\xb1\x5a\x53\xea"
3157              "\x1c\xaa\x6b\x29\xc2\xca\xfb\xaf",
3158        .klen = 32,
3159        .iv = "\x00\x00\x00\x00\x00\x00\x00\x00"
3160              "\x00\x00\x00\x00\x00\x00\x00\x02",
3161        .input = "\x30\x31\x32\x33\x34\x35\x36\x37"
3162              "\x38\x39\x41\x42\x43\x44\x45\x46",
3163        .ilen = 16,
3164        .result = "\x00\xc8\x2b\xae\x95\xbb\xcd\xe5"
3165              "\x27\x4f\x07\x69\xb2\x60\xe1\x36",
3166        .rlen = 16,
3167    }, { /* LRW-32-AES 3 */
3168        .key = "\xd8\x2a\x91\x34\xb2\x6a\x56\x50"
3169              "\x30\xfe\x69\xe2\x37\x7f\x98\x47"
3170              "\xcd\xf9\x0b\x16\x0c\x64\x8f\xb6"
3171              "\xb0\x0d\x0d\x1b\xae\x85\x87\x1f",
3172        .klen = 32,
3173        .iv = "\x00\x00\x00\x00\x00\x00\x00\x00"
3174              "\x00\x00\x00\x02\x00\x00\x00\x00",
3175        .input = "\x30\x31\x32\x33\x34\x35\x36\x37"
3176              "\x38\x39\x41\x42\x43\x44\x45\x46",
3177        .ilen = 16,
3178        .result = "\x76\x32\x21\x83\xed\x8f\xf1\x82"
3179              "\xf9\x59\x62\x03\x69\x0e\x5e\x01",
3180        .rlen = 16,
3181    }, { /* LRW-32-AES 4 */
3182        .key = "\x0f\x6a\xef\xf8\xd3\xd2\xbb\x15"
3183              "\x25\x83\xf7\x3c\x1f\x01\x28\x74"
3184              "\xca\xc6\xbc\x35\x4d\x4a\x65\x54"
3185              "\x90\xae\x61\xcf\x7b\xae\xbd\xcc"
3186              "\xad\xe4\x94\xc5\x4a\x29\xae\x70",
3187        .klen = 40,
3188        .iv = "\x00\x00\x00\x00\x00\x00\x00\x00"
3189              "\x00\x00\x00\x00\x00\x00\x00\x01",
3190        .input = "\x30\x31\x32\x33\x34\x35\x36\x37"
3191              "\x38\x39\x41\x42\x43\x44\x45\x46",
3192        .ilen = 16,
3193        .result = "\x9c\x0f\x15\x2f\x55\xa2\xd8\xf0"
3194              "\xd6\x7b\x8f\x9e\x28\x22\xbc\x41",
3195        .rlen = 16,
3196    }, { /* LRW-32-AES 5 */
3197        .key = "\x8a\xd4\xee\x10\x2f\xbd\x81\xff"
3198              "\xf8\x86\xce\xac\x93\xc5\xad\xc6"
3199              "\xa0\x19\x07\xc0\x9d\xf7\xbb\xdd"
3200              "\x52\x13\xb2\xb7\xf0\xff\x11\xd8"
3201              "\xd6\x08\xd0\xcd\x2e\xb1\x17\x6f",
3202        .klen = 40,
3203        .iv = "\x00\x00\x00\x00\x00\x00\x00\x00"
3204              "\x00\x00\x00\x02\x00\x00\x00\x00",
3205        .input = "\x30\x31\x32\x33\x34\x35\x36\x37"
3206              "\x38\x39\x41\x42\x43\x44\x45\x46",
3207        .ilen = 16,
3208        .result = "\xd4\x27\x6a\x7f\x14\x91\x3d\x65"
3209              "\xc8\x60\x48\x02\x87\xe3\x34\x06",
3210        .rlen = 16,
3211    }, { /* LRW-32-AES 6 */
3212        .key = "\xf8\xd4\x76\xff\xd6\x46\xee\x6c"
3213              "\x23\x84\xcb\x1c\x77\xd6\x19\x5d"
3214              "\xfe\xf1\xa9\xf3\x7b\xbc\x8d\x21"
3215              "\xa7\x9c\x21\xf8\xcb\x90\x02\x89"
3216              "\xa8\x45\x34\x8e\xc8\xc5\xb5\xf1"
3217              "\x26\xf5\x0e\x76\xfe\xfd\x1b\x1e",
3218        .klen = 48,
3219        .iv = "\x00\x00\x00\x00\x00\x00\x00\x00"
3220              "\x00\x00\x00\x00\x00\x00\x00\x01",
3221        .input = "\x30\x31\x32\x33\x34\x35\x36\x37"
3222              "\x38\x39\x41\x42\x43\x44\x45\x46",
3223        .ilen = 16,
3224        .result = "\xbd\x06\xb8\xe1\xdb\x98\x89\x9e"
3225              "\xc4\x98\xe4\x91\xcf\x1c\x70\x2b",
3226        .rlen = 16,
3227    }, { /* LRW-32-AES 7 */
3228        .key = "\xfb\x76\x15\xb2\x3d\x80\x89\x1d"
3229              "\xd4\x70\x98\x0b\xc7\x95\x84\xc8"
3230              "\xb2\xfb\x64\xce\x60\x97\x87\x8d"
3231              "\x17\xfc\xe4\x5a\x49\xe8\x30\xb7"
3232              "\x6e\x78\x17\xe7\x2d\x5e\x12\xd4"
3233              "\x60\x64\x04\x7a\xf1\x2f\x9e\x0c",
3234        .klen = 48,
3235        .iv = "\x00\x00\x00\x00\x00\x00\x00\x00"
3236              "\x00\x00\x00\x02\x00\x00\x00\x00",
3237        .input = "\x30\x31\x32\x33\x34\x35\x36\x37"
3238              "\x38\x39\x41\x42\x43\x44\x45\x46",
3239        .ilen = 16,
3240        .result = "\x5b\x90\x8e\xc1\xab\xdd\x67\x5f"
3241              "\x3d\x69\x8a\x95\x53\xc8\x9c\xe5",
3242        .rlen = 16,
3243    }, {
3244/* http://www.mail-archive.com/stds-p1619@listserv.ieee.org/msg00173.html */
3245        .key = "\xf8\xd4\x76\xff\xd6\x46\xee\x6c"
3246              "\x23\x84\xcb\x1c\x77\xd6\x19\x5d"
3247              "\xfe\xf1\xa9\xf3\x7b\xbc\x8d\x21"
3248              "\xa7\x9c\x21\xf8\xcb\x90\x02\x89"
3249              "\xa8\x45\x34\x8e\xc8\xc5\xb5\xf1"
3250              "\x26\xf5\x0e\x76\xfe\xfd\x1b\x1e",
3251        .klen = 48,
3252        .iv = "\x00\x00\x00\x00\x00\x00\x00\x00"
3253              "\x00\x00\x00\x00\x00\x00\x00\x01",
3254        .input = "\x05\x11\xb7\x18\xab\xc6\x2d\xac"
3255              "\x70\x5d\xf6\x22\x94\xcd\xe5\x6c"
3256              "\x17\x6b\xf6\x1c\xf0\xf3\x6e\xf8"
3257              "\x50\x38\x1f\x71\x49\xb6\x57\xd6"
3258              "\x8f\xcb\x8d\x6b\xe3\xa6\x29\x90"
3259              "\xfe\x2a\x62\x82\xae\x6d\x8b\xf6"
3260              "\xad\x1e\x9e\x20\x5f\x38\xbe\x04"
3261              "\xda\x10\x8e\xed\xa2\xa4\x87\xab"
3262              "\xda\x6b\xb4\x0c\x75\xba\xd3\x7c"
3263              "\xc9\xac\x42\x31\x95\x7c\xc9\x04"
3264              "\xeb\xd5\x6e\x32\x69\x8a\xdb\xa6"
3265              "\x15\xd7\x3f\x4f\x2f\x66\x69\x03"
3266              "\x9c\x1f\x54\x0f\xde\x1f\xf3\x65"
3267              "\x4c\x96\x12\xed\x7c\x92\x03\x01"
3268              "\x6f\xbc\x35\x93\xac\xf1\x27\xf1"
3269              "\xb4\x96\x82\x5a\x5f\xb0\xa0\x50"
3270              "\x89\xa4\x8e\x66\x44\x85\xcc\xfd"
3271              "\x33\x14\x70\xe3\x96\xb2\xc3\xd3"
3272              "\xbb\x54\x5a\x1a\xf9\x74\xa2\xc5"
3273              "\x2d\x64\x75\xdd\xb4\x54\xe6\x74"
3274              "\x8c\xd3\x9d\x9e\x86\xab\x51\x53"
3275              "\xb7\x93\x3e\x6f\xd0\x4e\x2c\x40"
3276              "\xf6\xa8\x2e\x3e\x9d\xf4\x66\xa5"
3277              "\x76\x12\x73\x44\x1a\x56\xd7\x72"
3278              "\x88\xcd\x21\x8c\x4c\x0f\xfe\xda"
3279              "\x95\xe0\x3a\xa6\xa5\x84\x46\xcd"
3280              "\xd5\x3e\x9d\x3a\xe2\x67\xe6\x60"
3281              "\x1a\xe2\x70\x85\x58\xc2\x1b\x09"
3282              "\xe1\xd7\x2c\xca\xad\xa8\x8f\xf9"
3283              "\xac\xb3\x0e\xdb\xca\x2e\xe2\xb8"
3284              "\x51\x71\xd9\x3c\x6c\xf1\x56\xf8"
3285              "\xea\x9c\xf1\xfb\x0c\xe6\xb7\x10"
3286              "\x1c\xf8\xa9\x7c\xe8\x53\x35\xc1"
3287              "\x90\x3e\x76\x4a\x74\xa4\x21\x2c"
3288              "\xf6\x2c\x4e\x0f\x94\x3a\x88\x2e"
3289              "\x41\x09\x6a\x33\x7d\xf6\xdd\x3f"
3290              "\x8d\x23\x31\x74\x84\xeb\x88\x6e"
3291              "\xcc\xb9\xbc\x22\x83\x19\x07\x22"
3292              "\xa5\x2d\xdf\xa5\xf3\x80\x85\x78"
3293              "\x84\x39\x6a\x6d\x6a\x99\x4f\xa5"
3294              "\x15\xfe\x46\xb0\xe4\x6c\xa5\x41"
3295              "\x3c\xce\x8f\x42\x60\x71\xa7\x75"
3296              "\x08\x40\x65\x8a\x82\xbf\xf5\x43"
3297              "\x71\x96\xa9\x4d\x44\x8a\x20\xbe"
3298              "\xfa\x4d\xbb\xc0\x7d\x31\x96\x65"
3299              "\xe7\x75\xe5\x3e\xfd\x92\x3b\xc9"
3300              "\x55\xbb\x16\x7e\xf7\xc2\x8c\xa4"
3301              "\x40\x1d\xe5\xef\x0e\xdf\xe4\x9a"
3302              "\x62\x73\x65\xfd\x46\x63\x25\x3d"
3303              "\x2b\xaf\xe5\x64\xfe\xa5\x5c\xcf"
3304              "\x24\xf3\xb4\xac\x64\xba\xdf\x4b"
3305              "\xc6\x96\x7d\x81\x2d\x8d\x97\xf7"
3306              "\xc5\x68\x77\x84\x32\x2b\xcc\x85"
3307              "\x74\x96\xf0\x12\x77\x61\xb9\xeb"
3308              "\x71\xaa\x82\xcb\x1c\xdb\x89\xc8"
3309              "\xc6\xb5\xe3\x5c\x7d\x39\x07\x24"
3310              "\xda\x39\x87\x45\xc0\x2b\xbb\x01"
3311              "\xac\xbc\x2a\x5c\x7f\xfc\xe8\xce"
3312              "\x6d\x9c\x6f\xed\xd3\xc1\xa1\xd6"
3313              "\xc5\x55\xa9\x66\x2f\xe1\xc8\x32"
3314              "\xa6\x5d\xa4\x3a\x98\x73\xe8\x45"
3315              "\xa4\xc7\xa8\xb4\xf6\x13\x03\xf6"
3316              "\xe9\x2e\xc4\x29\x0f\x84\xdb\xc4"
3317              "\x21\xc4\xc2\x75\x67\x89\x37\x0a",
3318        .ilen = 512,
3319        .result = "\x1a\x1d\xa9\x30\xad\xf9\x2f\x9b"
3320              "\xb6\x1d\xae\xef\xf0\x2f\xf8\x5a"
3321              "\x39\x3c\xbf\x2a\xb2\x45\xb2\x23"
3322              "\x1b\x63\x3c\xcf\xaa\xbe\xcf\x4e"
3323              "\xfa\xe8\x29\xc2\x20\x68\x2b\x3c"
3324              "\x2e\x8b\xf7\x6e\x25\xbd\xe3\x3d"
3325              "\x66\x27\xd6\xaf\xd6\x64\x3e\xe3"
3326              "\xe8\x58\x46\x97\x39\x51\x07\xde"
3327              "\xcb\x37\xbc\xa9\xc0\x5f\x75\xc3"
3328              "\x0e\x84\x23\x1d\x16\xd4\x1c\x59"
3329              "\x9c\x1a\x02\x55\xab\x3a\x97\x1d"
3330              "\xdf\xdd\xc7\x06\x51\xd7\x70\xae"
3331              "\x23\xc6\x8c\xf5\x1e\xa0\xe5\x82"
3332              "\xb8\xb2\xbf\x04\xa0\x32\x8e\x68"
3333              "\xeb\xaf\x6e\x2d\x94\x22\x2f\xce"
3334              "\x4c\xb5\x59\xe2\xa2\x2f\xa0\x98"
3335              "\x1a\x97\xc6\xd4\xb5\x00\x59\xf2"
3336              "\x84\x14\x72\xb1\x9a\x6e\xa3\x7f"
3337              "\xea\x20\xe7\xcb\x65\x77\x3a\xdf"
3338              "\xc8\x97\x67\x15\xc2\x2a\x27\xcc"
3339              "\x18\x55\xa1\x24\x0b\x24\x24\xaf"
3340              "\x5b\xec\x68\xb8\xc8\xf5\xba\x63"
3341              "\xff\xed\x89\xce\xd5\x3d\x88\xf3"
3342              "\x25\xef\x05\x7c\x3a\xef\xeb\xd8"
3343              "\x7a\x32\x0d\xd1\x1e\x58\x59\x99"
3344              "\x90\x25\xb5\x26\xb0\xe3\x2b\x6c"
3345              "\x4c\xa9\x8b\x84\x4f\x5e\x01\x50"
3346              "\x41\x30\x58\xc5\x62\x74\x52\x1d"
3347              "\x45\x24\x6a\x42\x64\x4f\x97\x1c"
3348              "\xa8\x66\xb5\x6d\x79\xd4\x0d\x48"
3349              "\xc5\x5f\xf3\x90\x32\xdd\xdd\xe1"
3350              "\xe4\xa9\x9f\xfc\xc3\x52\x5a\x46"
3351              "\xe4\x81\x84\x95\x36\x59\x7a\x6b"
3352              "\xaa\xb3\x60\xad\xce\x9f\x9f\x28"
3353              "\xe0\x01\x75\x22\xc4\x4e\xa9\x62"
3354              "\x5c\x62\x0d\x00\xcb\x13\xe8\x43"
3355              "\x72\xd4\x2d\x53\x46\xb5\xd1\x16"
3356              "\x22\x18\xdf\x34\x33\xf5\xd6\x1c"
3357              "\xb8\x79\x78\x97\x94\xff\x72\x13"
3358              "\x4c\x27\xfc\xcb\xbf\x01\x53\xa6"
3359              "\xb4\x50\x6e\xde\xdf\xb5\x43\xa4"
3360              "\x59\xdf\x52\xf9\x7c\xe0\x11\x6f"
3361              "\x2d\x14\x8e\x24\x61\x2c\xe1\x17"
3362              "\xcc\xce\x51\x0c\x19\x8a\x82\x30"
3363              "\x94\xd5\x3d\x6a\x53\x06\x5e\xbd"
3364              "\xb7\xeb\xfa\xfd\x27\x51\xde\x85"
3365              "\x1e\x86\x53\x11\x53\x94\x00\xee"
3366              "\x2b\x8c\x08\x2a\xbf\xdd\xae\x11"
3367              "\xcb\x1e\xa2\x07\x9a\x80\xcf\x62"
3368              "\x9b\x09\xdc\x95\x3c\x96\x8e\xb1"
3369              "\x09\xbd\xe4\xeb\xdb\xca\x70\x7a"
3370              "\x9e\xfa\x31\x18\x45\x3c\x21\x33"
3371              "\xb0\xb3\x2b\xea\xf3\x71\x2d\xe1"
3372              "\x03\xad\x1b\x48\xd4\x67\x27\xf0"
3373              "\x62\xe4\x3d\xfb\x9b\x08\x76\xe7"
3374              "\xdd\x2b\x01\x39\x04\x5a\x58\x7a"
3375              "\xf7\x11\x90\xec\xbd\x51\x5c\x32"
3376              "\x6b\xd7\x35\x39\x02\x6b\xf2\xa6"
3377              "\xd0\x0d\x07\xe1\x06\xc4\x5b\x7d"
3378              "\xe4\x6a\xd7\xee\x15\x1f\x83\xb4"
3379              "\xa3\xa7\x5e\xc3\x90\xb7\xef\xd3"
3380              "\xb7\x4f\xf8\x92\x4c\xb7\x3c\x29"
3381              "\xcd\x7e\x2b\x5d\x43\xea\x42\xe7"
3382              "\x74\x3f\x7d\x58\x88\x75\xde\x3e",
3383        .rlen = 512,
3384    }
3385};
3386
3387static struct cipher_testvec aes_lrw_dec_tv_template[] = {
3388    /* from http://grouper.ieee.org/groups/1619/email/pdf00017.pdf */
3389    /* same as enc vectors with input and result reversed */
3390    { /* LRW-32-AES 1 */
3391        .key = "\x45\x62\xac\x25\xf8\x28\x17\x6d"
3392              "\x4c\x26\x84\x14\xb5\x68\x01\x85"
3393              "\x25\x8e\x2a\x05\xe7\x3e\x9d\x03"
3394              "\xee\x5a\x83\x0c\xcc\x09\x4c\x87",
3395        .klen = 32,
3396        .iv = "\x00\x00\x00\x00\x00\x00\x00\x00"
3397              "\x00\x00\x00\x00\x00\x00\x00\x01",
3398        .input = "\xf1\xb2\x73\xcd\x65\xa3\xdf\x5f"
3399              "\xe9\x5d\x48\x92\x54\x63\x4e\xb8",
3400        .ilen = 16,
3401        .result = "\x30\x31\x32\x33\x34\x35\x36\x37"
3402              "\x38\x39\x41\x42\x43\x44\x45\x46",
3403        .rlen = 16,
3404    }, { /* LRW-32-AES 2 */
3405        .key = "\x59\x70\x47\x14\xf5\x57\x47\x8c"
3406              "\xd7\x79\xe8\x0f\x54\x88\x79\x44"
3407              "\x0d\x48\xf0\xb7\xb1\x5a\x53\xea"
3408              "\x1c\xaa\x6b\x29\xc2\xca\xfb\xaf",
3409        .klen = 32,
3410        .iv = "\x00\x00\x00\x00\x00\x00\x00\x00"
3411              "\x00\x00\x00\x00\x00\x00\x00\x02",
3412        .input = "\x00\xc8\x2b\xae\x95\xbb\xcd\xe5"
3413              "\x27\x4f\x07\x69\xb2\x60\xe1\x36",
3414        .ilen = 16,
3415        .result = "\x30\x31\x32\x33\x34\x35\x36\x37"
3416               "\x38\x39\x41\x42\x43\x44\x45\x46",
3417        .rlen = 16,
3418    }, { /* LRW-32-AES 3 */
3419        .key = "\xd8\x2a\x91\x34\xb2\x6a\x56\x50"
3420              "\x30\xfe\x69\xe2\x37\x7f\x98\x47"
3421              "\xcd\xf9\x0b\x16\x0c\x64\x8f\xb6"
3422              "\xb0\x0d\x0d\x1b\xae\x85\x87\x1f",
3423        .klen = 32,
3424        .iv = "\x00\x00\x00\x00\x00\x00\x00\x00"
3425              "\x00\x00\x00\x02\x00\x00\x00\x00",
3426        .input = "\x76\x32\x21\x83\xed\x8f\xf1\x82"
3427              "\xf9\x59\x62\x03\x69\x0e\x5e\x01",
3428        .ilen = 16,
3429        .result = "\x30\x31\x32\x33\x34\x35\x36\x37"
3430              "\x38\x39\x41\x42\x43\x44\x45\x46",
3431        .rlen = 16,
3432    }, { /* LRW-32-AES 4 */
3433        .key = "\x0f\x6a\xef\xf8\xd3\xd2\xbb\x15"
3434              "\x25\x83\xf7\x3c\x1f\x01\x28\x74"
3435              "\xca\xc6\xbc\x35\x4d\x4a\x65\x54"
3436              "\x90\xae\x61\xcf\x7b\xae\xbd\xcc"
3437              "\xad\xe4\x94\xc5\x4a\x29\xae\x70",
3438        .klen = 40,
3439        .iv = "\x00\x00\x00\x00\x00\x00\x00\x00"
3440              "\x00\x00\x00\x00\x00\x00\x00\x01",
3441        .input = "\x9c\x0f\x15\x2f\x55\xa2\xd8\xf0"
3442              "\xd6\x7b\x8f\x9e\x28\x22\xbc\x41",
3443        .ilen = 16,
3444        .result = "\x30\x31\x32\x33\x34\x35\x36\x37"
3445              "\x38\x39\x41\x42\x43\x44\x45\x46",
3446        .rlen = 16,
3447    }, { /* LRW-32-AES 5 */
3448        .key = "\x8a\xd4\xee\x10\x2f\xbd\x81\xff"
3449              "\xf8\x86\xce\xac\x93\xc5\xad\xc6"
3450              "\xa0\x19\x07\xc0\x9d\xf7\xbb\xdd"
3451              "\x52\x13\xb2\xb7\xf0\xff\x11\xd8"
3452              "\xd6\x08\xd0\xcd\x2e\xb1\x17\x6f",
3453        .klen = 40,
3454        .iv = "\x00\x00\x00\x00\x00\x00\x00\x00"
3455              "\x00\x00\x00\x02\x00\x00\x00\x00",
3456        .input = "\xd4\x27\x6a\x7f\x14\x91\x3d\x65"
3457              "\xc8\x60\x48\x02\x87\xe3\x34\x06",
3458        .ilen = 16,
3459        .result = "\x30\x31\x32\x33\x34\x35\x36\x37"
3460              "\x38\x39\x41\x42\x43\x44\x45\x46",
3461        .rlen = 16,
3462    }, { /* LRW-32-AES 6 */
3463        .key = "\xf8\xd4\x76\xff\xd6\x46\xee\x6c"
3464              "\x23\x84\xcb\x1c\x77\xd6\x19\x5d"
3465              "\xfe\xf1\xa9\xf3\x7b\xbc\x8d\x21"
3466              "\xa7\x9c\x21\xf8\xcb\x90\x02\x89"
3467              "\xa8\x45\x34\x8e\xc8\xc5\xb5\xf1"
3468              "\x26\xf5\x0e\x76\xfe\xfd\x1b\x1e",
3469        .klen = 48,
3470        .iv = "\x00\x00\x00\x00\x00\x00\x00\x00"
3471              "\x00\x00\x00\x00\x00\x00\x00\x01",
3472        .input = "\xbd\x06\xb8\xe1\xdb\x98\x89\x9e"
3473              "\xc4\x98\xe4\x91\xcf\x1c\x70\x2b",
3474        .ilen = 16,
3475        .result = "\x30\x31\x32\x33\x34\x35\x36\x37"
3476              "\x38\x39\x41\x42\x43\x44\x45\x46",
3477        .rlen = 16,
3478    }, { /* LRW-32-AES 7 */
3479        .key = "\xfb\x76\x15\xb2\x3d\x80\x89\x1d"
3480              "\xd4\x70\x98\x0b\xc7\x95\x84\xc8"
3481              "\xb2\xfb\x64\xce\x60\x97\x87\x8d"
3482              "\x17\xfc\xe4\x5a\x49\xe8\x30\xb7"
3483              "\x6e\x78\x17\xe7\x2d\x5e\x12\xd4"
3484              "\x60\x64\x04\x7a\xf1\x2f\x9e\x0c",
3485        .klen = 48,
3486        .iv = "\x00\x00\x00\x00\x00\x00\x00\x00"
3487              "\x00\x00\x00\x02\x00\x00\x00\x00",
3488        .input = "\x5b\x90\x8e\xc1\xab\xdd\x67\x5f"
3489              "\x3d\x69\x8a\x95\x53\xc8\x9c\xe5",
3490        .ilen = 16,
3491        .result = "\x30\x31\x32\x33\x34\x35\x36\x37"
3492              "\x38\x39\x41\x42\x43\x44\x45\x46",
3493        .rlen = 16,
3494    }, {
3495/* http://www.mail-archive.com/stds-p1619@listserv.ieee.org/msg00173.html */
3496        .key = "\xf8\xd4\x76\xff\xd6\x46\xee\x6c"
3497              "\x23\x84\xcb\x1c\x77\xd6\x19\x5d"
3498              "\xfe\xf1\xa9\xf3\x7b\xbc\x8d\x21"
3499              "\xa7\x9c\x21\xf8\xcb\x90\x02\x89"
3500              "\xa8\x45\x34\x8e\xc8\xc5\xb5\xf1"
3501              "\x26\xf5\x0e\x76\xfe\xfd\x1b\x1e",
3502        .klen = 48,
3503        .iv = "\x00\x00\x00\x00\x00\x00\x00\x00"
3504              "\x00\x00\x00\x00\x00\x00\x00\x01",
3505        .input = "\x1a\x1d\xa9\x30\xad\xf9\x2f\x9b"
3506              "\xb6\x1d\xae\xef\xf0\x2f\xf8\x5a"
3507              "\x39\x3c\xbf\x2a\xb2\x45\xb2\x23"
3508              "\x1b\x63\x3c\xcf\xaa\xbe\xcf\x4e"
3509              "\xfa\xe8\x29\xc2\x20\x68\x2b\x3c"
3510              "\x2e\x8b\xf7\x6e\x25\xbd\xe3\x3d"
3511              "\x66\x27\xd6\xaf\xd6\x64\x3e\xe3"
3512              "\xe8\x58\x46\x97\x39\x51\x07\xde"
3513              "\xcb\x37\xbc\xa9\xc0\x5f\x75\xc3"
3514              "\x0e\x84\x23\x1d\x16\xd4\x1c\x59"
3515              "\x9c\x1a\x02\x55\xab\x3a\x97\x1d"
3516              "\xdf\xdd\xc7\x06\x51\xd7\x70\xae"
3517              "\x23\xc6\x8c\xf5\x1e\xa0\xe5\x82"
3518              "\xb8\xb2\xbf\x04\xa0\x32\x8e\x68"
3519              "\xeb\xaf\x6e\x2d\x94\x22\x2f\xce"
3520              "\x4c\xb5\x59\xe2\xa2\x2f\xa0\x98"
3521              "\x1a\x97\xc6\xd4\xb5\x00\x59\xf2"
3522              "\x84\x14\x72\xb1\x9a\x6e\xa3\x7f"
3523              "\xea\x20\xe7\xcb\x65\x77\x3a\xdf"
3524              "\xc8\x97\x67\x15\xc2\x2a\x27\xcc"
3525              "\x18\x55\xa1\x24\x0b\x24\x24\xaf"
3526              "\x5b\xec\x68\xb8\xc8\xf5\xba\x63"
3527              "\xff\xed\x89\xce\xd5\x3d\x88\xf3"
3528              "\x25\xef\x05\x7c\x3a\xef\xeb\xd8"
3529              "\x7a\x32\x0d\xd1\x1e\x58\x59\x99"
3530              "\x90\x25\xb5\x26\xb0\xe3\x2b\x6c"
3531              "\x4c\xa9\x8b\x84\x4f\x5e\x01\x50"
3532              "\x41\x30\x58\xc5\x62\x74\x52\x1d"
3533              "\x45\x24\x6a\x42\x64\x4f\x97\x1c"
3534              "\xa8\x66\xb5\x6d\x79\xd4\x0d\x48"
3535              "\xc5\x5f\xf3\x90\x32\xdd\xdd\xe1"
3536              "\xe4\xa9\x9f\xfc\xc3\x52\x5a\x46"
3537              "\xe4\x81\x84\x95\x36\x59\x7a\x6b"
3538              "\xaa\xb3\x60\xad\xce\x9f\x9f\x28"
3539              "\xe0\x01\x75\x22\xc4\x4e\xa9\x62"
3540              "\x5c\x62\x0d\x00\xcb\x13\xe8\x43"
3541              "\x72\xd4\x2d\x53\x46\xb5\xd1\x16"
3542              "\x22\x18\xdf\x34\x33\xf5\xd6\x1c"
3543              "\xb8\x79\x78\x97\x94\xff\x72\x13"
3544              "\x4c\x27\xfc\xcb\xbf\x01\x53\xa6"
3545              "\xb4\x50\x6e\xde\xdf\xb5\x43\xa4"
3546              "\x59\xdf\x52\xf9\x7c\xe0\x11\x6f"
3547              "\x2d\x14\x8e\x24\x61\x2c\xe1\x17"
3548              "\xcc\xce\x51\x0c\x19\x8a\x82\x30"
3549              "\x94\xd5\x3d\x6a\x53\x06\x5e\xbd"
3550              "\xb7\xeb\xfa\xfd\x27\x51\xde\x85"
3551              "\x1e\x86\x53\x11\x53\x94\x00\xee"
3552              "\x2b\x8c\x08\x2a\xbf\xdd\xae\x11"
3553              "\xcb\x1e\xa2\x07\x9a\x80\xcf\x62"
3554              "\x9b\x09\xdc\x95\x3c\x96\x8e\xb1"
3555              "\x09\xbd\xe4\xeb\xdb\xca\x70\x7a"
3556              "\x9e\xfa\x31\x18\x45\x3c\x21\x33"
3557              "\xb0\xb3\x2b\xea\xf3\x71\x2d\xe1"
3558              "\x03\xad\x1b\x48\xd4\x67\x27\xf0"
3559              "\x62\xe4\x3d\xfb\x9b\x08\x76\xe7"
3560              "\xdd\x2b\x01\x39\x04\x5a\x58\x7a"
3561              "\xf7\x11\x90\xec\xbd\x51\x5c\x32"
3562              "\x6b\xd7\x35\x39\x02\x6b\xf2\xa6"
3563              "\xd0\x0d\x07\xe1\x06\xc4\x5b\x7d"
3564              "\xe4\x6a\xd7\xee\x15\x1f\x83\xb4"
3565              "\xa3\xa7\x5e\xc3\x90\xb7\xef\xd3"
3566              "\xb7\x4f\xf8\x92\x4c\xb7\x3c\x29"
3567              "\xcd\x7e\x2b\x5d\x43\xea\x42\xe7"
3568              "\x74\x3f\x7d\x58\x88\x75\xde\x3e",
3569        .ilen = 512,
3570        .result = "\x05\x11\xb7\x18\xab\xc6\x2d\xac"
3571              "\x70\x5d\xf6\x22\x94\xcd\xe5\x6c"
3572              "\x17\x6b\xf6\x1c\xf0\xf3\x6e\xf8"
3573              "\x50\x38\x1f\x71\x49\xb6\x57\xd6"
3574              "\x8f\xcb\x8d\x6b\xe3\xa6\x29\x90"
3575              "\xfe\x2a\x62\x82\xae\x6d\x8b\xf6"
3576              "\xad\x1e\x9e\x20\x5f\x38\xbe\x04"
3577              "\xda\x10\x8e\xed\xa2\xa4\x87\xab"
3578              "\xda\x6b\xb4\x0c\x75\xba\xd3\x7c"
3579              "\xc9\xac\x42\x31\x95\x7c\xc9\x04"
3580              "\xeb\xd5\x6e\x32\x69\x8a\xdb\xa6"
3581              "\x15\xd7\x3f\x4f\x2f\x66\x69\x03"
3582              "\x9c\x1f\x54\x0f\xde\x1f\xf3\x65"
3583              "\x4c\x96\x12\xed\x7c\x92\x03\x01"
3584              "\x6f\xbc\x35\x93\xac\xf1\x27\xf1"
3585              "\xb4\x96\x82\x5a\x5f\xb0\xa0\x50"
3586              "\x89\xa4\x8e\x66\x44\x85\xcc\xfd"
3587              "\x33\x14\x70\xe3\x96\xb2\xc3\xd3"
3588              "\xbb\x54\x5a\x1a\xf9\x74\xa2\xc5"
3589              "\x2d\x64\x75\xdd\xb4\x54\xe6\x74"
3590              "\x8c\xd3\x9d\x9e\x86\xab\x51\x53"
3591              "\xb7\x93\x3e\x6f\xd0\x4e\x2c\x40"
3592              "\xf6\xa8\x2e\x3e\x9d\xf4\x66\xa5"
3593              "\x76\x12\x73\x44\x1a\x56\xd7\x72"
3594              "\x88\xcd\x21\x8c\x4c\x0f\xfe\xda"
3595              "\x95\xe0\x3a\xa6\xa5\x84\x46\xcd"
3596              "\xd5\x3e\x9d\x3a\xe2\x67\xe6\x60"
3597              "\x1a\xe2\x70\x85\x58\xc2\x1b\x09"
3598              "\xe1\xd7\x2c\xca\xad\xa8\x8f\xf9"
3599              "\xac\xb3\x0e\xdb\xca\x2e\xe2\xb8"
3600              "\x51\x71\xd9\x3c\x6c\xf1\x56\xf8"
3601              "\xea\x9c\xf1\xfb\x0c\xe6\xb7\x10"
3602              "\x1c\xf8\xa9\x7c\xe8\x53\x35\xc1"
3603              "\x90\x3e\x76\x4a\x74\xa4\x21\x2c"
3604              "\xf6\x2c\x4e\x0f\x94\x3a\x88\x2e"
3605              "\x41\x09\x6a\x33\x7d\xf6\xdd\x3f"
3606              "\x8d\x23\x31\x74\x84\xeb\x88\x6e"
3607              "\xcc\xb9\xbc\x22\x83\x19\x07\x22"
3608              "\xa5\x2d\xdf\xa5\xf3\x80\x85\x78"
3609              "\x84\x39\x6a\x6d\x6a\x99\x4f\xa5"
3610              "\x15\xfe\x46\xb0\xe4\x6c\xa5\x41"
3611              "\x3c\xce\x8f\x42\x60\x71\xa7\x75"
3612              "\x08\x40\x65\x8a\x82\xbf\xf5\x43"
3613              "\x71\x96\xa9\x4d\x44\x8a\x20\xbe"
3614              "\xfa\x4d\xbb\xc0\x7d\x31\x96\x65"
3615              "\xe7\x75\xe5\x3e\xfd\x92\x3b\xc9"
3616              "\x55\xbb\x16\x7e\xf7\xc2\x8c\xa4"
3617              "\x40\x1d\xe5\xef\x0e\xdf\xe4\x9a"
3618              "\x62\x73\x65\xfd\x46\x63\x25\x3d"
3619              "\x2b\xaf\xe5\x64\xfe\xa5\x5c\xcf"
3620              "\x24\xf3\xb4\xac\x64\xba\xdf\x4b"
3621              "\xc6\x96\x7d\x81\x2d\x8d\x97\xf7"
3622              "\xc5\x68\x77\x84\x32\x2b\xcc\x85"
3623              "\x74\x96\xf0\x12\x77\x61\xb9\xeb"
3624              "\x71\xaa\x82\xcb\x1c\xdb\x89\xc8"
3625              "\xc6\xb5\xe3\x5c\x7d\x39\x07\x24"
3626              "\xda\x39\x87\x45\xc0\x2b\xbb\x01"
3627              "\xac\xbc\x2a\x5c\x7f\xfc\xe8\xce"
3628              "\x6d\x9c\x6f\xed\xd3\xc1\xa1\xd6"
3629              "\xc5\x55\xa9\x66\x2f\xe1\xc8\x32"
3630              "\xa6\x5d\xa4\x3a\x98\x73\xe8\x45"
3631              "\xa4\xc7\xa8\xb4\xf6\x13\x03\xf6"
3632              "\xe9\x2e\xc4\x29\x0f\x84\xdb\xc4"
3633              "\x21\xc4\xc2\x75\x67\x89\x37\x0a",
3634        .rlen = 512,
3635    }
3636};
3637
3638static struct cipher_testvec aes_xts_enc_tv_template[] = {
3639    /* http://grouper.ieee.org/groups/1619/email/pdf00086.pdf */
3640    { /* XTS-AES 1 */
3641        .key = "\x00\x00\x00\x00\x00\x00\x00\x00"
3642              "\x00\x00\x00\x00\x00\x00\x00\x00"
3643              "\x00\x00\x00\x00\x00\x00\x00\x00"
3644              "\x00\x00\x00\x00\x00\x00\x00\x00",
3645        .klen = 32,
3646        .iv = "\x00\x00\x00\x00\x00\x00\x00\x00"
3647              "\x00\x00\x00\x00\x00\x00\x00\x00",
3648        .input = "\x00\x00\x00\x00\x00\x00\x00\x00"
3649              "\x00\x00\x00\x00\x00\x00\x00\x00"
3650              "\x00\x00\x00\x00\x00\x00\x00\x00"
3651              "\x00\x00\x00\x00\x00\x00\x00\x00",
3652        .ilen = 32,
3653        .result = "\x91\x7c\xf6\x9e\xbd\x68\xb2\xec"
3654              "\x9b\x9f\xe9\xa3\xea\xdd\xa6\x92"
3655              "\xcd\x43\xd2\xf5\x95\x98\xed\x85"
3656              "\x8c\x02\xc2\x65\x2f\xbf\x92\x2e",
3657        .rlen = 32,
3658    }, { /* XTS-AES 2 */
3659        .key = "\x11\x11\x11\x11\x11\x11\x11\x11"
3660              "\x11\x11\x11\x11\x11\x11\x11\x11"
3661              "\x22\x22\x22\x22\x22\x22\x22\x22"
3662              "\x22\x22\x22\x22\x22\x22\x22\x22",
3663        .klen = 32,
3664        .iv = "\x33\x33\x33\x33\x33\x00\x00\x00"
3665              "\x00\x00\x00\x00\x00\x00\x00\x00",
3666        .input = "\x44\x44\x44\x44\x44\x44\x44\x44"
3667              "\x44\x44\x44\x44\x44\x44\x44\x44"
3668              "\x44\x44\x44\x44\x44\x44\x44\x44"
3669              "\x44\x44\x44\x44\x44\x44\x44\x44",
3670        .ilen = 32,
3671        .result = "\xc4\x54\x18\x5e\x6a\x16\x93\x6e"
3672              "\x39\x33\x40\x38\xac\xef\x83\x8b"
3673              "\xfb\x18\x6f\xff\x74\x80\xad\xc4"
3674              "\x28\x93\x82\xec\xd6\xd3\x94\xf0",
3675        .rlen = 32,
3676    }, { /* XTS-AES 3 */
3677        .key = "\xff\xfe\xfd\xfc\xfb\xfa\xf9\xf8"
3678              "\xf7\xf6\xf5\xf4\xf3\xf2\xf1\xf0"
3679              "\x22\x22\x22\x22\x22\x22\x22\x22"
3680              "\x22\x22\x22\x22\x22\x22\x22\x22",
3681        .klen = 32,
3682        .iv = "\x33\x33\x33\x33\x33\x00\x00\x00"
3683              "\x00\x00\x00\x00\x00\x00\x00\x00",
3684        .input = "\x44\x44\x44\x44\x44\x44\x44\x44"
3685              "\x44\x44\x44\x44\x44\x44\x44\x44"
3686              "\x44\x44\x44\x44\x44\x44\x44\x44"
3687              "\x44\x44\x44\x44\x44\x44\x44\x44",
3688        .ilen = 32,
3689        .result = "\xaf\x85\x33\x6b\x59\x7a\xfc\x1a"
3690              "\x90\x0b\x2e\xb2\x1e\xc9\x49\xd2"
3691              "\x92\xdf\x4c\x04\x7e\x0b\x21\x53"
3692              "\x21\x86\xa5\x97\x1a\x22\x7a\x89",
3693        .rlen = 32,
3694    }, { /* XTS-AES 4 */
3695        .key = "\x27\x18\x28\x18\x28\x45\x90\x45"
3696              "\x23\x53\x60\x28\x74\x71\x35\x26"
3697              "\x31\x41\x59\x26\x53\x58\x97\x93"
3698              "\x23\x84\x62\x64\x33\x83\x27\x95",
3699        .klen = 32,
3700        .iv = "\x00\x00\x00\x00\x00\x00\x00\x00"
3701              "\x00\x00\x00\x00\x00\x00\x00\x00",
3702        .input = "\x00\x01\x02\x03\x04\x05\x06\x07"
3703              "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
3704              "\x10\x11\x12\x13\x14\x15\x16\x17"
3705              "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f"
3706              "\x20\x21\x22\x23\x24\x25\x26\x27"
3707              "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f"
3708              "\x30\x31\x32\x33\x34\x35\x36\x37"
3709              "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f"
3710              "\x40\x41\x42\x43\x44\x45\x46\x47"
3711              "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f"
3712              "\x50\x51\x52\x53\x54\x55\x56\x57"
3713              "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f"
3714              "\x60\x61\x62\x63\x64\x65\x66\x67"
3715              "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f"
3716              "\x70\x71\x72\x73\x74\x75\x76\x77"
3717              "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f"
3718              "\x80\x81\x82\x83\x84\x85\x86\x87"
3719              "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f"
3720              "\x90\x91\x92\x93\x94\x95\x96\x97"
3721              "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f"
3722              "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7"
3723              "\xa8\xa9\xaa\xab\xac\xad\xae\xaf"
3724              "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7"
3725              "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf"
3726              "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7"
3727              "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf"
3728              "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7"
3729              "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf"
3730              "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7"
3731              "\xe8\xe9\xea\xeb\xec\xed\xee\xef"
3732              "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7"
3733              "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff"
3734              "\x00\x01\x02\x03\x04\x05\x06\x07"
3735              "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
3736              "\x10\x11\x12\x13\x14\x15\x16\x17"
3737              "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f"
3738              "\x20\x21\x22\x23\x24\x25\x26\x27"
3739              "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f"
3740              "\x30\x31\x32\x33\x34\x35\x36\x37"
3741              "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f"
3742              "\x40\x41\x42\x43\x44\x45\x46\x47"
3743              "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f"
3744              "\x50\x51\x52\x53\x54\x55\x56\x57"
3745              "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f"
3746              "\x60\x61\x62\x63\x64\x65\x66\x67"
3747              "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f"
3748              "\x70\x71\x72\x73\x74\x75\x76\x77"
3749              "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f"
3750              "\x80\x81\x82\x83\x84\x85\x86\x87"
3751              "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f"
3752              "\x90\x91\x92\x93\x94\x95\x96\x97"
3753              "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f"
3754              "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7"
3755              "\xa8\xa9\xaa\xab\xac\xad\xae\xaf"
3756              "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7"
3757              "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf"
3758              "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7"
3759              "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf"
3760              "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7"
3761              "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf"
3762              "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7"
3763              "\xe8\xe9\xea\xeb\xec\xed\xee\xef"
3764              "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7"
3765              "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
3766        .ilen = 512,
3767        .result = "\x27\xa7\x47\x9b\xef\xa1\xd4\x76"
3768              "\x48\x9f\x30\x8c\xd4\xcf\xa6\xe2"
3769              "\xa9\x6e\x4b\xbe\x32\x08\xff\x25"
3770              "\x28\x7d\xd3\x81\x96\x16\xe8\x9c"
3771              "\xc7\x8c\xf7\xf5\xe5\x43\x44\x5f"
3772              "\x83\x33\xd8\xfa\x7f\x56\x00\x00"
3773              "\x05\x27\x9f\xa5\xd8\xb5\xe4\xad"
3774              "\x40\xe7\x36\xdd\xb4\xd3\x54\x12"
3775              "\x32\x80\x63\xfd\x2a\xab\x53\xe5"
3776              "\xea\x1e\x0a\x9f\x33\x25\x00\xa5"
3777              "\xdf\x94\x87\xd0\x7a\x5c\x92\xcc"
3778              "\x51\x2c\x88\x66\xc7\xe8\x60\xce"
3779              "\x93\xfd\xf1\x66\xa2\x49\x12\xb4"
3780              "\x22\x97\x61\x46\xae\x20\xce\x84"
3781              "\x6b\xb7\xdc\x9b\xa9\x4a\x76\x7a"
3782              "\xae\xf2\x0c\x0d\x61\xad\x02\x65"
3783              "\x5e\xa9\x2d\xc4\xc4\xe4\x1a\x89"
3784              "\x52\xc6\x51\xd3\x31\x74\xbe\x51"
3785              "\xa1\x0c\x42\x11\x10\xe6\xd8\x15"
3786              "\x88\xed\xe8\x21\x03\xa2\x52\xd8"
3787              "\xa7\x50\xe8\x76\x8d\xef\xff\xed"
3788              "\x91\x22\x81\x0a\xae\xb9\x9f\x91"
3789              "\x72\xaf\x82\xb6\x04\xdc\x4b\x8e"
3790              "\x51\xbc\xb0\x82\x35\xa6\xf4\x34"
3791              "\x13\x32\xe4\xca\x60\x48\x2a\x4b"
3792              "\xa1\xa0\x3b\x3e\x65\x00\x8f\xc5"
3793              "\xda\x76\xb7\x0b\xf1\x69\x0d\xb4"
3794              "\xea\xe2\x9c\x5f\x1b\xad\xd0\x3c"
3795              "\x5c\xcf\x2a\x55\xd7\x05\xdd\xcd"
3796              "\x86\xd4\x49\x51\x1c\xeb\x7e\xc3"
3797              "\x0b\xf1\x2b\x1f\xa3\x5b\x91\x3f"
3798              "\x9f\x74\x7a\x8a\xfd\x1b\x13\x0e"
3799              "\x94\xbf\xf9\x4e\xff\xd0\x1a\x91"
3800              "\x73\x5c\xa1\x72\x6a\xcd\x0b\x19"
3801              "\x7c\x4e\x5b\x03\x39\x36\x97\xe1"
3802              "\x26\x82\x6f\xb6\xbb\xde\x8e\xcc"
3803              "\x1e\x08\x29\x85\x16\xe2\xc9\xed"
3804              "\x03\xff\x3c\x1b\x78\x60\xf6\xde"
3805              "\x76\xd4\xce\xcd\x94\xc8\x11\x98"
3806              "\x55\xef\x52\x97\xca\x67\xe9\xf3"
3807              "\xe7\xff\x72\xb1\xe9\x97\x85\xca"
3808              "\x0a\x7e\x77\x20\xc5\xb3\x6d\xc6"
3809              "\xd7\x2c\xac\x95\x74\xc8\xcb\xbc"
3810              "\x2f\x80\x1e\x23\xe5\x6f\xd3\x44"
3811              "\xb0\x7f\x22\x15\x4b\xeb\xa0\xf0"
3812              "\x8c\xe8\x89\x1e\x64\x3e\xd9\x95"
3813              "\xc9\x4d\x9a\x69\xc9\xf1\xb5\xf4"
3814              "\x99\x02\x7a\x78\x57\x2a\xee\xbd"
3815              "\x74\xd2\x0c\xc3\x98\x81\xc2\x13"
3816              "\xee\x77\x0b\x10\x10\xe4\xbe\xa7"
3817              "\x18\x84\x69\x77\xae\x11\x9f\x7a"
3818              "\x02\x3a\xb5\x8c\xca\x0a\xd7\x52"
3819              "\xaf\xe6\x56\xbb\x3c\x17\x25\x6a"
3820              "\x9f\x6e\x9b\xf1\x9f\xdd\x5a\x38"
3821              "\xfc\x82\xbb\xe8\x72\xc5\x53\x9e"
3822              "\xdb\x60\x9e\xf4\xf7\x9c\x20\x3e"
3823              "\xbb\x14\x0f\x2e\x58\x3c\xb2\xad"
3824              "\x15\xb4\xaa\x5b\x65\x50\x16\xa8"
3825              "\x44\x92\x77\xdb\xd4\x77\xef\x2c"
3826              "\x8d\x6c\x01\x7d\xb7\x38\xb1\x8d"
3827              "\xeb\x4a\x42\x7d\x19\x23\xce\x3f"
3828              "\xf2\x62\x73\x57\x79\xa4\x18\xf2"
3829              "\x0a\x28\x2d\xf9\x20\x14\x7b\xea"
3830              "\xbe\x42\x1e\xe5\x31\x9d\x05\x68",
3831        .rlen = 512,
3832    }
3833};
3834
3835static struct cipher_testvec aes_xts_dec_tv_template[] = {
3836    /* http://grouper.ieee.org/groups/1619/email/pdf00086.pdf */
3837    { /* XTS-AES 1 */
3838        .key = "\x00\x00\x00\x00\x00\x00\x00\x00"
3839              "\x00\x00\x00\x00\x00\x00\x00\x00"
3840              "\x00\x00\x00\x00\x00\x00\x00\x00"
3841              "\x00\x00\x00\x00\x00\x00\x00\x00",
3842        .klen = 32,
3843        .iv = "\x00\x00\x00\x00\x00\x00\x00\x00"
3844              "\x00\x00\x00\x00\x00\x00\x00\x00",
3845        .input = "\x91\x7c\xf6\x9e\xbd\x68\xb2\xec"
3846             "\x9b\x9f\xe9\xa3\xea\xdd\xa6\x92"
3847             "\xcd\x43\xd2\xf5\x95\x98\xed\x85"
3848             "\x8c\x02\xc2\x65\x2f\xbf\x92\x2e",
3849        .ilen = 32,
3850        .result = "\x00\x00\x00\x00\x00\x00\x00\x00"
3851               "\x00\x00\x00\x00\x00\x00\x00\x00"
3852               "\x00\x00\x00\x00\x00\x00\x00\x00"
3853               "\x00\x00\x00\x00\x00\x00\x00\x00",
3854        .rlen = 32,
3855    }, { /* XTS-AES 2 */
3856        .key = "\x11\x11\x11\x11\x11\x11\x11\x11"
3857              "\x11\x11\x11\x11\x11\x11\x11\x11"
3858              "\x22\x22\x22\x22\x22\x22\x22\x22"
3859              "\x22\x22\x22\x22\x22\x22\x22\x22",
3860        .klen = 32,
3861        .iv = "\x33\x33\x33\x33\x33\x00\x00\x00"
3862              "\x00\x00\x00\x00\x00\x00\x00\x00",
3863        .input = "\xc4\x54\x18\x5e\x6a\x16\x93\x6e"
3864              "\x39\x33\x40\x38\xac\xef\x83\x8b"
3865              "\xfb\x18\x6f\xff\x74\x80\xad\xc4"
3866              "\x28\x93\x82\xec\xd6\xd3\x94\xf0",
3867        .ilen = 32,
3868        .result = "\x44\x44\x44\x44\x44\x44\x44\x44"
3869              "\x44\x44\x44\x44\x44\x44\x44\x44"
3870              "\x44\x44\x44\x44\x44\x44\x44\x44"
3871              "\x44\x44\x44\x44\x44\x44\x44\x44",
3872        .rlen = 32,
3873    }, { /* XTS-AES 3 */
3874        .key = "\xff\xfe\xfd\xfc\xfb\xfa\xf9\xf8"
3875              "\xf7\xf6\xf5\xf4\xf3\xf2\xf1\xf0"
3876              "\x22\x22\x22\x22\x22\x22\x22\x22"
3877              "\x22\x22\x22\x22\x22\x22\x22\x22",
3878        .klen = 32,
3879        .iv = "\x33\x33\x33\x33\x33\x00\x00\x00"
3880              "\x00\x00\x00\x00\x00\x00\x00\x00",
3881        .input = "\xaf\x85\x33\x6b\x59\x7a\xfc\x1a"
3882              "\x90\x0b\x2e\xb2\x1e\xc9\x49\xd2"
3883              "\x92\xdf\x4c\x04\x7e\x0b\x21\x53"
3884              "\x21\x86\xa5\x97\x1a\x22\x7a\x89",
3885        .ilen = 32,
3886        .result = "\x44\x44\x44\x44\x44\x44\x44\x44"
3887              "\x44\x44\x44\x44\x44\x44\x44\x44"
3888              "\x44\x44\x44\x44\x44\x44\x44\x44"
3889              "\x44\x44\x44\x44\x44\x44\x44\x44",
3890        .rlen = 32,
3891    }, { /* XTS-AES 4 */
3892        .key = "\x27\x18\x28\x18\x28\x45\x90\x45"
3893              "\x23\x53\x60\x28\x74\x71\x35\x26"
3894              "\x31\x41\x59\x26\x53\x58\x97\x93"
3895              "\x23\x84\x62\x64\x33\x83\x27\x95",
3896        .klen = 32,
3897        .iv = "\x00\x00\x00\x00\x00\x00\x00\x00"
3898              "\x00\x00\x00\x00\x00\x00\x00\x00",
3899        .input = "\x27\xa7\x47\x9b\xef\xa1\xd4\x76"
3900              "\x48\x9f\x30\x8c\xd4\xcf\xa6\xe2"
3901              "\xa9\x6e\x4b\xbe\x32\x08\xff\x25"
3902              "\x28\x7d\xd3\x81\x96\x16\xe8\x9c"
3903              "\xc7\x8c\xf7\xf5\xe5\x43\x44\x5f"
3904              "\x83\x33\xd8\xfa\x7f\x56\x00\x00"
3905              "\x05\x27\x9f\xa5\xd8\xb5\xe4\xad"
3906              "\x40\xe7\x36\xdd\xb4\xd3\x54\x12"
3907              "\x32\x80\x63\xfd\x2a\xab\x53\xe5"
3908              "\xea\x1e\x0a\x9f\x33\x25\x00\xa5"
3909              "\xdf\x94\x87\xd0\x7a\x5c\x92\xcc"
3910              "\x51\x2c\x88\x66\xc7\xe8\x60\xce"
3911              "\x93\xfd\xf1\x66\xa2\x49\x12\xb4"
3912              "\x22\x97\x61\x46\xae\x20\xce\x84"
3913              "\x6b\xb7\xdc\x9b\xa9\x4a\x76\x7a"
3914              "\xae\xf2\x0c\x0d\x61\xad\x02\x65"
3915              "\x5e\xa9\x2d\xc4\xc4\xe4\x1a\x89"
3916              "\x52\xc6\x51\xd3\x31\x74\xbe\x51"
3917              "\xa1\x0c\x42\x11\x10\xe6\xd8\x15"
3918              "\x88\xed\xe8\x21\x03\xa2\x52\xd8"
3919              "\xa7\x50\xe8\x76\x8d\xef\xff\xed"
3920              "\x91\x22\x81\x0a\xae\xb9\x9f\x91"
3921              "\x72\xaf\x82\xb6\x04\xdc\x4b\x8e"
3922              "\x51\xbc\xb0\x82\x35\xa6\xf4\x34"
3923              "\x13\x32\xe4\xca\x60\x48\x2a\x4b"
3924              "\xa1\xa0\x3b\x3e\x65\x00\x8f\xc5"
3925              "\xda\x76\xb7\x0b\xf1\x69\x0d\xb4"
3926              "\xea\xe2\x9c\x5f\x1b\xad\xd0\x3c"
3927              "\x5c\xcf\x2a\x55\xd7\x05\xdd\xcd"
3928              "\x86\xd4\x49\x51\x1c\xeb\x7e\xc3"
3929              "\x0b\xf1\x2b\x1f\xa3\x5b\x91\x3f"
3930              "\x9f\x74\x7a\x8a\xfd\x1b\x13\x0e"
3931              "\x94\xbf\xf9\x4e\xff\xd0\x1a\x91"
3932              "\x73\x5c\xa1\x72\x6a\xcd\x0b\x19"
3933              "\x7c\x4e\x5b\x03\x39\x36\x97\xe1"
3934              "\x26\x82\x6f\xb6\xbb\xde\x8e\xcc"
3935              "\x1e\x08\x29\x85\x16\xe2\xc9\xed"
3936              "\x03\xff\x3c\x1b\x78\x60\xf6\xde"
3937              "\x76\xd4\xce\xcd\x94\xc8\x11\x98"
3938              "\x55\xef\x52\x97\xca\x67\xe9\xf3"
3939              "\xe7\xff\x72\xb1\xe9\x97\x85\xca"
3940              "\x0a\x7e\x77\x20\xc5\xb3\x6d\xc6"
3941              "\xd7\x2c\xac\x95\x74\xc8\xcb\xbc"
3942              "\x2f\x80\x1e\x23\xe5\x6f\xd3\x44"
3943              "\xb0\x7f\x22\x15\x4b\xeb\xa0\xf0"
3944              "\x8c\xe8\x89\x1e\x64\x3e\xd9\x95"
3945              "\xc9\x4d\x9a\x69\xc9\xf1\xb5\xf4"
3946              "\x99\x02\x7a\x78\x57\x2a\xee\xbd"
3947              "\x74\xd2\x0c\xc3\x98\x81\xc2\x13"
3948              "\xee\x77\x0b\x10\x10\xe4\xbe\xa7"
3949              "\x18\x84\x69\x77\xae\x11\x9f\x7a"
3950              "\x02\x3a\xb5\x8c\xca\x0a\xd7\x52"
3951              "\xaf\xe6\x56\xbb\x3c\x17\x25\x6a"
3952              "\x9f\x6e\x9b\xf1\x9f\xdd\x5a\x38"
3953              "\xfc\x82\xbb\xe8\x72\xc5\x53\x9e"
3954              "\xdb\x60\x9e\xf4\xf7\x9c\x20\x3e"
3955              "\xbb\x14\x0f\x2e\x58\x3c\xb2\xad"
3956              "\x15\xb4\xaa\x5b\x65\x50\x16\xa8"
3957              "\x44\x92\x77\xdb\xd4\x77\xef\x2c"
3958              "\x8d\x6c\x01\x7d\xb7\x38\xb1\x8d"
3959              "\xeb\x4a\x42\x7d\x19\x23\xce\x3f"
3960              "\xf2\x62\x73\x57\x79\xa4\x18\xf2"
3961              "\x0a\x28\x2d\xf9\x20\x14\x7b\xea"
3962              "\xbe\x42\x1e\xe5\x31\x9d\x05\x68",
3963        .ilen = 512,
3964        .result = "\x00\x01\x02\x03\x04\x05\x06\x07"
3965              "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
3966              "\x10\x11\x12\x13\x14\x15\x16\x17"
3967              "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f"
3968              "\x20\x21\x22\x23\x24\x25\x26\x27"
3969              "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f"
3970              "\x30\x31\x32\x33\x34\x35\x36\x37"
3971              "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f"
3972              "\x40\x41\x42\x43\x44\x45\x46\x47"
3973              "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f"
3974              "\x50\x51\x52\x53\x54\x55\x56\x57"
3975              "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f"
3976              "\x60\x61\x62\x63\x64\x65\x66\x67"
3977              "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f"
3978              "\x70\x71\x72\x73\x74\x75\x76\x77"
3979              "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f"
3980              "\x80\x81\x82\x83\x84\x85\x86\x87"
3981              "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f"
3982              "\x90\x91\x92\x93\x94\x95\x96\x97"
3983              "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f"
3984              "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7"
3985              "\xa8\xa9\xaa\xab\xac\xad\xae\xaf"
3986              "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7"
3987              "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf"
3988              "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7"
3989              "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf"
3990              "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7"
3991              "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf"
3992              "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7"
3993              "\xe8\xe9\xea\xeb\xec\xed\xee\xef"
3994              "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7"
3995              "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff"
3996              "\x00\x01\x02\x03\x04\x05\x06\x07"
3997              "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
3998              "\x10\x11\x12\x13\x14\x15\x16\x17"
3999              "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f"
4000              "\x20\x21\x22\x23\x24\x25\x26\x27"
4001              "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f"
4002              "\x30\x31\x32\x33\x34\x35\x36\x37"
4003              "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f"
4004              "\x40\x41\x42\x43\x44\x45\x46\x47"
4005              "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f"
4006              "\x50\x51\x52\x53\x54\x55\x56\x57"
4007              "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f"
4008              "\x60\x61\x62\x63\x64\x65\x66\x67"
4009              "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f"
4010              "\x70\x71\x72\x73\x74\x75\x76\x77"
4011              "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f"
4012              "\x80\x81\x82\x83\x84\x85\x86\x87"
4013              "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f"
4014              "\x90\x91\x92\x93\x94\x95\x96\x97"
4015              "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f"
4016              "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7"
4017              "\xa8\xa9\xaa\xab\xac\xad\xae\xaf"
4018              "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7"
4019              "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf"
4020              "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7"
4021              "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf"
4022              "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7"
4023              "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf"
4024              "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7"
4025              "\xe8\xe9\xea\xeb\xec\xed\xee\xef"
4026              "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7"
4027              "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
4028        .rlen = 512,
4029    }
4030};
4031
4032
4033static struct cipher_testvec aes_ctr_enc_tv_template[] = {
4034    { /* From NIST Special Publication 800-38A, Appendix F.5 */
4035        .key = "\x2b\x7e\x15\x16\x28\xae\xd2\xa6"
4036              "\xab\xf7\x15\x88\x09\xcf\x4f\x3c",
4037        .klen = 16,
4038        .iv = "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7"
4039              "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
4040        .input = "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96"
4041              "\xe9\x3d\x7e\x11\x73\x93\x17\x2a"
4042              "\xae\x2d\x8a\x57\x1e\x03\xac\x9c"
4043              "\x9e\xb7\x6f\xac\x45\xaf\x8e\x51"
4044              "\x30\xc8\x1c\x46\xa3\x5c\xe4\x11"
4045              "\xe5\xfb\xc1\x19\x1a\x0a\x52\xef"
4046              "\xf6\x9f\x24\x45\xdf\x4f\x9b\x17"
4047              "\xad\x2b\x41\x7b\xe6\x6c\x37\x10",
4048        .ilen = 64,
4049        .result = "\x87\x4d\x61\x91\xb6\x20\xe3\x26"
4050              "\x1b\xef\x68\x64\x99\x0d\xb6\xce"
4051              "\x98\x06\xf6\x6b\x79\x70\xfd\xff"
4052              "\x86\x17\x18\x7b\xb9\xff\xfd\xff"
4053              "\x5a\xe4\xdf\x3e\xdb\xd5\xd3\x5e"
4054              "\x5b\x4f\x09\x02\x0d\xb0\x3e\xab"
4055              "\x1e\x03\x1d\xda\x2f\xbe\x03\xd1"
4056              "\x79\x21\x70\xa0\xf3\x00\x9c\xee",
4057        .rlen = 64,
4058    }, {
4059        .key = "\x8e\x73\xb0\xf7\xda\x0e\x64\x52"
4060              "\xc8\x10\xf3\x2b\x80\x90\x79\xe5"
4061              "\x62\xf8\xea\xd2\x52\x2c\x6b\x7b",
4062        .klen = 24,
4063        .iv = "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7"
4064              "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
4065        .input = "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96"
4066              "\xe9\x3d\x7e\x11\x73\x93\x17\x2a"
4067              "\xae\x2d\x8a\x57\x1e\x03\xac\x9c"
4068              "\x9e\xb7\x6f\xac\x45\xaf\x8e\x51"
4069              "\x30\xc8\x1c\x46\xa3\x5c\xe4\x11"
4070              "\xe5\xfb\xc1\x19\x1a\x0a\x52\xef"
4071              "\xf6\x9f\x24\x45\xdf\x4f\x9b\x17"
4072              "\xad\x2b\x41\x7b\xe6\x6c\x37\x10",
4073        .ilen = 64,
4074        .result = "\x1a\xbc\x93\x24\x17\x52\x1c\xa2"
4075              "\x4f\x2b\x04\x59\xfe\x7e\x6e\x0b"
4076              "\x09\x03\x39\xec\x0a\xa6\xfa\xef"
4077              "\xd5\xcc\xc2\xc6\xf4\xce\x8e\x94"
4078              "\x1e\x36\xb2\x6b\xd1\xeb\xc6\x70"
4079              "\xd1\xbd\x1d\x66\x56\x20\xab\xf7"
4080              "\x4f\x78\xa7\xf6\xd2\x98\x09\x58"
4081              "\x5a\x97\xda\xec\x58\xc6\xb0\x50",
4082        .rlen = 64,
4083    }, {
4084        .key = "\x60\x3d\xeb\x10\x15\xca\x71\xbe"
4085              "\x2b\x73\xae\xf0\x85\x7d\x77\x81"
4086              "\x1f\x35\x2c\x07\x3b\x61\x08\xd7"
4087              "\x2d\x98\x10\xa3\x09\x14\xdf\xf4",
4088        .klen = 32,
4089        .iv = "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7"
4090              "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
4091        .input = "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96"
4092              "\xe9\x3d\x7e\x11\x73\x93\x17\x2a"
4093              "\xae\x2d\x8a\x57\x1e\x03\xac\x9c"
4094              "\x9e\xb7\x6f\xac\x45\xaf\x8e\x51"
4095              "\x30\xc8\x1c\x46\xa3\x5c\xe4\x11"
4096              "\xe5\xfb\xc1\x19\x1a\x0a\x52\xef"
4097              "\xf6\x9f\x24\x45\xdf\x4f\x9b\x17"
4098              "\xad\x2b\x41\x7b\xe6\x6c\x37\x10",
4099        .ilen = 64,
4100        .result = "\x60\x1e\xc3\x13\x77\x57\x89\xa5"
4101              "\xb7\xa7\xf5\x04\xbb\xf3\xd2\x28"
4102              "\xf4\x43\xe3\xca\x4d\x62\xb5\x9a"
4103              "\xca\x84\xe9\x90\xca\xca\xf5\xc5"
4104              "\x2b\x09\x30\xda\xa2\x3d\xe9\x4c"
4105              "\xe8\x70\x17\xba\x2d\x84\x98\x8d"
4106              "\xdf\xc9\xc5\x8d\xb6\x7a\xad\xa6"
4107              "\x13\xc2\xdd\x08\x45\x79\x41\xa6",
4108        .rlen = 64,
4109    }
4110};
4111
4112static struct cipher_testvec aes_ctr_dec_tv_template[] = {
4113    { /* From NIST Special Publication 800-38A, Appendix F.5 */
4114        .key = "\x2b\x7e\x15\x16\x28\xae\xd2\xa6"
4115              "\xab\xf7\x15\x88\x09\xcf\x4f\x3c",
4116        .klen = 16,
4117        .iv = "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7"
4118              "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
4119        .input = "\x87\x4d\x61\x91\xb6\x20\xe3\x26"
4120              "\x1b\xef\x68\x64\x99\x0d\xb6\xce"
4121              "\x98\x06\xf6\x6b\x79\x70\xfd\xff"
4122              "\x86\x17\x18\x7b\xb9\xff\xfd\xff"
4123              "\x5a\xe4\xdf\x3e\xdb\xd5\xd3\x5e"
4124              "\x5b\x4f\x09\x02\x0d\xb0\x3e\xab"
4125              "\x1e\x03\x1d\xda\x2f\xbe\x03\xd1"
4126              "\x79\x21\x70\xa0\xf3\x00\x9c\xee",
4127        .ilen = 64,
4128        .result = "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96"
4129              "\xe9\x3d\x7e\x11\x73\x93\x17\x2a"
4130              "\xae\x2d\x8a\x57\x1e\x03\xac\x9c"
4131              "\x9e\xb7\x6f\xac\x45\xaf\x8e\x51"
4132              "\x30\xc8\x1c\x46\xa3\x5c\xe4\x11"
4133              "\xe5\xfb\xc1\x19\x1a\x0a\x52\xef"
4134              "\xf6\x9f\x24\x45\xdf\x4f\x9b\x17"
4135              "\xad\x2b\x41\x7b\xe6\x6c\x37\x10",
4136        .rlen = 64,
4137    }, {
4138        .key = "\x8e\x73\xb0\xf7\xda\x0e\x64\x52"
4139              "\xc8\x10\xf3\x2b\x80\x90\x79\xe5"
4140              "\x62\xf8\xea\xd2\x52\x2c\x6b\x7b",
4141        .klen = 24,
4142        .iv = "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7"
4143              "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
4144        .input = "\x1a\xbc\x93\x24\x17\x52\x1c\xa2"
4145              "\x4f\x2b\x04\x59\xfe\x7e\x6e\x0b"
4146              "\x09\x03\x39\xec\x0a\xa6\xfa\xef"
4147              "\xd5\xcc\xc2\xc6\xf4\xce\x8e\x94"
4148              "\x1e\x36\xb2\x6b\xd1\xeb\xc6\x70"
4149              "\xd1\xbd\x1d\x66\x56\x20\xab\xf7"
4150              "\x4f\x78\xa7\xf6\xd2\x98\x09\x58"
4151              "\x5a\x97\xda\xec\x58\xc6\xb0\x50",
4152        .ilen = 64,
4153        .result = "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96"
4154              "\xe9\x3d\x7e\x11\x73\x93\x17\x2a"
4155              "\xae\x2d\x8a\x57\x1e\x03\xac\x9c"
4156              "\x9e\xb7\x6f\xac\x45\xaf\x8e\x51"
4157              "\x30\xc8\x1c\x46\xa3\x5c\xe4\x11"
4158              "\xe5\xfb\xc1\x19\x1a\x0a\x52\xef"
4159              "\xf6\x9f\x24\x45\xdf\x4f\x9b\x17"
4160              "\xad\x2b\x41\x7b\xe6\x6c\x37\x10",
4161        .rlen = 64,
4162    }, {
4163        .key = "\x60\x3d\xeb\x10\x15\xca\x71\xbe"
4164              "\x2b\x73\xae\xf0\x85\x7d\x77\x81"
4165              "\x1f\x35\x2c\x07\x3b\x61\x08\xd7"
4166              "\x2d\x98\x10\xa3\x09\x14\xdf\xf4",
4167        .klen = 32,
4168        .iv = "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7"
4169              "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff",
4170        .input = "\x60\x1e\xc3\x13\x77\x57\x89\xa5"
4171              "\xb7\xa7\xf5\x04\xbb\xf3\xd2\x28"
4172              "\xf4\x43\xe3\xca\x4d\x62\xb5\x9a"
4173              "\xca\x84\xe9\x90\xca\xca\xf5\xc5"
4174              "\x2b\x09\x30\xda\xa2\x3d\xe9\x4c"
4175              "\xe8\x70\x17\xba\x2d\x84\x98\x8d"
4176              "\xdf\xc9\xc5\x8d\xb6\x7a\xad\xa6"
4177              "\x13\xc2\xdd\x08\x45\x79\x41\xa6",
4178        .ilen = 64,
4179        .result = "\x6b\xc1\xbe\xe2\x2e\x40\x9f\x96"
4180              "\xe9\x3d\x7e\x11\x73\x93\x17\x2a"
4181              "\xae\x2d\x8a\x57\x1e\x03\xac\x9c"
4182              "\x9e\xb7\x6f\xac\x45\xaf\x8e\x51"
4183              "\x30\xc8\x1c\x46\xa3\x5c\xe4\x11"
4184              "\xe5\xfb\xc1\x19\x1a\x0a\x52\xef"
4185              "\xf6\x9f\x24\x45\xdf\x4f\x9b\x17"
4186              "\xad\x2b\x41\x7b\xe6\x6c\x37\x10",
4187        .rlen = 64,
4188    }
4189};
4190
4191static struct cipher_testvec aes_ctr_rfc3686_enc_tv_template[] = {
4192    { /* From RFC 3686 */
4193        .key = "\xae\x68\x52\xf8\x12\x10\x67\xcc"
4194              "\x4b\xf7\xa5\x76\x55\x77\xf3\x9e"
4195              "\x00\x00\x00\x30",
4196        .klen = 20,
4197        .iv = "\x00\x00\x00\x00\x00\x00\x00\x00",
4198        .input = "Single block msg",
4199        .ilen = 16,
4200        .result = "\xe4\x09\x5d\x4f\xb7\xa7\xb3\x79"
4201              "\x2d\x61\x75\xa3\x26\x13\x11\xb8",
4202        .rlen = 16,
4203    }, {
4204        .key = "\x7e\x24\x06\x78\x17\xfa\xe0\xd7"
4205              "\x43\xd6\xce\x1f\x32\x53\x91\x63"
4206              "\x00\x6c\xb6\xdb",
4207        .klen = 20,
4208        .iv = "\xc0\x54\x3b\x59\xda\x48\xd9\x0b",
4209        .input = "\x00\x01\x02\x03\x04\x05\x06\x07"
4210              "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
4211              "\x10\x11\x12\x13\x14\x15\x16\x17"
4212              "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f",
4213        .ilen = 32,
4214        .result = "\x51\x04\xa1\x06\x16\x8a\x72\xd9"
4215              "\x79\x0d\x41\xee\x8e\xda\xd3\x88"
4216              "\xeb\x2e\x1e\xfc\x46\xda\x57\xc8"
4217              "\xfc\xe6\x30\xdf\x91\x41\xbe\x28",
4218        .rlen = 32,
4219    }, {
4220        .key = "\x16\xaf\x5b\x14\x5f\xc9\xf5\x79"
4221              "\xc1\x75\xf9\x3e\x3b\xfb\x0e\xed"
4222              "\x86\x3d\x06\xcc\xfd\xb7\x85\x15"
4223              "\x00\x00\x00\x48",
4224        .klen = 28,
4225        .iv = "\x36\x73\x3c\x14\x7d\x6d\x93\xcb",
4226        .input = "Single block msg",
4227        .ilen = 16,
4228        .result = "\x4b\x55\x38\x4f\xe2\x59\xc9\xc8"
4229              "\x4e\x79\x35\xa0\x03\xcb\xe9\x28",
4230        .rlen = 16,
4231    }, {
4232        .key = "\x7c\x5c\xb2\x40\x1b\x3d\xc3\x3c"
4233              "\x19\xe7\x34\x08\x19\xe0\xf6\x9c"
4234              "\x67\x8c\x3d\xb8\xe6\xf6\xa9\x1a"
4235              "\x00\x96\xb0\x3b",
4236        .klen = 28,
4237        .iv = "\x02\x0c\x6e\xad\xc2\xcb\x50\x0d",
4238        .input = "\x00\x01\x02\x03\x04\x05\x06\x07"
4239              "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
4240              "\x10\x11\x12\x13\x14\x15\x16\x17"
4241              "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f",
4242        .ilen = 32,
4243        .result = "\x45\x32\x43\xfc\x60\x9b\x23\x32"
4244              "\x7e\xdf\xaa\xfa\x71\x31\xcd\x9f"
4245              "\x84\x90\x70\x1c\x5a\xd4\xa7\x9c"
4246              "\xfc\x1f\xe0\xff\x42\xf4\xfb\x00",
4247        .rlen = 32,
4248    }, {
4249        .key = "\x77\x6b\xef\xf2\x85\x1d\xb0\x6f"
4250              "\x4c\x8a\x05\x42\xc8\x69\x6f\x6c"
4251              "\x6a\x81\xaf\x1e\xec\x96\xb4\xd3"
4252              "\x7f\xc1\xd6\x89\xe6\xc1\xc1\x04"
4253              "\x00\x00\x00\x60",
4254        .klen = 36,
4255        .iv = "\xdb\x56\x72\xc9\x7a\xa8\xf0\xb2",
4256        .input = "Single block msg",
4257        .ilen = 16,
4258        .result = "\x14\x5a\xd0\x1d\xbf\x82\x4e\xc7"
4259              "\x56\x08\x63\xdc\x71\xe3\xe0\xc0",
4260        .rlen = 16,
4261    }, {
4262        .key = "\xf6\xd6\x6d\x6b\xd5\x2d\x59\xbb"
4263              "\x07\x96\x36\x58\x79\xef\xf8\x86"
4264              "\xc6\x6d\xd5\x1a\x5b\x6a\x99\x74"
4265              "\x4b\x50\x59\x0c\x87\xa2\x38\x84"
4266              "\x00\xfa\xac\x24",
4267        .klen = 36,
4268        .iv = "\xc1\x58\x5e\xf1\x5a\x43\xd8\x75",
4269        .input = "\x00\x01\x02\x03\x04\x05\x06\x07"
4270              "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
4271              "\x10\x11\x12\x13\x14\x15\x16\x17"
4272              "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f",
4273        .ilen = 32,
4274        .result = "\xf0\x5e\x23\x1b\x38\x94\x61\x2c"
4275              "\x49\xee\x00\x0b\x80\x4e\xb2\xa9"
4276              "\xb8\x30\x6b\x50\x8f\x83\x9d\x6a"
4277              "\x55\x30\x83\x1d\x93\x44\xaf\x1c",
4278        .rlen = 32,
4279    }, {
4280    // generated using Crypto++
4281        .key = "\x00\x01\x02\x03\x04\x05\x06\x07"
4282            "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
4283            "\x10\x11\x12\x13\x14\x15\x16\x17"
4284            "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f"
4285            "\x00\x00\x00\x00",
4286        .klen = 32 + 4,
4287        .iv = "\x00\x00\x00\x00\x00\x00\x00\x00",
4288        .input =
4289            "\x00\x01\x02\x03\x04\x05\x06\x07"
4290            "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
4291            "\x10\x11\x12\x13\x14\x15\x16\x17"
4292            "\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f"
4293            "\x20\x21\x22\x23\x24\x25\x26\x27"
4294            "\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f"
4295            "\x30\x31\x32\x33\x34\x35\x36\x37"
4296            "\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f"
4297            "\x40\x41\x42\x43\x44\x45\x46\x47"
4298            "\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f"
4299            "\x50\x51\x52\x53\x54\x55\x56\x57"
4300            "\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f"
4301            "\x60\x61\x62\x63\x64\x65\x66\x67"
4302            "\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f"
4303            "\x70\x71\x72\x73\x74\x75\x76\x77"
4304            "\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f"
4305            "\x80\x81\x82\x83\x84\x85\x86\x87"
4306            "\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f"
4307            "\x90\x91\x92\x93\x94\x95\x96\x97"
4308            "\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f"
4309            "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7"
4310            "\xa8\xa9\xaa\xab\xac\xad\xae\xaf"
4311            "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7"
4312            "\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf"
4313            "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7"
4314            "\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf"
4315            "\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7"
4316            "\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf"
4317            "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7"
4318            "\xe8\xe9\xea\xeb\xec\xed\xee\xef"
4319            "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7"
4320            "\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff"
4321            "\x00\x03\x06\x09\x0c\x0f\x12\x15"
4322            "\x18\x1b\x1e\x21\x24\x27\x2a\x2d"
4323            "\x30\x33\x36\x39\x3c\x3f\x42\x45"
4324            "\x48\x4b\x4e\x51\x54\x57\x5a\x5d"
4325            "\x60\x63\x66\x69\x6c\x6f\x72\x75"
4326            "\x78\x7b\x7e\x81\x84\x87\x8a\x8d"
4327            "\x90\x93\x96\x99\x9c\x9f\xa2\xa5"
4328            "\xa8\xab\xae\xb1\xb4\xb7\xba\xbd"
4329            "\xc0\xc3\xc6\xc9\xcc\xcf\xd2\xd5"
4330            "\xd8\xdb\xde\xe1\xe4\xe7\xea\xed"
4331            "\xf0\xf3\xf6\xf9\xfc\xff\x02\x05"
4332            "\x08\x0b\x0e\x11\x14\x17\x1a\x1d"
4333            "\x20\x23\x26\x29\x2c\x2f\x32\x35"
4334            "\x38\x3b\x3e\x41\x44\x47\x4a\x4d"
4335            "\x50\x53\x56\x59\x5c\x5f\x62\x65"
4336            "\x68\x6b\x6e\x71\x74\x77\x7a\x7d"
4337            "\x80\x83\x86\x89\x8c\x8f\x92\x95"
4338            "\x98\x9b\x9e\xa1\xa4\xa7\xaa\xad"
4339            "\xb0\xb3\xb6\xb9\xbc\xbf\xc2\xc5"
4340            "\xc8\xcb\xce\xd1\xd4\xd7\xda\xdd"
4341            "\xe0\xe3\xe6\xe9\xec\xef\xf2\xf5"
4342            "\xf8\xfb\xfe\x01\x04\x07\x0a\x0d"
4343            "\x10\x13\x16\x19\x1c\x1f\x22\x25"
4344            "\x28\x2b\x2e\x31\x34\x37\x3a\x3d"
4345            "\x40\x43\x46\x49\x4c\x4f\x52\x55"
4346            "\x58\x5b\x5e\x61\x64\x67\x6a\x6d"
4347            "\x70\x73\x76\x79\x7c\x7f\x82\x85"
4348            "\x88\x8b\x8e\x91\x94\x97\x9a\x9d"
4349            "\xa0\xa3\xa6\xa9\xac\xaf\xb2\xb5"
4350            "\xb8\xbb\xbe\xc1\xc4\xc7\xca\xcd"
4351            "\xd0\xd3\xd6\xd9\xdc\xdf\xe2\xe5"
4352            "\xe8\xeb\xee\xf1\xf4\xf7\xfa\xfd"
4353            "\x00\x05\x0a\x0f\x14\x19\x1e\x23"
4354            "\x28\x2d\x32\x37\x3c\x41\x46\x4b"
4355            "\x50\x55\x5a\x5f\x64\x69\x6e\x73"
4356            "\x78\x7d\x82\x87\x8c\x91\x96\x9b"
4357            "\xa0\xa5\xaa\xaf\xb4\xb9\xbe\xc3"
4358            "\xc8\xcd\xd2\xd7\xdc\xe1\xe6\xeb"
4359            "\xf0\xf5\xfa\xff\x04\x09\x0e\x13"
4360            "\x18\x1d\x22\x27\x2c\x31\x36\x3b"
4361            "\x40\x45\x4a\x4f\x54\x59\x5e\x63"
4362            "\x68\x6d\x72\x77\x7c\x81\x86\x8b"
4363            "\x90\x95\x9a\x9f\xa4\xa9\xae\xb3"
4364            "\xb8\xbd\xc2\xc7\xcc\xd1\xd6\xdb"
4365            "\xe0\xe5\xea\xef\xf4\xf9\xfe\x03"
4366            "\x08\x0d\x12\x17\x1c\x21\x26\x2b"
4367            "\x30\x35\x3a\x3f\x44\x49\x4e\x53"
4368            "\x58\x5d\x62\x67\x6c\x71\x76\x7b"
4369            "\x80\x85\x8a\x8f\x94\x99\x9e\xa3"
4370            "\xa8\xad\xb2\xb7\xbc\xc1\xc6\xcb"
4371            "\xd0\xd5\xda\xdf\xe4\xe9\xee\xf3"
4372            "\xf8\xfd\x02\x07\x0c\x11\x16\x1b"
4373            "\x20\x25\x2a\x2f\x34\x39\x3e\x43"
4374            "\x48\x4d\x52\x57\x5c\x61\x66\x6b"
4375            "\x70\x75\x7a\x7f\x84\x89\x8e\x93"
4376            "\x98\x9d\xa2\xa7\xac\xb1\xb6\xbb"
4377            "\xc0\xc5\xca\xcf\xd4\xd9\xde\xe3"
4378            "\xe8\xed\xf2\xf7\xfc\x01\x06\x0b"
4379            "\x10\x15\x1a\x1f\x24\x29\x2e\x33"
4380            "\x38\x3d\x42\x47\x4c\x51\x56\x5b"
4381            "\x60\x65\x6a\x6f\x74\x79\x7e\x83"
4382            "\x88\x8d\x92\x97\x9c\xa1\xa6\xab"
4383            "\xb0\xb5\xba\xbf\xc4\xc9\xce\xd3"
4384            "\xd8\xdd\xe2\xe7\xec\xf1\xf6\xfb"
4385            "\x00\x07\x0e\x15\x1c\x23\x2a\x31"
4386            "\x38\x3f\x46\x4d\x54\x5b\x62\x69"
4387            "\x70\x77\x7e\x85\x8c\x93\x9a\xa1"
4388            "\xa8\xaf\xb6\xbd\xc4\xcb\xd2\xd9"
4389            "\xe0\xe7\xee\xf5\xfc\x03\x0a\x11"
4390            "\x18\x1f\x26\x2d\x34\x3b\x42\x49"
4391            "\x50\x57\x5e\x65\x6c\x73\x7a\x81"
4392            "\x88\x8f\x96\x9d\xa4\xab\xb2\xb9"
4393            "\xc0\xc7\xce\xd5\xdc\xe3\xea\xf1"
4394            "\xf8\xff\x06\x0d\x14\x1b\x22\x29"
4395            "\x30\x37\x3e\x45\x4c\x53\x5a\x61"
4396            "\x68\x6f\x76\x7d\x84\x8b\x92\x99"
4397            "\xa0\xa7\xae\xb5\xbc\xc3\xca\xd1"
4398            "\xd8\xdf\xe6\xed\xf4\xfb\x02\x09"
4399            "\x10\x17\x1e\x25\x2c\x33\x3a\x41"
4400            "\x48\x4f\x56\x5d\x64\x6b\x72\x79"
4401            "\x80\x87\x8e\x95\x9c\xa3\xaa\xb1"
4402            "\xb8\xbf\xc6\xcd\xd4\xdb\xe2\xe9"
4403            "\xf0\xf7\xfe\x05\x0c\x13\x1a\x21"
4404            "\x28\x2f\x36\x3d\x44\x4b\x52\x59"
4405            "\x60\x67\x6e\x75\x7c\x83\x8a\x91"
4406            "\x98\x9f\xa6\xad\xb4\xbb\xc2\xc9"
4407            "\xd0\xd7\xde\xe5\xec\xf3\xfa\x01"
4408            "\x08\x0f\x16\x1d\x24\x2b\x32\x39"
4409            "\x40\x47\x4e\x55\x5c\x63\x6a\x71"
4410            "\x78\x7f\x86\x8d\x94\x9b\xa2\xa9"
4411            "\xb0\xb7\xbe\xc5\xcc\xd3\xda\xe1"
4412            "\xe8\xef\xf6\xfd\x04\x0b\x12\x19"
4413            "\x20\x27\x2e\x35\x3c\x43\x4a\x51"
4414            "\x58\x5f\x66\x6d\x74\x7b\x82\x89"
4415            "\x90\x97\x9e\xa5\xac\xb3\xba\xc1"
4416            "\xc8\xcf\xd6\xdd\xe4\xeb\xf2\xf9"
4417            "\x00\x09\x12\x1b\x24\x2d\x36\x3f"
4418            "\x48\x51\x5a\x63\x6c\x75\x7e\x87"
4419            "\x90\x99\xa2\xab\xb4\xbd\xc6\xcf"
4420            "\xd8\xe1\xea\xf3\xfc\x05\x0e\x17"
4421            "\x20\x29\x32\x3b\x44\x4d\x56\x5f"
4422            "\x68\x71\x7a\x83\x8c\x95\x9e\xa7"
4423            "\xb0\xb9\xc2\xcb\xd4\xdd\xe6\xef"
4424            "\xf8\x01\x0a\x13\x1c\x25\x2e\x37"
4425            "\x40\x49\x52\x5b\x64\x6d\x76\x7f"
4426            "\x88\x91\x9a\xa3\xac\xb5\xbe\xc7"
4427            "\xd0\xd9\xe2\xeb\xf4\xfd\x06\x0f"
4428            "\x18\x21\x2a\x33\x3c\x45\x4e\x57"
4429            "\x60\x69\x72\x7b\x84\x8d\x96\x9f"
4430            "\xa8\xb1\xba\xc3\xcc\xd5\xde\xe7"
4431            "\xf0\xf9\x02\x0b\x14\x1d\x26\x2f"
4432            "\x38\x41\x4a\x53\x5c\x65\x6e\x77"
4433            "\x80\x89\x92\x9b\xa4\xad\xb6\xbf"
4434            "\xc8\xd1\xda\xe3\xec\xf5\xfe\x07"
4435            "\x10\x19\x22\x2b\x34\x3d\x46\x4f"
4436            "\x58\x61\x6a\x73\x7c\x85\x8e\x97"
4437            "\xa0\xa9\xb2\xbb\xc4\xcd\xd6\xdf"
4438            "\xe8\xf1\xfa\x03\x0c\x15\x1e\x27"
4439            "\x30\x39\x42\x4b\x54\x5d\x66\x6f"
4440            "\x78\x81\x8a\x93\x9c\xa5\xae\xb7"
4441            "\xc0\xc9\xd2\xdb\xe4\xed\xf6\xff"
4442            "\x08\x11\x1a\x23\x2c\x35\x3e\x47"
4443            "\x50\x59\x62\x6b\x74\x7d\x86\x8f"
4444            "\x98\xa1\xaa\xb3\xbc\xc5\xce\xd7"
4445            "\xe0\xe9\xf2\xfb\x04\x0d\x16\x1f"
4446            "\x28\x31\x3a\x43\x4c\x55\x5e\x67"
4447            "\x70\x79\x82\x8b\x94\x9d\xa6\xaf"
4448            "\xb8\xc1\xca\xd3\xdc\xe5\xee\xf7"
4449            "\x00\x0b\x16\x21\x2c\x37\x42\x4d"
4450            "\x58\x63\x6e\x79\x84\x8f\x9a\xa5"
4451            "\xb0\xbb\xc6\xd1\xdc\xe7\xf2\xfd"
4452            "\x08\x13\x1e\x29\x34\x3f\x4a\x55"
4453            "\x60\x6b\x76\x81\x8c\x97\xa2\xad"
4454            "\xb8\xc3\xce\xd9\xe4\xef\xfa\x05"
4455            "\x10\x1b\x26\x31\x3c\x47\x52\x5d"
4456            "\x68\x73\x7e\x89\x94\x9f\xaa\xb5"
4457            "\xc0\xcb\xd6\xe1\xec\xf7\x02\x0d"
4458            "\x18\x23\x2e\x39\x44\x4f\x5a\x65"
4459            "\x70\x7b\x86\x91\x9c\xa7\xb2\xbd"
4460            "\xc8\xd3\xde\xe9\xf4\xff\x0a\x15"
4461            "\x20\x2b\x36\x41\x4c\x57\x62\x6d"
4462            "\x78\x83\x8e\x99\xa4\xaf\xba\xc5"
4463            "\xd0\xdb\xe6\xf1\xfc\x07\x12\x1d"
4464            "\x28\x33\x3e\x49\x54\x5f\x6a\x75"
4465            "\x80\x8b\x96\xa1\xac\xb7\xc2\xcd"
4466            "\xd8\xe3\xee\xf9\x04\x0f\x1a\x25"
4467            "\x30\x3b\x46\x51\x5c\x67\x72\x7d"
4468            "\x88\x93\x9e\xa9\xb4\xbf\xca\xd5"
4469            "\xe0\xeb\xf6\x01\x0c\x17\x22\x2d"
4470            "\x38\x43\x4e\x59\x64\x6f\x7a\x85"
4471            "\x90\x9b\xa6\xb1\xbc\xc7\xd2\xdd"
4472            "\xe8\xf3\xfe\x09\x14\x1f\x2a\x35"
4473            "\x40\x4b\x56\x61\x6c\x77\x82\x8d"
4474            "\x98\xa3\xae\xb9\xc4\xcf\xda\xe5"
4475            "\xf0\xfb\x06\x11\x1c\x27\x32\x3d"
4476            "\x48\x53\x5e\x69\x74\x7f\x8a\x95"
4477            "\xa0\xab\xb6\xc1\xcc\xd7\xe2\xed"
4478            "\xf8\x03\x0e\x19\x24\x2f\x3a\x45"
4479            "\x50\x5b\x66\x71\x7c\x87\x92\x9d"
4480            "\xa8\xb3\xbe\xc9\xd4\xdf\xea\xf5"
4481            "\x00\x0d\x1a\x27\x34\x41\x4e\x5b"
4482            "\x68\x75\x82\x8f\x9c\xa9\xb6\xc3"
4483            "\xd0\xdd\xea\xf7\x04\x11\x1e\x2b"
4484            "\x38\x45\x52\x5f\x6c\x79\x86\x93"
4485            "\xa0\xad\xba\xc7\xd4\xe1\xee\xfb"
4486            "\x08\x15\x22\x2f\x3c\x49\x56\x63"
4487            "\x70\x7d\x8a\x97\xa4\xb1\xbe\xcb"
4488            "\xd8\xe5\xf2\xff\x0c\x19\x26\x33"
4489            "\x40\x4d\x5a\x67\x74\x81\x8e\x9b"
4490            "\xa8\xb5\xc2\xcf\xdc\xe9\xf6\x03"
4491            "\x10\x1d\x2a\x37\x44\x51\x5e\x6b"
4492            "\x78\x85\x92\x9f\xac\xb9\xc6\xd3"
4493            "\xe0\xed\xfa\x07\x14\x21\x2e\x3b"
4494            "\x48\x55\x62\x6f\x7c\x89\x96\xa3"
4495            "\xb0\xbd\xca\xd7\xe4\xf1\xfe\x0b"
4496            "\x18\x25\x32\x3f\x4c\x59\x66\x73"
4497            "\x80\x8d\x9a\xa7\xb4\xc1\xce\xdb"
4498            "\xe8\xf5\x02\x0f\x1c\x29\x36\x43"
4499            "\x50\x5d\x6a\x77\x84\x91\x9e\xab"
4500            "\xb8\xc5\xd2\xdf\xec\xf9\x06\x13"
4501            "\x20\x2d\x3a\x47\x54\x61\x6e\x7b"
4502            "\x88\x95\xa2\xaf\xbc\xc9\xd6\xe3"
4503            "\xf0\xfd\x0a\x17\x24\x31\x3e\x4b"
4504            "\x58\x65\x72\x7f\x8c\x99\xa6\xb3"
4505            "\xc0\xcd\xda\xe7\xf4\x01\x0e\x1b"
4506            "\x28\x35\x42\x4f\x5c\x69\x76\x83"
4507            "\x90\x9d\xaa\xb7\xc4\xd1\xde\xeb"
4508            "\xf8\x05\x12\x1f\x2c\x39\x46\x53"
4509            "\x60\x6d\x7a\x87\x94\xa1\xae\xbb"
4510            "\xc8\xd5\xe2\xef\xfc\x09\x16\x23"
4511            "\x30\x3d\x4a\x57\x64\x71\x7e\x8b"
4512            "\x98\xa5\xb2\xbf\xcc\xd9\xe6\xf3"
4513            "\x00\x0f\x1e\x2d\x3c\x4b\x5a\x69"
4514            "\x78\x87\x96\xa5\xb4\xc3\xd2\xe1"
4515            "\xf0\xff\x0e\x1d\x2c\x3b\x4a\x59"
4516            "\x68\x77\x86\x95\xa4\xb3\xc2\xd1"
4517            "\xe0\xef\xfe\x0d\x1c\x2b\x3a\x49"
4518            "\x58\x67\x76\x85\x94\xa3\xb2\xc1"
4519            "\xd0\xdf\xee\xfd\x0c\x1b\x2a\x39"
4520            "\x48\x57\x66\x75\x84\x93\xa2\xb1"
4521            "\xc0\xcf\xde\xed\xfc\x0b\x1a\x29"
4522            "\x38\x47\x56\x65\x74\x83\x92\xa1"
4523            "\xb0\xbf\xce\xdd\xec\xfb\x0a\x19"
4524            "\x28\x37\x46\x55\x64\x73\x82\x91"
4525            "\xa0\xaf\xbe\xcd\xdc\xeb\xfa\x09"
4526            "\x18\x27\x36\x45\x54\x63\x72\x81"
4527            "\x90\x9f\xae\xbd\xcc\xdb\xea\xf9"
4528            "\x08\x17\x26\x35\x44\x53\x62\x71"
4529            "\x80\x8f\x9e\xad\xbc\xcb\xda\xe9"
4530            "\xf8\x07\x16\x25\x34\x43\x52\x61"
4531            "\x70\x7f\x8e\x9d\xac\xbb\xca\xd9"
4532            "\xe8\xf7\x06\x15\x24\x33\x42\x51"
4533            "\x60\x6f\x7e\x8d\x9c\xab\xba\xc9"
4534            "\xd8\xe7\xf6\x05\x14\x23\x32\x41"
4535            "\x50\x5f\x6e\x7d\x8c\x9b\xaa\xb9"
4536            "\xc8\xd7\xe6\xf5\x04\x13\x22\x31"
4537            "\x40\x4f\x5e\x6d\x7c\x8b\x9a\xa9"
4538            "\xb8\xc7\xd6\xe5\xf4\x03\x12\x21"
4539            "\x30\x3f\x4e\x5d\x6c\x7b\x8a\x99"
4540            "\xa8\xb7\xc6\xd5\xe4\xf3\x02\x11"
4541            "\x20\x2f\x3e\x4d\x5c\x6b\x7a\x89"
4542            "\x98\xa7\xb6\xc5\xd4\xe3\xf2\x01"
4543            "\x10\x1f\x2e\x3d\x4c\x5b\x6a\x79"
4544            "\x88\x97\xa6\xb5\xc4\xd3\xe2\xf1"
4545            "\x00\x11\x22\x33\x44\x55\x66\x77"
4546            "\x88\x99\xaa\xbb\xcc\xdd\xee\xff"
4547            "\x10\x21\x32\x43\x54\x65\x76\x87"
4548            "\x98\xa9\xba\xcb\xdc\xed\xfe\x0f"
4549            "\x20\x31\x42\x53\x64\x75\x86\x97"
4550            "\xa8\xb9\xca\xdb\xec\xfd\x0e\x1f"
4551            "\x30\x41\x52\x63\x74\x85\x96\xa7"
4552            "\xb8\xc9\xda\xeb\xfc\x0d\x1e\x2f"
4553            "\x40\x51\x62\x73\x84\x95\xa6\xb7"
4554            "\xc8\xd9\xea\xfb\x0c\x1d\x2e\x3f"
4555            "\x50\x61\x72\x83\x94\xa5\xb6\xc7"
4556            "\xd8\xe9\xfa\x0b\x1c\x2d\x3e\x4f"
4557            "\x60\x71\x82\x93\xa4\xb5\xc6\xd7"
4558            "\xe8\xf9\x0a\x1b\x2c\x3d\x4e\x5f"
4559            "\x70\x81\x92\xa3\xb4\xc5\xd6\xe7"
4560            "\xf8\x09\x1a\x2b\x3c\x4d\x5e\x6f"
4561            "\x80\x91\xa2\xb3\xc4\xd5\xe6\xf7"
4562            "\x08\x19\x2a\x3b\x4c\x5d\x6e\x7f"
4563            "\x90\xa1\xb2\xc3\xd4\xe5\xf6\x07"
4564            "\x18\x29\x3a\x4b\x5c\x6d\x7e\x8f"
4565            "\xa0\xb1\xc2\xd3\xe4\xf5\x06\x17"
4566            "\x28\x39\x4a\x5b\x6c\x7d\x8e\x9f"
4567            "\xb0\xc1\xd2\xe3\xf4\x05\x16\x27"
4568            "\x38\x49\x5a\x6b\x7c\x8d\x9e\xaf"
4569            "\xc0\xd1\xe2\xf3\x04\x15\x26\x37"
4570            "\x48\x59\x6a\x7b\x8c\x9d\xae\xbf"
4571            "\xd0\xe1\xf2\x03\x14\x25\x36\x47"
4572            "\x58\x69\x7a\x8b\x9c\xad\xbe\xcf"
4573            "\xe0\xf1\x02\x13\x24\x35\x46\x57"
4574            "\x68\x79\x8a\x9b\xac\xbd\xce\xdf"
4575            "\xf0\x01\x12\x23\x34\x45\x56\x67"
4576            "\x78\x89\x9a\xab\xbc\xcd\xde\xef"
4577            "\x00\x13\x26\x39\x4c\x5f\x72\x85"
4578            "\x98\xab\xbe\xd1\xe4\xf7\x0a\x1d"
4579            "\x30\x43\x56\x69\x7c\x8f\xa2\xb5"
4580            "\xc8\xdb\xee\x01\x14\x27\x3a\x4d"
4581            "\x60\x73\x86\x99\xac\xbf\xd2\xe5"
4582            "\xf8\x0b\x1e\x31\x44\x57\x6a\x7d"
4583            "\x90\xa3\xb6\xc9\xdc\xef\x02\x15"
4584            "\x28\x3b\x4e\x61\x74\x87\x9a\xad"
4585            "\xc0\xd3\xe6\xf9\x0c\x1f\x32\x45"
4586            "\x58\x6b\x7e\x91\xa4\xb7\xca\xdd"
4587            "\xf0\x03\x16\x29\x3c\x4f\x62\x75"
4588            "\x88\x9b\xae\xc1\xd4\xe7\xfa\x0d"
4589            "\x20\x33\x46\x59\x6c\x7f\x92\xa5"
4590            "\xb8\xcb\xde\xf1\x04\x17\x2a\x3d"
4591            "\x50\x63\x76\x89\x9c\xaf\xc2\xd5"
4592            "\xe8\xfb\x0e\x21\x34\x47\x5a\x6d"
4593            "\x80\x93\xa6\xb9\xcc\xdf\xf2\x05"
4594            "\x18\x2b\x3e\x51\x64\x77\x8a\x9d"
4595            "\xb0\xc3\xd6\xe9\xfc\x0f\x22\x35"
4596            "\x48\x5b\x6e\x81\x94\xa7\xba\xcd"
4597            "\xe0\xf3\x06\x19\x2c\x3f\x52\x65"
4598            "\x78\x8b\x9e\xb1\xc4\xd7\xea\xfd"
4599            "\x10\x23\x36\x49\x5c\x6f\x82\x95"
4600            "\xa8\xbb\xce\xe1\xf4\x07\x1a\x2d"
4601            "\x40\x53\x66\x79\x8c\x9f\xb2\xc5"
4602            "\xd8\xeb\xfe\x11\x24\x37\x4a\x5d"
4603            "\x70\x83\x96\xa9\xbc\xcf\xe2\xf5"
4604            "\x08\x1b\x2e\x41\x54\x67\x7a\x8d"
4605            "\xa0\xb3\xc6\xd9\xec\xff\x12\x25"
4606            "\x38\x4b\x5e\x71\x84\x97\xaa\xbd"
4607            "\xd0\xe3\xf6\x09\x1c\x2f\x42\x55"
4608            "\x68\x7b\x8e\xa1\xb4\xc7\xda\xed"
4609            "\x00\x15\x2a\x3f\x54\x69\x7e\x93"
4610            "\xa8\xbd\xd2\xe7\xfc\x11\x26\x3b"
4611            "\x50\x65\x7a\x8f\xa4\xb9\xce\xe3"
4612            "\xf8\x0d\x22\x37\x4c\x61\x76\x8b"
4613            "\xa0\xb5\xca\xdf\xf4\x09\x1e\x33"
4614            "\x48\x5d\x72\x87\x9c\xb1\xc6\xdb"
4615            "\xf0\x05\x1a\x2f\x44\x59\x6e\x83"
4616            "\x98\xad\xc2\xd7\xec\x01\x16\x2b"
4617            "\x40\x55\x6a\x7f\x94\xa9\xbe\xd3"
4618            "\xe8\xfd\x12\x27\x3c\x51\x66\x7b"
4619            "\x90\xa5\xba\xcf\xe4\xf9\x0e\x23"
4620            "\x38\x4d\x62\x77\x8c\xa1\xb6\xcb"
4621            "\xe0\xf5\x0a\x1f\x34\x49\x5e\x73"
4622            "\x88\x9d\xb2\xc7\xdc\xf1\x06\x1b"
4623            "\x30\x45\x5a\x6f\x84\x99\xae\xc3"
4624            "\xd8\xed\x02\x17\x2c\x41\x56\x6b"
4625            "\x80\x95\xaa\xbf\xd4\xe9\xfe\x13"
4626            "\x28\x3d\x52\x67\x7c\x91\xa6\xbb"
4627            "\xd0\xe5\xfa\x0f\x24\x39\x4e\x63"
4628            "\x78\x8d\xa2\xb7\xcc\xe1\xf6\x0b"
4629            "\x20\x35\x4a\x5f\x74\x89\x9e\xb3"
4630            "\xc8\xdd\xf2\x07\x1c\x31\x46\x5b"
4631            "\x70\x85\x9a\xaf\xc4\xd9\xee\x03"
4632            "\x18\x2d\x42\x57\x6c\x81\x96\xab"
4633            "\xc0\xd5\xea\xff\x14\x29\x3e\x53"
4634            "\x68\x7d\x92\xa7\xbc\xd1\xe6\xfb"
4635            "\x10\x25\x3a\x4f\x64\x79\x8e\xa3"
4636            "\xb8\xcd\xe2\xf7\x0c\x21\x36\x4b"
4637            "\x60\x75\x8a\x9f\xb4\xc9\xde\xf3"
4638            "\x08\x1d\x32\x47\x5c\x71\x86\x9b"
4639            "\xb0\xc5\xda\xef\x04\x19\x2e\x43"
4640            "\x58\x6d\x82\x97\xac\xc1\xd6\xeb"
4641            "\x00\x17\x2e\x45\x5c\x73\x8a\xa1"
4642            "\xb8\xcf\xe6\xfd\x14\x2b\x42\x59"
4643            "\x70\x87\x9e\xb5\xcc\xe3\xfa\x11"
4644            "\x28\x3f\x56\x6d\x84\x9b\xb2\xc9"
4645            "\xe0\xf7\x0e\x25\x3c\x53\x6a\x81"
4646            "\x98\xaf\xc6\xdd\xf4\x0b\x22\x39"
4647            "\x50\x67\x7e\x95\xac\xc3\xda\xf1"
4648            "\x08\x1f\x36\x4d\x64\x7b\x92\xa9"
4649            "\xc0\xd7\xee\x05\x1c\x33\x4a\x61"
4650            "\x78\x8f\xa6\xbd\xd4\xeb\x02\x19"
4651            "\x30\x47\x5e\x75\x8c\xa3\xba\xd1"
4652            "\xe8\xff\x16\x2d\x44\x5b\x72\x89"
4653            "\xa0\xb7\xce\xe5\xfc\x13\x2a\x41"
4654            "\x58\x6f\x86\x9d\xb4\xcb\xe2\xf9"
4655            "\x10\x27\x3e\x55\x6c\x83\x9a\xb1"
4656            "\xc8\xdf\xf6\x0d\x24\x3b\x52\x69"
4657            "\x80\x97\xae\xc5\xdc\xf3\x0a\x21"
4658            "\x38\x4f\x66\x7d\x94\xab\xc2\xd9"
4659            "\xf0\x07\x1e\x35\x4c\x63\x7a\x91"
4660            "\xa8\xbf\xd6\xed\x04\x1b\x32\x49"
4661            "\x60\x77\x8e\xa5\xbc\xd3\xea\x01"
4662            "\x18\x2f\x46\x5d\x74\x8b\xa2\xb9"
4663            "\xd0\xe7\xfe\x15\x2c\x43\x5a\x71"
4664            "\x88\x9f\xb6\xcd\xe4\xfb\x12\x29"
4665            "\x40\x57\x6e\x85\x9c\xb3\xca\xe1"
4666            "\xf8\x0f\x26\x3d\x54\x6b\x82\x99"
4667            "\xb0\xc7\xde\xf5\x0c\x23\x3a\x51"
4668            "\x68\x7f\x96\xad\xc4\xdb\xf2\x09"
4669            "\x20\x37\x4e\x65\x7c\x93\xaa\xc1"
4670            "\xd8\xef\x06\x1d\x34\x4b\x62\x79"
4671            "\x90\xa7\xbe\xd5\xec\x03\x1a\x31"
4672            "\x48\x5f\x76\x8d\xa4\xbb\xd2\xe9"
4673            "\x00\x19\x32\x4b\x64\x7d\x96\xaf"
4674            "\xc8\xe1\xfa\x13\x2c\x45\x5e\x77"
4675            "\x90\xa9\xc2\xdb\xf4\x0d\x26\x3f"
4676            "\x58\x71\x8a\xa3\xbc\xd5\xee\x07"
4677            "\x20\x39\x52\x6b\x84\x9d\xb6\xcf"
4678            "\xe8\x01\x1a\x33\x4c\x65\x7e\x97"
4679            "\xb0\xc9\xe2\xfb\x14\x2d\x46\x5f"
4680            "\x78\x91\xaa\xc3\xdc\xf5\x0e\x27"
4681            "\x40\x59\x72\x8b\xa4\xbd\xd6\xef"
4682            "\x08\x21\x3a\x53\x6c\x85\x9e\xb7"
4683            "\xd0\xe9\x02\x1b\x34\x4d\x66\x7f"
4684            "\x98\xb1\xca\xe3\xfc\x15\x2e\x47"
4685            "\x60\x79\x92\xab\xc4\xdd\xf6\x0f"
4686            "\x28\x41\x5a\x73\x8c\xa5\xbe\xd7"
4687            "\xf0\x09\x22\x3b\x54\x6d\x86\x9f"
4688            "\xb8\xd1\xea\x03\x1c\x35\x4e\x67"
4689            "\x80\x99\xb2\xcb\xe4\xfd\x16\x2f"
4690            "\x48\x61\x7a\x93\xac\xc5\xde\xf7"
4691            "\x10\x29\x42\x5b\x74\x8d\xa6\xbf"
4692            "\xd8\xf1\x0a\x23\x3c\x55\x6e\x87"
4693            "\xa0\xb9\xd2\xeb\x04\x1d\x36\x4f"
4694            "\x68\x81\x9a\xb3\xcc\xe5\xfe\x17"
4695            "\x30\x49\x62\x7b\x94\xad\xc6\xdf"
4696            "\xf8\x11\x2a\x43\x5c\x75\x8e\xa7"
4697            "\xc0\xd9\xf2\x0b\x24\x3d\x56\x6f"
4698            "\x88\xa1\xba\xd3\xec\x05\x1e\x37"
4699            "\x50\x69\x82\x9b\xb4\xcd\xe6\xff"
4700            "\x18\x31\x4a\x63\x7c\x95\xae\xc7"
4701            "\xe0\xf9\x12\x2b\x44\x5d\x76\x8f"
4702            "\xa8\xc1\xda\xf3\x0c\x25\x3e\x57"
4703            "\x70\x89\xa2\xbb\xd4\xed\x06\x1f"
4704            "\x38\x51\x6a\x83\x9c\xb5\xce\xe7"
4705            "\x00\x1b\x36\x51\x6c\x87\xa2\xbd"
4706            "\xd8\xf3\x0e\x29\x44\x5f\x7a\x95"
4707            "\xb0\xcb\xe6\x01\x1c\x37\x52\x6d"
4708            "\x88\xa3\xbe\xd9\xf4\x0f\x2a\x45"
4709            "\x60\x7b\x96\xb1\xcc\xe7\x02\x1d"
4710            "\x38\x53\x6e\x89\xa4\xbf\xda\xf5"
4711            "\x10\x2b\x46\x61\x7c\x97\xb2\xcd"
4712            "\xe8\x03\x1e\x39\x54\x6f\x8a\xa5"
4713            "\xc0\xdb\xf6\x11\x2c\x47\x62\x7d"
4714            "\x98\xb3\xce\xe9\x04\x1f\x3a\x55"
4715            "\x70\x8b\xa6\xc1\xdc\xf7\x12\x2d"
4716            "\x48\x63\x7e\x99\xb4\xcf\xea\x05"
4717            "\x20\x3b\x56\x71\x8c\xa7\xc2\xdd"
4718            "\xf8\x13\x2e\x49\x64\x7f\x9a\xb5"
4719            "\xd0\xeb\x06\x21\x3c\x57\x72\x8d"
4720            "\xa8\xc3\xde\xf9\x14\x2f\x4a\x65"
4721            "\x80\x9b\xb6\xd1\xec\x07\x22\x3d"
4722            "\x58\x73\x8e\xa9\xc4\xdf\xfa\x15"
4723            "\x30\x4b\x66\x81\x9c\xb7\xd2\xed"
4724            "\x08\x23\x3e\x59\x74\x8f\xaa\xc5"
4725            "\xe0\xfb\x16\x31\x4c\x67\x82\x9d"
4726            "\xb8\xd3\xee\x09\x24\x3f\x5a\x75"
4727            "\x90\xab\xc6\xe1\xfc\x17\x32\x4d"
4728            "\x68\x83\x9e\xb9\xd4\xef\x0a\x25"
4729            "\x40\x5b\x76\x91\xac\xc7\xe2\xfd"
4730            "\x18\x33\x4e\x69\x84\x9f\xba\xd5"
4731            "\xf0\x0b\x26\x41\x5c\x77\x92\xad"
4732            "\xc8\xe3\xfe\x19\x34\x4f\x6a\x85"
4733            "\xa0\xbb\xd6\xf1\x0c\x27\x42\x5d"
4734            "\x78\x93\xae\xc9\xe4\xff\x1a\x35"
4735            "\x50\x6b\x86\xa1\xbc\xd7\xf2\x0d"
4736            "\x28\x43\x5e\x79\x94\xaf\xca\xe5"
4737            "\x00\x1d\x3a\x57\x74\x91\xae\xcb"
4738            "\xe8\x05\x22\x3f\x5c\x79\x96\xb3"
4739            "\xd0\xed\x0a\x27\x44\x61\x7e\x9b"
4740            "\xb8\xd5\xf2\x0f\x2c\x49\x66\x83"
4741            "\xa0\xbd\xda\xf7\x14\x31\x4e\x6b"
4742            "\x88\xa5\xc2\xdf\xfc\x19\x36\x53"
4743            "\x70\x8d\xaa\xc7\xe4\x01\x1e\x3b"
4744            "\x58\x75\x92\xaf\xcc\xe9\x06\x23"
4745            "\x40\x5d\x7a\x97\xb4\xd1\xee\x0b"
4746            "\x28\x45\x62\x7f\x9c\xb9\xd6\xf3"
4747            "\x10\x2d\x4a\x67\x84\xa1\xbe\xdb"
4748            "\xf8\x15\x32\x4f\x6c\x89\xa6\xc3"
4749            "\xe0\xfd\x1a\x37\x54\x71\x8e\xab"
4750            "\xc8\xe5\x02\x1f\x3c\x59\x76\x93"
4751            "\xb0\xcd\xea\x07\x24\x41\x5e\x7b"
4752            "\x98\xb5\xd2\xef\x0c\x29\x46\x63"
4753            "\x80\x9d\xba\xd7\xf4\x11\x2e\x4b"
4754            "\x68\x85\xa2\xbf\xdc\xf9\x16\x33"
4755            "\x50\x6d\x8a\xa7\xc4\xe1\xfe\x1b"
4756            "\x38\x55\x72\x8f\xac\xc9\xe6\x03"
4757            "\x20\x3d\x5a\x77\x94\xb1\xce\xeb"
4758            "\x08\x25\x42\x5f\x7c\x99\xb6\xd3"
4759            "\xf0\x0d\x2a\x47\x64\x81\x9e\xbb"
4760            "\xd8\xf5\x12\x2f\x4c\x69\x86\xa3"
4761            "\xc0\xdd\xfa\x17\x34\x51\x6e\x8b"
4762            "\xa8\xc5\xe2\xff\x1c\x39\x56\x73"
4763            "\x90\xad\xca\xe7\x04\x21\x3e\x5b"
4764            "\x78\x95\xb2\xcf\xec\x09\x26\x43"
4765            "\x60\x7d\x9a\xb7\xd4\xf1\x0e\x2b"
4766            "\x48\x65\x82\x9f\xbc\xd9\xf6\x13"
4767            "\x30\x4d\x6a\x87\xa4\xc1\xde\xfb"
4768            "\x18\x35\x52\x6f\x8c\xa9\xc6\xe3"
4769            "\x00\x1f\x3e\x5d\x7c\x9b\xba\xd9"
4770            "\xf8\x17\x36\x55\x74\x93\xb2\xd1"
4771            "\xf0\x0f\x2e\x4d\x6c\x8b\xaa\xc9"
4772            "\xe8\x07\x26\x45\x64\x83\xa2\xc1"
4773            "\xe0\xff\x1e\x3d\x5c\x7b\x9a\xb9"
4774            "\xd8\xf7\x16\x35\x54\x73\x92\xb1"
4775            "\xd0\xef\x0e\x2d\x4c\x6b\x8a\xa9"
4776            "\xc8\xe7\x06\x25\x44\x63\x82\xa1"
4777            "\xc0\xdf\xfe\x1d\x3c\x5b\x7a\x99"
4778            "\xb8\xd7\xf6\x15\x34\x53\x72\x91"
4779            "\xb0\xcf\xee\x0d\x2c\x4b\x6a\x89"
4780            "\xa8\xc7\xe6\x05\x24\x43\x62\x81"
4781            "\xa0\xbf\xde\xfd\x1c\x3b\x5a\x79"
4782            "\x98\xb7\xd6\xf5\x14\x33\x52\x71"
4783            "\x90\xaf\xce\xed\x0c\x2b\x4a\x69"
4784            "\x88\xa7\xc6\xe5\x04\x23\x42\x61"
4785            "\x80\x9f\xbe\xdd\xfc\x1b\x3a\x59"
4786            "\x78\x97\xb6\xd5\xf4\x13\x32\x51"
4787            "\x70\x8f\xae\xcd\xec\x0b\x2a\x49"
4788            "\x68\x87\xa6\xc5\xe4\x03\x22\x41"
4789            "\x60\x7f\x9e\xbd\xdc\xfb\x1a\x39"
4790            "\x58\x77\x96\xb5\xd4\xf3\x12\x31"
4791            "\x50\x6f\x8e\xad\xcc\xeb\x0a\x29"
4792            "\x48\x67\x86\xa5\xc4\xe3\x02\x21"
4793            "\x40\x5f\x7e\x9d\xbc\xdb\xfa\x19"
4794            "\x38\x57\x76\x95\xb4\xd3\xf2\x11"
4795            "\x30\x4f\x6e\x8d\xac\xcb\xea\x09"
4796            "\x28\x47\x66\x85\xa4\xc3\xe2\x01"
4797            "\x20\x3f\x5e\x7d\x9c\xbb\xda\xf9"
4798            "\x18\x37\x56\x75\x94\xb3\xd2\xf1"
4799            "\x10\x2f\x4e\x6d\x8c\xab\xca\xe9"
4800            "\x08\x27\x46\x65\x84\xa3\xc2\xe1"
4801            "\x00\x21\x42\x63",
4802        .ilen = 4100,
4803        .result =
4804            "\xf0\x5c\x74\xad\x4e\xbc\x99\xe2"
4805            "\xae\xff\x91\x3a\x44\xcf\x38\x32"
4806            "\x1e\xad\xa7\xcd\xa1\x39\x95\xaa"
4807            "\x10\xb1\xb3\x2e\x04\x31\x8f\x86"
4808            "\xf2\x62\x74\x70\x0c\xa4\x46\x08"
4809            "\xa8\xb7\x99\xa8\xe9\xd2\x73\x79"
4810            "\x7e\x6e\xd4\x8f\x1e\xc7\x8e\x31"
4811            "\x0b\xfa\x4b\xce\xfd\xf3\x57\x71"
4812            "\xe9\x46\x03\xa5\x3d\x34\x00\xe2"
4813            "\x18\xff\x75\x6d\x06\x2d\x00\xab"
4814            "\xb9\x3e\x6c\x59\xc5\x84\x06\xb5"
4815            "\x8b\xd0\x89\x9c\x4a\x79\x16\xc6"
4816            "\x3d\x74\x54\xfa\x44\xcd\x23\x26"
4817            "\x5c\xcf\x7e\x28\x92\x32\xbf\xdf"
4818            "\xa7\x20\x3c\x74\x58\x2a\x9a\xde"
4819            "\x61\x00\x1c\x4f\xff\x59\xc4\x22"
4820            "\xac\x3c\xd0\xe8\x6c\xf9\x97\x1b"
4821            "\x58\x9b\xad\x71\xe8\xa9\xb5\x0d"
4822            "\xee\x2f\x04\x1f\x7f\xbc\x99\xee"
4823            "\x84\xff\x42\x60\xdc\x3a\x18\xa5"
4824            "\x81\xf9\xef\xdc\x7a\x0f\x65\x41"
4825            "\x2f\xa3\xd3\xf9\xc2\xcb\xc0\x4d"
4826            "\x8f\xd3\x76\x96\xad\x49\x6d\x38"
4827            "\x3d\x39\x0b\x6c\x80\xb7\x54\x69"
4828            "\xf0\x2c\x90\x02\x29\x0d\x1c\x12"
4829            "\xad\x55\xc3\x8b\x68\xd9\xcc\xb3"
4830            "\xb2\x64\x33\x90\x5e\xca\x4b\xe2"
4831            "\xfb\x75\xdc\x63\xf7\x9f\x82\x74"
4832            "\xf0\xc9\xaa\x7f\xe9\x2a\x9b\x33"
4833            "\xbc\x88\x00\x7f\xca\xb2\x1f\x14"
4834            "\xdb\xc5\x8e\x7b\x11\x3c\x3e\x08"
4835            "\xf3\x83\xe8\xe0\x94\x86\x2e\x92"
4836            "\x78\x6b\x01\xc9\xc7\x83\xba\x21"
4837            "\x6a\x25\x15\x33\x4e\x45\x08\xec"
4838            "\x35\xdb\xe0\x6e\x31\x51\x79\xa9"
4839            "\x42\x44\x65\xc1\xa0\xf1\xf9\x2a"
4840            "\x70\xd5\xb6\xc6\xc1\x8c\x39\xfc"
4841            "\x25\xa6\x55\xd9\xdd\x2d\x4c\xec"
4842            "\x49\xc6\xeb\x0e\xa8\x25\x2a\x16"
4843            "\x1b\x66\x84\xda\xe2\x92\xe5\xc0"
4844            "\xc8\x53\x07\xaf\x80\x84\xec\xfd"
4845            "\xcd\xd1\x6e\xcd\x6f\x6a\xf5\x36"
4846            "\xc5\x15\xe5\x25\x7d\x77\xd1\x1a"
4847            "\x93\x36\xa9\xcf\x7c\xa4\x54\x4a"
4848            "\x06\x51\x48\x4e\xf6\x59\x87\xd2"
4849            "\x04\x02\xef\xd3\x44\xde\x76\x31"
4850            "\xb3\x34\x17\x1b\x9d\x66\x11\x9f"
4851            "\x1e\xcc\x17\xe9\xc7\x3c\x1b\xe7"
4852            "\xcb\x50\x08\xfc\xdc\x2b\x24\xdb"
4853            "\x65\x83\xd0\x3b\xe3\x30\xea\x94"
4854            "\x6c\xe7\xe8\x35\x32\xc7\xdb\x64"
4855            "\xb4\x01\xab\x36\x2c\x77\x13\xaf"
4856            "\xf8\x2b\x88\x3f\x54\x39\xc4\x44"
4857            "\xfe\xef\x6f\x68\x34\xbe\x0f\x05"
4858            "\x16\x6d\xf6\x0a\x30\xe7\xe3\xed"
4859            "\xc4\xde\x3c\x1b\x13\xd8\xdb\xfe"
4860            "\x41\x62\xe5\x28\xd4\x8d\xa3\xc7"
4861            "\x93\x97\xc6\x48\x45\x1d\x9f\x83"
4862            "\xdf\x4b\x40\x3e\x42\x25\x87\x80"
4863            "\x4c\x7d\xa8\xd4\x98\x23\x95\x75"
4864            "\x41\x8c\xda\x41\x9b\xd4\xa7\x06"
4865            "\xb5\xf1\x71\x09\x53\xbe\xca\xbf"
4866            "\x32\x03\xed\xf0\x50\x1c\x56\x39"
4867            "\x5b\xa4\x75\x18\xf7\x9b\x58\xef"
4868            "\x53\xfc\x2a\x38\x23\x15\x75\xcd"
4869            "\x45\xe5\x5a\x82\x55\xba\x21\xfa"
4870            "\xd4\xbd\xc6\x94\x7c\xc5\x80\x12"
4871            "\xf7\x4b\x32\xc4\x9a\x82\xd8\x28"
4872            "\x8f\xd9\xc2\x0f\x60\x03\xbe\x5e"
4873            "\x21\xd6\x5f\x58\xbf\x5c\xb1\x32"
4874            "\x82\x8d\xa9\xe5\xf2\x66\x1a\xc0"
4875            "\xa0\xbc\x58\x2f\x71\xf5\x2f\xed"
4876            "\xd1\x26\xb9\xd8\x49\x5a\x07\x19"
4877            "\x01\x7c\x59\xb0\xf8\xa4\xb7\xd3"
4878            "\x7b\x1a\x8c\x38\xf4\x50\xa4\x59"
4879            "\xb0\xcc\x41\x0b\x88\x7f\xe5\x31"
4880            "\xb3\x42\xba\xa2\x7e\xd4\x32\x71"
4881            "\x45\x87\x48\xa9\xc2\xf2\x89\xb3"
4882            "\xe4\xa7\x7e\x52\x15\x61\xfa\xfe"
4883            "\xc9\xdd\x81\xeb\x13\xab\xab\xc3"
4884            "\x98\x59\xd8\x16\x3d\x14\x7a\x1c"
4885            "\x3c\x41\x9a\x16\x16\x9b\xd2\xd2"
4886            "\x69\x3a\x29\x23\xac\x86\x32\xa5"
4887            "\x48\x9c\x9e\xf3\x47\x77\x81\x70"
4888            "\x24\xe8\x85\xd2\xf5\xb5\xfa\xff"
4889            "\x59\x6a\xd3\x50\x59\x43\x59\xde"
4890            "\xd9\xf1\x55\xa5\x0c\xc3\x1a\x1a"
4891            "\x18\x34\x0d\x1a\x63\x33\xed\x10"
4892            "\xe0\x1d\x2a\x18\xd2\xc0\x54\xa8"
4893            "\xca\xb5\x9a\xd3\xdd\xca\x45\x84"
4894            "\x50\xe7\x0f\xfe\xa4\x99\x5a\xbe"
4895            "\x43\x2d\x9a\xcb\x92\x3f\x5a\x1d"
4896            "\x85\xd8\xc9\xdf\x68\xc9\x12\x80"
4897            "\x56\x0c\xdc\x00\xdc\x3a\x7d\x9d"
4898            "\xa3\xa2\xe8\x4d\xbf\xf9\x70\xa0"
4899            "\xa4\x13\x4f\x6b\xaf\x0a\x89\x7f"
4900            "\xda\xf0\xbf\x9b\xc8\x1d\xe5\xf8"
4901            "\x2e\x8b\x07\xb5\x73\x1b\xcc\xa2"
4902            "\xa6\xad\x30\xbc\x78\x3c\x5b\x10"
4903            "\xfa\x5e\x62\x2d\x9e\x64\xb3\x33"
4904            "\xce\xf9\x1f\x86\xe7\x8b\xa2\xb8"
4905            "\xe8\x99\x57\x8c\x11\xed\x66\xd9"
4906            "\x3c\x72\xb9\xc3\xe6\x4e\x17\x3a"
4907            "\x6a\xcb\x42\x24\x06\xed\x3e\x4e"
4908            "\xa3\xe8\x6a\x94\xda\x0d\x4e\xd5"
4909            "\x14\x19\xcf\xb6\x26\xd8\x2e\xcc"
4910            "\x64\x76\x38\x49\x4d\xfe\x30\x6d"
4911            "\xe4\xc8\x8c\x7b\xc4\xe0\x35\xba"
4912            "\x22\x6e\x76\xe1\x1a\xf2\x53\xc3"
4913            "\x28\xa2\x82\x1f\x61\x69\xad\xc1"
4914            "\x7b\x28\x4b\x1e\x6c\x85\x95\x9b"
4915            "\x51\xb5\x17\x7f\x12\x69\x8c\x24"
4916            "\xd5\xc7\x5a\x5a\x11\x54\xff\x5a"
4917            "\xf7\x16\xc3\x91\xa6\xf0\xdc\x0a"
4918            "\xb6\xa7\x4a\x0d\x7a\x58\xfe\xa5"
4919            "\xf5\xcb\x8f\x7b\x0e\xea\x57\xe7"
4920            "\xbd\x79\xd6\x1c\x88\x23\x6c\xf2"
4921            "\x4d\x29\x77\x53\x35\x6a\x00\x8d"
4922            "\xcd\xa3\x58\xbe\x77\x99\x18\xf8"
4923            "\xe6\xe1\x8f\xe9\x37\x8f\xe3\xe2"
4924            "\x5a\x8a\x93\x25\xaf\xf3\x78\x80"
4925            "\xbe\xa6\x1b\xc6\xac\x8b\x1c\x91"
4926            "\x58\xe1\x9f\x89\x35\x9d\x1d\x21"
4927            "\x29\x9f\xf4\x99\x02\x27\x0f\xa8"
4928            "\x4f\x79\x94\x2b\x33\x2c\xda\xa2"
4929            "\x26\x39\x83\x94\xef\x27\xd8\x53"
4930            "\x8f\x66\x0d\xe4\x41\x7d\x34\xcd"
4931            "\x43\x7c\x95\x0a\x53\xef\x66\xda"
4932            "\x7e\x9b\xf3\x93\xaf\xd0\x73\x71"
4933            "\xba\x40\x9b\x74\xf8\xd7\xd7\x41"
4934            "\x6d\xaf\x72\x9c\x8d\x21\x87\x3c"
4935            "\xfd\x0a\x90\xa9\x47\x96\x9e\xd3"
4936            "\x88\xee\x73\xcf\x66\x2f\x52\x56"
4937            "\x6d\xa9\x80\x4c\xe2\x6f\x62\x88"
4938            "\x3f\x0e\x54\x17\x48\x80\x5d\xd3"
4939            "\xc3\xda\x25\x3d\xa1\xc8\xcb\x9f"
4940            "\x9b\x70\xb3\xa1\xeb\x04\x52\xa1"
4941            "\xf2\x22\x0f\xfc\xc8\x18\xfa\xf9"
4942            "\x85\x9c\xf1\xac\xeb\x0c\x02\x46"
4943            "\x75\xd2\xf5\x2c\xe3\xd2\x59\x94"
4944            "\x12\xf3\x3c\xfc\xd7\x92\xfa\x36"
4945            "\xba\x61\x34\x38\x7c\xda\x48\x3e"
4946            "\x08\xc9\x39\x23\x5e\x02\x2c\x1a"
4947            "\x18\x7e\xb4\xd9\xfd\x9e\x40\x02"
4948            "\xb1\x33\x37\x32\xe7\xde\xd6\xd0"
4949            "\x7c\x58\x65\x4b\xf8\x34\x27\x9c"
4950            "\x44\xb4\xbd\xe9\xe9\x4c\x78\x7d"
4951            "\x4b\x9f\xce\xb1\xcd\x47\xa5\x37"
4952            "\xe5\x6d\xbd\xb9\x43\x94\x0a\xd4"
4953            "\xd6\xf9\x04\x5f\xb5\x66\x6c\x1a"
4954            "\x35\x12\xe3\x36\x28\x27\x36\x58"
4955            "\x01\x2b\x79\xe4\xba\x6d\x10\x7d"
4956            "\x65\xdf\x84\x95\xf4\xd5\xb6\x8f"
4957            "\x2b\x9f\x96\x00\x86\x60\xf0\x21"
4958            "\x76\xa8\x6a\x8c\x28\x1c\xb3\x6b"
4959            "\x97\xd7\xb6\x53\x2a\xcc\xab\x40"
4960            "\x9d\x62\x79\x58\x52\xe6\x65\xb7"
4961            "\xab\x55\x67\x9c\x89\x7c\x03\xb0"
4962            "\x73\x59\xc5\x81\xf5\x18\x17\x5c"
4963            "\x89\xf3\x78\x35\x44\x62\x78\x72"
4964            "\xd0\x96\xeb\x31\xe7\x87\x77\x14"
4965            "\x99\x51\xf2\x59\x26\x9e\xb5\xa6"
4966            "\x45\xfe\x6e\xbd\x07\x4c\x94\x5a"
4967            "\xa5\x7d\xfc\xf1\x2b\x77\xe2\xfe"
4968            "\x17\xd4\x84\xa0\xac\xb5\xc7\xda"
4969            "\xa9\x1a\xb6\xf3\x74\x11\xb4\x9d"
4970            "\xfb\x79\x2e\x04\x2d\x50\x28\x83"
4971            "\xbf\xc6\x52\xd3\x34\xd6\xe8\x7a"
4972            "\xb6\xea\xe7\xa8\x6c\x15\x1e\x2c"
4973            "\x57\xbc\x48\x4e\x5f\x5c\xb6\x92"
4974            "\xd2\x49\x77\x81\x6d\x90\x70\xae"
4975            "\x98\xa1\x03\x0d\x6b\xb9\x77\x14"
4976            "\xf1\x4e\x23\xd3\xf8\x68\xbd\xc2"
4977            "\xfe\x04\xb7\x5c\xc5\x17\x60\x8f"
4978            "\x65\x54\xa4\x7a\x42\xdc\x18\x0d"
4979            "\xb5\xcf\x0f\xd3\xc7\x91\x66\x1b"
4980            "\x45\x42\x27\x75\x50\xe5\xee\xb8"
4981            "\x7f\x33\x2c\xba\x4a\x92\x4d\x2c"
4982            "\x3c\xe3\x0d\x80\x01\xba\x0d\x29"
4983            "\xd8\x3c\xe9\x13\x16\x57\xe6\xea"
4984            "\x94\x52\xe7\x00\x4d\x30\xb0\x0f"
4985            "\x35\xb8\xb8\xa7\xb1\xb5\x3b\x44"
4986            "\xe1\x2f\xfd\x88\xed\x43\xe7\x52"
4987            "\x10\x93\xb3\x8a\x30\x6b\x0a\xf7"
4988            "\x23\xc6\x50\x9d\x4a\xb0\xde\xc3"
4989            "\xdc\x9b\x2f\x01\x56\x36\x09\xc5"
4990            "\x2f\x6b\xfe\xf1\xd8\x27\x45\x03"
4991            "\x30\x5e\x5c\x5b\xb4\x62\x0e\x1a"
4992            "\xa9\x21\x2b\x92\x94\x87\x62\x57"
4993            "\x4c\x10\x74\x1a\xf1\x0a\xc5\x84"
4994            "\x3b\x9e\x72\x02\xd7\xcc\x09\x56"
4995            "\xbd\x54\xc1\xf0\xc3\xe3\xb3\xf8"
4996            "\xd2\x0d\x61\xcb\xef\xce\x0d\x05"
4997            "\xb0\x98\xd9\x8e\x4f\xf9\xbc\x93"
4998            "\xa6\xea\xc8\xcf\x10\x53\x4b\xf1"
4999            "\xec\xfc\x89\xf9\x64\xb0\x22\xbf"
5000            "\x9e\x55\x46\x9f\x7c\x50\x8e\x84"
5001            "\x54\x20\x98\xd7\x6c\x40\x1e\xdb"
5002            "\x69\x34\x78\x61\x24\x21\x9c\x8a"
5003            "\xb3\x62\x31\x8b\x6e\xf5\x2a\x35"
5004            "\x86\x13\xb1\x6c\x64\x2e\x41\xa5"
5005            "\x05\xf2\x42\xba\xd2\x3a\x0d\x8e"
5006            "\x8a\x59\x94\x3c\xcf\x36\x27\x82"
5007            "\xc2\x45\xee\x58\xcd\x88\xb4\xec"
5008            "\xde\xb2\x96\x0a\xaf\x38\x6f\x88"
5009            "\xd7\xd8\xe1\xdf\xb9\x96\xa9\x0a"
5010            "\xb1\x95\x28\x86\x20\xe9\x17\x49"
5011            "\xa2\x29\x38\xaa\xa5\xe9\x6e\xf1"
5012            "\x19\x27\xc0\xd5\x2a\x22\xc3\x0b"
5013            "\xdb\x7c\x73\x10\xb9\xba\x89\x76"
5014            "\x54\xae\x7d\x71\xb3\x93\xf6\x32"
5015            &qu