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