Root/crypto/testmgr.h

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