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