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