[PATCH] PNP: adjust pnp_register_card_driver() signature: wavefront
[linux-2.6/pdupreez.git] / crypto / tcrypt.h
blob1f683ba794ee6034ec9e2e59efa375db27288727
1 /*
2 * Quick & dirty crypto testing module.
4 * This will only exist until we have a better testing mechanism
5 * (e.g. a char device).
7 * Copyright (c) 2002 James Morris <jmorris@intercode.com.au>
8 * Copyright (c) 2002 Jean-Francois Dive <jef@linuxbe.org>
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the Free
12 * Software Foundation; either version 2 of the License, or (at your option)
13 * any later version.
15 * 2004-08-09 Cipher speed tests by Reyk Floeter <reyk@vantronix.net>
16 * 2003-09-14 Changes by Kartikey Mahendra Bhatt
19 #ifndef _CRYPTO_TCRYPT_H
20 #define _CRYPTO_TCRYPT_H
22 #define MAX_DIGEST_SIZE 64
23 #define MAX_TAP 8
25 #define MAX_KEYLEN 56
26 #define MAX_IVLEN 32
28 struct hash_testvec {
29 /* only used with keyed hash algorithms */
30 char key[128] __attribute__ ((__aligned__(4)));
31 char plaintext[128];
32 char digest[MAX_DIGEST_SIZE];
33 unsigned char tap[MAX_TAP];
34 unsigned char psize;
35 unsigned char np;
36 unsigned char ksize;
39 struct hmac_testvec {
40 char key[128];
41 char plaintext[128];
42 char digest[MAX_DIGEST_SIZE];
43 unsigned char tap[MAX_TAP];
44 unsigned char ksize;
45 unsigned char psize;
46 unsigned char np;
49 struct cipher_testvec {
50 char key[MAX_KEYLEN] __attribute__ ((__aligned__(4)));
51 char iv[MAX_IVLEN];
52 char input[48];
53 char result[48];
54 unsigned char tap[MAX_TAP];
55 int np;
56 unsigned char fail;
57 unsigned char wk; /* weak key flag */
58 unsigned char klen;
59 unsigned char ilen;
60 unsigned char rlen;
63 struct cipher_speed {
64 unsigned char klen;
65 unsigned int blen;
69 * MD4 test vectors from RFC1320
71 #define MD4_TEST_VECTORS 7
73 static struct hash_testvec md4_tv_template [] = {
75 .plaintext = "",
76 .digest = { 0x31, 0xd6, 0xcf, 0xe0, 0xd1, 0x6a, 0xe9, 0x31,
77 0xb7, 0x3c, 0x59, 0xd7, 0xe0, 0xc0, 0x89, 0xc0 },
78 }, {
79 .plaintext = "a",
80 .psize = 1,
81 .digest = { 0xbd, 0xe5, 0x2c, 0xb3, 0x1d, 0xe3, 0x3e, 0x46,
82 0x24, 0x5e, 0x05, 0xfb, 0xdb, 0xd6, 0xfb, 0x24 },
83 }, {
84 .plaintext = "abc",
85 .psize = 3,
86 .digest = { 0xa4, 0x48, 0x01, 0x7a, 0xaf, 0x21, 0xd8, 0x52,
87 0x5f, 0xc1, 0x0a, 0xe8, 0x7a, 0xa6, 0x72, 0x9d },
88 }, {
89 .plaintext = "message digest",
90 .psize = 14,
91 .digest = { 0xd9, 0x13, 0x0a, 0x81, 0x64, 0x54, 0x9f, 0xe8,
92 0x18, 0x87, 0x48, 0x06, 0xe1, 0xc7, 0x01, 0x4b },
93 }, {
94 .plaintext = "abcdefghijklmnopqrstuvwxyz",
95 .psize = 26,
96 .digest = { 0xd7, 0x9e, 0x1c, 0x30, 0x8a, 0xa5, 0xbb, 0xcd,
97 0xee, 0xa8, 0xed, 0x63, 0xdf, 0x41, 0x2d, 0xa9 },
98 .np = 2,
99 .tap = { 13, 13 },
100 }, {
101 .plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
102 .psize = 62,
103 .digest = { 0x04, 0x3f, 0x85, 0x82, 0xf2, 0x41, 0xdb, 0x35,
104 0x1c, 0xe6, 0x27, 0xe1, 0x53, 0xe7, 0xf0, 0xe4 },
105 }, {
106 .plaintext = "123456789012345678901234567890123456789012345678901234567890123"
107 "45678901234567890",
108 .psize = 80,
109 .digest = { 0xe3, 0x3b, 0x4d, 0xdc, 0x9c, 0x38, 0xf2, 0x19,
110 0x9c, 0x3e, 0x7b, 0x16, 0x4f, 0xcc, 0x05, 0x36 },
115 * MD5 test vectors from RFC1321
117 #define MD5_TEST_VECTORS 7
119 static struct hash_testvec md5_tv_template[] = {
121 .digest = { 0xd4, 0x1d, 0x8c, 0xd9, 0x8f, 0x00, 0xb2, 0x04,
122 0xe9, 0x80, 0x09, 0x98, 0xec, 0xf8, 0x42, 0x7e },
123 }, {
124 .plaintext = "a",
125 .psize = 1,
126 .digest = { 0x0c, 0xc1, 0x75, 0xb9, 0xc0, 0xf1, 0xb6, 0xa8,
127 0x31, 0xc3, 0x99, 0xe2, 0x69, 0x77, 0x26, 0x61 },
128 }, {
129 .plaintext = "abc",
130 .psize = 3,
131 .digest = { 0x90, 0x01, 0x50, 0x98, 0x3c, 0xd2, 0x4f, 0xb0,
132 0xd6, 0x96, 0x3f, 0x7d, 0x28, 0xe1, 0x7f, 0x72 },
133 }, {
134 .plaintext = "message digest",
135 .psize = 14,
136 .digest = { 0xf9, 0x6b, 0x69, 0x7d, 0x7c, 0xb7, 0x93, 0x8d,
137 0x52, 0x5a, 0x2f, 0x31, 0xaa, 0xf1, 0x61, 0xd0 },
138 }, {
139 .plaintext = "abcdefghijklmnopqrstuvwxyz",
140 .psize = 26,
141 .digest = { 0xc3, 0xfc, 0xd3, 0xd7, 0x61, 0x92, 0xe4, 0x00,
142 0x7d, 0xfb, 0x49, 0x6c, 0xca, 0x67, 0xe1, 0x3b },
143 .np = 2,
144 .tap = {13, 13}
145 }, {
146 .plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
147 .psize = 62,
148 .digest = { 0xd1, 0x74, 0xab, 0x98, 0xd2, 0x77, 0xd9, 0xf5,
149 0xa5, 0x61, 0x1c, 0x2c, 0x9f, 0x41, 0x9d, 0x9f },
150 }, {
151 .plaintext = "12345678901234567890123456789012345678901234567890123456789012"
152 "345678901234567890",
153 .psize = 80,
154 .digest = { 0x57, 0xed, 0xf4, 0xa2, 0x2b, 0xe3, 0xc9, 0x55,
155 0xac, 0x49, 0xda, 0x2e, 0x21, 0x07, 0xb6, 0x7a },
160 * SHA1 test vectors from from FIPS PUB 180-1
162 #define SHA1_TEST_VECTORS 2
164 static struct hash_testvec sha1_tv_template[] = {
166 .plaintext = "abc",
167 .psize = 3,
168 .digest = { 0xa9, 0x99, 0x3e, 0x36, 0x47, 0x06, 0x81, 0x6a, 0xba, 0x3e,
169 0x25, 0x71, 0x78, 0x50, 0xc2, 0x6c, 0x9c, 0xd0, 0xd8, 0x9d },
170 }, {
171 .plaintext = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
172 .psize = 56,
173 .digest = { 0x84, 0x98, 0x3e, 0x44, 0x1c, 0x3b, 0xd2, 0x6e, 0xba, 0xae,
174 0x4a, 0xa1, 0xf9, 0x51, 0x29, 0xe5, 0xe5, 0x46, 0x70, 0xf1 },
175 .np = 2,
176 .tap = { 28, 28 }
181 * SHA256 test vectors from from NIST
183 #define SHA256_TEST_VECTORS 2
185 static struct hash_testvec sha256_tv_template[] = {
187 .plaintext = "abc",
188 .psize = 3,
189 .digest = { 0xba, 0x78, 0x16, 0xbf, 0x8f, 0x01, 0xcf, 0xea,
190 0x41, 0x41, 0x40, 0xde, 0x5d, 0xae, 0x22, 0x23,
191 0xb0, 0x03, 0x61, 0xa3, 0x96, 0x17, 0x7a, 0x9c,
192 0xb4, 0x10, 0xff, 0x61, 0xf2, 0x00, 0x15, 0xad },
193 }, {
194 .plaintext = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
195 .psize = 56,
196 .digest = { 0x24, 0x8d, 0x6a, 0x61, 0xd2, 0x06, 0x38, 0xb8,
197 0xe5, 0xc0, 0x26, 0x93, 0x0c, 0x3e, 0x60, 0x39,
198 0xa3, 0x3c, 0xe4, 0x59, 0x64, 0xff, 0x21, 0x67,
199 0xf6, 0xec, 0xed, 0xd4, 0x19, 0xdb, 0x06, 0xc1 },
200 .np = 2,
201 .tap = { 28, 28 }
206 * SHA384 test vectors from from NIST and kerneli
208 #define SHA384_TEST_VECTORS 4
210 static struct hash_testvec sha384_tv_template[] = {
212 .plaintext= "abc",
213 .psize = 3,
214 .digest = { 0xcb, 0x00, 0x75, 0x3f, 0x45, 0xa3, 0x5e, 0x8b,
215 0xb5, 0xa0, 0x3d, 0x69, 0x9a, 0xc6, 0x50, 0x07,
216 0x27, 0x2c, 0x32, 0xab, 0x0e, 0xde, 0xd1, 0x63,
217 0x1a, 0x8b, 0x60, 0x5a, 0x43, 0xff, 0x5b, 0xed,
218 0x80, 0x86, 0x07, 0x2b, 0xa1, 0xe7, 0xcc, 0x23,
219 0x58, 0xba, 0xec, 0xa1, 0x34, 0xc8, 0x25, 0xa7 },
220 }, {
221 .plaintext = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
222 .psize = 56,
223 .digest = { 0x33, 0x91, 0xfd, 0xdd, 0xfc, 0x8d, 0xc7, 0x39,
224 0x37, 0x07, 0xa6, 0x5b, 0x1b, 0x47, 0x09, 0x39,
225 0x7c, 0xf8, 0xb1, 0xd1, 0x62, 0xaf, 0x05, 0xab,
226 0xfe, 0x8f, 0x45, 0x0d, 0xe5, 0xf3, 0x6b, 0xc6,
227 0xb0, 0x45, 0x5a, 0x85, 0x20, 0xbc, 0x4e, 0x6f,
228 0x5f, 0xe9, 0x5b, 0x1f, 0xe3, 0xc8, 0x45, 0x2b},
229 }, {
230 .plaintext = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmn"
231 "hijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu",
232 .psize = 112,
233 .digest = { 0x09, 0x33, 0x0c, 0x33, 0xf7, 0x11, 0x47, 0xe8,
234 0x3d, 0x19, 0x2f, 0xc7, 0x82, 0xcd, 0x1b, 0x47,
235 0x53, 0x11, 0x1b, 0x17, 0x3b, 0x3b, 0x05, 0xd2,
236 0x2f, 0xa0, 0x80, 0x86, 0xe3, 0xb0, 0xf7, 0x12,
237 0xfc, 0xc7, 0xc7, 0x1a, 0x55, 0x7e, 0x2d, 0xb9,
238 0x66, 0xc3, 0xe9, 0xfa, 0x91, 0x74, 0x60, 0x39 },
239 }, {
240 .plaintext = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcd"
241 "efghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz",
242 .psize = 104,
243 .digest = { 0x3d, 0x20, 0x89, 0x73, 0xab, 0x35, 0x08, 0xdb,
244 0xbd, 0x7e, 0x2c, 0x28, 0x62, 0xba, 0x29, 0x0a,
245 0xd3, 0x01, 0x0e, 0x49, 0x78, 0xc1, 0x98, 0xdc,
246 0x4d, 0x8f, 0xd0, 0x14, 0xe5, 0x82, 0x82, 0x3a,
247 0x89, 0xe1, 0x6f, 0x9b, 0x2a, 0x7b, 0xbc, 0x1a,
248 0xc9, 0x38, 0xe2, 0xd1, 0x99, 0xe8, 0xbe, 0xa4 },
249 .np = 4,
250 .tap = { 26, 26, 26, 26 }
255 * SHA512 test vectors from from NIST and kerneli
257 #define SHA512_TEST_VECTORS 4
259 static struct hash_testvec sha512_tv_template[] = {
261 .plaintext = "abc",
262 .psize = 3,
263 .digest = { 0xdd, 0xaf, 0x35, 0xa1, 0x93, 0x61, 0x7a, 0xba,
264 0xcc, 0x41, 0x73, 0x49, 0xae, 0x20, 0x41, 0x31,
265 0x12, 0xe6, 0xfa, 0x4e, 0x89, 0xa9, 0x7e, 0xa2,
266 0x0a, 0x9e, 0xee, 0xe6, 0x4b, 0x55, 0xd3, 0x9a,
267 0x21, 0x92, 0x99, 0x2a, 0x27, 0x4f, 0xc1, 0xa8,
268 0x36, 0xba, 0x3c, 0x23, 0xa3, 0xfe, 0xeb, 0xbd,
269 0x45, 0x4d, 0x44, 0x23, 0x64, 0x3c, 0xe8, 0x0e,
270 0x2a, 0x9a, 0xc9, 0x4f, 0xa5, 0x4c, 0xa4, 0x9f },
271 }, {
272 .plaintext = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
273 .psize = 56,
274 .digest = { 0x20, 0x4a, 0x8f, 0xc6, 0xdd, 0xa8, 0x2f, 0x0a,
275 0x0c, 0xed, 0x7b, 0xeb, 0x8e, 0x08, 0xa4, 0x16,
276 0x57, 0xc1, 0x6e, 0xf4, 0x68, 0xb2, 0x28, 0xa8,
277 0x27, 0x9b, 0xe3, 0x31, 0xa7, 0x03, 0xc3, 0x35,
278 0x96, 0xfd, 0x15, 0xc1, 0x3b, 0x1b, 0x07, 0xf9,
279 0xaa, 0x1d, 0x3b, 0xea, 0x57, 0x78, 0x9c, 0xa0,
280 0x31, 0xad, 0x85, 0xc7, 0xa7, 0x1d, 0xd7, 0x03,
281 0x54, 0xec, 0x63, 0x12, 0x38, 0xca, 0x34, 0x45 },
282 }, {
283 .plaintext = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmn"
284 "hijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu",
285 .psize = 112,
286 .digest = { 0x8e, 0x95, 0x9b, 0x75, 0xda, 0xe3, 0x13, 0xda,
287 0x8c, 0xf4, 0xf7, 0x28, 0x14, 0xfc, 0x14, 0x3f,
288 0x8f, 0x77, 0x79, 0xc6, 0xeb, 0x9f, 0x7f, 0xa1,
289 0x72, 0x99, 0xae, 0xad, 0xb6, 0x88, 0x90, 0x18,
290 0x50, 0x1d, 0x28, 0x9e, 0x49, 0x00, 0xf7, 0xe4,
291 0x33, 0x1b, 0x99, 0xde, 0xc4, 0xb5, 0x43, 0x3a,
292 0xc7, 0xd3, 0x29, 0xee, 0xb6, 0xdd, 0x26, 0x54,
293 0x5e, 0x96, 0xe5, 0x5b, 0x87, 0x4b, 0xe9, 0x09 },
294 }, {
295 .plaintext = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcd"
296 "efghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz",
297 .psize = 104,
298 .digest = { 0x93, 0x0d, 0x0c, 0xef, 0xcb, 0x30, 0xff, 0x11,
299 0x33, 0xb6, 0x89, 0x81, 0x21, 0xf1, 0xcf, 0x3d,
300 0x27, 0x57, 0x8a, 0xfc, 0xaf, 0xe8, 0x67, 0x7c,
301 0x52, 0x57, 0xcf, 0x06, 0x99, 0x11, 0xf7, 0x5d,
302 0x8f, 0x58, 0x31, 0xb5, 0x6e, 0xbf, 0xda, 0x67,
303 0xb2, 0x78, 0xe6, 0x6d, 0xff, 0x8b, 0x84, 0xfe,
304 0x2b, 0x28, 0x70, 0xf7, 0x42, 0xa5, 0x80, 0xd8,
305 0xed, 0xb4, 0x19, 0x87, 0x23, 0x28, 0x50, 0xc9 },
306 .np = 4,
307 .tap = { 26, 26, 26, 26 }
313 * WHIRLPOOL test vectors from Whirlpool package
314 * by Vincent Rijmen and Paulo S. L. M. Barreto as part of the NESSIE
315 * submission
317 #define WP512_TEST_VECTORS 8
319 static struct hash_testvec wp512_tv_template[] = {
321 .plaintext = "",
322 .psize = 0,
323 .digest = { 0x19, 0xFA, 0x61, 0xD7, 0x55, 0x22, 0xA4, 0x66,
324 0x9B, 0x44, 0xE3, 0x9C, 0x1D, 0x2E, 0x17, 0x26,
325 0xC5, 0x30, 0x23, 0x21, 0x30, 0xD4, 0x07, 0xF8,
326 0x9A, 0xFE, 0xE0, 0x96, 0x49, 0x97, 0xF7, 0xA7,
327 0x3E, 0x83, 0xBE, 0x69, 0x8B, 0x28, 0x8F, 0xEB,
328 0xCF, 0x88, 0xE3, 0xE0, 0x3C, 0x4F, 0x07, 0x57,
329 0xEA, 0x89, 0x64, 0xE5, 0x9B, 0x63, 0xD9, 0x37,
330 0x08, 0xB1, 0x38, 0xCC, 0x42, 0xA6, 0x6E, 0xB3 },
333 }, {
334 .plaintext = "a",
335 .psize = 1,
336 .digest = { 0x8A, 0xCA, 0x26, 0x02, 0x79, 0x2A, 0xEC, 0x6F,
337 0x11, 0xA6, 0x72, 0x06, 0x53, 0x1F, 0xB7, 0xD7,
338 0xF0, 0xDF, 0xF5, 0x94, 0x13, 0x14, 0x5E, 0x69,
339 0x73, 0xC4, 0x50, 0x01, 0xD0, 0x08, 0x7B, 0x42,
340 0xD1, 0x1B, 0xC6, 0x45, 0x41, 0x3A, 0xEF, 0xF6,
341 0x3A, 0x42, 0x39, 0x1A, 0x39, 0x14, 0x5A, 0x59,
342 0x1A, 0x92, 0x20, 0x0D, 0x56, 0x01, 0x95, 0xE5,
343 0x3B, 0x47, 0x85, 0x84, 0xFD, 0xAE, 0x23, 0x1A },
344 }, {
345 .plaintext = "abc",
346 .psize = 3,
347 .digest = { 0x4E, 0x24, 0x48, 0xA4, 0xC6, 0xF4, 0x86, 0xBB,
348 0x16, 0xB6, 0x56, 0x2C, 0x73, 0xB4, 0x02, 0x0B,
349 0xF3, 0x04, 0x3E, 0x3A, 0x73, 0x1B, 0xCE, 0x72,
350 0x1A, 0xE1, 0xB3, 0x03, 0xD9, 0x7E, 0x6D, 0x4C,
351 0x71, 0x81, 0xEE, 0xBD, 0xB6, 0xC5, 0x7E, 0x27,
352 0x7D, 0x0E, 0x34, 0x95, 0x71, 0x14, 0xCB, 0xD6,
353 0xC7, 0x97, 0xFC, 0x9D, 0x95, 0xD8, 0xB5, 0x82,
354 0xD2, 0x25, 0x29, 0x20, 0x76, 0xD4, 0xEE, 0xF5 },
355 }, {
356 .plaintext = "message digest",
357 .psize = 14,
358 .digest = { 0x37, 0x8C, 0x84, 0xA4, 0x12, 0x6E, 0x2D, 0xC6,
359 0xE5, 0x6D, 0xCC, 0x74, 0x58, 0x37, 0x7A, 0xAC,
360 0x83, 0x8D, 0x00, 0x03, 0x22, 0x30, 0xF5, 0x3C,
361 0xE1, 0xF5, 0x70, 0x0C, 0x0F, 0xFB, 0x4D, 0x3B,
362 0x84, 0x21, 0x55, 0x76, 0x59, 0xEF, 0x55, 0xC1,
363 0x06, 0xB4, 0xB5, 0x2A, 0xC5, 0xA4, 0xAA, 0xA6,
364 0x92, 0xED, 0x92, 0x00, 0x52, 0x83, 0x8F, 0x33,
365 0x62, 0xE8, 0x6D, 0xBD, 0x37, 0xA8, 0x90, 0x3E },
366 }, {
367 .plaintext = "abcdefghijklmnopqrstuvwxyz",
368 .psize = 26,
369 .digest = { 0xF1, 0xD7, 0x54, 0x66, 0x26, 0x36, 0xFF, 0xE9,
370 0x2C, 0x82, 0xEB, 0xB9, 0x21, 0x2A, 0x48, 0x4A,
371 0x8D, 0x38, 0x63, 0x1E, 0xAD, 0x42, 0x38, 0xF5,
372 0x44, 0x2E, 0xE1, 0x3B, 0x80, 0x54, 0xE4, 0x1B,
373 0x08, 0xBF, 0x2A, 0x92, 0x51, 0xC3, 0x0B, 0x6A,
374 0x0B, 0x8A, 0xAE, 0x86, 0x17, 0x7A, 0xB4, 0xA6,
375 0xF6, 0x8F, 0x67, 0x3E, 0x72, 0x07, 0x86, 0x5D,
376 0x5D, 0x98, 0x19, 0xA3, 0xDB, 0xA4, 0xEB, 0x3B },
377 }, {
378 .plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
379 "abcdefghijklmnopqrstuvwxyz0123456789",
380 .psize = 62,
381 .digest = { 0xDC, 0x37, 0xE0, 0x08, 0xCF, 0x9E, 0xE6, 0x9B,
382 0xF1, 0x1F, 0x00, 0xED, 0x9A, 0xBA, 0x26, 0x90,
383 0x1D, 0xD7, 0xC2, 0x8C, 0xDE, 0xC0, 0x66, 0xCC,
384 0x6A, 0xF4, 0x2E, 0x40, 0xF8, 0x2F, 0x3A, 0x1E,
385 0x08, 0xEB, 0xA2, 0x66, 0x29, 0x12, 0x9D, 0x8F,
386 0xB7, 0xCB, 0x57, 0x21, 0x1B, 0x92, 0x81, 0xA6,
387 0x55, 0x17, 0xCC, 0x87, 0x9D, 0x7B, 0x96, 0x21,
388 0x42, 0xC6, 0x5F, 0x5A, 0x7A, 0xF0, 0x14, 0x67 },
389 }, {
390 .plaintext = "1234567890123456789012345678901234567890"
391 "1234567890123456789012345678901234567890",
392 .psize = 80,
393 .digest = { 0x46, 0x6E, 0xF1, 0x8B, 0xAB, 0xB0, 0x15, 0x4D,
394 0x25, 0xB9, 0xD3, 0x8A, 0x64, 0x14, 0xF5, 0xC0,
395 0x87, 0x84, 0x37, 0x2B, 0xCC, 0xB2, 0x04, 0xD6,
396 0x54, 0x9C, 0x4A, 0xFA, 0xDB, 0x60, 0x14, 0x29,
397 0x4D, 0x5B, 0xD8, 0xDF, 0x2A, 0x6C, 0x44, 0xE5,
398 0x38, 0xCD, 0x04, 0x7B, 0x26, 0x81, 0xA5, 0x1A,
399 0x2C, 0x60, 0x48, 0x1E, 0x88, 0xC5, 0xA2, 0x0B,
400 0x2C, 0x2A, 0x80, 0xCF, 0x3A, 0x9A, 0x08, 0x3B },
401 }, {
402 .plaintext = "abcdbcdecdefdefgefghfghighijhijk",
403 .psize = 32,
404 .digest = { 0x2A, 0x98, 0x7E, 0xA4, 0x0F, 0x91, 0x70, 0x61,
405 0xF5, 0xD6, 0xF0, 0xA0, 0xE4, 0x64, 0x4F, 0x48,
406 0x8A, 0x7A, 0x5A, 0x52, 0xDE, 0xEE, 0x65, 0x62,
407 0x07, 0xC5, 0x62, 0xF9, 0x88, 0xE9, 0x5C, 0x69,
408 0x16, 0xBD, 0xC8, 0x03, 0x1B, 0xC5, 0xBE, 0x1B,
409 0x7B, 0x94, 0x76, 0x39, 0xFE, 0x05, 0x0B, 0x56,
410 0x93, 0x9B, 0xAA, 0xA0, 0xAD, 0xFF, 0x9A, 0xE6,
411 0x74, 0x5B, 0x7B, 0x18, 0x1C, 0x3B, 0xE3, 0xFD },
415 #define WP384_TEST_VECTORS 8
417 static struct hash_testvec wp384_tv_template[] = {
419 .plaintext = "",
420 .psize = 0,
421 .digest = { 0x19, 0xFA, 0x61, 0xD7, 0x55, 0x22, 0xA4, 0x66,
422 0x9B, 0x44, 0xE3, 0x9C, 0x1D, 0x2E, 0x17, 0x26,
423 0xC5, 0x30, 0x23, 0x21, 0x30, 0xD4, 0x07, 0xF8,
424 0x9A, 0xFE, 0xE0, 0x96, 0x49, 0x97, 0xF7, 0xA7,
425 0x3E, 0x83, 0xBE, 0x69, 0x8B, 0x28, 0x8F, 0xEB,
426 0xCF, 0x88, 0xE3, 0xE0, 0x3C, 0x4F, 0x07, 0x57 },
429 }, {
430 .plaintext = "a",
431 .psize = 1,
432 .digest = { 0x8A, 0xCA, 0x26, 0x02, 0x79, 0x2A, 0xEC, 0x6F,
433 0x11, 0xA6, 0x72, 0x06, 0x53, 0x1F, 0xB7, 0xD7,
434 0xF0, 0xDF, 0xF5, 0x94, 0x13, 0x14, 0x5E, 0x69,
435 0x73, 0xC4, 0x50, 0x01, 0xD0, 0x08, 0x7B, 0x42,
436 0xD1, 0x1B, 0xC6, 0x45, 0x41, 0x3A, 0xEF, 0xF6,
437 0x3A, 0x42, 0x39, 0x1A, 0x39, 0x14, 0x5A, 0x59 },
438 }, {
439 .plaintext = "abc",
440 .psize = 3,
441 .digest = { 0x4E, 0x24, 0x48, 0xA4, 0xC6, 0xF4, 0x86, 0xBB,
442 0x16, 0xB6, 0x56, 0x2C, 0x73, 0xB4, 0x02, 0x0B,
443 0xF3, 0x04, 0x3E, 0x3A, 0x73, 0x1B, 0xCE, 0x72,
444 0x1A, 0xE1, 0xB3, 0x03, 0xD9, 0x7E, 0x6D, 0x4C,
445 0x71, 0x81, 0xEE, 0xBD, 0xB6, 0xC5, 0x7E, 0x27,
446 0x7D, 0x0E, 0x34, 0x95, 0x71, 0x14, 0xCB, 0xD6 },
447 }, {
448 .plaintext = "message digest",
449 .psize = 14,
450 .digest = { 0x37, 0x8C, 0x84, 0xA4, 0x12, 0x6E, 0x2D, 0xC6,
451 0xE5, 0x6D, 0xCC, 0x74, 0x58, 0x37, 0x7A, 0xAC,
452 0x83, 0x8D, 0x00, 0x03, 0x22, 0x30, 0xF5, 0x3C,
453 0xE1, 0xF5, 0x70, 0x0C, 0x0F, 0xFB, 0x4D, 0x3B,
454 0x84, 0x21, 0x55, 0x76, 0x59, 0xEF, 0x55, 0xC1,
455 0x06, 0xB4, 0xB5, 0x2A, 0xC5, 0xA4, 0xAA, 0xA6 },
456 }, {
457 .plaintext = "abcdefghijklmnopqrstuvwxyz",
458 .psize = 26,
459 .digest = { 0xF1, 0xD7, 0x54, 0x66, 0x26, 0x36, 0xFF, 0xE9,
460 0x2C, 0x82, 0xEB, 0xB9, 0x21, 0x2A, 0x48, 0x4A,
461 0x8D, 0x38, 0x63, 0x1E, 0xAD, 0x42, 0x38, 0xF5,
462 0x44, 0x2E, 0xE1, 0x3B, 0x80, 0x54, 0xE4, 0x1B,
463 0x08, 0xBF, 0x2A, 0x92, 0x51, 0xC3, 0x0B, 0x6A,
464 0x0B, 0x8A, 0xAE, 0x86, 0x17, 0x7A, 0xB4, 0xA6 },
465 }, {
466 .plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
467 "abcdefghijklmnopqrstuvwxyz0123456789",
468 .psize = 62,
469 .digest = { 0xDC, 0x37, 0xE0, 0x08, 0xCF, 0x9E, 0xE6, 0x9B,
470 0xF1, 0x1F, 0x00, 0xED, 0x9A, 0xBA, 0x26, 0x90,
471 0x1D, 0xD7, 0xC2, 0x8C, 0xDE, 0xC0, 0x66, 0xCC,
472 0x6A, 0xF4, 0x2E, 0x40, 0xF8, 0x2F, 0x3A, 0x1E,
473 0x08, 0xEB, 0xA2, 0x66, 0x29, 0x12, 0x9D, 0x8F,
474 0xB7, 0xCB, 0x57, 0x21, 0x1B, 0x92, 0x81, 0xA6 },
475 }, {
476 .plaintext = "1234567890123456789012345678901234567890"
477 "1234567890123456789012345678901234567890",
478 .psize = 80,
479 .digest = { 0x46, 0x6E, 0xF1, 0x8B, 0xAB, 0xB0, 0x15, 0x4D,
480 0x25, 0xB9, 0xD3, 0x8A, 0x64, 0x14, 0xF5, 0xC0,
481 0x87, 0x84, 0x37, 0x2B, 0xCC, 0xB2, 0x04, 0xD6,
482 0x54, 0x9C, 0x4A, 0xFA, 0xDB, 0x60, 0x14, 0x29,
483 0x4D, 0x5B, 0xD8, 0xDF, 0x2A, 0x6C, 0x44, 0xE5,
484 0x38, 0xCD, 0x04, 0x7B, 0x26, 0x81, 0xA5, 0x1A },
485 }, {
486 .plaintext = "abcdbcdecdefdefgefghfghighijhijk",
487 .psize = 32,
488 .digest = { 0x2A, 0x98, 0x7E, 0xA4, 0x0F, 0x91, 0x70, 0x61,
489 0xF5, 0xD6, 0xF0, 0xA0, 0xE4, 0x64, 0x4F, 0x48,
490 0x8A, 0x7A, 0x5A, 0x52, 0xDE, 0xEE, 0x65, 0x62,
491 0x07, 0xC5, 0x62, 0xF9, 0x88, 0xE9, 0x5C, 0x69,
492 0x16, 0xBD, 0xC8, 0x03, 0x1B, 0xC5, 0xBE, 0x1B,
493 0x7B, 0x94, 0x76, 0x39, 0xFE, 0x05, 0x0B, 0x56 },
497 #define WP256_TEST_VECTORS 8
499 static struct hash_testvec wp256_tv_template[] = {
501 .plaintext = "",
502 .psize = 0,
503 .digest = { 0x19, 0xFA, 0x61, 0xD7, 0x55, 0x22, 0xA4, 0x66,
504 0x9B, 0x44, 0xE3, 0x9C, 0x1D, 0x2E, 0x17, 0x26,
505 0xC5, 0x30, 0x23, 0x21, 0x30, 0xD4, 0x07, 0xF8,
506 0x9A, 0xFE, 0xE0, 0x96, 0x49, 0x97, 0xF7, 0xA7 },
509 }, {
510 .plaintext = "a",
511 .psize = 1,
512 .digest = { 0x8A, 0xCA, 0x26, 0x02, 0x79, 0x2A, 0xEC, 0x6F,
513 0x11, 0xA6, 0x72, 0x06, 0x53, 0x1F, 0xB7, 0xD7,
514 0xF0, 0xDF, 0xF5, 0x94, 0x13, 0x14, 0x5E, 0x69,
515 0x73, 0xC4, 0x50, 0x01, 0xD0, 0x08, 0x7B, 0x42 },
516 }, {
517 .plaintext = "abc",
518 .psize = 3,
519 .digest = { 0x4E, 0x24, 0x48, 0xA4, 0xC6, 0xF4, 0x86, 0xBB,
520 0x16, 0xB6, 0x56, 0x2C, 0x73, 0xB4, 0x02, 0x0B,
521 0xF3, 0x04, 0x3E, 0x3A, 0x73, 0x1B, 0xCE, 0x72,
522 0x1A, 0xE1, 0xB3, 0x03, 0xD9, 0x7E, 0x6D, 0x4C },
523 }, {
524 .plaintext = "message digest",
525 .psize = 14,
526 .digest = { 0x37, 0x8C, 0x84, 0xA4, 0x12, 0x6E, 0x2D, 0xC6,
527 0xE5, 0x6D, 0xCC, 0x74, 0x58, 0x37, 0x7A, 0xAC,
528 0x83, 0x8D, 0x00, 0x03, 0x22, 0x30, 0xF5, 0x3C,
529 0xE1, 0xF5, 0x70, 0x0C, 0x0F, 0xFB, 0x4D, 0x3B },
530 }, {
531 .plaintext = "abcdefghijklmnopqrstuvwxyz",
532 .psize = 26,
533 .digest = { 0xF1, 0xD7, 0x54, 0x66, 0x26, 0x36, 0xFF, 0xE9,
534 0x2C, 0x82, 0xEB, 0xB9, 0x21, 0x2A, 0x48, 0x4A,
535 0x8D, 0x38, 0x63, 0x1E, 0xAD, 0x42, 0x38, 0xF5,
536 0x44, 0x2E, 0xE1, 0x3B, 0x80, 0x54, 0xE4, 0x1B },
537 }, {
538 .plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
539 "abcdefghijklmnopqrstuvwxyz0123456789",
540 .psize = 62,
541 .digest = { 0xDC, 0x37, 0xE0, 0x08, 0xCF, 0x9E, 0xE6, 0x9B,
542 0xF1, 0x1F, 0x00, 0xED, 0x9A, 0xBA, 0x26, 0x90,
543 0x1D, 0xD7, 0xC2, 0x8C, 0xDE, 0xC0, 0x66, 0xCC,
544 0x6A, 0xF4, 0x2E, 0x40, 0xF8, 0x2F, 0x3A, 0x1E },
545 }, {
546 .plaintext = "1234567890123456789012345678901234567890"
547 "1234567890123456789012345678901234567890",
548 .psize = 80,
549 .digest = { 0x46, 0x6E, 0xF1, 0x8B, 0xAB, 0xB0, 0x15, 0x4D,
550 0x25, 0xB9, 0xD3, 0x8A, 0x64, 0x14, 0xF5, 0xC0,
551 0x87, 0x84, 0x37, 0x2B, 0xCC, 0xB2, 0x04, 0xD6,
552 0x54, 0x9C, 0x4A, 0xFA, 0xDB, 0x60, 0x14, 0x29 },
553 }, {
554 .plaintext = "abcdbcdecdefdefgefghfghighijhijk",
555 .psize = 32,
556 .digest = { 0x2A, 0x98, 0x7E, 0xA4, 0x0F, 0x91, 0x70, 0x61,
557 0xF5, 0xD6, 0xF0, 0xA0, 0xE4, 0x64, 0x4F, 0x48,
558 0x8A, 0x7A, 0x5A, 0x52, 0xDE, 0xEE, 0x65, 0x62,
559 0x07, 0xC5, 0x62, 0xF9, 0x88, 0xE9, 0x5C, 0x69 },
564 * TIGER test vectors from Tiger website
566 #define TGR192_TEST_VECTORS 6
568 static struct hash_testvec tgr192_tv_template[] = {
570 .plaintext = "",
571 .psize = 0,
572 .digest = { 0x24, 0xf0, 0x13, 0x0c, 0x63, 0xac, 0x93, 0x32,
573 0x16, 0x16, 0x6e, 0x76, 0xb1, 0xbb, 0x92, 0x5f,
574 0xf3, 0x73, 0xde, 0x2d, 0x49, 0x58, 0x4e, 0x7a },
575 }, {
576 .plaintext = "abc",
577 .psize = 3,
578 .digest = { 0xf2, 0x58, 0xc1, 0xe8, 0x84, 0x14, 0xab, 0x2a,
579 0x52, 0x7a, 0xb5, 0x41, 0xff, 0xc5, 0xb8, 0xbf,
580 0x93, 0x5f, 0x7b, 0x95, 0x1c, 0x13, 0x29, 0x51 },
581 }, {
582 .plaintext = "Tiger",
583 .psize = 5,
584 .digest = { 0x9f, 0x00, 0xf5, 0x99, 0x07, 0x23, 0x00, 0xdd,
585 0x27, 0x6a, 0xbb, 0x38, 0xc8, 0xeb, 0x6d, 0xec,
586 0x37, 0x79, 0x0c, 0x11, 0x6f, 0x9d, 0x2b, 0xdf },
587 }, {
588 .plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-",
589 .psize = 64,
590 .digest = { 0x87, 0xfb, 0x2a, 0x90, 0x83, 0x85, 0x1c, 0xf7,
591 0x47, 0x0d, 0x2c, 0xf8, 0x10, 0xe6, 0xdf, 0x9e,
592 0xb5, 0x86, 0x44, 0x50, 0x34, 0xa5, 0xa3, 0x86 },
593 }, {
594 .plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZ=abcdefghijklmnopqrstuvwxyz+0123456789",
595 .psize = 64,
596 .digest = { 0x46, 0x7d, 0xb8, 0x08, 0x63, 0xeb, 0xce, 0x48,
597 0x8d, 0xf1, 0xcd, 0x12, 0x61, 0x65, 0x5d, 0xe9,
598 0x57, 0x89, 0x65, 0x65, 0x97, 0x5f, 0x91, 0x97 },
599 }, {
600 .plaintext = "Tiger - A Fast New Hash Function, "
601 "by Ross Anderson and Eli Biham, "
602 "proceedings of Fast Software Encryption 3, "
603 "Cambridge, 1996.",
604 .psize = 125,
605 .digest = { 0x3d, 0x9a, 0xeb, 0x03, 0xd1, 0xbd, 0x1a, 0x63,
606 0x57, 0xb2, 0x77, 0x4d, 0xfd, 0x6d, 0x5b, 0x24,
607 0xdd, 0x68, 0x15, 0x1d, 0x50, 0x39, 0x74, 0xfc },
611 #define TGR160_TEST_VECTORS 6
613 static struct hash_testvec tgr160_tv_template[] = {
615 .plaintext = "",
616 .psize = 0,
617 .digest = { 0x24, 0xf0, 0x13, 0x0c, 0x63, 0xac, 0x93, 0x32,
618 0x16, 0x16, 0x6e, 0x76, 0xb1, 0xbb, 0x92, 0x5f,
619 0xf3, 0x73, 0xde, 0x2d },
620 }, {
621 .plaintext = "abc",
622 .psize = 3,
623 .digest = { 0xf2, 0x58, 0xc1, 0xe8, 0x84, 0x14, 0xab, 0x2a,
624 0x52, 0x7a, 0xb5, 0x41, 0xff, 0xc5, 0xb8, 0xbf,
625 0x93, 0x5f, 0x7b, 0x95 },
626 }, {
627 .plaintext = "Tiger",
628 .psize = 5,
629 .digest = { 0x9f, 0x00, 0xf5, 0x99, 0x07, 0x23, 0x00, 0xdd,
630 0x27, 0x6a, 0xbb, 0x38, 0xc8, 0xeb, 0x6d, 0xec,
631 0x37, 0x79, 0x0c, 0x11 },
632 }, {
633 .plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-",
634 .psize = 64,
635 .digest = { 0x87, 0xfb, 0x2a, 0x90, 0x83, 0x85, 0x1c, 0xf7,
636 0x47, 0x0d, 0x2c, 0xf8, 0x10, 0xe6, 0xdf, 0x9e,
637 0xb5, 0x86, 0x44, 0x50 },
638 }, {
639 .plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZ=abcdefghijklmnopqrstuvwxyz+0123456789",
640 .psize = 64,
641 .digest = { 0x46, 0x7d, 0xb8, 0x08, 0x63, 0xeb, 0xce, 0x48,
642 0x8d, 0xf1, 0xcd, 0x12, 0x61, 0x65, 0x5d, 0xe9,
643 0x57, 0x89, 0x65, 0x65 },
644 }, {
645 .plaintext = "Tiger - A Fast New Hash Function, "
646 "by Ross Anderson and Eli Biham, "
647 "proceedings of Fast Software Encryption 3, "
648 "Cambridge, 1996.",
649 .psize = 125,
650 .digest = { 0x3d, 0x9a, 0xeb, 0x03, 0xd1, 0xbd, 0x1a, 0x63,
651 0x57, 0xb2, 0x77, 0x4d, 0xfd, 0x6d, 0x5b, 0x24,
652 0xdd, 0x68, 0x15, 0x1d },
656 #define TGR128_TEST_VECTORS 6
658 static struct hash_testvec tgr128_tv_template[] = {
660 .plaintext = "",
661 .psize = 0,
662 .digest = { 0x24, 0xf0, 0x13, 0x0c, 0x63, 0xac, 0x93, 0x32,
663 0x16, 0x16, 0x6e, 0x76, 0xb1, 0xbb, 0x92, 0x5f },
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 }, {
670 .plaintext = "Tiger",
671 .psize = 5,
672 .digest = { 0x9f, 0x00, 0xf5, 0x99, 0x07, 0x23, 0x00, 0xdd,
673 0x27, 0x6a, 0xbb, 0x38, 0xc8, 0xeb, 0x6d, 0xec },
674 }, {
675 .plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-",
676 .psize = 64,
677 .digest = { 0x87, 0xfb, 0x2a, 0x90, 0x83, 0x85, 0x1c, 0xf7,
678 0x47, 0x0d, 0x2c, 0xf8, 0x10, 0xe6, 0xdf, 0x9e },
679 }, {
680 .plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZ=abcdefghijklmnopqrstuvwxyz+0123456789",
681 .psize = 64,
682 .digest = { 0x46, 0x7d, 0xb8, 0x08, 0x63, 0xeb, 0xce, 0x48,
683 0x8d, 0xf1, 0xcd, 0x12, 0x61, 0x65, 0x5d, 0xe9 },
684 }, {
685 .plaintext = "Tiger - A Fast New Hash Function, "
686 "by Ross Anderson and Eli Biham, "
687 "proceedings of Fast Software Encryption 3, "
688 "Cambridge, 1996.",
689 .psize = 125,
690 .digest = { 0x3d, 0x9a, 0xeb, 0x03, 0xd1, 0xbd, 0x1a, 0x63,
691 0x57, 0xb2, 0x77, 0x4d, 0xfd, 0x6d, 0x5b, 0x24 },
695 #ifdef CONFIG_CRYPTO_HMAC
697 * HMAC-MD5 test vectors from RFC2202
698 * (These need to be fixed to not use strlen).
700 #define HMAC_MD5_TEST_VECTORS 7
702 static struct hmac_testvec hmac_md5_tv_template[] =
705 .key = { [0 ... 15] = 0x0b },
706 .ksize = 16,
707 .plaintext = "Hi There",
708 .psize = 8,
709 .digest = { 0x92, 0x94, 0x72, 0x7a, 0x36, 0x38, 0xbb, 0x1c,
710 0x13, 0xf4, 0x8e, 0xf8, 0x15, 0x8b, 0xfc, 0x9d },
711 }, {
712 .key = { 'J', 'e', 'f', 'e' },
713 .ksize = 4,
714 .plaintext = "what do ya want for nothing?",
715 .psize = 28,
716 .digest = { 0x75, 0x0c, 0x78, 0x3e, 0x6a, 0xb0, 0xb5, 0x03,
717 0xea, 0xa8, 0x6e, 0x31, 0x0a, 0x5d, 0xb7, 0x38 },
718 .np = 2,
719 .tap = {14, 14}
720 }, {
721 .key = { [0 ... 15] = 0xaa },
722 .ksize = 16,
723 .plaintext = { [0 ... 49] = 0xdd },
724 .psize = 50,
725 .digest = { 0x56, 0xbe, 0x34, 0x52, 0x1d, 0x14, 0x4c, 0x88,
726 0xdb, 0xb8, 0xc7, 0x33, 0xf0, 0xe8, 0xb3, 0xf6 },
727 }, {
728 .key = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
729 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
730 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, },
731 .ksize = 25,
732 .plaintext = { [0 ... 49] = 0xcd },
733 .psize = 50,
734 .digest = { 0x69, 0x7e, 0xaf, 0x0a, 0xca, 0x3a, 0x3a, 0xea,
735 0x3a, 0x75, 0x16, 0x47, 0x46, 0xff, 0xaa, 0x79 },
736 }, {
737 .key = { [0 ... 15] = 0x0c },
738 .ksize = 16,
739 .plaintext = "Test With Truncation",
740 .psize = 20,
741 .digest = { 0x56, 0x46, 0x1e, 0xf2, 0x34, 0x2e, 0xdc, 0x00,
742 0xf9, 0xba, 0xb9, 0x95, 0x69, 0x0e, 0xfd, 0x4c },
743 }, {
744 .key = { [0 ... 79] = 0xaa },
745 .ksize = 80,
746 .plaintext = "Test Using Larger Than Block-Size Key - Hash Key First",
747 .psize = 54,
748 .digest = { 0x6b, 0x1a, 0xb7, 0xfe, 0x4b, 0xd7, 0xbf, 0x8f,
749 0x0b, 0x62, 0xe6, 0xce, 0x61, 0xb9, 0xd0, 0xcd },
750 }, {
751 .key = { [0 ... 79] = 0xaa },
752 .ksize = 80,
753 .plaintext = "Test Using Larger Than Block-Size Key and Larger Than One "
754 "Block-Size Data",
755 .psize = 73,
756 .digest = { 0x6f, 0x63, 0x0f, 0xad, 0x67, 0xcd, 0xa0, 0xee,
757 0x1f, 0xb1, 0xf5, 0x62, 0xdb, 0x3a, 0xa5, 0x3e },
762 * HMAC-SHA1 test vectors from RFC2202
764 #define HMAC_SHA1_TEST_VECTORS 7
766 static struct hmac_testvec hmac_sha1_tv_template[] = {
768 .key = { [0 ... 19] = 0x0b },
769 .ksize = 20,
770 .plaintext = "Hi There",
771 .psize = 8,
772 .digest = { 0xb6, 0x17, 0x31, 0x86, 0x55, 0x05, 0x72, 0x64,
773 0xe2, 0x8b, 0xc0, 0xb6, 0xfb, 0x37, 0x8c, 0x8e, 0xf1,
774 0x46, 0xbe },
775 }, {
776 .key = { 'J', 'e', 'f', 'e' },
777 .ksize = 4,
778 .plaintext = "what do ya want for nothing?",
779 .psize = 28,
780 .digest = { 0xef, 0xfc, 0xdf, 0x6a, 0xe5, 0xeb, 0x2f, 0xa2, 0xd2, 0x74,
781 0x16, 0xd5, 0xf1, 0x84, 0xdf, 0x9c, 0x25, 0x9a, 0x7c, 0x79 },
782 .np = 2,
783 .tap = { 14, 14 }
784 }, {
785 .key = { [0 ... 19] = 0xaa },
786 .ksize = 20,
787 .plaintext = { [0 ... 49] = 0xdd },
788 .psize = 50,
789 .digest = { 0x12, 0x5d, 0x73, 0x42, 0xb9, 0xac, 0x11, 0xcd, 0x91, 0xa3,
790 0x9a, 0xf4, 0x8a, 0xa1, 0x7b, 0x4f, 0x63, 0xf1, 0x75, 0xd3 },
791 }, {
792 .key = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
793 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
794 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19 },
795 .ksize = 25,
796 .plaintext = { [0 ... 49] = 0xcd },
797 .psize = 50,
798 .digest = { 0x4c, 0x90, 0x07, 0xf4, 0x02, 0x62, 0x50, 0xc6, 0xbc, 0x84,
799 0x14, 0xf9, 0xbf, 0x50, 0xc8, 0x6c, 0x2d, 0x72, 0x35, 0xda },
800 }, {
801 .key = { [0 ... 19] = 0x0c },
802 .ksize = 20,
803 .plaintext = "Test With Truncation",
804 .psize = 20,
805 .digest = { 0x4c, 0x1a, 0x03, 0x42, 0x4b, 0x55, 0xe0, 0x7f, 0xe7, 0xf2,
806 0x7b, 0xe1, 0xd5, 0x8b, 0xb9, 0x32, 0x4a, 0x9a, 0x5a, 0x04 },
807 }, {
808 .key = { [0 ... 79] = 0xaa },
809 .ksize = 80,
810 .plaintext = "Test Using Larger Than Block-Size Key - Hash Key First",
811 .psize = 54,
812 .digest = { 0xaa, 0x4a, 0xe5, 0xe1, 0x52, 0x72, 0xd0, 0x0e, 0x95, 0x70,
813 0x56, 0x37, 0xce, 0x8a, 0x3b, 0x55, 0xed, 0x40, 0x21, 0x12 },
814 }, {
815 .key = { [0 ... 79] = 0xaa },
816 .ksize = 80,
817 .plaintext = "Test Using Larger Than Block-Size Key and Larger Than One "
818 "Block-Size Data",
819 .psize = 73,
820 .digest = { 0xe8, 0xe9, 0x9d, 0x0f, 0x45, 0x23, 0x7d, 0x78, 0x6d, 0x6b,
821 0xba, 0xa7, 0x96, 0x5c, 0x78, 0x08, 0xbb, 0xff, 0x1a, 0x91 },
826 * HMAC-SHA256 test vectors from
827 * draft-ietf-ipsec-ciph-sha-256-01.txt
829 #define HMAC_SHA256_TEST_VECTORS 10
831 static struct hmac_testvec hmac_sha256_tv_template[] = {
833 .key = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
834 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
835 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
836 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20},
837 .ksize = 32,
838 .plaintext = "abc",
839 .psize = 3,
840 .digest = { 0xa2, 0x1b, 0x1f, 0x5d, 0x4c, 0xf4, 0xf7, 0x3a,
841 0x4d, 0xd9, 0x39, 0x75, 0x0f, 0x7a, 0x06, 0x6a,
842 0x7f, 0x98, 0xcc, 0x13, 0x1c, 0xb1, 0x6a, 0x66,
843 0x92, 0x75, 0x90, 0x21, 0xcf, 0xab, 0x81, 0x81 },
844 }, {
845 .key = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
846 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
847 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
848 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20 },
849 .ksize = 32,
850 .plaintext = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
851 .psize = 56,
852 .digest = { 0x10, 0x4f, 0xdc, 0x12, 0x57, 0x32, 0x8f, 0x08,
853 0x18, 0x4b, 0xa7, 0x31, 0x31, 0xc5, 0x3c, 0xae,
854 0xe6, 0x98, 0xe3, 0x61, 0x19, 0x42, 0x11, 0x49,
855 0xea, 0x8c, 0x71, 0x24, 0x56, 0x69, 0x7d, 0x30 },
856 }, {
857 .key = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
858 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
859 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
860 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20 },
861 .ksize = 32,
862 .plaintext = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"
863 "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
864 .psize = 112,
865 .digest = { 0x47, 0x03, 0x05, 0xfc, 0x7e, 0x40, 0xfe, 0x34,
866 0xd3, 0xee, 0xb3, 0xe7, 0x73, 0xd9, 0x5a, 0xab,
867 0x73, 0xac, 0xf0, 0xfd, 0x06, 0x04, 0x47, 0xa5,
868 0xeb, 0x45, 0x95, 0xbf, 0x33, 0xa9, 0xd1, 0xa3 },
869 }, {
870 .key = { [0 ... 31] = 0x0b },
871 .ksize = 32,
872 .plaintext = "Hi There",
873 .psize = 8,
874 .digest = { 0x19, 0x8a, 0x60, 0x7e, 0xb4, 0x4b, 0xfb, 0xc6,
875 0x99, 0x03, 0xa0, 0xf1, 0xcf, 0x2b, 0xbd, 0xc5,
876 0xba, 0x0a, 0xa3, 0xf3, 0xd9, 0xae, 0x3c, 0x1c,
877 0x7a, 0x3b, 0x16, 0x96, 0xa0, 0xb6, 0x8c, 0xf7 },
878 }, {
879 .key = "Jefe",
880 .ksize = 4,
881 .plaintext = "what do ya want for nothing?",
882 .psize = 28,
883 .digest = { 0x5b, 0xdc, 0xc1, 0x46, 0xbf, 0x60, 0x75, 0x4e,
884 0x6a, 0x04, 0x24, 0x26, 0x08, 0x95, 0x75, 0xc7,
885 0x5a, 0x00, 0x3f, 0x08, 0x9d, 0x27, 0x39, 0x83,
886 0x9d, 0xec, 0x58, 0xb9, 0x64, 0xec, 0x38, 0x43 },
887 .np = 2,
888 .tap = { 14, 14 }
889 }, {
890 .key = { [0 ... 31] = 0xaa },
891 .ksize = 32,
892 .plaintext = { [0 ... 49] = 0xdd },
893 .psize = 50,
894 .digest = { 0xcd, 0xcb, 0x12, 0x20, 0xd1, 0xec, 0xcc, 0xea,
895 0x91, 0xe5, 0x3a, 0xba, 0x30, 0x92, 0xf9, 0x62,
896 0xe5, 0x49, 0xfe, 0x6c, 0xe9, 0xed, 0x7f, 0xdc,
897 0x43, 0x19, 0x1f, 0xbd, 0xe4, 0x5c, 0x30, 0xb0 },
898 }, {
899 .key = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
900 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
901 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
902 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20,
903 0x21, 0x22, 0x23, 0x24, 0x25 },
904 .ksize = 37,
905 .plaintext = { [0 ... 49] = 0xcd },
906 .psize = 50,
907 .digest = { 0xd4, 0x63, 0x3c, 0x17, 0xf6, 0xfb, 0x8d, 0x74,
908 0x4c, 0x66, 0xde, 0xe0, 0xf8, 0xf0, 0x74, 0x55,
909 0x6e, 0xc4, 0xaf, 0x55, 0xef, 0x07, 0x99, 0x85,
910 0x41, 0x46, 0x8e, 0xb4, 0x9b, 0xd2, 0xe9, 0x17 },
911 }, {
912 .key = { [0 ... 31] = 0x0c },
913 .ksize = 32,
914 .plaintext = "Test With Truncation",
915 .psize = 20,
916 .digest = { 0x75, 0x46, 0xaf, 0x01, 0x84, 0x1f, 0xc0, 0x9b,
917 0x1a, 0xb9, 0xc3, 0x74, 0x9a, 0x5f, 0x1c, 0x17,
918 0xd4, 0xf5, 0x89, 0x66, 0x8a, 0x58, 0x7b, 0x27,
919 0x00, 0xa9, 0xc9, 0x7c, 0x11, 0x93, 0xcf, 0x42 },
920 }, {
921 .key = { [0 ... 79] = 0xaa },
922 .ksize = 80,
923 .plaintext = "Test Using Larger Than Block-Size Key - Hash Key First",
924 .psize = 54,
925 .digest = { 0x69, 0x53, 0x02, 0x5e, 0xd9, 0x6f, 0x0c, 0x09,
926 0xf8, 0x0a, 0x96, 0xf7, 0x8e, 0x65, 0x38, 0xdb,
927 0xe2, 0xe7, 0xb8, 0x20, 0xe3, 0xdd, 0x97, 0x0e,
928 0x7d, 0xdd, 0x39, 0x09, 0x1b, 0x32, 0x35, 0x2f },
929 }, {
930 .key = { [0 ... 79] = 0xaa },
931 .ksize = 80,
932 .plaintext = "Test Using Larger Than Block-Size Key and Larger Than "
933 "One Block-Size Data",
934 .psize = 73,
935 .digest = { 0x63, 0x55, 0xac, 0x22, 0xe8, 0x90, 0xd0, 0xa3,
936 0xc8, 0x48, 0x1a, 0x5c, 0xa4, 0x82, 0x5b, 0xc8,
937 0x84, 0xd3, 0xe7, 0xa1, 0xff, 0x98, 0xa2, 0xfc,
938 0x2a, 0xc7, 0xd8, 0xe0, 0x64, 0xc3, 0xb2, 0xe6 },
942 #endif /* CONFIG_CRYPTO_HMAC */
945 * DES test vectors.
947 #define DES_ENC_TEST_VECTORS 10
948 #define DES_DEC_TEST_VECTORS 4
949 #define DES_CBC_ENC_TEST_VECTORS 5
950 #define DES_CBC_DEC_TEST_VECTORS 4
951 #define DES3_EDE_ENC_TEST_VECTORS 3
952 #define DES3_EDE_DEC_TEST_VECTORS 3
954 static struct cipher_testvec des_enc_tv_template[] = {
955 { /* From Applied Cryptography */
956 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
957 .klen = 8,
958 .input = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xe7 },
959 .ilen = 8,
960 .result = { 0xc9, 0x57, 0x44, 0x25, 0x6a, 0x5e, 0xd3, 0x1d },
961 .rlen = 8,
962 }, { /* Same key, different plaintext block */
963 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
964 .klen = 8,
965 .input = { 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99 },
966 .ilen = 8,
967 .result = { 0xf7, 0x9c, 0x89, 0x2a, 0x33, 0x8f, 0x4a, 0x8b },
968 .rlen = 8,
969 }, { /* Sbox test from NBS */
970 .key = { 0x7c, 0xa1, 0x10, 0x45, 0x4a, 0x1a, 0x6e, 0x57 },
971 .klen = 8,
972 .input = { 0x01, 0xa1, 0xd6, 0xd0, 0x39, 0x77, 0x67, 0x42 },
973 .ilen = 8,
974 .result = { 0x69, 0x0f, 0x5b, 0x0d, 0x9a, 0x26, 0x93, 0x9b },
975 .rlen = 8,
976 }, { /* Three blocks */
977 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
978 .klen = 8,
979 .input = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xe7,
980 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99,
981 0xca, 0xfe, 0xba, 0xbe, 0xfe, 0xed, 0xbe, 0xef },
982 .ilen = 24,
983 .result = { 0xc9, 0x57, 0x44, 0x25, 0x6a, 0x5e, 0xd3, 0x1d,
984 0xf7, 0x9c, 0x89, 0x2a, 0x33, 0x8f, 0x4a, 0x8b,
985 0xb4, 0x99, 0x26, 0xf7, 0x1f, 0xe1, 0xd4, 0x90 },
986 .rlen = 24,
987 }, { /* Weak key */
988 .fail = 1,
989 .wk = 1,
990 .key = { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 },
991 .klen = 8,
992 .input = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xe7 },
993 .ilen = 8,
994 .result = { 0xc9, 0x57, 0x44, 0x25, 0x6a, 0x5e, 0xd3, 0x1d },
995 .rlen = 8,
996 }, { /* Two blocks -- for testing encryption across pages */
997 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
998 .klen = 8,
999 .input = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xe7,
1000 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99 },
1001 .ilen = 16,
1002 .result = { 0xc9, 0x57, 0x44, 0x25, 0x6a, 0x5e, 0xd3, 0x1d,
1003 0xf7, 0x9c, 0x89, 0x2a, 0x33, 0x8f, 0x4a, 0x8b },
1004 .rlen = 16,
1005 .np = 2,
1006 .tap = { 8, 8 }
1007 }, { /* Four blocks -- for testing encryption with chunking */
1008 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1009 .klen = 8,
1010 .input = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xe7,
1011 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99,
1012 0xca, 0xfe, 0xba, 0xbe, 0xfe, 0xed, 0xbe, 0xef,
1013 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99 },
1014 .ilen = 32,
1015 .result = { 0xc9, 0x57, 0x44, 0x25, 0x6a, 0x5e, 0xd3, 0x1d,
1016 0xf7, 0x9c, 0x89, 0x2a, 0x33, 0x8f, 0x4a, 0x8b,
1017 0xb4, 0x99, 0x26, 0xf7, 0x1f, 0xe1, 0xd4, 0x90,
1018 0xf7, 0x9c, 0x89, 0x2a, 0x33, 0x8f, 0x4a, 0x8b },
1019 .rlen = 32,
1020 .np = 3,
1021 .tap = { 14, 10, 8 }
1022 }, {
1023 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1024 .klen = 8,
1025 .input = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xe7,
1026 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99,
1027 0xca, 0xfe, 0xba, 0xbe, 0xfe, 0xed, 0xbe, 0xef },
1028 .ilen = 24,
1029 .result = { 0xc9, 0x57, 0x44, 0x25, 0x6a, 0x5e, 0xd3, 0x1d,
1030 0xf7, 0x9c, 0x89, 0x2a, 0x33, 0x8f, 0x4a, 0x8b,
1031 0xb4, 0x99, 0x26, 0xf7, 0x1f, 0xe1, 0xd4, 0x90 },
1032 .rlen = 24,
1033 .np = 4,
1034 .tap = { 2, 1, 3, 18 }
1035 }, {
1036 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1037 .klen = 8,
1038 .input = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xe7,
1039 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99 },
1040 .ilen = 16,
1041 .result = { 0xc9, 0x57, 0x44, 0x25, 0x6a, 0x5e, 0xd3, 0x1d,
1042 0xf7, 0x9c, 0x89, 0x2a, 0x33, 0x8f, 0x4a, 0x8b },
1043 .rlen = 16,
1044 .np = 5,
1045 .tap = { 2, 2, 2, 2, 8 }
1046 }, {
1047 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1048 .klen = 8,
1049 .input = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xe7 },
1050 .ilen = 8,
1051 .result = { 0xc9, 0x57, 0x44, 0x25, 0x6a, 0x5e, 0xd3, 0x1d },
1052 .rlen = 8,
1053 .np = 8,
1054 .tap = { 1, 1, 1, 1, 1, 1, 1, 1 }
1058 static struct cipher_testvec des_dec_tv_template[] = {
1059 { /* From Applied Cryptography */
1060 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1061 .klen = 8,
1062 .input = { 0xc9, 0x57, 0x44, 0x25, 0x6a, 0x5e, 0xd3, 0x1d },
1063 .ilen = 8,
1064 .result = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xe7 },
1065 .rlen = 8,
1066 }, { /* Sbox test from NBS */
1067 .key = { 0x7c, 0xa1, 0x10, 0x45, 0x4a, 0x1a, 0x6e, 0x57 },
1068 .klen = 8,
1069 .input = { 0x69, 0x0f, 0x5b, 0x0d, 0x9a, 0x26, 0x93, 0x9b },
1070 .ilen = 8,
1071 .result = { 0x01, 0xa1, 0xd6, 0xd0, 0x39, 0x77, 0x67, 0x42 },
1072 .rlen = 8,
1073 }, { /* Two blocks, for chunking test */
1074 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1075 .klen = 8,
1076 .input = { 0xc9, 0x57, 0x44, 0x25, 0x6a, 0x5e, 0xd3, 0x1d,
1077 0x69, 0x0f, 0x5b, 0x0d, 0x9a, 0x26, 0x93, 0x9b },
1078 .ilen = 16,
1079 .result = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xe7,
1080 0xa3, 0x99, 0x7b, 0xca, 0xaf, 0x69, 0xa0, 0xf5 },
1081 .rlen = 16,
1082 .np = 2,
1083 .tap = { 8, 8 }
1084 }, {
1085 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1086 .klen = 8,
1087 .input = { 0xc9, 0x57, 0x44, 0x25, 0x6a, 0x5e, 0xd3, 0x1d,
1088 0x69, 0x0f, 0x5b, 0x0d, 0x9a, 0x26, 0x93, 0x9b },
1089 .ilen = 16,
1090 .result = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xe7,
1091 0xa3, 0x99, 0x7b, 0xca, 0xaf, 0x69, 0xa0, 0xf5 },
1092 .rlen = 16,
1093 .np = 3,
1094 .tap = { 3, 12, 1 }
1098 static struct cipher_testvec des_cbc_enc_tv_template[] = {
1099 { /* From OpenSSL */
1100 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef},
1101 .klen = 8,
1102 .iv = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10},
1103 .input = { 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x31, 0x20,
1104 0x4e, 0x6f, 0x77, 0x20, 0x69, 0x73, 0x20, 0x74,
1105 0x68, 0x65, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x20 },
1106 .ilen = 24,
1107 .result = { 0xcc, 0xd1, 0x73, 0xff, 0xab, 0x20, 0x39, 0xf4,
1108 0xac, 0xd8, 0xae, 0xfd, 0xdf, 0xd8, 0xa1, 0xeb,
1109 0x46, 0x8e, 0x91, 0x15, 0x78, 0x88, 0xba, 0x68 },
1110 .rlen = 24,
1111 }, { /* FIPS Pub 81 */
1112 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1113 .klen = 8,
1114 .iv = { 0x12, 0x34, 0x56, 0x78, 0x90, 0xab, 0xcd, 0xef },
1115 .input = { 0x4e, 0x6f, 0x77, 0x20, 0x69, 0x73, 0x20, 0x74 },
1116 .ilen = 8,
1117 .result = { 0xe5, 0xc7, 0xcd, 0xde, 0x87, 0x2b, 0xf2, 0x7c },
1118 .rlen = 8,
1119 }, {
1120 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1121 .klen = 8,
1122 .iv = { 0xe5, 0xc7, 0xcd, 0xde, 0x87, 0x2b, 0xf2, 0x7c },
1123 .input = { 0x68, 0x65, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x20 },
1124 .ilen = 8,
1125 .result = { 0x43, 0xe9, 0x34, 0x00, 0x8c, 0x38, 0x9c, 0x0f },
1126 .rlen = 8,
1127 }, {
1128 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1129 .klen = 8,
1130 .iv = { 0x43, 0xe9, 0x34, 0x00, 0x8c, 0x38, 0x9c, 0x0f },
1131 .input = { 0x66, 0x6f, 0x72, 0x20, 0x61, 0x6c, 0x6c, 0x20 },
1132 .ilen = 8,
1133 .result = { 0x68, 0x37, 0x88, 0x49, 0x9a, 0x7c, 0x05, 0xf6 },
1134 .rlen = 8,
1135 }, { /* Copy of openssl vector for chunk testing */
1136 /* From OpenSSL */
1137 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef},
1138 .klen = 8,
1139 .iv = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10},
1140 .input = { 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x31, 0x20,
1141 0x4e, 0x6f, 0x77, 0x20, 0x69, 0x73, 0x20, 0x74,
1142 0x68, 0x65, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x20 },
1143 .ilen = 24,
1144 .result = { 0xcc, 0xd1, 0x73, 0xff, 0xab, 0x20, 0x39, 0xf4,
1145 0xac, 0xd8, 0xae, 0xfd, 0xdf, 0xd8, 0xa1, 0xeb,
1146 0x46, 0x8e, 0x91, 0x15, 0x78, 0x88, 0xba, 0x68 },
1147 .rlen = 24,
1148 .np = 2,
1149 .tap = { 13, 11 }
1153 static struct cipher_testvec des_cbc_dec_tv_template[] = {
1154 { /* FIPS Pub 81 */
1155 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1156 .klen = 8,
1157 .iv = { 0x12, 0x34, 0x56, 0x78, 0x90, 0xab, 0xcd, 0xef },
1158 .input = { 0xe5, 0xc7, 0xcd, 0xde, 0x87, 0x2b, 0xf2, 0x7c },
1159 .ilen = 8,
1160 .result = { 0x4e, 0x6f, 0x77, 0x20, 0x69, 0x73, 0x20, 0x74 },
1161 .rlen = 8,
1162 }, {
1163 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1164 .klen = 8,
1165 .iv = { 0xe5, 0xc7, 0xcd, 0xde, 0x87, 0x2b, 0xf2, 0x7c },
1166 .input = { 0x43, 0xe9, 0x34, 0x00, 0x8c, 0x38, 0x9c, 0x0f },
1167 .ilen = 8,
1168 .result = { 0x68, 0x65, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x20 },
1169 .rlen = 8,
1170 }, {
1171 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1172 .klen = 8,
1173 .iv = { 0x43, 0xe9, 0x34, 0x00, 0x8c, 0x38, 0x9c, 0x0f },
1174 .input = { 0x68, 0x37, 0x88, 0x49, 0x9a, 0x7c, 0x05, 0xf6 },
1175 .ilen = 8,
1176 .result = { 0x66, 0x6f, 0x72, 0x20, 0x61, 0x6c, 0x6c, 0x20 },
1177 .rlen = 8,
1178 }, { /* Copy of above, for chunk testing */
1179 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1180 .klen = 8,
1181 .iv = { 0x43, 0xe9, 0x34, 0x00, 0x8c, 0x38, 0x9c, 0x0f },
1182 .input = { 0x68, 0x37, 0x88, 0x49, 0x9a, 0x7c, 0x05, 0xf6 },
1183 .ilen = 8,
1184 .result = { 0x66, 0x6f, 0x72, 0x20, 0x61, 0x6c, 0x6c, 0x20 },
1185 .rlen = 8,
1186 .np = 2,
1187 .tap = { 4, 4 }
1192 * We really need some more test vectors, especially for DES3 CBC.
1194 static struct cipher_testvec des3_ede_enc_tv_template[] = {
1195 { /* These are from openssl */
1196 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
1197 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
1198 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10},
1199 .klen = 24,
1200 .input = { 0x73, 0x6f, 0x6d, 0x65, 0x64, 0x61, 0x74, 0x61 },
1201 .ilen = 8,
1202 .result = { 0x18, 0xd7, 0x48, 0xe5, 0x63, 0x62, 0x05, 0x72 },
1203 .rlen = 8,
1204 }, {
1205 .key = { 0x03, 0x52, 0x02, 0x07, 0x67, 0x20, 0x82, 0x17,
1206 0x86, 0x02, 0x87, 0x66, 0x59, 0x08, 0x21, 0x98,
1207 0x64, 0x05, 0x6a, 0xbd, 0xfe, 0xa9, 0x34, 0x57 },
1208 .klen = 24,
1209 .input = { 0x73, 0x71, 0x75, 0x69, 0x67, 0x67, 0x6c, 0x65 },
1210 .ilen = 8,
1211 .result = { 0xc0, 0x7d, 0x2a, 0x0f, 0xa5, 0x66, 0xfa, 0x30 },
1212 .rlen = 8,
1213 }, {
1214 .key = { 0x10, 0x46, 0x10, 0x34, 0x89, 0x98, 0x80, 0x20,
1215 0x91, 0x07, 0xd0, 0x15, 0x89, 0x19, 0x01, 0x01,
1216 0x19, 0x07, 0x92, 0x10, 0x98, 0x1a, 0x01, 0x01 },
1217 .klen = 24,
1218 .input = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
1219 .ilen = 8,
1220 .result = { 0xe1, 0xef, 0x62, 0xc3, 0x32, 0xfe, 0x82, 0x5b },
1221 .rlen = 8,
1225 static struct cipher_testvec des3_ede_dec_tv_template[] = {
1226 { /* These are from openssl */
1227 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
1228 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
1229 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10},
1230 .klen = 24,
1231 .input = { 0x18, 0xd7, 0x48, 0xe5, 0x63, 0x62, 0x05, 0x72 },
1232 .ilen = 8,
1233 .result = { 0x73, 0x6f, 0x6d, 0x65, 0x64, 0x61, 0x74, 0x61 },
1234 .rlen = 8,
1235 }, {
1236 .key = { 0x03, 0x52, 0x02, 0x07, 0x67, 0x20, 0x82, 0x17,
1237 0x86, 0x02, 0x87, 0x66, 0x59, 0x08, 0x21, 0x98,
1238 0x64, 0x05, 0x6a, 0xbd, 0xfe, 0xa9, 0x34, 0x57 },
1239 .klen = 24,
1240 .input = { 0xc0, 0x7d, 0x2a, 0x0f, 0xa5, 0x66, 0xfa, 0x30 },
1241 .ilen = 8,
1242 .result = { 0x73, 0x71, 0x75, 0x69, 0x67, 0x67, 0x6c, 0x65 },
1243 .rlen = 8,
1244 }, {
1245 .key = { 0x10, 0x46, 0x10, 0x34, 0x89, 0x98, 0x80, 0x20,
1246 0x91, 0x07, 0xd0, 0x15, 0x89, 0x19, 0x01, 0x01,
1247 0x19, 0x07, 0x92, 0x10, 0x98, 0x1a, 0x01, 0x01 },
1248 .klen = 24,
1249 .input = { 0xe1, 0xef, 0x62, 0xc3, 0x32, 0xfe, 0x82, 0x5b },
1250 .ilen = 8,
1251 .result = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
1252 .rlen = 8,
1257 * Blowfish test vectors.
1259 #define BF_ENC_TEST_VECTORS 6
1260 #define BF_DEC_TEST_VECTORS 6
1261 #define BF_CBC_ENC_TEST_VECTORS 1
1262 #define BF_CBC_DEC_TEST_VECTORS 1
1264 static struct cipher_testvec bf_enc_tv_template[] = {
1265 { /* DES test vectors from OpenSSL */
1266 .key = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, },
1267 .klen = 8,
1268 .input = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
1269 .ilen = 8,
1270 .result = { 0x4e, 0xf9, 0x97, 0x45, 0x61, 0x98, 0xdd, 0x78 },
1271 .rlen = 8,
1272 }, {
1273 .key = { 0x1f, 0x1f, 0x1f, 0x1f, 0x0e, 0x0e, 0x0e, 0x0e },
1274 .klen = 8,
1275 .input = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1276 .ilen = 8,
1277 .result = { 0xa7, 0x90, 0x79, 0x51, 0x08, 0xea, 0x3c, 0xae },
1278 .rlen = 8,
1279 }, {
1280 .key = { 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87 },
1281 .klen = 8,
1282 .input = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 },
1283 .ilen = 8,
1284 .result = { 0xe8, 0x7a, 0x24, 0x4e, 0x2c, 0xc8, 0x5e, 0x82 },
1285 .rlen = 8,
1286 }, { /* Vary the keylength... */
1287 .key = { 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87,
1288 0x78, 0x69, 0x5a, 0x4b, 0x3c, 0x2d, 0x1e, 0x0f },
1289 .klen = 16,
1290 .input = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 },
1291 .ilen = 8,
1292 .result = { 0x93, 0x14, 0x28, 0x87, 0xee, 0x3b, 0xe1, 0x5c },
1293 .rlen = 8,
1294 }, {
1295 .key = { 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87,
1296 0x78, 0x69, 0x5a, 0x4b, 0x3c, 0x2d, 0x1e, 0x0f,
1297 0x00, 0x11, 0x22, 0x33, 0x44 },
1298 .klen = 21,
1299 .input = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 },
1300 .ilen = 8,
1301 .result = { 0xe6, 0xf5, 0x1e, 0xd7, 0x9b, 0x9d, 0xb2, 0x1f },
1302 .rlen = 8,
1303 }, { /* Generated with bf488 */
1304 .key = { 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87,
1305 0x78, 0x69, 0x5a, 0x4b, 0x3c, 0x2d, 0x1e, 0x0f,
1306 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
1307 0x04, 0x68, 0x91, 0x04, 0xc2, 0xfd, 0x3b, 0x2f,
1308 0x58, 0x40, 0x23, 0x64, 0x1a, 0xba, 0x61, 0x76,
1309 0x1f, 0x1f, 0x1f, 0x1f, 0x0e, 0x0e, 0x0e, 0x0e,
1310 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff },
1311 .klen = 56,
1312 .input = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 },
1313 .ilen = 8,
1314 .result = { 0xc0, 0x45, 0x04, 0x01, 0x2e, 0x4e, 0x1f, 0x53 },
1315 .rlen = 8,
1319 static struct cipher_testvec bf_dec_tv_template[] = {
1320 { /* DES test vectors from OpenSSL */
1321 .key = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
1322 .klen = 8,
1323 .input = { 0x4e, 0xf9, 0x97, 0x45, 0x61, 0x98, 0xdd, 0x78 },
1324 .ilen = 8,
1325 .result = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
1326 .rlen = 8,
1327 }, {
1328 .key = { 0x1f, 0x1f, 0x1f, 0x1f, 0x0e, 0x0e, 0x0e, 0x0e },
1329 .klen = 8,
1330 .input = { 0xa7, 0x90, 0x79, 0x51, 0x08, 0xea, 0x3c, 0xae },
1331 .ilen = 8,
1332 .result = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1333 .rlen = 8,
1334 }, {
1335 .key = { 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87 },
1336 .klen = 8,
1337 .input = { 0xe8, 0x7a, 0x24, 0x4e, 0x2c, 0xc8, 0x5e, 0x82 },
1338 .ilen = 8,
1339 .result = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 },
1340 .rlen = 8,
1341 }, { /* Vary the keylength... */
1342 .key = { 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87,
1343 0x78, 0x69, 0x5a, 0x4b, 0x3c, 0x2d, 0x1e, 0x0f },
1344 .klen = 16,
1345 .input = { 0x93, 0x14, 0x28, 0x87, 0xee, 0x3b, 0xe1, 0x5c },
1346 .ilen = 8,
1347 .result = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 },
1348 .rlen = 8,
1349 }, {
1350 .key = { 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87,
1351 0x78, 0x69, 0x5a, 0x4b, 0x3c, 0x2d, 0x1e, 0x0f,
1352 0x00, 0x11, 0x22, 0x33, 0x44 },
1353 .klen = 21,
1354 .input = { 0xe6, 0xf5, 0x1e, 0xd7, 0x9b, 0x9d, 0xb2, 0x1f },
1355 .ilen = 8,
1356 .result = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 },
1357 .rlen = 8,
1358 }, { /* Generated with bf488, using OpenSSL, Libgcrypt and Nettle */
1359 .key = { 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87,
1360 0x78, 0x69, 0x5a, 0x4b, 0x3c, 0x2d, 0x1e, 0x0f,
1361 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
1362 0x04, 0x68, 0x91, 0x04, 0xc2, 0xfd, 0x3b, 0x2f,
1363 0x58, 0x40, 0x23, 0x64, 0x1a, 0xba, 0x61, 0x76,
1364 0x1f, 0x1f, 0x1f, 0x1f, 0x0e, 0x0e, 0x0e, 0x0e,
1365 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff },
1366 .klen = 56,
1367 .input = { 0xc0, 0x45, 0x04, 0x01, 0x2e, 0x4e, 0x1f, 0x53 },
1368 .ilen = 8,
1369 .result = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 },
1370 .rlen = 8,
1374 static struct cipher_testvec bf_cbc_enc_tv_template[] = {
1375 { /* From OpenSSL */
1376 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
1377 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87 },
1378 .klen = 16,
1379 .iv = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 },
1380 .input = { 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x31, 0x20,
1381 0x4e, 0x6f, 0x77, 0x20, 0x69, 0x73, 0x20, 0x74,
1382 0x68, 0x65, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x20,
1383 0x66, 0x6f, 0x72, 0x20, 0x00, 0x00, 0x00, 0x00 },
1384 .ilen = 32,
1385 .result = { 0x6b, 0x77, 0xb4, 0xd6, 0x30, 0x06, 0xde, 0xe6,
1386 0x05, 0xb1, 0x56, 0xe2, 0x74, 0x03, 0x97, 0x93,
1387 0x58, 0xde, 0xb9, 0xe7, 0x15, 0x46, 0x16, 0xd9,
1388 0x59, 0xf1, 0x65, 0x2b, 0xd5, 0xff, 0x92, 0xcc },
1389 .rlen = 32,
1393 static struct cipher_testvec bf_cbc_dec_tv_template[] = {
1394 { /* From OpenSSL */
1395 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
1396 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87 },
1397 .klen = 16,
1398 .iv = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 },
1399 .input = { 0x6b, 0x77, 0xb4, 0xd6, 0x30, 0x06, 0xde, 0xe6,
1400 0x05, 0xb1, 0x56, 0xe2, 0x74, 0x03, 0x97, 0x93,
1401 0x58, 0xde, 0xb9, 0xe7, 0x15, 0x46, 0x16, 0xd9,
1402 0x59, 0xf1, 0x65, 0x2b, 0xd5, 0xff, 0x92, 0xcc },
1403 .ilen = 32,
1404 .result = { 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x31, 0x20,
1405 0x4e, 0x6f, 0x77, 0x20, 0x69, 0x73, 0x20, 0x74,
1406 0x68, 0x65, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x20,
1407 0x66, 0x6f, 0x72, 0x20, 0x00, 0x00, 0x00, 0x00 },
1408 .rlen = 32,
1413 * Twofish test vectors.
1415 #define TF_ENC_TEST_VECTORS 3
1416 #define TF_DEC_TEST_VECTORS 3
1417 #define TF_CBC_ENC_TEST_VECTORS 4
1418 #define TF_CBC_DEC_TEST_VECTORS 4
1420 static struct cipher_testvec tf_enc_tv_template[] = {
1422 .key = { [0 ... 15] = 0x00 },
1423 .klen = 16,
1424 .input = { [0 ... 15] = 0x00 },
1425 .ilen = 16,
1426 .result = { 0x9f, 0x58, 0x9f, 0x5c, 0xf6, 0x12, 0x2c, 0x32,
1427 0xb6, 0xbf, 0xec, 0x2f, 0x2a, 0xe8, 0xc3, 0x5a },
1428 .rlen = 16,
1429 }, {
1430 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
1431 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10,
1432 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77 },
1433 .klen = 24,
1434 .input = { [0 ... 15] = 0x00 },
1435 .ilen = 16,
1436 .result = { 0xcf, 0xd1, 0xd2, 0xe5, 0xa9, 0xbe, 0x9c, 0xdf,
1437 0x50, 0x1f, 0x13, 0xb8, 0x92, 0xbd, 0x22, 0x48 },
1438 .rlen = 16,
1439 }, {
1440 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
1441 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10,
1442 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
1443 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff },
1444 .klen = 32,
1445 .input = { [0 ... 15] = 0x00 },
1446 .ilen = 16,
1447 .result = { 0x37, 0x52, 0x7b, 0xe0, 0x05, 0x23, 0x34, 0xb8,
1448 0x9f, 0x0c, 0xfc, 0xca, 0xe8, 0x7c, 0xfa, 0x20 },
1449 .rlen = 16,
1453 static struct cipher_testvec tf_dec_tv_template[] = {
1455 .key = { [0 ... 15] = 0x00 },
1456 .klen = 16,
1457 .input = { 0x9f, 0x58, 0x9f, 0x5c, 0xf6, 0x12, 0x2c, 0x32,
1458 0xb6, 0xbf, 0xec, 0x2f, 0x2a, 0xe8, 0xc3, 0x5a },
1459 .ilen = 16,
1460 .result = { [0 ... 15] = 0x00 },
1461 .rlen = 16,
1462 }, {
1463 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
1464 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10,
1465 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77 },
1466 .klen = 24,
1467 .input = { 0xcf, 0xd1, 0xd2, 0xe5, 0xa9, 0xbe, 0x9c, 0xdf,
1468 0x50, 0x1f, 0x13, 0xb8, 0x92, 0xbd, 0x22, 0x48 },
1469 .ilen = 16,
1470 .result = { [0 ... 15] = 0x00 },
1471 .rlen = 16,
1472 }, {
1473 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
1474 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10,
1475 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
1476 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff },
1477 .klen = 32,
1478 .input = { 0x37, 0x52, 0x7b, 0xe0, 0x05, 0x23, 0x34, 0xb8,
1479 0x9f, 0x0c, 0xfc, 0xca, 0xe8, 0x7c, 0xfa, 0x20 },
1480 .ilen = 16,
1481 .result = { [0 ... 15] = 0x00 },
1482 .rlen = 16,
1486 static struct cipher_testvec tf_cbc_enc_tv_template[] = {
1487 { /* Generated with Nettle */
1488 .key = { [0 ... 15] = 0x00 },
1489 .klen = 16,
1490 .iv = { [0 ... 15] = 0x00 },
1491 .input = { [0 ... 15] = 0x00 },
1492 .ilen = 16,
1493 .result = { 0x9f, 0x58, 0x9f, 0x5c, 0xf6, 0x12, 0x2c, 0x32,
1494 0xb6, 0xbf, 0xec, 0x2f, 0x2a, 0xe8, 0xc3, 0x5a },
1495 .rlen = 16,
1496 }, {
1497 .key = { [0 ... 15] = 0x00 },
1498 .klen = 16,
1499 .iv = { 0x9f, 0x58, 0x9f, 0x5c, 0xf6, 0x12, 0x2c, 0x32,
1500 0xb6, 0xbf, 0xec, 0x2f, 0x2a, 0xe8, 0xc3, 0x5a },
1501 .input = { [0 ... 15] = 0x00 },
1502 .ilen = 16,
1503 .result = { 0xd4, 0x91, 0xdb, 0x16, 0xe7, 0xb1, 0xc3, 0x9e,
1504 0x86, 0xcb, 0x08, 0x6b, 0x78, 0x9f, 0x54, 0x19 },
1505 .rlen = 16,
1506 }, {
1507 .key = { [0 ... 15] = 0x00 },
1508 .klen = 16,
1509 .iv = { 0xd4, 0x91, 0xdb, 0x16, 0xe7, 0xb1, 0xc3, 0x9e,
1510 0x86, 0xcb, 0x08, 0x6b, 0x78, 0x9f, 0x54, 0x19 },
1511 .input = { [0 ... 15] = 0x00 },
1512 .ilen = 16,
1513 .result = { 0x05, 0xef, 0x8c, 0x61, 0xa8, 0x11, 0x58, 0x26,
1514 0x34, 0xba, 0x5c, 0xb7, 0x10, 0x6a, 0xa6, 0x41 },
1515 .rlen = 16,
1516 }, {
1517 .key = { [0 ... 15] = 0x00 },
1518 .klen = 16,
1519 .iv = { [0 ... 15] = 0x00 },
1520 .input = { [0 ... 47] = 0x00 },
1521 .ilen = 48,
1522 .result = { 0x9f, 0x58, 0x9f, 0x5c, 0xf6, 0x12, 0x2c, 0x32,
1523 0xb6, 0xbf, 0xec, 0x2f, 0x2a, 0xe8, 0xc3, 0x5a,
1524 0xd4, 0x91, 0xdb, 0x16, 0xe7, 0xb1, 0xc3, 0x9e,
1525 0x86, 0xcb, 0x08, 0x6b, 0x78, 0x9f, 0x54, 0x19,
1526 0x05, 0xef, 0x8c, 0x61, 0xa8, 0x11, 0x58, 0x26,
1527 0x34, 0xba, 0x5c, 0xb7, 0x10, 0x6a, 0xa6, 0x41 },
1528 .rlen = 48,
1532 static struct cipher_testvec tf_cbc_dec_tv_template[] = {
1533 { /* Reverse of the first four above */
1534 .key = { [0 ... 15] = 0x00 },
1535 .klen = 16,
1536 .iv = { [0 ... 15] = 0x00 },
1537 .input = { 0x9f, 0x58, 0x9f, 0x5c, 0xf6, 0x12, 0x2c, 0x32,
1538 0xb6, 0xbf, 0xec, 0x2f, 0x2a, 0xe8, 0xc3, 0x5a },
1539 .ilen = 16,
1540 .result = { [0 ... 15] = 0x00 },
1541 .rlen = 16,
1542 }, {
1543 .key = { [0 ... 15] = 0x00 },
1544 .klen = 16,
1545 .iv = { 0x9f, 0x58, 0x9f, 0x5c, 0xf6, 0x12, 0x2c, 0x32,
1546 0xb6, 0xbf, 0xec, 0x2f, 0x2a, 0xe8, 0xc3, 0x5a },
1547 .input = { 0xd4, 0x91, 0xdb, 0x16, 0xe7, 0xb1, 0xc3, 0x9e,
1548 0x86, 0xcb, 0x08, 0x6b, 0x78, 0x9f, 0x54, 0x19 },
1549 .ilen = 16,
1550 .result = { [0 ... 15] = 0x00 },
1551 .rlen = 16,
1552 }, {
1553 .key = { [0 ... 15] = 0x00 },
1554 .klen = 16,
1555 .iv = { 0xd4, 0x91, 0xdb, 0x16, 0xe7, 0xb1, 0xc3, 0x9e,
1556 0x86, 0xcb, 0x08, 0x6b, 0x78, 0x9f, 0x54, 0x19 },
1557 .input = { 0x05, 0xef, 0x8c, 0x61, 0xa8, 0x11, 0x58, 0x26,
1558 0x34, 0xba, 0x5c, 0xb7, 0x10, 0x6a, 0xa6, 0x41 },
1559 .ilen = 16,
1560 .result = { [0 ... 15] = 0x00 },
1561 .rlen = 16,
1562 }, {
1563 .key = { [0 ... 15] = 0x00 },
1564 .klen = 16,
1565 .iv = { [0 ... 15] = 0x00 },
1566 .input = { 0x9f, 0x58, 0x9f, 0x5c, 0xf6, 0x12, 0x2c, 0x32,
1567 0xb6, 0xbf, 0xec, 0x2f, 0x2a, 0xe8, 0xc3, 0x5a,
1568 0xd4, 0x91, 0xdb, 0x16, 0xe7, 0xb1, 0xc3, 0x9e,
1569 0x86, 0xcb, 0x08, 0x6b, 0x78, 0x9f, 0x54, 0x19,
1570 0x05, 0xef, 0x8c, 0x61, 0xa8, 0x11, 0x58, 0x26,
1571 0x34, 0xba, 0x5c, 0xb7, 0x10, 0x6a, 0xa6, 0x41 },
1572 .ilen = 48,
1573 .result = { [0 ... 47] = 0x00 },
1574 .rlen = 48,
1579 * Serpent test vectors. These are backwards because Serpent writes
1580 * octet sequences in right-to-left mode.
1582 #define SERPENT_ENC_TEST_VECTORS 4
1583 #define SERPENT_DEC_TEST_VECTORS 4
1585 #define TNEPRES_ENC_TEST_VECTORS 4
1586 #define TNEPRES_DEC_TEST_VECTORS 4
1588 static struct cipher_testvec serpent_enc_tv_template[] = {
1590 .input = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1591 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
1592 .ilen = 16,
1593 .result = { 0x12, 0x07, 0xfc, 0xce, 0x9b, 0xd0, 0xd6, 0x47,
1594 0x6a, 0xe9, 0x8f, 0xbe, 0xd1, 0x43, 0xa0, 0xe2 },
1595 .rlen = 16,
1596 }, {
1597 .key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1598 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
1599 .klen = 16,
1600 .input = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1601 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
1602 .ilen = 16,
1603 .result = { 0x4c, 0x7d, 0x8a, 0x32, 0x80, 0x72, 0xa2, 0x2c,
1604 0x82, 0x3e, 0x4a, 0x1f, 0x3a, 0xcd, 0xa1, 0x6d },
1605 .rlen = 16,
1606 }, {
1607 .key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1608 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
1609 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
1610 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f },
1611 .klen = 32,
1612 .input = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1613 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
1614 .ilen = 16,
1615 .result = { 0xde, 0x26, 0x9f, 0xf8, 0x33, 0xe4, 0x32, 0xb8,
1616 0x5b, 0x2e, 0x88, 0xd2, 0x70, 0x1c, 0xe7, 0x5c },
1617 .rlen = 16,
1618 }, {
1619 .key = { [15] = 0x80 },
1620 .klen = 16,
1621 .input = { [0 ... 15] = 0x00 },
1622 .ilen = 16,
1623 .result = { 0xdd, 0xd2, 0x6b, 0x98, 0xa5, 0xff, 0xd8, 0x2c,
1624 0x05, 0x34, 0x5a, 0x9d, 0xad, 0xbf, 0xaf, 0x49},
1625 .rlen = 16,
1629 static struct cipher_testvec tnepres_enc_tv_template[] = {
1630 { /* KeySize=128, PT=0, I=1 */
1631 .input = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1632 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
1633 .key = { 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1634 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
1635 .klen = 16,
1636 .ilen = 16,
1637 .result = { 0x49, 0xaf, 0xbf, 0xad, 0x9d, 0x5a, 0x34, 0x05,
1638 0x2c, 0xd8, 0xff, 0xa5, 0x98, 0x6b, 0xd2, 0xdd },
1639 .rlen = 16,
1640 }, { /* KeySize=192, PT=0, I=1 */
1641 .key = { 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1642 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1643 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
1644 .klen = 24,
1645 .input = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1646 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
1647 .ilen = 16,
1648 .result = { 0xe7, 0x8e, 0x54, 0x02, 0xc7, 0x19, 0x55, 0x68,
1649 0xac, 0x36, 0x78, 0xf7, 0xa3, 0xf6, 0x0c, 0x66 },
1650 .rlen = 16,
1651 }, { /* KeySize=256, PT=0, I=1 */
1652 .key = { 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1653 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1654 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1655 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
1656 .klen = 32,
1657 .input = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1658 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
1659 .ilen = 16,
1660 .result = { 0xab, 0xed, 0x96, 0xe7, 0x66, 0xbf, 0x28, 0xcb,
1661 0xc0, 0xeb, 0xd2, 0x1a, 0x82, 0xef, 0x08, 0x19 },
1662 .rlen = 16,
1663 }, { /* KeySize=256, I=257 */
1664 .key = { 0x1f, 0x1e, 0x1d, 0x1c, 0x1b, 0x1a, 0x19, 0x18,
1665 0x17, 0x16, 0x15, 0x14, 0x13, 0x12, 0x11, 0x10,
1666 0x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x08,
1667 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00 },
1668 .klen = 32,
1669 .input = { 0x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x08,
1670 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00 },
1671 .ilen = 16,
1672 .result = { 0x5c, 0xe7, 0x1c, 0x70, 0xd2, 0x88, 0x2e, 0x5b,
1673 0xb8, 0x32, 0xe4, 0x33, 0xf8, 0x9f, 0x26, 0xde },
1674 .rlen = 16,
1679 static struct cipher_testvec serpent_dec_tv_template[] = {
1681 .input = { 0x12, 0x07, 0xfc, 0xce, 0x9b, 0xd0, 0xd6, 0x47,
1682 0x6a, 0xe9, 0x8f, 0xbe, 0xd1, 0x43, 0xa0, 0xe2 },
1683 .ilen = 16,
1684 .result = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1685 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
1686 .rlen = 16,
1687 }, {
1688 .key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1689 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
1690 .klen = 16,
1691 .input = { 0x4c, 0x7d, 0x8a, 0x32, 0x80, 0x72, 0xa2, 0x2c,
1692 0x82, 0x3e, 0x4a, 0x1f, 0x3a, 0xcd, 0xa1, 0x6d },
1693 .ilen = 16,
1694 .result = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1695 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
1696 .rlen = 16,
1697 }, {
1698 .key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1699 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
1700 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
1701 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f },
1702 .klen = 32,
1703 .input = { 0xde, 0x26, 0x9f, 0xf8, 0x33, 0xe4, 0x32, 0xb8,
1704 0x5b, 0x2e, 0x88, 0xd2, 0x70, 0x1c, 0xe7, 0x5c },
1705 .ilen = 16,
1706 .result = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1707 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
1708 .rlen = 16,
1709 }, {
1710 .key = { [15] = 0x80 },
1711 .klen = 16,
1712 .input = { 0xdd, 0xd2, 0x6b, 0x98, 0xa5, 0xff, 0xd8, 0x2c,
1713 0x05, 0x34, 0x5a, 0x9d, 0xad, 0xbf, 0xaf, 0x49},
1714 .ilen = 16,
1715 .result = { [0 ... 15] = 0x00 },
1716 .rlen = 16,
1720 static struct cipher_testvec tnepres_dec_tv_template[] = {
1722 .input = { 0x41, 0xcc, 0x6b, 0x31, 0x59, 0x31, 0x45, 0x97,
1723 0x6d, 0x6f, 0xbb, 0x38, 0x4b, 0x37, 0x21, 0x28 },
1724 .ilen = 16,
1725 .result = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1726 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
1727 .rlen = 16,
1728 }, {
1729 .key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1730 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
1731 .klen = 16,
1732 .input = { 0xea, 0xf4, 0xd7, 0xfc, 0xd8, 0x01, 0x34, 0x47,
1733 0x81, 0x45, 0x0b, 0xfa, 0x0c, 0xd6, 0xad, 0x6e },
1734 .ilen = 16,
1735 .result = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1736 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
1737 .rlen = 16,
1738 }, {
1739 .key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1740 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
1741 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
1742 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f },
1743 .klen = 32,
1744 .input = { 0x64, 0xa9, 0x1a, 0x37, 0xed, 0x9f, 0xe7, 0x49,
1745 0xa8, 0x4e, 0x76, 0xd6, 0xf5, 0x0d, 0x78, 0xee },
1746 .ilen = 16,
1747 .result = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1748 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
1749 .rlen = 16,
1750 }, { /* KeySize=128, I=121 */
1751 .key = { [15] = 0x80 },
1752 .klen = 16,
1753 .input = { 0x3d, 0xda, 0xbf, 0xc0, 0x06, 0xda, 0xab, 0x06,
1754 0x46, 0x2a, 0xf4, 0xef, 0x81, 0x54, 0x4e, 0x26 },
1755 .ilen = 16,
1756 .result = { [0 ... 15] = 0x00 },
1757 .rlen = 16,
1762 /* Cast6 test vectors from RFC 2612 */
1763 #define CAST6_ENC_TEST_VECTORS 3
1764 #define CAST6_DEC_TEST_VECTORS 3
1766 static struct cipher_testvec cast6_enc_tv_template[] = {
1768 .key = { 0x23, 0x42, 0xbb, 0x9e, 0xfa, 0x38, 0x54, 0x2c,
1769 0x0a, 0xf7, 0x56, 0x47, 0xf2, 0x9f, 0x61, 0x5d },
1770 .klen = 16,
1771 .input = { [0 ... 15] = 0x00 },
1772 .ilen = 16,
1773 .result = { 0xc8, 0x42, 0xa0, 0x89, 0x72, 0xb4, 0x3d, 0x20,
1774 0x83, 0x6c, 0x91, 0xd1, 0xb7, 0x53, 0x0f, 0x6b },
1775 .rlen = 16,
1776 }, {
1777 .key = { 0x23, 0x42, 0xbb, 0x9e, 0xfa, 0x38, 0x54, 0x2c,
1778 0xbe, 0xd0, 0xac, 0x83, 0x94, 0x0a, 0xc2, 0x98,
1779 0xba, 0xc7, 0x7a, 0x77, 0x17, 0x94, 0x28, 0x63 },
1780 .klen = 24,
1781 .input = { [0 ... 15] = 0x00 },
1782 .ilen = 16,
1783 .result = { 0x1b, 0x38, 0x6c, 0x02, 0x10, 0xdc, 0xad, 0xcb,
1784 0xdd, 0x0e, 0x41, 0xaa, 0x08, 0xa7, 0xa7, 0xe8 },
1785 .rlen = 16,
1786 }, {
1787 .key = { 0x23, 0x42, 0xbb, 0x9e, 0xfa, 0x38, 0x54, 0x2c,
1788 0xbe, 0xd0, 0xac, 0x83, 0x94, 0x0a, 0xc2, 0x98,
1789 0x8d, 0x7c, 0x47, 0xce, 0x26, 0x49, 0x08, 0x46,
1790 0x1c, 0xc1, 0xb5, 0x13, 0x7a, 0xe6, 0xb6, 0x04 },
1791 .klen = 32,
1792 .input = { [0 ... 15] = 0x00 },
1793 .ilen = 16,
1794 .result = { 0x4f, 0x6a, 0x20, 0x38, 0x28, 0x68, 0x97, 0xb9,
1795 0xc9, 0x87, 0x01, 0x36, 0x55, 0x33, 0x17, 0xfa },
1796 .rlen = 16,
1800 static struct cipher_testvec cast6_dec_tv_template[] = {
1802 .key = { 0x23, 0x42, 0xbb, 0x9e, 0xfa, 0x38, 0x54, 0x2c,
1803 0x0a, 0xf7, 0x56, 0x47, 0xf2, 0x9f, 0x61, 0x5d },
1804 .klen = 16,
1805 .input = { 0xc8, 0x42, 0xa0, 0x89, 0x72, 0xb4, 0x3d, 0x20,
1806 0x83, 0x6c, 0x91, 0xd1, 0xb7, 0x53, 0x0f, 0x6b },
1807 .ilen = 16,
1808 .result = { [0 ... 15] = 0x00 },
1809 .rlen = 16,
1810 }, {
1811 .key = { 0x23, 0x42, 0xbb, 0x9e, 0xfa, 0x38, 0x54, 0x2c,
1812 0xbe, 0xd0, 0xac, 0x83, 0x94, 0x0a, 0xc2, 0x98,
1813 0xba, 0xc7, 0x7a, 0x77, 0x17, 0x94, 0x28, 0x63 },
1814 .klen = 24,
1815 .input = { 0x1b, 0x38, 0x6c, 0x02, 0x10, 0xdc, 0xad, 0xcb,
1816 0xdd, 0x0e, 0x41, 0xaa, 0x08, 0xa7, 0xa7, 0xe8 },
1817 .ilen = 16,
1818 .result = { [0 ... 15] = 0x00 },
1819 .rlen = 16,
1820 }, {
1821 .key = { 0x23, 0x42, 0xbb, 0x9e, 0xfa, 0x38, 0x54, 0x2c,
1822 0xbe, 0xd0, 0xac, 0x83, 0x94, 0x0a, 0xc2, 0x98,
1823 0x8d, 0x7c, 0x47, 0xce, 0x26, 0x49, 0x08, 0x46,
1824 0x1c, 0xc1, 0xb5, 0x13, 0x7a, 0xe6, 0xb6, 0x04 },
1825 .klen = 32,
1826 .input = { 0x4f, 0x6a, 0x20, 0x38, 0x28, 0x68, 0x97, 0xb9,
1827 0xc9, 0x87, 0x01, 0x36, 0x55, 0x33, 0x17, 0xfa },
1828 .ilen = 16,
1829 .result = { [0 ... 15] = 0x00 },
1830 .rlen = 16,
1836 * AES test vectors.
1838 #define AES_ENC_TEST_VECTORS 3
1839 #define AES_DEC_TEST_VECTORS 3
1840 #define AES_CBC_ENC_TEST_VECTORS 2
1841 #define AES_CBC_DEC_TEST_VECTORS 2
1843 static struct cipher_testvec aes_enc_tv_template[] = {
1844 { /* From FIPS-197 */
1845 .key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1846 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
1847 .klen = 16,
1848 .input = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
1849 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff },
1850 .ilen = 16,
1851 .result = { 0x69, 0xc4, 0xe0, 0xd8, 0x6a, 0x7b, 0x04, 0x30,
1852 0xd8, 0xcd, 0xb7, 0x80, 0x70, 0xb4, 0xc5, 0x5a },
1853 .rlen = 16,
1854 }, {
1855 .key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1856 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
1857 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17 },
1858 .klen = 24,
1859 .input = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
1860 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff },
1861 .ilen = 16,
1862 .result = { 0xdd, 0xa9, 0x7c, 0xa4, 0x86, 0x4c, 0xdf, 0xe0,
1863 0x6e, 0xaf, 0x70, 0xa0, 0xec, 0x0d, 0x71, 0x91 },
1864 .rlen = 16,
1865 }, {
1866 .key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1867 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
1868 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
1869 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f },
1870 .klen = 32,
1871 .input = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
1872 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff },
1873 .ilen = 16,
1874 .result = { 0x8e, 0xa2, 0xb7, 0xca, 0x51, 0x67, 0x45, 0xbf,
1875 0xea, 0xfc, 0x49, 0x90, 0x4b, 0x49, 0x60, 0x89 },
1876 .rlen = 16,
1880 static struct cipher_testvec aes_dec_tv_template[] = {
1881 { /* From FIPS-197 */
1882 .key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1883 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
1884 .klen = 16,
1885 .input = { 0x69, 0xc4, 0xe0, 0xd8, 0x6a, 0x7b, 0x04, 0x30,
1886 0xd8, 0xcd, 0xb7, 0x80, 0x70, 0xb4, 0xc5, 0x5a },
1887 .ilen = 16,
1888 .result = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
1889 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff },
1890 .rlen = 16,
1891 }, {
1892 .key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1893 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
1894 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17 },
1895 .klen = 24,
1896 .input = { 0xdd, 0xa9, 0x7c, 0xa4, 0x86, 0x4c, 0xdf, 0xe0,
1897 0x6e, 0xaf, 0x70, 0xa0, 0xec, 0x0d, 0x71, 0x91 },
1898 .ilen = 16,
1899 .result = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
1900 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff },
1901 .rlen = 16,
1902 }, {
1903 .key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1904 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
1905 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
1906 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f },
1907 .klen = 32,
1908 .input = { 0x8e, 0xa2, 0xb7, 0xca, 0x51, 0x67, 0x45, 0xbf,
1909 0xea, 0xfc, 0x49, 0x90, 0x4b, 0x49, 0x60, 0x89 },
1910 .ilen = 16,
1911 .result = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
1912 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff },
1913 .rlen = 16,
1917 static struct cipher_testvec aes_cbc_enc_tv_template[] = {
1918 { /* From RFC 3602 */
1919 .key = { 0x06, 0xa9, 0x21, 0x40, 0x36, 0xb8, 0xa1, 0x5b,
1920 0x51, 0x2e, 0x03, 0xd5, 0x34, 0x12, 0x00, 0x06 },
1921 .klen = 16,
1922 .iv = { 0x3d, 0xaf, 0xba, 0x42, 0x9d, 0x9e, 0xb4, 0x30,
1923 0xb4, 0x22, 0xda, 0x80, 0x2c, 0x9f, 0xac, 0x41 },
1924 .input = { "Single block msg" },
1925 .ilen = 16,
1926 .result = { 0xe3, 0x53, 0x77, 0x9c, 0x10, 0x79, 0xae, 0xb8,
1927 0x27, 0x08, 0x94, 0x2d, 0xbe, 0x77, 0x18, 0x1a },
1928 .rlen = 16,
1929 }, {
1930 .key = { 0xc2, 0x86, 0x69, 0x6d, 0x88, 0x7c, 0x9a, 0xa0,
1931 0x61, 0x1b, 0xbb, 0x3e, 0x20, 0x25, 0xa4, 0x5a },
1932 .klen = 16,
1933 .iv = { 0x56, 0x2e, 0x17, 0x99, 0x6d, 0x09, 0x3d, 0x28,
1934 0xdd, 0xb3, 0xba, 0x69, 0x5a, 0x2e, 0x6f, 0x58 },
1935 .input = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1936 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
1937 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
1938 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f },
1939 .ilen = 32,
1940 .result = { 0xd2, 0x96, 0xcd, 0x94, 0xc2, 0xcc, 0xcf, 0x8a,
1941 0x3a, 0x86, 0x30, 0x28, 0xb5, 0xe1, 0xdc, 0x0a,
1942 0x75, 0x86, 0x60, 0x2d, 0x25, 0x3c, 0xff, 0xf9,
1943 0x1b, 0x82, 0x66, 0xbe, 0xa6, 0xd6, 0x1a, 0xb1 },
1944 .rlen = 32,
1948 static struct cipher_testvec aes_cbc_dec_tv_template[] = {
1949 { /* From RFC 3602 */
1950 .key = { 0x06, 0xa9, 0x21, 0x40, 0x36, 0xb8, 0xa1, 0x5b,
1951 0x51, 0x2e, 0x03, 0xd5, 0x34, 0x12, 0x00, 0x06 },
1952 .klen = 16,
1953 .iv = { 0x3d, 0xaf, 0xba, 0x42, 0x9d, 0x9e, 0xb4, 0x30,
1954 0xb4, 0x22, 0xda, 0x80, 0x2c, 0x9f, 0xac, 0x41 },
1955 .input = { 0xe3, 0x53, 0x77, 0x9c, 0x10, 0x79, 0xae, 0xb8,
1956 0x27, 0x08, 0x94, 0x2d, 0xbe, 0x77, 0x18, 0x1a },
1957 .ilen = 16,
1958 .result = { "Single block msg" },
1959 .rlen = 16,
1960 }, {
1961 .key = { 0xc2, 0x86, 0x69, 0x6d, 0x88, 0x7c, 0x9a, 0xa0,
1962 0x61, 0x1b, 0xbb, 0x3e, 0x20, 0x25, 0xa4, 0x5a },
1963 .klen = 16,
1964 .iv = { 0x56, 0x2e, 0x17, 0x99, 0x6d, 0x09, 0x3d, 0x28,
1965 0xdd, 0xb3, 0xba, 0x69, 0x5a, 0x2e, 0x6f, 0x58 },
1966 .input = { 0xd2, 0x96, 0xcd, 0x94, 0xc2, 0xcc, 0xcf, 0x8a,
1967 0x3a, 0x86, 0x30, 0x28, 0xb5, 0xe1, 0xdc, 0x0a,
1968 0x75, 0x86, 0x60, 0x2d, 0x25, 0x3c, 0xff, 0xf9,
1969 0x1b, 0x82, 0x66, 0xbe, 0xa6, 0xd6, 0x1a, 0xb1 },
1970 .ilen = 32,
1971 .result = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1972 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
1973 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
1974 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f },
1975 .rlen = 32,
1979 /* Cast5 test vectors from RFC 2144 */
1980 #define CAST5_ENC_TEST_VECTORS 3
1981 #define CAST5_DEC_TEST_VECTORS 3
1983 static struct cipher_testvec cast5_enc_tv_template[] = {
1985 .key = { 0x01, 0x23, 0x45, 0x67, 0x12, 0x34, 0x56, 0x78,
1986 0x23, 0x45, 0x67, 0x89, 0x34, 0x56, 0x78, 0x9a },
1987 .klen = 16,
1988 .input = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1989 .ilen = 8,
1990 .result = { 0x23, 0x8b, 0x4f, 0xe5, 0x84, 0x7e, 0x44, 0xb2 },
1991 .rlen = 8,
1992 }, {
1993 .key = { 0x01, 0x23, 0x45, 0x67, 0x12, 0x34, 0x56, 0x78,
1994 0x23, 0x45 },
1995 .klen = 10,
1996 .input = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1997 .ilen = 8,
1998 .result = { 0xeb, 0x6a, 0x71, 0x1a, 0x2c, 0x02, 0x27, 0x1b },
1999 .rlen = 8,
2000 }, {
2001 .key = { 0x01, 0x23, 0x45, 0x67, 0x12 },
2002 .klen = 5,
2003 .input = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
2004 .ilen = 8,
2005 .result = { 0x7a, 0xc8, 0x16, 0xd1, 0x6e, 0x9b, 0x30, 0x2e },
2006 .rlen = 8,
2010 static struct cipher_testvec cast5_dec_tv_template[] = {
2012 .key = { 0x01, 0x23, 0x45, 0x67, 0x12, 0x34, 0x56, 0x78,
2013 0x23, 0x45, 0x67, 0x89, 0x34, 0x56, 0x78, 0x9a },
2014 .klen = 16,
2015 .input = { 0x23, 0x8b, 0x4f, 0xe5, 0x84, 0x7e, 0x44, 0xb2 },
2016 .ilen = 8,
2017 .result = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
2018 .rlen = 8,
2019 }, {
2020 .key = { 0x01, 0x23, 0x45, 0x67, 0x12, 0x34, 0x56, 0x78,
2021 0x23, 0x45 },
2022 .klen = 10,
2023 .input = { 0xeb, 0x6a, 0x71, 0x1a, 0x2c, 0x02, 0x27, 0x1b },
2024 .ilen = 8,
2025 .result = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
2026 .rlen = 8,
2027 }, {
2028 .key = { 0x01, 0x23, 0x45, 0x67, 0x12 },
2029 .klen = 5,
2030 .input = { 0x7a, 0xc8, 0x16, 0xd1, 0x6e, 0x9b, 0x30, 0x2e },
2031 .ilen = 8,
2032 .result = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
2033 .rlen = 8,
2038 * ARC4 test vectors from OpenSSL
2040 #define ARC4_ENC_TEST_VECTORS 7
2041 #define ARC4_DEC_TEST_VECTORS 7
2043 static struct cipher_testvec arc4_enc_tv_template[] = {
2045 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
2046 .klen = 8,
2047 .input = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
2048 .ilen = 8,
2049 .result = { 0x75, 0xb7, 0x87, 0x80, 0x99, 0xe0, 0xc5, 0x96 },
2050 .rlen = 8,
2051 }, {
2052 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
2053 .klen = 8,
2054 .input = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
2055 .ilen = 8,
2056 .result = { 0x74, 0x94, 0xc2, 0xe7, 0x10, 0x4b, 0x08, 0x79 },
2057 .rlen = 8,
2058 }, {
2059 .key = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
2060 .klen = 8,
2061 .input = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
2062 .ilen = 8,
2063 .result = { 0xde, 0x18, 0x89, 0x41, 0xa3, 0x37, 0x5d, 0x3a },
2064 .rlen = 8,
2065 }, {
2066 .key = { 0xef, 0x01, 0x23, 0x45},
2067 .klen = 4,
2068 .input = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2069 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2070 0x00, 0x00, 0x00, 0x00 },
2071 .ilen = 20,
2072 .result = { 0xd6, 0xa1, 0x41, 0xa7, 0xec, 0x3c, 0x38, 0xdf,
2073 0xbd, 0x61, 0x5a, 0x11, 0x62, 0xe1, 0xc7, 0xba,
2074 0x36, 0xb6, 0x78, 0x58 },
2075 .rlen = 20,
2076 }, {
2077 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
2078 .klen = 8,
2079 .input = { 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0,
2080 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0,
2081 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0,
2082 0x12, 0x34, 0x56, 0x78 },
2083 .ilen = 28,
2084 .result = { 0x66, 0xa0, 0x94, 0x9f, 0x8a, 0xf7, 0xd6, 0x89,
2085 0x1f, 0x7f, 0x83, 0x2b, 0xa8, 0x33, 0xc0, 0x0c,
2086 0x89, 0x2e, 0xbe, 0x30, 0x14, 0x3c, 0xe2, 0x87,
2087 0x40, 0x01, 0x1e, 0xcf },
2088 .rlen = 28,
2089 }, {
2090 .key = { 0xef, 0x01, 0x23, 0x45 },
2091 .klen = 4,
2092 .input = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2093 0x00, 0x00 },
2094 .ilen = 10,
2095 .result = { 0xd6, 0xa1, 0x41, 0xa7, 0xec, 0x3c, 0x38, 0xdf,
2096 0xbd, 0x61 },
2097 .rlen = 10,
2098 }, {
2099 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF,
2100 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
2101 .klen = 16,
2102 .input = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF },
2103 .ilen = 8,
2104 .result = { 0x69, 0x72, 0x36, 0x59, 0x1B, 0x52, 0x42, 0xB1 },
2105 .rlen = 8,
2109 static struct cipher_testvec arc4_dec_tv_template[] = {
2111 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
2112 .klen = 8,
2113 .input = { 0x75, 0xb7, 0x87, 0x80, 0x99, 0xe0, 0xc5, 0x96 },
2114 .ilen = 8,
2115 .result = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
2116 .rlen = 8,
2117 }, {
2118 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
2119 .klen = 8,
2120 .input = { 0x74, 0x94, 0xc2, 0xe7, 0x10, 0x4b, 0x08, 0x79 },
2121 .ilen = 8,
2122 .result = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
2123 .rlen = 8,
2124 }, {
2125 .key = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
2126 .klen = 8,
2127 .input = { 0xde, 0x18, 0x89, 0x41, 0xa3, 0x37, 0x5d, 0x3a },
2128 .ilen = 8,
2129 .result = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
2130 .rlen = 8,
2131 }, {
2132 .key = { 0xef, 0x01, 0x23, 0x45},
2133 .klen = 4,
2134 .input = { 0xd6, 0xa1, 0x41, 0xa7, 0xec, 0x3c, 0x38, 0xdf,
2135 0xbd, 0x61, 0x5a, 0x11, 0x62, 0xe1, 0xc7, 0xba,
2136 0x36, 0xb6, 0x78, 0x58 },
2137 .ilen = 20,
2138 .result = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2139 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2140 0x00, 0x00, 0x00, 0x00 },
2141 .rlen = 20,
2142 }, {
2143 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
2144 .klen = 8,
2145 .input = { 0x66, 0xa0, 0x94, 0x9f, 0x8a, 0xf7, 0xd6, 0x89,
2146 0x1f, 0x7f, 0x83, 0x2b, 0xa8, 0x33, 0xc0, 0x0c,
2147 0x89, 0x2e, 0xbe, 0x30, 0x14, 0x3c, 0xe2, 0x87,
2148 0x40, 0x01, 0x1e, 0xcf },
2149 .ilen = 28,
2150 .result = { 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0,
2151 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0,
2152 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0,
2153 0x12, 0x34, 0x56, 0x78 },
2154 .rlen = 28,
2155 }, {
2156 .key = { 0xef, 0x01, 0x23, 0x45 },
2157 .klen = 4,
2158 .input = { 0xd6, 0xa1, 0x41, 0xa7, 0xec, 0x3c, 0x38, 0xdf,
2159 0xbd, 0x61 },
2160 .ilen = 10,
2161 .result = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2162 0x00, 0x00 },
2163 .rlen = 10,
2164 }, {
2165 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF,
2166 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
2167 .klen = 16,
2168 .input = { 0x69, 0x72, 0x36, 0x59, 0x1B, 0x52, 0x42, 0xB1 },
2169 .ilen = 8,
2170 .result = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF },
2171 .rlen = 8,
2176 * TEA test vectors
2178 #define TEA_ENC_TEST_VECTORS 4
2179 #define TEA_DEC_TEST_VECTORS 4
2181 static struct cipher_testvec tea_enc_tv_template[] = {
2183 .key = { [0 ... 15] = 0x00 },
2184 .klen = 16,
2185 .input = { [0 ... 8] = 0x00 },
2186 .ilen = 8,
2187 .result = { 0x0a, 0x3a, 0xea, 0x41, 0x40, 0xa9, 0xba, 0x94 },
2188 .rlen = 8,
2189 }, {
2190 .key = { 0x2b, 0x02, 0x05, 0x68, 0x06, 0x14, 0x49, 0x76,
2191 0x77, 0x5d, 0x0e, 0x26, 0x6c, 0x28, 0x78, 0x43 },
2192 .klen = 16,
2193 .input = { 0x74, 0x65, 0x73, 0x74, 0x20, 0x6d, 0x65, 0x2e },
2194 .ilen = 8,
2195 .result = { 0x77, 0x5d, 0x2a, 0x6a, 0xf6, 0xce, 0x92, 0x09 },
2196 .rlen = 8,
2197 }, {
2198 .key = { 0x09, 0x65, 0x43, 0x11, 0x66, 0x44, 0x39, 0x25,
2199 0x51, 0x3a, 0x16, 0x10, 0x0a, 0x08, 0x12, 0x6e },
2200 .klen = 16,
2201 .input = { 0x6c, 0x6f, 0x6e, 0x67, 0x65, 0x72, 0x5f, 0x74,
2202 0x65, 0x73, 0x74, 0x5f, 0x76, 0x65, 0x63, 0x74 },
2203 .ilen = 16,
2204 .result = { 0xbe, 0x7a, 0xbb, 0x81, 0x95, 0x2d, 0x1f, 0x1e,
2205 0xdd, 0x89, 0xa1, 0x25, 0x04, 0x21, 0xdf, 0x95 },
2206 .rlen = 16,
2207 }, {
2208 .key = { 0x4d, 0x76, 0x32, 0x17, 0x05, 0x3f, 0x75, 0x2c,
2209 0x5d, 0x04, 0x16, 0x36, 0x15, 0x72, 0x63, 0x2f },
2210 .klen = 16,
2211 .input = { 0x54, 0x65, 0x61, 0x20, 0x69, 0x73, 0x20, 0x67,
2212 0x6f, 0x6f, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20,
2213 0x79, 0x6f, 0x75, 0x21, 0x21, 0x21, 0x20, 0x72,
2214 0x65, 0x61, 0x6c, 0x6c, 0x79, 0x21, 0x21, 0x21 },
2215 .ilen = 32,
2216 .result = { 0xe0, 0x4d, 0x5d, 0x3c, 0xb7, 0x8c, 0x36, 0x47,
2217 0x94, 0x18, 0x95, 0x91, 0xa9, 0xfc, 0x49, 0xf8,
2218 0x44, 0xd1, 0x2d, 0xc2, 0x99, 0xb8, 0x08, 0x2a,
2219 0x07, 0x89, 0x73, 0xc2, 0x45, 0x92, 0xc6, 0x90 },
2220 .rlen = 32,
2224 static struct cipher_testvec tea_dec_tv_template[] = {
2226 .key = { [0 ... 15] = 0x00 },
2227 .klen = 16,
2228 .input = { 0x0a, 0x3a, 0xea, 0x41, 0x40, 0xa9, 0xba, 0x94 },
2229 .ilen = 8,
2230 .result = { [0 ... 8] = 0x00 },
2231 .rlen = 8,
2232 }, {
2233 .key = { 0x2b, 0x02, 0x05, 0x68, 0x06, 0x14, 0x49, 0x76,
2234 0x77, 0x5d, 0x0e, 0x26, 0x6c, 0x28, 0x78, 0x43 },
2235 .klen = 16,
2236 .input = { 0x77, 0x5d, 0x2a, 0x6a, 0xf6, 0xce, 0x92, 0x09 },
2237 .ilen = 8,
2238 .result = { 0x74, 0x65, 0x73, 0x74, 0x20, 0x6d, 0x65, 0x2e },
2239 .rlen = 8,
2240 }, {
2241 .key = { 0x09, 0x65, 0x43, 0x11, 0x66, 0x44, 0x39, 0x25,
2242 0x51, 0x3a, 0x16, 0x10, 0x0a, 0x08, 0x12, 0x6e },
2243 .klen = 16,
2244 .input = { 0xbe, 0x7a, 0xbb, 0x81, 0x95, 0x2d, 0x1f, 0x1e,
2245 0xdd, 0x89, 0xa1, 0x25, 0x04, 0x21, 0xdf, 0x95 },
2246 .ilen = 16,
2247 .result = { 0x6c, 0x6f, 0x6e, 0x67, 0x65, 0x72, 0x5f, 0x74,
2248 0x65, 0x73, 0x74, 0x5f, 0x76, 0x65, 0x63, 0x74 },
2249 .rlen = 16,
2250 }, {
2251 .key = { 0x4d, 0x76, 0x32, 0x17, 0x05, 0x3f, 0x75, 0x2c,
2252 0x5d, 0x04, 0x16, 0x36, 0x15, 0x72, 0x63, 0x2f },
2253 .klen = 16,
2254 .input = { 0xe0, 0x4d, 0x5d, 0x3c, 0xb7, 0x8c, 0x36, 0x47,
2255 0x94, 0x18, 0x95, 0x91, 0xa9, 0xfc, 0x49, 0xf8,
2256 0x44, 0xd1, 0x2d, 0xc2, 0x99, 0xb8, 0x08, 0x2a,
2257 0x07, 0x89, 0x73, 0xc2, 0x45, 0x92, 0xc6, 0x90 },
2258 .ilen = 32,
2259 .result = { 0x54, 0x65, 0x61, 0x20, 0x69, 0x73, 0x20, 0x67,
2260 0x6f, 0x6f, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20,
2261 0x79, 0x6f, 0x75, 0x21, 0x21, 0x21, 0x20, 0x72,
2262 0x65, 0x61, 0x6c, 0x6c, 0x79, 0x21, 0x21, 0x21 },
2263 .rlen = 32,
2268 * XTEA test vectors
2270 #define XTEA_ENC_TEST_VECTORS 4
2271 #define XTEA_DEC_TEST_VECTORS 4
2273 static struct cipher_testvec xtea_enc_tv_template[] = {
2275 .key = { [0 ... 15] = 0x00 },
2276 .klen = 16,
2277 .input = { [0 ... 8] = 0x00 },
2278 .ilen = 8,
2279 .result = { 0xd8, 0xd4, 0xe9, 0xde, 0xd9, 0x1e, 0x13, 0xf7 },
2280 .rlen = 8,
2281 }, {
2282 .key = { 0x2b, 0x02, 0x05, 0x68, 0x06, 0x14, 0x49, 0x76,
2283 0x77, 0x5d, 0x0e, 0x26, 0x6c, 0x28, 0x78, 0x43 },
2284 .klen = 16,
2285 .input = { 0x74, 0x65, 0x73, 0x74, 0x20, 0x6d, 0x65, 0x2e },
2286 .ilen = 8,
2287 .result = { 0x94, 0xeb, 0xc8, 0x96, 0x84, 0x6a, 0x49, 0xa8 },
2288 .rlen = 8,
2289 }, {
2290 .key = { 0x09, 0x65, 0x43, 0x11, 0x66, 0x44, 0x39, 0x25,
2291 0x51, 0x3a, 0x16, 0x10, 0x0a, 0x08, 0x12, 0x6e },
2292 .klen = 16,
2293 .input = { 0x3e, 0xce, 0xae, 0x22, 0x60, 0x56, 0xa8, 0x9d,
2294 0x65, 0x73, 0x74, 0x5f, 0x76, 0x65, 0x63, 0x74 },
2295 .ilen = 16,
2296 .result = { 0xe2, 0x04, 0xdb, 0xf2, 0x89, 0x85, 0x9e, 0xea,
2297 0x61, 0x35, 0xaa, 0xed, 0xb5, 0xcb, 0x71, 0x2c },
2298 .rlen = 16,
2299 }, {
2300 .key = { 0x4d, 0x76, 0x32, 0x17, 0x05, 0x3f, 0x75, 0x2c,
2301 0x5d, 0x04, 0x16, 0x36, 0x15, 0x72, 0x63, 0x2f },
2302 .klen = 16,
2303 .input = { 0x54, 0x65, 0x61, 0x20, 0x69, 0x73, 0x20, 0x67,
2304 0x6f, 0x6f, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20,
2305 0x79, 0x6f, 0x75, 0x21, 0x21, 0x21, 0x20, 0x72,
2306 0x65, 0x61, 0x6c, 0x6c, 0x79, 0x21, 0x21, 0x21 },
2307 .ilen = 32,
2308 .result = { 0x99, 0x81, 0x9f, 0x5d, 0x6f, 0x4b, 0x31, 0x3a,
2309 0x86, 0xff, 0x6f, 0xd0, 0xe3, 0x87, 0x70, 0x07,
2310 0x4d, 0xb8, 0xcf, 0xf3, 0x99, 0x50, 0xb3, 0xd4,
2311 0x73, 0xa2, 0xfa, 0xc9, 0x16, 0x59, 0x5d, 0x81 },
2312 .rlen = 32,
2316 static struct cipher_testvec xtea_dec_tv_template[] = {
2318 .key = { [0 ... 15] = 0x00 },
2319 .klen = 16,
2320 .input = { 0xd8, 0xd4, 0xe9, 0xde, 0xd9, 0x1e, 0x13, 0xf7 },
2321 .ilen = 8,
2322 .result = { [0 ... 8] = 0x00 },
2323 .rlen = 8,
2324 }, {
2325 .key = { 0x2b, 0x02, 0x05, 0x68, 0x06, 0x14, 0x49, 0x76,
2326 0x77, 0x5d, 0x0e, 0x26, 0x6c, 0x28, 0x78, 0x43 },
2327 .klen = 16,
2328 .input = { 0x94, 0xeb, 0xc8, 0x96, 0x84, 0x6a, 0x49, 0xa8 },
2329 .ilen = 8,
2330 .result = { 0x74, 0x65, 0x73, 0x74, 0x20, 0x6d, 0x65, 0x2e },
2331 .rlen = 8,
2332 }, {
2333 .key = { 0x09, 0x65, 0x43, 0x11, 0x66, 0x44, 0x39, 0x25,
2334 0x51, 0x3a, 0x16, 0x10, 0x0a, 0x08, 0x12, 0x6e },
2335 .klen = 16,
2336 .input = { 0x3e, 0xce, 0xae, 0x22, 0x60, 0x56, 0xa8, 0x9d,
2337 0x77, 0x4d, 0xd4, 0xb4, 0x87, 0x24, 0xe3, 0x9a },
2338 .ilen = 16,
2339 .result = { 0x6c, 0x6f, 0x6e, 0x67, 0x65, 0x72, 0x5f, 0x74,
2340 0x65, 0x73, 0x74, 0x5f, 0x76, 0x65, 0x63, 0x74 },
2341 .rlen = 16,
2342 }, {
2343 .key = { 0x4d, 0x76, 0x32, 0x17, 0x05, 0x3f, 0x75, 0x2c,
2344 0x5d, 0x04, 0x16, 0x36, 0x15, 0x72, 0x63, 0x2f },
2345 .klen = 16,
2346 .input = { 0x99, 0x81, 0x9f, 0x5d, 0x6f, 0x4b, 0x31, 0x3a,
2347 0x86, 0xff, 0x6f, 0xd0, 0xe3, 0x87, 0x70, 0x07,
2348 0x4d, 0xb8, 0xcf, 0xf3, 0x99, 0x50, 0xb3, 0xd4,
2349 0x73, 0xa2, 0xfa, 0xc9, 0x16, 0x59, 0x5d, 0x81 },
2350 .ilen = 32,
2351 .result = { 0x54, 0x65, 0x61, 0x20, 0x69, 0x73, 0x20, 0x67,
2352 0x6f, 0x6f, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20,
2353 0x79, 0x6f, 0x75, 0x21, 0x21, 0x21, 0x20, 0x72,
2354 0x65, 0x61, 0x6c, 0x6c, 0x79, 0x21, 0x21, 0x21 },
2355 .rlen = 32,
2360 * KHAZAD test vectors.
2362 #define KHAZAD_ENC_TEST_VECTORS 5
2363 #define KHAZAD_DEC_TEST_VECTORS 5
2365 static struct cipher_testvec khazad_enc_tv_template[] = {
2367 .key = { 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2368 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
2369 .klen = 16,
2370 .input = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
2371 .ilen = 8,
2372 .result = { 0x49, 0xa4, 0xce, 0x32, 0xac, 0x19, 0x0e, 0x3f },
2373 .rlen = 8,
2374 }, {
2375 .key = { 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38,
2376 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38 },
2377 .klen = 16,
2378 .input = { 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38 },
2379 .ilen = 8,
2380 .result = { 0x7e, 0x82, 0x12, 0xa1, 0Xd9, 0X5b, 0Xe4, 0Xf9 },
2381 .rlen = 8,
2382 }, {
2383 .key = { 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2,
2384 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2 },
2385 .klen = 16,
2386 .input = { 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2 },
2387 .ilen = 8,
2388 .result = { 0Xaa, 0Xbe, 0Xc1, 0X95, 0Xc5, 0X94, 0X1a, 0X9c },
2389 .rlen = 8,
2390 }, {
2391 .key = { 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f,
2392 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f },
2393 .klen = 16,
2394 .input = { 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f },
2395 .ilen = 8,
2396 .result = { 0X04, 0X74, 0Xf5, 0X70, 0X50, 0X16, 0Xd3, 0Xb8 },
2397 .rlen = 8,
2398 }, {
2399 .key = { 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f,
2400 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f },
2401 .klen = 16,
2402 .input = { 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f ,
2403 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f },
2404 .ilen = 16,
2405 .result = { 0X04, 0X74, 0Xf5, 0X70, 0X50, 0X16, 0Xd3, 0Xb8 ,
2406 0X04, 0X74, 0Xf5, 0X70, 0X50, 0X16, 0Xd3, 0Xb8 },
2407 .rlen = 16,
2411 static struct cipher_testvec khazad_dec_tv_template[] = {
2413 .key = { 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2414 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
2415 .klen = 16,
2416 .input = { 0X49, 0Xa4, 0Xce, 0X32, 0Xac, 0X19, 0X0e, 0X3f },
2417 .ilen = 8,
2418 .result = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
2419 .rlen = 8,
2420 }, {
2421 .key = { 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38,
2422 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38 },
2423 .klen = 16,
2424 .input = { 0X7e, 0X82, 0X12, 0Xa1, 0Xd9, 0X5b, 0Xe4, 0Xf9 },
2425 .ilen = 8,
2426 .result = { 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38 },
2427 .rlen = 8,
2428 }, {
2429 .key = { 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2,
2430 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2 },
2431 .klen = 16,
2432 .input = { 0Xaa, 0Xbe, 0Xc1, 0X95, 0Xc5, 0X94, 0X1a, 0X9c },
2433 .ilen = 8,
2434 .result = { 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2 },
2435 .rlen = 8,
2436 }, {
2437 .key = { 0x2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f,
2438 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f },
2439 .klen = 16,
2440 .input = { 0X04, 0X74, 0Xf5, 0X70, 0X50, 0X16, 0Xd3, 0Xb8 },
2441 .ilen = 8,
2442 .result = { 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f },
2443 .rlen = 8,
2444 }, {
2445 .key = { 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f,
2446 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f },
2447 .klen = 16,
2448 .input = { 0X04, 0X74, 0Xf5, 0X70, 0X50, 0X16, 0Xd3, 0Xb8 ,
2449 0X04, 0X74, 0Xf5, 0X70, 0X50, 0X16, 0Xd3, 0Xb8 },
2450 .ilen = 16,
2451 .result = { 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f ,
2452 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f },
2453 .rlen = 16,
2458 * Anubis test vectors.
2461 #define ANUBIS_ENC_TEST_VECTORS 5
2462 #define ANUBIS_DEC_TEST_VECTORS 5
2463 #define ANUBIS_CBC_ENC_TEST_VECTORS 2
2464 #define ANUBIS_CBC_DEC_TEST_VECTORS 2
2466 static struct cipher_testvec anubis_enc_tv_template[] = {
2468 .key = { 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe,
2469 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe },
2470 .klen = 16,
2471 .input = { 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe,
2472 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe },
2473 .ilen = 16,
2474 .result = { 0x6d, 0xc5, 0xda, 0xa2, 0x26, 0x7d, 0x62, 0x6f,
2475 0x08, 0xb7, 0x52, 0x8e, 0x6e, 0x6e, 0x86, 0x90 },
2476 .rlen = 16,
2477 }, {
2479 .key = { 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
2480 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
2481 0x03, 0x03, 0x03, 0x03 },
2482 .klen = 20,
2483 .input = { 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
2484 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03 },
2485 .ilen = 16,
2486 .result = { 0xdb, 0xf1, 0x42, 0xf4, 0xd1, 0x8a, 0xc7, 0x49,
2487 0x87, 0x41, 0x6f, 0x82, 0x0a, 0x98, 0x64, 0xae },
2488 .rlen = 16,
2489 }, {
2490 .key = { 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24,
2491 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24,
2492 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24,
2493 0x24, 0x24, 0x24, 0x24 },
2494 .klen = 28,
2495 .input = { 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24,
2496 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24 },
2497 .ilen = 16,
2498 .result = { 0xfd, 0x1b, 0x4a, 0xe3, 0xbf, 0xf0, 0xad, 0x3d,
2499 0x06, 0xd3, 0x61, 0x27, 0xfd, 0x13, 0x9e, 0xde },
2500 .rlen = 16,
2501 }, {
2502 .key = { 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25,
2503 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25,
2504 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25,
2505 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25 },
2506 .klen = 32,
2507 .input = { 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25,
2508 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25 },
2509 .ilen = 16,
2510 .result = { 0x1a, 0x91, 0xfb, 0x2b, 0xb7, 0x78, 0x6b, 0xc4,
2511 0x17, 0xd9, 0xff, 0x40, 0x3b, 0x0e, 0xe5, 0xfe },
2512 .rlen = 16,
2513 }, {
2514 .key = { 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
2515 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
2516 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
2517 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
2518 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35 },
2519 .klen = 40,
2520 .input = { 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
2521 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35 },
2522 .ilen = 16,
2523 .result = { 0xa5, 0x2c, 0x85, 0x6f, 0x9c, 0xba, 0xa0, 0x97,
2524 0x9e, 0xc6, 0x84, 0x0f, 0x17, 0x21, 0x07, 0xee },
2525 .rlen = 16,
2529 static struct cipher_testvec anubis_dec_tv_template[] = {
2531 .key = { 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe,
2532 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe },
2533 .klen = 16,
2534 .input = { 0x6d, 0xc5, 0xda, 0xa2, 0x26, 0x7d, 0x62, 0x6f,
2535 0x08, 0xb7, 0x52, 0x8e, 0x6e, 0x6e, 0x86, 0x90 },
2536 .ilen = 16,
2537 .result = { 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe,
2538 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe },
2539 .rlen = 16,
2540 }, {
2542 .key = { 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
2543 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
2544 0x03, 0x03, 0x03, 0x03 },
2545 .klen = 20,
2546 .input = { 0xdb, 0xf1, 0x42, 0xf4, 0xd1, 0x8a, 0xc7, 0x49,
2547 0x87, 0x41, 0x6f, 0x82, 0x0a, 0x98, 0x64, 0xae },
2548 .ilen = 16,
2549 .result = { 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
2550 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03 },
2551 .rlen = 16,
2552 }, {
2553 .key = { 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24,
2554 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24,
2555 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24,
2556 0x24, 0x24, 0x24, 0x24 },
2557 .klen = 28,
2558 .input = { 0xfd, 0x1b, 0x4a, 0xe3, 0xbf, 0xf0, 0xad, 0x3d,
2559 0x06, 0xd3, 0x61, 0x27, 0xfd, 0x13, 0x9e, 0xde },
2560 .ilen = 16,
2561 .result = { 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24,
2562 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24 },
2563 .rlen = 16,
2564 }, {
2565 .key = { 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25,
2566 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25,
2567 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25,
2568 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25 },
2569 .klen = 32,
2570 .input = { 0x1a, 0x91, 0xfb, 0x2b, 0xb7, 0x78, 0x6b, 0xc4,
2571 0x17, 0xd9, 0xff, 0x40, 0x3b, 0x0e, 0xe5, 0xfe },
2572 .ilen = 16,
2573 .result = { 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25,
2574 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25 },
2575 .rlen = 16,
2576 }, {
2577 .key = { 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
2578 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
2579 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
2580 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
2581 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35 },
2582 .input = { 0xa5, 0x2c, 0x85, 0x6f, 0x9c, 0xba, 0xa0, 0x97,
2583 0x9e, 0xc6, 0x84, 0x0f, 0x17, 0x21, 0x07, 0xee },
2584 .klen = 40,
2585 .ilen = 16,
2586 .result = { 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
2587 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35 },
2588 .rlen = 16,
2592 static struct cipher_testvec anubis_cbc_enc_tv_template[] = {
2594 .key = { 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe,
2595 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe },
2596 .klen = 16,
2597 .input = { 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe,
2598 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe,
2599 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe,
2600 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe },
2601 .ilen = 32,
2602 .result = { 0x6d, 0xc5, 0xda, 0xa2, 0x26, 0x7d, 0x62, 0x6f,
2603 0x08, 0xb7, 0x52, 0x8e, 0x6e, 0x6e, 0x86, 0x90,
2604 0x86, 0xd8, 0xb5, 0x6f, 0x98, 0x5e, 0x8a, 0x66,
2605 0x4f, 0x1f, 0x78, 0xa1, 0xbb, 0x37, 0xf1, 0xbe },
2606 .rlen = 32,
2607 }, {
2608 .key = { 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
2609 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
2610 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
2611 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
2612 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35 },
2613 .klen = 40,
2614 .input = { 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
2615 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
2616 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
2617 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35 },
2618 .ilen = 32,
2619 .result = { 0xa5, 0x2c, 0x85, 0x6f, 0x9c, 0xba, 0xa0, 0x97,
2620 0x9e, 0xc6, 0x84, 0x0f, 0x17, 0x21, 0x07, 0xee,
2621 0xa2, 0xbc, 0x06, 0x98, 0xc6, 0x4b, 0xda, 0x75,
2622 0x2e, 0xaa, 0xbe, 0x58, 0xce, 0x01, 0x5b, 0xc7 },
2623 .rlen = 32,
2627 static struct cipher_testvec anubis_cbc_dec_tv_template[] = {
2629 .key = { 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe,
2630 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe },
2631 .klen = 16,
2632 .input = { 0x6d, 0xc5, 0xda, 0xa2, 0x26, 0x7d, 0x62, 0x6f,
2633 0x08, 0xb7, 0x52, 0x8e, 0x6e, 0x6e, 0x86, 0x90,
2634 0x86, 0xd8, 0xb5, 0x6f, 0x98, 0x5e, 0x8a, 0x66,
2635 0x4f, 0x1f, 0x78, 0xa1, 0xbb, 0x37, 0xf1, 0xbe },
2636 .ilen = 32,
2637 .result = { 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe,
2638 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe,
2639 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe,
2640 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe },
2641 .rlen = 32,
2642 }, {
2643 .key = { 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
2644 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
2645 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
2646 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
2647 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35 },
2648 .klen = 40,
2649 .input = { 0xa5, 0x2c, 0x85, 0x6f, 0x9c, 0xba, 0xa0, 0x97,
2650 0x9e, 0xc6, 0x84, 0x0f, 0x17, 0x21, 0x07, 0xee,
2651 0xa2, 0xbc, 0x06, 0x98, 0xc6, 0x4b, 0xda, 0x75,
2652 0x2e, 0xaa, 0xbe, 0x58, 0xce, 0x01, 0x5b, 0xc7 },
2653 .ilen = 32,
2654 .result = { 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
2655 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
2656 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
2657 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35 },
2658 .rlen = 32,
2663 * XETA test vectors
2665 #define XETA_ENC_TEST_VECTORS 4
2666 #define XETA_DEC_TEST_VECTORS 4
2668 static struct cipher_testvec xeta_enc_tv_template[] = {
2670 .key = { [0 ... 15] = 0x00 },
2671 .klen = 16,
2672 .input = { [0 ... 8] = 0x00 },
2673 .ilen = 8,
2674 .result = { 0xaa, 0x22, 0x96, 0xe5, 0x6c, 0x61, 0xf3, 0x45 },
2675 .rlen = 8,
2676 }, {
2677 .key = { 0x2b, 0x02, 0x05, 0x68, 0x06, 0x14, 0x49, 0x76,
2678 0x77, 0x5d, 0x0e, 0x26, 0x6c, 0x28, 0x78, 0x43 },
2679 .klen = 16,
2680 .input = { 0x74, 0x65, 0x73, 0x74, 0x20, 0x6d, 0x65, 0x2e },
2681 .ilen = 8,
2682 .result = { 0x82, 0x3e, 0xeb, 0x35, 0xdc, 0xdd, 0xd9, 0xc3 },
2683 .rlen = 8,
2684 }, {
2685 .key = { 0x09, 0x65, 0x43, 0x11, 0x66, 0x44, 0x39, 0x25,
2686 0x51, 0x3a, 0x16, 0x10, 0x0a, 0x08, 0x12, 0x6e },
2687 .klen = 16,
2688 .input = { 0x6c, 0x6f, 0x6e, 0x67, 0x65, 0x72, 0x5f, 0x74,
2689 0x65, 0x73, 0x74, 0x5f, 0x76, 0x65, 0x63, 0x74 },
2690 .ilen = 16,
2691 .result = { 0xe2, 0x04, 0xdb, 0xf2, 0x89, 0x85, 0x9e, 0xea,
2692 0x61, 0x35, 0xaa, 0xed, 0xb5, 0xcb, 0x71, 0x2c },
2693 .rlen = 16,
2694 }, {
2695 .key = { 0x4d, 0x76, 0x32, 0x17, 0x05, 0x3f, 0x75, 0x2c,
2696 0x5d, 0x04, 0x16, 0x36, 0x15, 0x72, 0x63, 0x2f },
2697 .klen = 16,
2698 .input = { 0x54, 0x65, 0x61, 0x20, 0x69, 0x73, 0x20, 0x67,
2699 0x6f, 0x6f, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20,
2700 0x79, 0x6f, 0x75, 0x21, 0x21, 0x21, 0x20, 0x72,
2701 0x65, 0x61, 0x6c, 0x6c, 0x79, 0x21, 0x21, 0x21 },
2702 .ilen = 32,
2703 .result = { 0x0b, 0x03, 0xcd, 0x8a, 0xbe, 0x95, 0xfd, 0xb1,
2704 0xc1, 0x44, 0x91, 0x0b, 0xa5, 0xc9, 0x1b, 0xb4,
2705 0xa9, 0xda, 0x1e, 0x9e, 0xb1, 0x3e, 0x2a, 0x8f,
2706 0xea, 0xa5, 0x6a, 0x85, 0xd1, 0xf4, 0xa8, 0xa5 },
2707 .rlen = 32,
2711 static struct cipher_testvec xeta_dec_tv_template[] = {
2713 .key = { [0 ... 15] = 0x00 },
2714 .klen = 16,
2715 .input = { 0xaa, 0x22, 0x96, 0xe5, 0x6c, 0x61, 0xf3, 0x45 },
2716 .ilen = 8,
2717 .result = { [0 ... 8] = 0x00 },
2718 .rlen = 8,
2719 }, {
2720 .key = { 0x2b, 0x02, 0x05, 0x68, 0x06, 0x14, 0x49, 0x76,
2721 0x77, 0x5d, 0x0e, 0x26, 0x6c, 0x28, 0x78, 0x43 },
2722 .klen = 16,
2723 .input = { 0x82, 0x3e, 0xeb, 0x35, 0xdc, 0xdd, 0xd9, 0xc3 },
2724 .ilen = 8,
2725 .result = { 0x74, 0x65, 0x73, 0x74, 0x20, 0x6d, 0x65, 0x2e },
2726 .rlen = 8,
2727 }, {
2728 .key = { 0x09, 0x65, 0x43, 0x11, 0x66, 0x44, 0x39, 0x25,
2729 0x51, 0x3a, 0x16, 0x10, 0x0a, 0x08, 0x12, 0x6e },
2730 .klen = 16,
2731 .input = { 0xe2, 0x04, 0xdb, 0xf2, 0x89, 0x85, 0x9e, 0xea,
2732 0x61, 0x35, 0xaa, 0xed, 0xb5, 0xcb, 0x71, 0x2c },
2733 .ilen = 16,
2734 .result = { 0x6c, 0x6f, 0x6e, 0x67, 0x65, 0x72, 0x5f, 0x74,
2735 0x65, 0x73, 0x74, 0x5f, 0x76, 0x65, 0x63, 0x74 },
2736 .rlen = 16,
2737 }, {
2738 .key = { 0x4d, 0x76, 0x32, 0x17, 0x05, 0x3f, 0x75, 0x2c,
2739 0x5d, 0x04, 0x16, 0x36, 0x15, 0x72, 0x63, 0x2f },
2740 .klen = 16,
2741 .input = { 0x0b, 0x03, 0xcd, 0x8a, 0xbe, 0x95, 0xfd, 0xb1,
2742 0xc1, 0x44, 0x91, 0x0b, 0xa5, 0xc9, 0x1b, 0xb4,
2743 0xa9, 0xda, 0x1e, 0x9e, 0xb1, 0x3e, 0x2a, 0x8f,
2744 0xea, 0xa5, 0x6a, 0x85, 0xd1, 0xf4, 0xa8, 0xa5 },
2745 .ilen = 32,
2746 .result = { 0x54, 0x65, 0x61, 0x20, 0x69, 0x73, 0x20, 0x67,
2747 0x6f, 0x6f, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20,
2748 0x79, 0x6f, 0x75, 0x21, 0x21, 0x21, 0x20, 0x72,
2749 0x65, 0x61, 0x6c, 0x6c, 0x79, 0x21, 0x21, 0x21 },
2750 .rlen = 32,
2755 * Compression stuff.
2757 #define COMP_BUF_SIZE 512
2759 struct comp_testvec {
2760 int inlen, outlen;
2761 char input[COMP_BUF_SIZE];
2762 char output[COMP_BUF_SIZE];
2766 * Deflate test vectors (null-terminated strings).
2767 * Params: winbits=11, Z_DEFAULT_COMPRESSION, MAX_MEM_LEVEL.
2769 #define DEFLATE_COMP_TEST_VECTORS 2
2770 #define DEFLATE_DECOMP_TEST_VECTORS 2
2772 static struct comp_testvec deflate_comp_tv_template[] = {
2774 .inlen = 70,
2775 .outlen = 38,
2776 .input = "Join us now and share the software "
2777 "Join us now and share the software ",
2778 .output = { 0xf3, 0xca, 0xcf, 0xcc, 0x53, 0x28, 0x2d, 0x56,
2779 0xc8, 0xcb, 0x2f, 0x57, 0x48, 0xcc, 0x4b, 0x51,
2780 0x28, 0xce, 0x48, 0x2c, 0x4a, 0x55, 0x28, 0xc9,
2781 0x48, 0x55, 0x28, 0xce, 0x4f, 0x2b, 0x29, 0x07,
2782 0x71, 0xbc, 0x08, 0x2b, 0x01, 0x00 },
2783 }, {
2784 .inlen = 191,
2785 .outlen = 122,
2786 .input = "This document describes a compression method based on the DEFLATE"
2787 "compression algorithm. This document defines the application of "
2788 "the DEFLATE algorithm to the IP Payload Compression Protocol.",
2789 .output = { 0x5d, 0x8d, 0x31, 0x0e, 0xc2, 0x30, 0x10, 0x04,
2790 0xbf, 0xb2, 0x2f, 0xc8, 0x1f, 0x10, 0x04, 0x09,
2791 0x89, 0xc2, 0x85, 0x3f, 0x70, 0xb1, 0x2f, 0xf8,
2792 0x24, 0xdb, 0x67, 0xd9, 0x47, 0xc1, 0xef, 0x49,
2793 0x68, 0x12, 0x51, 0xae, 0x76, 0x67, 0xd6, 0x27,
2794 0x19, 0x88, 0x1a, 0xde, 0x85, 0xab, 0x21, 0xf2,
2795 0x08, 0x5d, 0x16, 0x1e, 0x20, 0x04, 0x2d, 0xad,
2796 0xf3, 0x18, 0xa2, 0x15, 0x85, 0x2d, 0x69, 0xc4,
2797 0x42, 0x83, 0x23, 0xb6, 0x6c, 0x89, 0x71, 0x9b,
2798 0xef, 0xcf, 0x8b, 0x9f, 0xcf, 0x33, 0xca, 0x2f,
2799 0xed, 0x62, 0xa9, 0x4c, 0x80, 0xff, 0x13, 0xaf,
2800 0x52, 0x37, 0xed, 0x0e, 0x52, 0x6b, 0x59, 0x02,
2801 0xd9, 0x4e, 0xe8, 0x7a, 0x76, 0x1d, 0x02, 0x98,
2802 0xfe, 0x8a, 0x87, 0x83, 0xa3, 0x4f, 0x56, 0x8a,
2803 0xb8, 0x9e, 0x8e, 0x5c, 0x57, 0xd3, 0xa0, 0x79,
2804 0xfa, 0x02 },
2808 static struct comp_testvec deflate_decomp_tv_template[] = {
2810 .inlen = 122,
2811 .outlen = 191,
2812 .input = { 0x5d, 0x8d, 0x31, 0x0e, 0xc2, 0x30, 0x10, 0x04,
2813 0xbf, 0xb2, 0x2f, 0xc8, 0x1f, 0x10, 0x04, 0x09,
2814 0x89, 0xc2, 0x85, 0x3f, 0x70, 0xb1, 0x2f, 0xf8,
2815 0x24, 0xdb, 0x67, 0xd9, 0x47, 0xc1, 0xef, 0x49,
2816 0x68, 0x12, 0x51, 0xae, 0x76, 0x67, 0xd6, 0x27,
2817 0x19, 0x88, 0x1a, 0xde, 0x85, 0xab, 0x21, 0xf2,
2818 0x08, 0x5d, 0x16, 0x1e, 0x20, 0x04, 0x2d, 0xad,
2819 0xf3, 0x18, 0xa2, 0x15, 0x85, 0x2d, 0x69, 0xc4,
2820 0x42, 0x83, 0x23, 0xb6, 0x6c, 0x89, 0x71, 0x9b,
2821 0xef, 0xcf, 0x8b, 0x9f, 0xcf, 0x33, 0xca, 0x2f,
2822 0xed, 0x62, 0xa9, 0x4c, 0x80, 0xff, 0x13, 0xaf,
2823 0x52, 0x37, 0xed, 0x0e, 0x52, 0x6b, 0x59, 0x02,
2824 0xd9, 0x4e, 0xe8, 0x7a, 0x76, 0x1d, 0x02, 0x98,
2825 0xfe, 0x8a, 0x87, 0x83, 0xa3, 0x4f, 0x56, 0x8a,
2826 0xb8, 0x9e, 0x8e, 0x5c, 0x57, 0xd3, 0xa0, 0x79,
2827 0xfa, 0x02 },
2828 .output = "This document describes a compression method based on the DEFLATE"
2829 "compression algorithm. This document defines the application of "
2830 "the DEFLATE algorithm to the IP Payload Compression Protocol.",
2831 }, {
2832 .inlen = 38,
2833 .outlen = 70,
2834 .input = { 0xf3, 0xca, 0xcf, 0xcc, 0x53, 0x28, 0x2d, 0x56,
2835 0xc8, 0xcb, 0x2f, 0x57, 0x48, 0xcc, 0x4b, 0x51,
2836 0x28, 0xce, 0x48, 0x2c, 0x4a, 0x55, 0x28, 0xc9,
2837 0x48, 0x55, 0x28, 0xce, 0x4f, 0x2b, 0x29, 0x07,
2838 0x71, 0xbc, 0x08, 0x2b, 0x01, 0x00 },
2839 .output = "Join us now and share the software "
2840 "Join us now and share the software ",
2845 * Michael MIC test vectors from IEEE 802.11i
2847 #define MICHAEL_MIC_TEST_VECTORS 6
2849 static struct hash_testvec michael_mic_tv_template[] = {
2851 .key = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
2852 .ksize = 8,
2853 .plaintext = { },
2854 .psize = 0,
2855 .digest = { 0x82, 0x92, 0x5c, 0x1c, 0xa1, 0xd1, 0x30, 0xb8 }
2858 .key = { 0x82, 0x92, 0x5c, 0x1c, 0xa1, 0xd1, 0x30, 0xb8 },
2859 .ksize = 8,
2860 .plaintext = { 'M' },
2861 .psize = 1,
2862 .digest = { 0x43, 0x47, 0x21, 0xca, 0x40, 0x63, 0x9b, 0x3f }
2865 .key = { 0x43, 0x47, 0x21, 0xca, 0x40, 0x63, 0x9b, 0x3f },
2866 .ksize = 8,
2867 .plaintext = { 'M', 'i' },
2868 .psize = 2,
2869 .digest = { 0xe8, 0xf9, 0xbe, 0xca, 0xe9, 0x7e, 0x5d, 0x29 }
2872 .key = { 0xe8, 0xf9, 0xbe, 0xca, 0xe9, 0x7e, 0x5d, 0x29 },
2873 .ksize = 8,
2874 .plaintext = { 'M', 'i', 'c' },
2875 .psize = 3,
2876 .digest = { 0x90, 0x03, 0x8f, 0xc6, 0xcf, 0x13, 0xc1, 0xdb }
2879 .key = { 0x90, 0x03, 0x8f, 0xc6, 0xcf, 0x13, 0xc1, 0xdb },
2880 .ksize = 8,
2881 .plaintext = { 'M', 'i', 'c', 'h' },
2882 .psize = 4,
2883 .digest = { 0xd5, 0x5e, 0x10, 0x05, 0x10, 0x12, 0x89, 0x86 }
2886 .key = { 0xd5, 0x5e, 0x10, 0x05, 0x10, 0x12, 0x89, 0x86 },
2887 .ksize = 8,
2888 .plaintext = { 'M', 'i', 'c', 'h', 'a', 'e', 'l' },
2889 .psize = 7,
2890 .digest = { 0x0a, 0x94, 0x2b, 0x12, 0x4e, 0xca, 0xa5, 0x46 },
2895 * Cipher speed tests
2897 static struct cipher_speed aes_speed_template[] = {
2898 { .klen = 16, .blen = 16, },
2899 { .klen = 16, .blen = 64, },
2900 { .klen = 16, .blen = 256, },
2901 { .klen = 16, .blen = 1024, },
2902 { .klen = 16, .blen = 8192, },
2903 { .klen = 24, .blen = 16, },
2904 { .klen = 24, .blen = 64, },
2905 { .klen = 24, .blen = 256, },
2906 { .klen = 24, .blen = 1024, },
2907 { .klen = 24, .blen = 8192, },
2908 { .klen = 32, .blen = 16, },
2909 { .klen = 32, .blen = 64, },
2910 { .klen = 32, .blen = 256, },
2911 { .klen = 32, .blen = 1024, },
2912 { .klen = 32, .blen = 8192, },
2914 /* End marker */
2915 { .klen = 0, .blen = 0, }
2918 static struct cipher_speed des3_ede_speed_template[] = {
2919 { .klen = 24, .blen = 16, },
2920 { .klen = 24, .blen = 64, },
2921 { .klen = 24, .blen = 256, },
2922 { .klen = 24, .blen = 1024, },
2923 { .klen = 24, .blen = 8192, },
2925 /* End marker */
2926 { .klen = 0, .blen = 0, }
2929 static struct cipher_speed twofish_speed_template[] = {
2930 { .klen = 16, .blen = 16, },
2931 { .klen = 16, .blen = 64, },
2932 { .klen = 16, .blen = 256, },
2933 { .klen = 16, .blen = 1024, },
2934 { .klen = 16, .blen = 8192, },
2935 { .klen = 24, .blen = 16, },
2936 { .klen = 24, .blen = 64, },
2937 { .klen = 24, .blen = 256, },
2938 { .klen = 24, .blen = 1024, },
2939 { .klen = 24, .blen = 8192, },
2940 { .klen = 32, .blen = 16, },
2941 { .klen = 32, .blen = 64, },
2942 { .klen = 32, .blen = 256, },
2943 { .klen = 32, .blen = 1024, },
2944 { .klen = 32, .blen = 8192, },
2946 /* End marker */
2947 { .klen = 0, .blen = 0, }
2950 static struct cipher_speed blowfish_speed_template[] = {
2951 /* Don't support blowfish keys > 256 bit in this test */
2952 { .klen = 8, .blen = 16, },
2953 { .klen = 8, .blen = 64, },
2954 { .klen = 8, .blen = 256, },
2955 { .klen = 8, .blen = 1024, },
2956 { .klen = 8, .blen = 8192, },
2957 { .klen = 32, .blen = 16, },
2958 { .klen = 32, .blen = 64, },
2959 { .klen = 32, .blen = 256, },
2960 { .klen = 32, .blen = 1024, },
2961 { .klen = 32, .blen = 8192, },
2963 /* End marker */
2964 { .klen = 0, .blen = 0, }
2967 static struct cipher_speed des_speed_template[] = {
2968 { .klen = 8, .blen = 16, },
2969 { .klen = 8, .blen = 64, },
2970 { .klen = 8, .blen = 256, },
2971 { .klen = 8, .blen = 1024, },
2972 { .klen = 8, .blen = 8192, },
2974 /* End marker */
2975 { .klen = 0, .blen = 0, }
2978 #endif /* _CRYPTO_TCRYPT_H */