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