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