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)
15 * 2006-12-07 Added SHA384 HMAC and SHA512 HMAC tests
16 * 2004-08-09 Cipher speed tests by Reyk Floeter <reyk@vantronix.net>
17 * 2003-09-14 Changes by Kartikey Mahendra Bhatt
20 #ifndef _CRYPTO_TCRYPT_H
21 #define _CRYPTO_TCRYPT_H
23 #define MAX_DIGEST_SIZE 64
30 /* only used with keyed hash algorithms */
31 char key
[132] __attribute__ ((__aligned__(4)));
33 char digest
[MAX_DIGEST_SIZE
];
34 unsigned char tap
[MAX_TAP
];
40 struct cipher_testvec
{
41 char key
[MAX_KEYLEN
] __attribute__ ((__aligned__(4)));
45 unsigned char tap
[MAX_TAP
];
48 unsigned char wk
; /* weak key flag */
60 unsigned int blen
; /* buffer length */
61 unsigned int plen
; /* per-update length */
65 * MD4 test vectors from RFC1320
67 #define MD4_TEST_VECTORS 7
69 static struct hash_testvec md4_tv_template
[] = {
72 .digest
= { 0x31, 0xd6, 0xcf, 0xe0, 0xd1, 0x6a, 0xe9, 0x31,
73 0xb7, 0x3c, 0x59, 0xd7, 0xe0, 0xc0, 0x89, 0xc0 },
77 .digest
= { 0xbd, 0xe5, 0x2c, 0xb3, 0x1d, 0xe3, 0x3e, 0x46,
78 0x24, 0x5e, 0x05, 0xfb, 0xdb, 0xd6, 0xfb, 0x24 },
82 .digest
= { 0xa4, 0x48, 0x01, 0x7a, 0xaf, 0x21, 0xd8, 0x52,
83 0x5f, 0xc1, 0x0a, 0xe8, 0x7a, 0xa6, 0x72, 0x9d },
85 .plaintext
= "message digest",
87 .digest
= { 0xd9, 0x13, 0x0a, 0x81, 0x64, 0x54, 0x9f, 0xe8,
88 0x18, 0x87, 0x48, 0x06, 0xe1, 0xc7, 0x01, 0x4b },
90 .plaintext
= "abcdefghijklmnopqrstuvwxyz",
92 .digest
= { 0xd7, 0x9e, 0x1c, 0x30, 0x8a, 0xa5, 0xbb, 0xcd,
93 0xee, 0xa8, 0xed, 0x63, 0xdf, 0x41, 0x2d, 0xa9 },
97 .plaintext
= "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
99 .digest
= { 0x04, 0x3f, 0x85, 0x82, 0xf2, 0x41, 0xdb, 0x35,
100 0x1c, 0xe6, 0x27, 0xe1, 0x53, 0xe7, 0xf0, 0xe4 },
102 .plaintext
= "123456789012345678901234567890123456789012345678901234567890123"
105 .digest
= { 0xe3, 0x3b, 0x4d, 0xdc, 0x9c, 0x38, 0xf2, 0x19,
106 0x9c, 0x3e, 0x7b, 0x16, 0x4f, 0xcc, 0x05, 0x36 },
111 * MD5 test vectors from RFC1321
113 #define MD5_TEST_VECTORS 7
115 static struct hash_testvec md5_tv_template
[] = {
117 .digest
= { 0xd4, 0x1d, 0x8c, 0xd9, 0x8f, 0x00, 0xb2, 0x04,
118 0xe9, 0x80, 0x09, 0x98, 0xec, 0xf8, 0x42, 0x7e },
122 .digest
= { 0x0c, 0xc1, 0x75, 0xb9, 0xc0, 0xf1, 0xb6, 0xa8,
123 0x31, 0xc3, 0x99, 0xe2, 0x69, 0x77, 0x26, 0x61 },
127 .digest
= { 0x90, 0x01, 0x50, 0x98, 0x3c, 0xd2, 0x4f, 0xb0,
128 0xd6, 0x96, 0x3f, 0x7d, 0x28, 0xe1, 0x7f, 0x72 },
130 .plaintext
= "message digest",
132 .digest
= { 0xf9, 0x6b, 0x69, 0x7d, 0x7c, 0xb7, 0x93, 0x8d,
133 0x52, 0x5a, 0x2f, 0x31, 0xaa, 0xf1, 0x61, 0xd0 },
135 .plaintext
= "abcdefghijklmnopqrstuvwxyz",
137 .digest
= { 0xc3, 0xfc, 0xd3, 0xd7, 0x61, 0x92, 0xe4, 0x00,
138 0x7d, 0xfb, 0x49, 0x6c, 0xca, 0x67, 0xe1, 0x3b },
142 .plaintext
= "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
144 .digest
= { 0xd1, 0x74, 0xab, 0x98, 0xd2, 0x77, 0xd9, 0xf5,
145 0xa5, 0x61, 0x1c, 0x2c, 0x9f, 0x41, 0x9d, 0x9f },
147 .plaintext
= "12345678901234567890123456789012345678901234567890123456789012"
148 "345678901234567890",
150 .digest
= { 0x57, 0xed, 0xf4, 0xa2, 0x2b, 0xe3, 0xc9, 0x55,
151 0xac, 0x49, 0xda, 0x2e, 0x21, 0x07, 0xb6, 0x7a },
156 * SHA1 test vectors from from FIPS PUB 180-1
158 #define SHA1_TEST_VECTORS 2
160 static struct hash_testvec sha1_tv_template
[] = {
164 .digest
= { 0xa9, 0x99, 0x3e, 0x36, 0x47, 0x06, 0x81, 0x6a, 0xba, 0x3e,
165 0x25, 0x71, 0x78, 0x50, 0xc2, 0x6c, 0x9c, 0xd0, 0xd8, 0x9d },
167 .plaintext
= "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
169 .digest
= { 0x84, 0x98, 0x3e, 0x44, 0x1c, 0x3b, 0xd2, 0x6e, 0xba, 0xae,
170 0x4a, 0xa1, 0xf9, 0x51, 0x29, 0xe5, 0xe5, 0x46, 0x70, 0xf1 },
177 * SHA256 test vectors from from NIST
179 #define SHA256_TEST_VECTORS 2
181 static struct hash_testvec sha256_tv_template
[] = {
185 .digest
= { 0xba, 0x78, 0x16, 0xbf, 0x8f, 0x01, 0xcf, 0xea,
186 0x41, 0x41, 0x40, 0xde, 0x5d, 0xae, 0x22, 0x23,
187 0xb0, 0x03, 0x61, 0xa3, 0x96, 0x17, 0x7a, 0x9c,
188 0xb4, 0x10, 0xff, 0x61, 0xf2, 0x00, 0x15, 0xad },
190 .plaintext
= "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
192 .digest
= { 0x24, 0x8d, 0x6a, 0x61, 0xd2, 0x06, 0x38, 0xb8,
193 0xe5, 0xc0, 0x26, 0x93, 0x0c, 0x3e, 0x60, 0x39,
194 0xa3, 0x3c, 0xe4, 0x59, 0x64, 0xff, 0x21, 0x67,
195 0xf6, 0xec, 0xed, 0xd4, 0x19, 0xdb, 0x06, 0xc1 },
202 * SHA384 test vectors from from NIST and kerneli
204 #define SHA384_TEST_VECTORS 4
206 static struct hash_testvec sha384_tv_template
[] = {
210 .digest
= { 0xcb, 0x00, 0x75, 0x3f, 0x45, 0xa3, 0x5e, 0x8b,
211 0xb5, 0xa0, 0x3d, 0x69, 0x9a, 0xc6, 0x50, 0x07,
212 0x27, 0x2c, 0x32, 0xab, 0x0e, 0xde, 0xd1, 0x63,
213 0x1a, 0x8b, 0x60, 0x5a, 0x43, 0xff, 0x5b, 0xed,
214 0x80, 0x86, 0x07, 0x2b, 0xa1, 0xe7, 0xcc, 0x23,
215 0x58, 0xba, 0xec, 0xa1, 0x34, 0xc8, 0x25, 0xa7 },
217 .plaintext
= "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
219 .digest
= { 0x33, 0x91, 0xfd, 0xdd, 0xfc, 0x8d, 0xc7, 0x39,
220 0x37, 0x07, 0xa6, 0x5b, 0x1b, 0x47, 0x09, 0x39,
221 0x7c, 0xf8, 0xb1, 0xd1, 0x62, 0xaf, 0x05, 0xab,
222 0xfe, 0x8f, 0x45, 0x0d, 0xe5, 0xf3, 0x6b, 0xc6,
223 0xb0, 0x45, 0x5a, 0x85, 0x20, 0xbc, 0x4e, 0x6f,
224 0x5f, 0xe9, 0x5b, 0x1f, 0xe3, 0xc8, 0x45, 0x2b},
226 .plaintext
= "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmn"
227 "hijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu",
229 .digest
= { 0x09, 0x33, 0x0c, 0x33, 0xf7, 0x11, 0x47, 0xe8,
230 0x3d, 0x19, 0x2f, 0xc7, 0x82, 0xcd, 0x1b, 0x47,
231 0x53, 0x11, 0x1b, 0x17, 0x3b, 0x3b, 0x05, 0xd2,
232 0x2f, 0xa0, 0x80, 0x86, 0xe3, 0xb0, 0xf7, 0x12,
233 0xfc, 0xc7, 0xc7, 0x1a, 0x55, 0x7e, 0x2d, 0xb9,
234 0x66, 0xc3, 0xe9, 0xfa, 0x91, 0x74, 0x60, 0x39 },
236 .plaintext
= "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcd"
237 "efghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz",
239 .digest
= { 0x3d, 0x20, 0x89, 0x73, 0xab, 0x35, 0x08, 0xdb,
240 0xbd, 0x7e, 0x2c, 0x28, 0x62, 0xba, 0x29, 0x0a,
241 0xd3, 0x01, 0x0e, 0x49, 0x78, 0xc1, 0x98, 0xdc,
242 0x4d, 0x8f, 0xd0, 0x14, 0xe5, 0x82, 0x82, 0x3a,
243 0x89, 0xe1, 0x6f, 0x9b, 0x2a, 0x7b, 0xbc, 0x1a,
244 0xc9, 0x38, 0xe2, 0xd1, 0x99, 0xe8, 0xbe, 0xa4 },
246 .tap
= { 26, 26, 26, 26 }
251 * SHA512 test vectors from from NIST and kerneli
253 #define SHA512_TEST_VECTORS 4
255 static struct hash_testvec sha512_tv_template
[] = {
259 .digest
= { 0xdd, 0xaf, 0x35, 0xa1, 0x93, 0x61, 0x7a, 0xba,
260 0xcc, 0x41, 0x73, 0x49, 0xae, 0x20, 0x41, 0x31,
261 0x12, 0xe6, 0xfa, 0x4e, 0x89, 0xa9, 0x7e, 0xa2,
262 0x0a, 0x9e, 0xee, 0xe6, 0x4b, 0x55, 0xd3, 0x9a,
263 0x21, 0x92, 0x99, 0x2a, 0x27, 0x4f, 0xc1, 0xa8,
264 0x36, 0xba, 0x3c, 0x23, 0xa3, 0xfe, 0xeb, 0xbd,
265 0x45, 0x4d, 0x44, 0x23, 0x64, 0x3c, 0xe8, 0x0e,
266 0x2a, 0x9a, 0xc9, 0x4f, 0xa5, 0x4c, 0xa4, 0x9f },
268 .plaintext
= "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
270 .digest
= { 0x20, 0x4a, 0x8f, 0xc6, 0xdd, 0xa8, 0x2f, 0x0a,
271 0x0c, 0xed, 0x7b, 0xeb, 0x8e, 0x08, 0xa4, 0x16,
272 0x57, 0xc1, 0x6e, 0xf4, 0x68, 0xb2, 0x28, 0xa8,
273 0x27, 0x9b, 0xe3, 0x31, 0xa7, 0x03, 0xc3, 0x35,
274 0x96, 0xfd, 0x15, 0xc1, 0x3b, 0x1b, 0x07, 0xf9,
275 0xaa, 0x1d, 0x3b, 0xea, 0x57, 0x78, 0x9c, 0xa0,
276 0x31, 0xad, 0x85, 0xc7, 0xa7, 0x1d, 0xd7, 0x03,
277 0x54, 0xec, 0x63, 0x12, 0x38, 0xca, 0x34, 0x45 },
279 .plaintext
= "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmn"
280 "hijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu",
282 .digest
= { 0x8e, 0x95, 0x9b, 0x75, 0xda, 0xe3, 0x13, 0xda,
283 0x8c, 0xf4, 0xf7, 0x28, 0x14, 0xfc, 0x14, 0x3f,
284 0x8f, 0x77, 0x79, 0xc6, 0xeb, 0x9f, 0x7f, 0xa1,
285 0x72, 0x99, 0xae, 0xad, 0xb6, 0x88, 0x90, 0x18,
286 0x50, 0x1d, 0x28, 0x9e, 0x49, 0x00, 0xf7, 0xe4,
287 0x33, 0x1b, 0x99, 0xde, 0xc4, 0xb5, 0x43, 0x3a,
288 0xc7, 0xd3, 0x29, 0xee, 0xb6, 0xdd, 0x26, 0x54,
289 0x5e, 0x96, 0xe5, 0x5b, 0x87, 0x4b, 0xe9, 0x09 },
291 .plaintext
= "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcd"
292 "efghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz",
294 .digest
= { 0x93, 0x0d, 0x0c, 0xef, 0xcb, 0x30, 0xff, 0x11,
295 0x33, 0xb6, 0x89, 0x81, 0x21, 0xf1, 0xcf, 0x3d,
296 0x27, 0x57, 0x8a, 0xfc, 0xaf, 0xe8, 0x67, 0x7c,
297 0x52, 0x57, 0xcf, 0x06, 0x99, 0x11, 0xf7, 0x5d,
298 0x8f, 0x58, 0x31, 0xb5, 0x6e, 0xbf, 0xda, 0x67,
299 0xb2, 0x78, 0xe6, 0x6d, 0xff, 0x8b, 0x84, 0xfe,
300 0x2b, 0x28, 0x70, 0xf7, 0x42, 0xa5, 0x80, 0xd8,
301 0xed, 0xb4, 0x19, 0x87, 0x23, 0x28, 0x50, 0xc9 },
303 .tap
= { 26, 26, 26, 26 }
309 * WHIRLPOOL test vectors from Whirlpool package
310 * by Vincent Rijmen and Paulo S. L. M. Barreto as part of the NESSIE
313 #define WP512_TEST_VECTORS 8
315 static struct hash_testvec wp512_tv_template
[] = {
319 .digest
= { 0x19, 0xFA, 0x61, 0xD7, 0x55, 0x22, 0xA4, 0x66,
320 0x9B, 0x44, 0xE3, 0x9C, 0x1D, 0x2E, 0x17, 0x26,
321 0xC5, 0x30, 0x23, 0x21, 0x30, 0xD4, 0x07, 0xF8,
322 0x9A, 0xFE, 0xE0, 0x96, 0x49, 0x97, 0xF7, 0xA7,
323 0x3E, 0x83, 0xBE, 0x69, 0x8B, 0x28, 0x8F, 0xEB,
324 0xCF, 0x88, 0xE3, 0xE0, 0x3C, 0x4F, 0x07, 0x57,
325 0xEA, 0x89, 0x64, 0xE5, 0x9B, 0x63, 0xD9, 0x37,
326 0x08, 0xB1, 0x38, 0xCC, 0x42, 0xA6, 0x6E, 0xB3 },
332 .digest
= { 0x8A, 0xCA, 0x26, 0x02, 0x79, 0x2A, 0xEC, 0x6F,
333 0x11, 0xA6, 0x72, 0x06, 0x53, 0x1F, 0xB7, 0xD7,
334 0xF0, 0xDF, 0xF5, 0x94, 0x13, 0x14, 0x5E, 0x69,
335 0x73, 0xC4, 0x50, 0x01, 0xD0, 0x08, 0x7B, 0x42,
336 0xD1, 0x1B, 0xC6, 0x45, 0x41, 0x3A, 0xEF, 0xF6,
337 0x3A, 0x42, 0x39, 0x1A, 0x39, 0x14, 0x5A, 0x59,
338 0x1A, 0x92, 0x20, 0x0D, 0x56, 0x01, 0x95, 0xE5,
339 0x3B, 0x47, 0x85, 0x84, 0xFD, 0xAE, 0x23, 0x1A },
343 .digest
= { 0x4E, 0x24, 0x48, 0xA4, 0xC6, 0xF4, 0x86, 0xBB,
344 0x16, 0xB6, 0x56, 0x2C, 0x73, 0xB4, 0x02, 0x0B,
345 0xF3, 0x04, 0x3E, 0x3A, 0x73, 0x1B, 0xCE, 0x72,
346 0x1A, 0xE1, 0xB3, 0x03, 0xD9, 0x7E, 0x6D, 0x4C,
347 0x71, 0x81, 0xEE, 0xBD, 0xB6, 0xC5, 0x7E, 0x27,
348 0x7D, 0x0E, 0x34, 0x95, 0x71, 0x14, 0xCB, 0xD6,
349 0xC7, 0x97, 0xFC, 0x9D, 0x95, 0xD8, 0xB5, 0x82,
350 0xD2, 0x25, 0x29, 0x20, 0x76, 0xD4, 0xEE, 0xF5 },
352 .plaintext
= "message digest",
354 .digest
= { 0x37, 0x8C, 0x84, 0xA4, 0x12, 0x6E, 0x2D, 0xC6,
355 0xE5, 0x6D, 0xCC, 0x74, 0x58, 0x37, 0x7A, 0xAC,
356 0x83, 0x8D, 0x00, 0x03, 0x22, 0x30, 0xF5, 0x3C,
357 0xE1, 0xF5, 0x70, 0x0C, 0x0F, 0xFB, 0x4D, 0x3B,
358 0x84, 0x21, 0x55, 0x76, 0x59, 0xEF, 0x55, 0xC1,
359 0x06, 0xB4, 0xB5, 0x2A, 0xC5, 0xA4, 0xAA, 0xA6,
360 0x92, 0xED, 0x92, 0x00, 0x52, 0x83, 0x8F, 0x33,
361 0x62, 0xE8, 0x6D, 0xBD, 0x37, 0xA8, 0x90, 0x3E },
363 .plaintext
= "abcdefghijklmnopqrstuvwxyz",
365 .digest
= { 0xF1, 0xD7, 0x54, 0x66, 0x26, 0x36, 0xFF, 0xE9,
366 0x2C, 0x82, 0xEB, 0xB9, 0x21, 0x2A, 0x48, 0x4A,
367 0x8D, 0x38, 0x63, 0x1E, 0xAD, 0x42, 0x38, 0xF5,
368 0x44, 0x2E, 0xE1, 0x3B, 0x80, 0x54, 0xE4, 0x1B,
369 0x08, 0xBF, 0x2A, 0x92, 0x51, 0xC3, 0x0B, 0x6A,
370 0x0B, 0x8A, 0xAE, 0x86, 0x17, 0x7A, 0xB4, 0xA6,
371 0xF6, 0x8F, 0x67, 0x3E, 0x72, 0x07, 0x86, 0x5D,
372 0x5D, 0x98, 0x19, 0xA3, 0xDB, 0xA4, 0xEB, 0x3B },
374 .plaintext
= "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
375 "abcdefghijklmnopqrstuvwxyz0123456789",
377 .digest
= { 0xDC, 0x37, 0xE0, 0x08, 0xCF, 0x9E, 0xE6, 0x9B,
378 0xF1, 0x1F, 0x00, 0xED, 0x9A, 0xBA, 0x26, 0x90,
379 0x1D, 0xD7, 0xC2, 0x8C, 0xDE, 0xC0, 0x66, 0xCC,
380 0x6A, 0xF4, 0x2E, 0x40, 0xF8, 0x2F, 0x3A, 0x1E,
381 0x08, 0xEB, 0xA2, 0x66, 0x29, 0x12, 0x9D, 0x8F,
382 0xB7, 0xCB, 0x57, 0x21, 0x1B, 0x92, 0x81, 0xA6,
383 0x55, 0x17, 0xCC, 0x87, 0x9D, 0x7B, 0x96, 0x21,
384 0x42, 0xC6, 0x5F, 0x5A, 0x7A, 0xF0, 0x14, 0x67 },
386 .plaintext
= "1234567890123456789012345678901234567890"
387 "1234567890123456789012345678901234567890",
389 .digest
= { 0x46, 0x6E, 0xF1, 0x8B, 0xAB, 0xB0, 0x15, 0x4D,
390 0x25, 0xB9, 0xD3, 0x8A, 0x64, 0x14, 0xF5, 0xC0,
391 0x87, 0x84, 0x37, 0x2B, 0xCC, 0xB2, 0x04, 0xD6,
392 0x54, 0x9C, 0x4A, 0xFA, 0xDB, 0x60, 0x14, 0x29,
393 0x4D, 0x5B, 0xD8, 0xDF, 0x2A, 0x6C, 0x44, 0xE5,
394 0x38, 0xCD, 0x04, 0x7B, 0x26, 0x81, 0xA5, 0x1A,
395 0x2C, 0x60, 0x48, 0x1E, 0x88, 0xC5, 0xA2, 0x0B,
396 0x2C, 0x2A, 0x80, 0xCF, 0x3A, 0x9A, 0x08, 0x3B },
398 .plaintext
= "abcdbcdecdefdefgefghfghighijhijk",
400 .digest
= { 0x2A, 0x98, 0x7E, 0xA4, 0x0F, 0x91, 0x70, 0x61,
401 0xF5, 0xD6, 0xF0, 0xA0, 0xE4, 0x64, 0x4F, 0x48,
402 0x8A, 0x7A, 0x5A, 0x52, 0xDE, 0xEE, 0x65, 0x62,
403 0x07, 0xC5, 0x62, 0xF9, 0x88, 0xE9, 0x5C, 0x69,
404 0x16, 0xBD, 0xC8, 0x03, 0x1B, 0xC5, 0xBE, 0x1B,
405 0x7B, 0x94, 0x76, 0x39, 0xFE, 0x05, 0x0B, 0x56,
406 0x93, 0x9B, 0xAA, 0xA0, 0xAD, 0xFF, 0x9A, 0xE6,
407 0x74, 0x5B, 0x7B, 0x18, 0x1C, 0x3B, 0xE3, 0xFD },
411 #define WP384_TEST_VECTORS 8
413 static struct hash_testvec wp384_tv_template
[] = {
417 .digest
= { 0x19, 0xFA, 0x61, 0xD7, 0x55, 0x22, 0xA4, 0x66,
418 0x9B, 0x44, 0xE3, 0x9C, 0x1D, 0x2E, 0x17, 0x26,
419 0xC5, 0x30, 0x23, 0x21, 0x30, 0xD4, 0x07, 0xF8,
420 0x9A, 0xFE, 0xE0, 0x96, 0x49, 0x97, 0xF7, 0xA7,
421 0x3E, 0x83, 0xBE, 0x69, 0x8B, 0x28, 0x8F, 0xEB,
422 0xCF, 0x88, 0xE3, 0xE0, 0x3C, 0x4F, 0x07, 0x57 },
428 .digest
= { 0x8A, 0xCA, 0x26, 0x02, 0x79, 0x2A, 0xEC, 0x6F,
429 0x11, 0xA6, 0x72, 0x06, 0x53, 0x1F, 0xB7, 0xD7,
430 0xF0, 0xDF, 0xF5, 0x94, 0x13, 0x14, 0x5E, 0x69,
431 0x73, 0xC4, 0x50, 0x01, 0xD0, 0x08, 0x7B, 0x42,
432 0xD1, 0x1B, 0xC6, 0x45, 0x41, 0x3A, 0xEF, 0xF6,
433 0x3A, 0x42, 0x39, 0x1A, 0x39, 0x14, 0x5A, 0x59 },
437 .digest
= { 0x4E, 0x24, 0x48, 0xA4, 0xC6, 0xF4, 0x86, 0xBB,
438 0x16, 0xB6, 0x56, 0x2C, 0x73, 0xB4, 0x02, 0x0B,
439 0xF3, 0x04, 0x3E, 0x3A, 0x73, 0x1B, 0xCE, 0x72,
440 0x1A, 0xE1, 0xB3, 0x03, 0xD9, 0x7E, 0x6D, 0x4C,
441 0x71, 0x81, 0xEE, 0xBD, 0xB6, 0xC5, 0x7E, 0x27,
442 0x7D, 0x0E, 0x34, 0x95, 0x71, 0x14, 0xCB, 0xD6 },
444 .plaintext
= "message digest",
446 .digest
= { 0x37, 0x8C, 0x84, 0xA4, 0x12, 0x6E, 0x2D, 0xC6,
447 0xE5, 0x6D, 0xCC, 0x74, 0x58, 0x37, 0x7A, 0xAC,
448 0x83, 0x8D, 0x00, 0x03, 0x22, 0x30, 0xF5, 0x3C,
449 0xE1, 0xF5, 0x70, 0x0C, 0x0F, 0xFB, 0x4D, 0x3B,
450 0x84, 0x21, 0x55, 0x76, 0x59, 0xEF, 0x55, 0xC1,
451 0x06, 0xB4, 0xB5, 0x2A, 0xC5, 0xA4, 0xAA, 0xA6 },
453 .plaintext
= "abcdefghijklmnopqrstuvwxyz",
455 .digest
= { 0xF1, 0xD7, 0x54, 0x66, 0x26, 0x36, 0xFF, 0xE9,
456 0x2C, 0x82, 0xEB, 0xB9, 0x21, 0x2A, 0x48, 0x4A,
457 0x8D, 0x38, 0x63, 0x1E, 0xAD, 0x42, 0x38, 0xF5,
458 0x44, 0x2E, 0xE1, 0x3B, 0x80, 0x54, 0xE4, 0x1B,
459 0x08, 0xBF, 0x2A, 0x92, 0x51, 0xC3, 0x0B, 0x6A,
460 0x0B, 0x8A, 0xAE, 0x86, 0x17, 0x7A, 0xB4, 0xA6 },
462 .plaintext
= "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
463 "abcdefghijklmnopqrstuvwxyz0123456789",
465 .digest
= { 0xDC, 0x37, 0xE0, 0x08, 0xCF, 0x9E, 0xE6, 0x9B,
466 0xF1, 0x1F, 0x00, 0xED, 0x9A, 0xBA, 0x26, 0x90,
467 0x1D, 0xD7, 0xC2, 0x8C, 0xDE, 0xC0, 0x66, 0xCC,
468 0x6A, 0xF4, 0x2E, 0x40, 0xF8, 0x2F, 0x3A, 0x1E,
469 0x08, 0xEB, 0xA2, 0x66, 0x29, 0x12, 0x9D, 0x8F,
470 0xB7, 0xCB, 0x57, 0x21, 0x1B, 0x92, 0x81, 0xA6 },
472 .plaintext
= "1234567890123456789012345678901234567890"
473 "1234567890123456789012345678901234567890",
475 .digest
= { 0x46, 0x6E, 0xF1, 0x8B, 0xAB, 0xB0, 0x15, 0x4D,
476 0x25, 0xB9, 0xD3, 0x8A, 0x64, 0x14, 0xF5, 0xC0,
477 0x87, 0x84, 0x37, 0x2B, 0xCC, 0xB2, 0x04, 0xD6,
478 0x54, 0x9C, 0x4A, 0xFA, 0xDB, 0x60, 0x14, 0x29,
479 0x4D, 0x5B, 0xD8, 0xDF, 0x2A, 0x6C, 0x44, 0xE5,
480 0x38, 0xCD, 0x04, 0x7B, 0x26, 0x81, 0xA5, 0x1A },
482 .plaintext
= "abcdbcdecdefdefgefghfghighijhijk",
484 .digest
= { 0x2A, 0x98, 0x7E, 0xA4, 0x0F, 0x91, 0x70, 0x61,
485 0xF5, 0xD6, 0xF0, 0xA0, 0xE4, 0x64, 0x4F, 0x48,
486 0x8A, 0x7A, 0x5A, 0x52, 0xDE, 0xEE, 0x65, 0x62,
487 0x07, 0xC5, 0x62, 0xF9, 0x88, 0xE9, 0x5C, 0x69,
488 0x16, 0xBD, 0xC8, 0x03, 0x1B, 0xC5, 0xBE, 0x1B,
489 0x7B, 0x94, 0x76, 0x39, 0xFE, 0x05, 0x0B, 0x56 },
493 #define WP256_TEST_VECTORS 8
495 static struct hash_testvec wp256_tv_template
[] = {
499 .digest
= { 0x19, 0xFA, 0x61, 0xD7, 0x55, 0x22, 0xA4, 0x66,
500 0x9B, 0x44, 0xE3, 0x9C, 0x1D, 0x2E, 0x17, 0x26,
501 0xC5, 0x30, 0x23, 0x21, 0x30, 0xD4, 0x07, 0xF8,
502 0x9A, 0xFE, 0xE0, 0x96, 0x49, 0x97, 0xF7, 0xA7 },
508 .digest
= { 0x8A, 0xCA, 0x26, 0x02, 0x79, 0x2A, 0xEC, 0x6F,
509 0x11, 0xA6, 0x72, 0x06, 0x53, 0x1F, 0xB7, 0xD7,
510 0xF0, 0xDF, 0xF5, 0x94, 0x13, 0x14, 0x5E, 0x69,
511 0x73, 0xC4, 0x50, 0x01, 0xD0, 0x08, 0x7B, 0x42 },
515 .digest
= { 0x4E, 0x24, 0x48, 0xA4, 0xC6, 0xF4, 0x86, 0xBB,
516 0x16, 0xB6, 0x56, 0x2C, 0x73, 0xB4, 0x02, 0x0B,
517 0xF3, 0x04, 0x3E, 0x3A, 0x73, 0x1B, 0xCE, 0x72,
518 0x1A, 0xE1, 0xB3, 0x03, 0xD9, 0x7E, 0x6D, 0x4C },
520 .plaintext
= "message digest",
522 .digest
= { 0x37, 0x8C, 0x84, 0xA4, 0x12, 0x6E, 0x2D, 0xC6,
523 0xE5, 0x6D, 0xCC, 0x74, 0x58, 0x37, 0x7A, 0xAC,
524 0x83, 0x8D, 0x00, 0x03, 0x22, 0x30, 0xF5, 0x3C,
525 0xE1, 0xF5, 0x70, 0x0C, 0x0F, 0xFB, 0x4D, 0x3B },
527 .plaintext
= "abcdefghijklmnopqrstuvwxyz",
529 .digest
= { 0xF1, 0xD7, 0x54, 0x66, 0x26, 0x36, 0xFF, 0xE9,
530 0x2C, 0x82, 0xEB, 0xB9, 0x21, 0x2A, 0x48, 0x4A,
531 0x8D, 0x38, 0x63, 0x1E, 0xAD, 0x42, 0x38, 0xF5,
532 0x44, 0x2E, 0xE1, 0x3B, 0x80, 0x54, 0xE4, 0x1B },
534 .plaintext
= "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
535 "abcdefghijklmnopqrstuvwxyz0123456789",
537 .digest
= { 0xDC, 0x37, 0xE0, 0x08, 0xCF, 0x9E, 0xE6, 0x9B,
538 0xF1, 0x1F, 0x00, 0xED, 0x9A, 0xBA, 0x26, 0x90,
539 0x1D, 0xD7, 0xC2, 0x8C, 0xDE, 0xC0, 0x66, 0xCC,
540 0x6A, 0xF4, 0x2E, 0x40, 0xF8, 0x2F, 0x3A, 0x1E },
542 .plaintext
= "1234567890123456789012345678901234567890"
543 "1234567890123456789012345678901234567890",
545 .digest
= { 0x46, 0x6E, 0xF1, 0x8B, 0xAB, 0xB0, 0x15, 0x4D,
546 0x25, 0xB9, 0xD3, 0x8A, 0x64, 0x14, 0xF5, 0xC0,
547 0x87, 0x84, 0x37, 0x2B, 0xCC, 0xB2, 0x04, 0xD6,
548 0x54, 0x9C, 0x4A, 0xFA, 0xDB, 0x60, 0x14, 0x29 },
550 .plaintext
= "abcdbcdecdefdefgefghfghighijhijk",
552 .digest
= { 0x2A, 0x98, 0x7E, 0xA4, 0x0F, 0x91, 0x70, 0x61,
553 0xF5, 0xD6, 0xF0, 0xA0, 0xE4, 0x64, 0x4F, 0x48,
554 0x8A, 0x7A, 0x5A, 0x52, 0xDE, 0xEE, 0x65, 0x62,
555 0x07, 0xC5, 0x62, 0xF9, 0x88, 0xE9, 0x5C, 0x69 },
560 * TIGER test vectors from Tiger website
562 #define TGR192_TEST_VECTORS 6
564 static struct hash_testvec tgr192_tv_template
[] = {
568 .digest
= { 0x24, 0xf0, 0x13, 0x0c, 0x63, 0xac, 0x93, 0x32,
569 0x16, 0x16, 0x6e, 0x76, 0xb1, 0xbb, 0x92, 0x5f,
570 0xf3, 0x73, 0xde, 0x2d, 0x49, 0x58, 0x4e, 0x7a },
574 .digest
= { 0xf2, 0x58, 0xc1, 0xe8, 0x84, 0x14, 0xab, 0x2a,
575 0x52, 0x7a, 0xb5, 0x41, 0xff, 0xc5, 0xb8, 0xbf,
576 0x93, 0x5f, 0x7b, 0x95, 0x1c, 0x13, 0x29, 0x51 },
578 .plaintext
= "Tiger",
580 .digest
= { 0x9f, 0x00, 0xf5, 0x99, 0x07, 0x23, 0x00, 0xdd,
581 0x27, 0x6a, 0xbb, 0x38, 0xc8, 0xeb, 0x6d, 0xec,
582 0x37, 0x79, 0x0c, 0x11, 0x6f, 0x9d, 0x2b, 0xdf },
584 .plaintext
= "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-",
586 .digest
= { 0x87, 0xfb, 0x2a, 0x90, 0x83, 0x85, 0x1c, 0xf7,
587 0x47, 0x0d, 0x2c, 0xf8, 0x10, 0xe6, 0xdf, 0x9e,
588 0xb5, 0x86, 0x44, 0x50, 0x34, 0xa5, 0xa3, 0x86 },
590 .plaintext
= "ABCDEFGHIJKLMNOPQRSTUVWXYZ=abcdefghijklmnopqrstuvwxyz+0123456789",
592 .digest
= { 0x46, 0x7d, 0xb8, 0x08, 0x63, 0xeb, 0xce, 0x48,
593 0x8d, 0xf1, 0xcd, 0x12, 0x61, 0x65, 0x5d, 0xe9,
594 0x57, 0x89, 0x65, 0x65, 0x97, 0x5f, 0x91, 0x97 },
596 .plaintext
= "Tiger - A Fast New Hash Function, "
597 "by Ross Anderson and Eli Biham, "
598 "proceedings of Fast Software Encryption 3, "
601 .digest
= { 0x3d, 0x9a, 0xeb, 0x03, 0xd1, 0xbd, 0x1a, 0x63,
602 0x57, 0xb2, 0x77, 0x4d, 0xfd, 0x6d, 0x5b, 0x24,
603 0xdd, 0x68, 0x15, 0x1d, 0x50, 0x39, 0x74, 0xfc },
607 #define TGR160_TEST_VECTORS 6
609 static struct hash_testvec tgr160_tv_template
[] = {
613 .digest
= { 0x24, 0xf0, 0x13, 0x0c, 0x63, 0xac, 0x93, 0x32,
614 0x16, 0x16, 0x6e, 0x76, 0xb1, 0xbb, 0x92, 0x5f,
615 0xf3, 0x73, 0xde, 0x2d },
619 .digest
= { 0xf2, 0x58, 0xc1, 0xe8, 0x84, 0x14, 0xab, 0x2a,
620 0x52, 0x7a, 0xb5, 0x41, 0xff, 0xc5, 0xb8, 0xbf,
621 0x93, 0x5f, 0x7b, 0x95 },
623 .plaintext
= "Tiger",
625 .digest
= { 0x9f, 0x00, 0xf5, 0x99, 0x07, 0x23, 0x00, 0xdd,
626 0x27, 0x6a, 0xbb, 0x38, 0xc8, 0xeb, 0x6d, 0xec,
627 0x37, 0x79, 0x0c, 0x11 },
629 .plaintext
= "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-",
631 .digest
= { 0x87, 0xfb, 0x2a, 0x90, 0x83, 0x85, 0x1c, 0xf7,
632 0x47, 0x0d, 0x2c, 0xf8, 0x10, 0xe6, 0xdf, 0x9e,
633 0xb5, 0x86, 0x44, 0x50 },
635 .plaintext
= "ABCDEFGHIJKLMNOPQRSTUVWXYZ=abcdefghijklmnopqrstuvwxyz+0123456789",
637 .digest
= { 0x46, 0x7d, 0xb8, 0x08, 0x63, 0xeb, 0xce, 0x48,
638 0x8d, 0xf1, 0xcd, 0x12, 0x61, 0x65, 0x5d, 0xe9,
639 0x57, 0x89, 0x65, 0x65 },
641 .plaintext
= "Tiger - A Fast New Hash Function, "
642 "by Ross Anderson and Eli Biham, "
643 "proceedings of Fast Software Encryption 3, "
646 .digest
= { 0x3d, 0x9a, 0xeb, 0x03, 0xd1, 0xbd, 0x1a, 0x63,
647 0x57, 0xb2, 0x77, 0x4d, 0xfd, 0x6d, 0x5b, 0x24,
648 0xdd, 0x68, 0x15, 0x1d },
652 #define TGR128_TEST_VECTORS 6
654 static struct hash_testvec tgr128_tv_template
[] = {
658 .digest
= { 0x24, 0xf0, 0x13, 0x0c, 0x63, 0xac, 0x93, 0x32,
659 0x16, 0x16, 0x6e, 0x76, 0xb1, 0xbb, 0x92, 0x5f },
663 .digest
= { 0xf2, 0x58, 0xc1, 0xe8, 0x84, 0x14, 0xab, 0x2a,
664 0x52, 0x7a, 0xb5, 0x41, 0xff, 0xc5, 0xb8, 0xbf },
666 .plaintext
= "Tiger",
668 .digest
= { 0x9f, 0x00, 0xf5, 0x99, 0x07, 0x23, 0x00, 0xdd,
669 0x27, 0x6a, 0xbb, 0x38, 0xc8, 0xeb, 0x6d, 0xec },
671 .plaintext
= "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-",
673 .digest
= { 0x87, 0xfb, 0x2a, 0x90, 0x83, 0x85, 0x1c, 0xf7,
674 0x47, 0x0d, 0x2c, 0xf8, 0x10, 0xe6, 0xdf, 0x9e },
676 .plaintext
= "ABCDEFGHIJKLMNOPQRSTUVWXYZ=abcdefghijklmnopqrstuvwxyz+0123456789",
678 .digest
= { 0x46, 0x7d, 0xb8, 0x08, 0x63, 0xeb, 0xce, 0x48,
679 0x8d, 0xf1, 0xcd, 0x12, 0x61, 0x65, 0x5d, 0xe9 },
681 .plaintext
= "Tiger - A Fast New Hash Function, "
682 "by Ross Anderson and Eli Biham, "
683 "proceedings of Fast Software Encryption 3, "
686 .digest
= { 0x3d, 0x9a, 0xeb, 0x03, 0xd1, 0xbd, 0x1a, 0x63,
687 0x57, 0xb2, 0x77, 0x4d, 0xfd, 0x6d, 0x5b, 0x24 },
692 * HMAC-MD5 test vectors from RFC2202
693 * (These need to be fixed to not use strlen).
695 #define HMAC_MD5_TEST_VECTORS 7
697 static struct hash_testvec hmac_md5_tv_template
[] =
700 .key
= { [0 ... 15] = 0x0b },
702 .plaintext
= "Hi There",
704 .digest
= { 0x92, 0x94, 0x72, 0x7a, 0x36, 0x38, 0xbb, 0x1c,
705 0x13, 0xf4, 0x8e, 0xf8, 0x15, 0x8b, 0xfc, 0x9d },
707 .key
= { 'J', 'e', 'f', 'e' },
709 .plaintext
= "what do ya want for nothing?",
711 .digest
= { 0x75, 0x0c, 0x78, 0x3e, 0x6a, 0xb0, 0xb5, 0x03,
712 0xea, 0xa8, 0x6e, 0x31, 0x0a, 0x5d, 0xb7, 0x38 },
716 .key
= { [0 ... 15] = 0xaa },
718 .plaintext
= { [0 ... 49] = 0xdd },
720 .digest
= { 0x56, 0xbe, 0x34, 0x52, 0x1d, 0x14, 0x4c, 0x88,
721 0xdb, 0xb8, 0xc7, 0x33, 0xf0, 0xe8, 0xb3, 0xf6 },
723 .key
= { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
724 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
725 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, },
727 .plaintext
= { [0 ... 49] = 0xcd },
729 .digest
= { 0x69, 0x7e, 0xaf, 0x0a, 0xca, 0x3a, 0x3a, 0xea,
730 0x3a, 0x75, 0x16, 0x47, 0x46, 0xff, 0xaa, 0x79 },
732 .key
= { [0 ... 15] = 0x0c },
734 .plaintext
= "Test With Truncation",
736 .digest
= { 0x56, 0x46, 0x1e, 0xf2, 0x34, 0x2e, 0xdc, 0x00,
737 0xf9, 0xba, 0xb9, 0x95, 0x69, 0x0e, 0xfd, 0x4c },
739 .key
= { [0 ... 79] = 0xaa },
741 .plaintext
= "Test Using Larger Than Block-Size Key - Hash Key First",
743 .digest
= { 0x6b, 0x1a, 0xb7, 0xfe, 0x4b, 0xd7, 0xbf, 0x8f,
744 0x0b, 0x62, 0xe6, 0xce, 0x61, 0xb9, 0xd0, 0xcd },
746 .key
= { [0 ... 79] = 0xaa },
748 .plaintext
= "Test Using Larger Than Block-Size Key and Larger Than One "
751 .digest
= { 0x6f, 0x63, 0x0f, 0xad, 0x67, 0xcd, 0xa0, 0xee,
752 0x1f, 0xb1, 0xf5, 0x62, 0xdb, 0x3a, 0xa5, 0x3e },
757 * HMAC-SHA1 test vectors from RFC2202
759 #define HMAC_SHA1_TEST_VECTORS 7
761 static struct hash_testvec hmac_sha1_tv_template
[] = {
763 .key
= { [0 ... 19] = 0x0b },
765 .plaintext
= "Hi There",
767 .digest
= { 0xb6, 0x17, 0x31, 0x86, 0x55, 0x05, 0x72, 0x64,
768 0xe2, 0x8b, 0xc0, 0xb6, 0xfb, 0x37, 0x8c, 0x8e, 0xf1,
771 .key
= { 'J', 'e', 'f', 'e' },
773 .plaintext
= "what do ya want for nothing?",
775 .digest
= { 0xef, 0xfc, 0xdf, 0x6a, 0xe5, 0xeb, 0x2f, 0xa2, 0xd2, 0x74,
776 0x16, 0xd5, 0xf1, 0x84, 0xdf, 0x9c, 0x25, 0x9a, 0x7c, 0x79 },
780 .key
= { [0 ... 19] = 0xaa },
782 .plaintext
= { [0 ... 49] = 0xdd },
784 .digest
= { 0x12, 0x5d, 0x73, 0x42, 0xb9, 0xac, 0x11, 0xcd, 0x91, 0xa3,
785 0x9a, 0xf4, 0x8a, 0xa1, 0x7b, 0x4f, 0x63, 0xf1, 0x75, 0xd3 },
787 .key
= { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
788 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
789 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19 },
791 .plaintext
= { [0 ... 49] = 0xcd },
793 .digest
= { 0x4c, 0x90, 0x07, 0xf4, 0x02, 0x62, 0x50, 0xc6, 0xbc, 0x84,
794 0x14, 0xf9, 0xbf, 0x50, 0xc8, 0x6c, 0x2d, 0x72, 0x35, 0xda },
796 .key
= { [0 ... 19] = 0x0c },
798 .plaintext
= "Test With Truncation",
800 .digest
= { 0x4c, 0x1a, 0x03, 0x42, 0x4b, 0x55, 0xe0, 0x7f, 0xe7, 0xf2,
801 0x7b, 0xe1, 0xd5, 0x8b, 0xb9, 0x32, 0x4a, 0x9a, 0x5a, 0x04 },
803 .key
= { [0 ... 79] = 0xaa },
805 .plaintext
= "Test Using Larger Than Block-Size Key - Hash Key First",
807 .digest
= { 0xaa, 0x4a, 0xe5, 0xe1, 0x52, 0x72, 0xd0, 0x0e, 0x95, 0x70,
808 0x56, 0x37, 0xce, 0x8a, 0x3b, 0x55, 0xed, 0x40, 0x21, 0x12 },
810 .key
= { [0 ... 79] = 0xaa },
812 .plaintext
= "Test Using Larger Than Block-Size Key and Larger Than One "
815 .digest
= { 0xe8, 0xe9, 0x9d, 0x0f, 0x45, 0x23, 0x7d, 0x78, 0x6d, 0x6b,
816 0xba, 0xa7, 0x96, 0x5c, 0x78, 0x08, 0xbb, 0xff, 0x1a, 0x91 },
821 * HMAC-SHA256 test vectors from
822 * draft-ietf-ipsec-ciph-sha-256-01.txt
824 #define HMAC_SHA256_TEST_VECTORS 10
826 static struct hash_testvec hmac_sha256_tv_template
[] = {
828 .key
= { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
829 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
830 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
831 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20},
835 .digest
= { 0xa2, 0x1b, 0x1f, 0x5d, 0x4c, 0xf4, 0xf7, 0x3a,
836 0x4d, 0xd9, 0x39, 0x75, 0x0f, 0x7a, 0x06, 0x6a,
837 0x7f, 0x98, 0xcc, 0x13, 0x1c, 0xb1, 0x6a, 0x66,
838 0x92, 0x75, 0x90, 0x21, 0xcf, 0xab, 0x81, 0x81 },
840 .key
= { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
841 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
842 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
843 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20 },
845 .plaintext
= "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
847 .digest
= { 0x10, 0x4f, 0xdc, 0x12, 0x57, 0x32, 0x8f, 0x08,
848 0x18, 0x4b, 0xa7, 0x31, 0x31, 0xc5, 0x3c, 0xae,
849 0xe6, 0x98, 0xe3, 0x61, 0x19, 0x42, 0x11, 0x49,
850 0xea, 0x8c, 0x71, 0x24, 0x56, 0x69, 0x7d, 0x30 },
852 .key
= { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
853 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
854 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
855 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20 },
857 .plaintext
= "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"
858 "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
860 .digest
= { 0x47, 0x03, 0x05, 0xfc, 0x7e, 0x40, 0xfe, 0x34,
861 0xd3, 0xee, 0xb3, 0xe7, 0x73, 0xd9, 0x5a, 0xab,
862 0x73, 0xac, 0xf0, 0xfd, 0x06, 0x04, 0x47, 0xa5,
863 0xeb, 0x45, 0x95, 0xbf, 0x33, 0xa9, 0xd1, 0xa3 },
865 .key
= { [0 ... 31] = 0x0b },
867 .plaintext
= "Hi There",
869 .digest
= { 0x19, 0x8a, 0x60, 0x7e, 0xb4, 0x4b, 0xfb, 0xc6,
870 0x99, 0x03, 0xa0, 0xf1, 0xcf, 0x2b, 0xbd, 0xc5,
871 0xba, 0x0a, 0xa3, 0xf3, 0xd9, 0xae, 0x3c, 0x1c,
872 0x7a, 0x3b, 0x16, 0x96, 0xa0, 0xb6, 0x8c, 0xf7 },
876 .plaintext
= "what do ya want for nothing?",
878 .digest
= { 0x5b, 0xdc, 0xc1, 0x46, 0xbf, 0x60, 0x75, 0x4e,
879 0x6a, 0x04, 0x24, 0x26, 0x08, 0x95, 0x75, 0xc7,
880 0x5a, 0x00, 0x3f, 0x08, 0x9d, 0x27, 0x39, 0x83,
881 0x9d, 0xec, 0x58, 0xb9, 0x64, 0xec, 0x38, 0x43 },
885 .key
= { [0 ... 31] = 0xaa },
887 .plaintext
= { [0 ... 49] = 0xdd },
889 .digest
= { 0xcd, 0xcb, 0x12, 0x20, 0xd1, 0xec, 0xcc, 0xea,
890 0x91, 0xe5, 0x3a, 0xba, 0x30, 0x92, 0xf9, 0x62,
891 0xe5, 0x49, 0xfe, 0x6c, 0xe9, 0xed, 0x7f, 0xdc,
892 0x43, 0x19, 0x1f, 0xbd, 0xe4, 0x5c, 0x30, 0xb0 },
894 .key
= { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
895 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
896 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
897 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20,
898 0x21, 0x22, 0x23, 0x24, 0x25 },
900 .plaintext
= { [0 ... 49] = 0xcd },
902 .digest
= { 0xd4, 0x63, 0x3c, 0x17, 0xf6, 0xfb, 0x8d, 0x74,
903 0x4c, 0x66, 0xde, 0xe0, 0xf8, 0xf0, 0x74, 0x55,
904 0x6e, 0xc4, 0xaf, 0x55, 0xef, 0x07, 0x99, 0x85,
905 0x41, 0x46, 0x8e, 0xb4, 0x9b, 0xd2, 0xe9, 0x17 },
907 .key
= { [0 ... 31] = 0x0c },
909 .plaintext
= "Test With Truncation",
911 .digest
= { 0x75, 0x46, 0xaf, 0x01, 0x84, 0x1f, 0xc0, 0x9b,
912 0x1a, 0xb9, 0xc3, 0x74, 0x9a, 0x5f, 0x1c, 0x17,
913 0xd4, 0xf5, 0x89, 0x66, 0x8a, 0x58, 0x7b, 0x27,
914 0x00, 0xa9, 0xc9, 0x7c, 0x11, 0x93, 0xcf, 0x42 },
916 .key
= { [0 ... 79] = 0xaa },
918 .plaintext
= "Test Using Larger Than Block-Size Key - Hash Key First",
920 .digest
= { 0x69, 0x53, 0x02, 0x5e, 0xd9, 0x6f, 0x0c, 0x09,
921 0xf8, 0x0a, 0x96, 0xf7, 0x8e, 0x65, 0x38, 0xdb,
922 0xe2, 0xe7, 0xb8, 0x20, 0xe3, 0xdd, 0x97, 0x0e,
923 0x7d, 0xdd, 0x39, 0x09, 0x1b, 0x32, 0x35, 0x2f },
925 .key
= { [0 ... 79] = 0xaa },
927 .plaintext
= "Test Using Larger Than Block-Size Key and Larger Than "
928 "One Block-Size Data",
930 .digest
= { 0x63, 0x55, 0xac, 0x22, 0xe8, 0x90, 0xd0, 0xa3,
931 0xc8, 0x48, 0x1a, 0x5c, 0xa4, 0x82, 0x5b, 0xc8,
932 0x84, 0xd3, 0xe7, 0xa1, 0xff, 0x98, 0xa2, 0xfc,
933 0x2a, 0xc7, 0xd8, 0xe0, 0x64, 0xc3, 0xb2, 0xe6 },
937 #define XCBC_AES_TEST_VECTORS 6
939 static struct hash_testvec aes_xcbc128_tv_template
[] = {
941 .key
= { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
942 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
943 .plaintext
= { [0 ... 15] = 0 },
944 .digest
= { 0x75, 0xf0, 0x25, 0x1d, 0x52, 0x8a, 0xc0, 0x1c,
945 0x45, 0x73, 0xdf, 0xd5, 0x84, 0xd7, 0x9f, 0x29 },
949 .key
= { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
950 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
951 .plaintext
= { 0x00, 0x01, 0x02 },
952 .digest
= { 0x5b, 0x37, 0x65, 0x80, 0xae, 0x2f, 0x19, 0xaf,
953 0xe7, 0x21, 0x9c, 0xee, 0xf1, 0x72, 0x75, 0x6f },
957 .key
= { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
958 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
959 .plaintext
= { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
960 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
961 .digest
= { 0xd2, 0xa2, 0x46, 0xfa, 0x34, 0x9b, 0x68, 0xa7,
962 0x99, 0x98, 0xa4, 0x39, 0x4f, 0xf7, 0xa2, 0x63 },
966 .key
= { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
967 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
968 .plaintext
= { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
969 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
970 0x10, 0x11, 0x12, 0x13 },
971 .digest
= { 0x47, 0xf5, 0x1b, 0x45, 0x64, 0x96, 0x62, 0x15,
972 0xb8, 0x98, 0x5c, 0x63, 0x05, 0x5e, 0xd3, 0x08 },
978 .key
= { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
979 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
980 .plaintext
= { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
981 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
982 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
983 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f },
984 .digest
= { 0xf5, 0x4f, 0x0e, 0xc8, 0xd2, 0xb9, 0xf3, 0xd3,
985 0x68, 0x07, 0x73, 0x4b, 0xd5, 0x28, 0x3f, 0xd4 },
989 .key
= { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
990 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
991 .plaintext
= { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
992 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
993 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
994 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
996 .digest
= { 0xbe, 0xcb, 0xb3, 0xbc, 0xcd, 0xb5, 0x18, 0xa3,
997 0x06, 0x77, 0xd5, 0x48, 0x1f, 0xb6, 0xb4, 0xd8 },
1006 * SHA384 HMAC test vectors from RFC4231
1009 #define HMAC_SHA384_TEST_VECTORS 4
1011 static struct hash_testvec hmac_sha384_tv_template
[] = {
1013 .key
= { 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
1014 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
1015 0x0b, 0x0b, 0x0b, 0x0b }, // (20 bytes)
1017 .plaintext
= { 0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65 }, // ("Hi There")
1019 .digest
= { 0xaf, 0xd0, 0x39, 0x44, 0xd8, 0x48, 0x95, 0x62,
1020 0x6b, 0x08, 0x25, 0xf4, 0xab, 0x46, 0x90, 0x7f,
1021 0x15, 0xf9, 0xda, 0xdb, 0xe4, 0x10, 0x1e, 0xc6,
1022 0x82, 0xaa, 0x03, 0x4c, 0x7c, 0xeb, 0xc5, 0x9c,
1023 0xfa, 0xea, 0x9e, 0xa9, 0x07, 0x6e, 0xde, 0x7f,
1024 0x4a, 0xf1, 0x52, 0xe8, 0xb2, 0xfa, 0x9c, 0xb6 },
1026 .key
= { 0x4a, 0x65, 0x66, 0x65 }, // ("Jefe")
1028 .plaintext
= { 0x77, 0x68, 0x61, 0x74, 0x20, 0x64, 0x6f, 0x20,
1029 0x79, 0x61, 0x20, 0x77, 0x61, 0x6e, 0x74, 0x20, // ("what do ya want ")
1030 0x66, 0x6f, 0x72, 0x20, 0x6e, 0x6f, 0x74, 0x68,
1031 0x69, 0x6e, 0x67, 0x3f }, // ("for nothing?")
1033 .digest
= { 0xaf, 0x45, 0xd2, 0xe3, 0x76, 0x48, 0x40, 0x31,
1034 0x61, 0x7f, 0x78, 0xd2, 0xb5, 0x8a, 0x6b, 0x1b,
1035 0x9c, 0x7e, 0xf4, 0x64, 0xf5, 0xa0, 0x1b, 0x47,
1036 0xe4, 0x2e, 0xc3, 0x73, 0x63, 0x22, 0x44, 0x5e,
1037 0x8e, 0x22, 0x40, 0xca, 0x5e, 0x69, 0xe2, 0xc7,
1038 0x8b, 0x32, 0x39, 0xec, 0xfa, 0xb2, 0x16, 0x49 },
1040 .tap
= { 7, 7, 7, 7 }
1042 .key
= { 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1043 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1044 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1045 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1046 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1047 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1048 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1049 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1050 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1051 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1052 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1053 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1054 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1055 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1056 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1057 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1058 0xaa, 0xaa, 0xaa }, // (131 bytes)
1060 .plaintext
= { 0x54, 0x65, 0x73, 0x74, 0x20, 0x55, 0x73, 0x69,
1061 0x6e, 0x67, 0x20, 0x4c, 0x61, 0x72, 0x67, 0x65, // ("Test Using Large")
1062 0x72, 0x20, 0x54, 0x68, 0x61, 0x6e, 0x20, 0x42,
1063 0x6c, 0x6f, 0x63, 0x6b, 0x2d, 0x53, 0x69, 0x7a, // ("r Than Block-Siz")
1064 0x65, 0x20, 0x4b, 0x65, 0x79, 0x20, 0x2d, 0x20,
1065 0x48, 0x61, 0x73, 0x68, 0x20, 0x4b, 0x65, 0x79, // ("e Key - Hash Key")
1066 0x20, 0x46, 0x69, 0x72, 0x73, 0x74 }, // (" First")
1068 .digest
= { 0x4e, 0xce, 0x08, 0x44, 0x85, 0x81, 0x3e, 0x90,
1069 0x88, 0xd2, 0xc6, 0x3a, 0x04, 0x1b, 0xc5, 0xb4,
1070 0x4f, 0x9e, 0xf1, 0x01, 0x2a, 0x2b, 0x58, 0x8f,
1071 0x3c, 0xd1, 0x1f, 0x05, 0x03, 0x3a, 0xc4, 0xc6,
1072 0x0c, 0x2e, 0xf6, 0xab, 0x40, 0x30, 0xfe, 0x82,
1073 0x96, 0x24, 0x8d, 0xf1, 0x63, 0xf4, 0x49, 0x52 },
1075 .key
= { 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1076 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1077 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1078 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1079 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1080 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1081 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1082 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1083 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1084 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1085 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1086 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1087 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1088 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1089 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1090 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1091 0xaa, 0xaa, 0xaa }, // (131 bytes)
1093 .plaintext
= { 0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20,
1094 0x61, 0x20, 0x74, 0x65, 0x73, 0x74, 0x20, 0x75, // ("This is a test u")
1095 0x73, 0x69, 0x6e, 0x67, 0x20, 0x61, 0x20, 0x6c,
1096 0x61, 0x72, 0x67, 0x65, 0x72, 0x20, 0x74, 0x68, // ("sing a larger th")
1097 0x61, 0x6e, 0x20, 0x62, 0x6c, 0x6f, 0x63, 0x6b,
1098 0x2d, 0x73, 0x69, 0x7a, 0x65, 0x20, 0x6b, 0x65, // ("an block-size ke")
1099 0x79, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x61, 0x20,
1100 0x6c, 0x61, 0x72, 0x67, 0x65, 0x72, 0x20, 0x74, // ("y and a larger t")
1101 0x68, 0x61, 0x6e, 0x20, 0x62, 0x6c, 0x6f, 0x63,
1102 0x6b, 0x2d, 0x73, 0x69, 0x7a, 0x65, 0x20, 0x64, // ("han block-size d")
1103 0x61, 0x74, 0x61, 0x2e, 0x20, 0x54, 0x68, 0x65,
1104 0x20, 0x6b, 0x65, 0x79, 0x20, 0x6e, 0x65, 0x65, // ("ata. The key nee")
1105 0x64, 0x73, 0x20, 0x74, 0x6f, 0x20, 0x62, 0x65,
1106 0x20, 0x68, 0x61, 0x73, 0x68, 0x65, 0x64, 0x20, // ("ds to be hashed ")
1107 0x62, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x20, 0x62,
1108 0x65, 0x69, 0x6e, 0x67, 0x20, 0x75, 0x73, 0x65, // ("before being use")
1109 0x64, 0x20, 0x62, 0x79, 0x20, 0x74, 0x68, 0x65,
1110 0x20, 0x48, 0x4d, 0x41, 0x43, 0x20, 0x61, 0x6c, // ("d by the HMAC al")
1111 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x2e }, // ("gorithm.")
1113 .digest
= { 0x66, 0x17, 0x17, 0x8e, 0x94, 0x1f, 0x02, 0x0d,
1114 0x35, 0x1e, 0x2f, 0x25, 0x4e, 0x8f, 0xd3, 0x2c,
1115 0x60, 0x24, 0x20, 0xfe, 0xb0, 0xb8, 0xfb, 0x9a,
1116 0xdc, 0xce, 0xbb, 0x82, 0x46, 0x1e, 0x99, 0xc5,
1117 0xa6, 0x78, 0xcc, 0x31, 0xe7, 0x99, 0x17, 0x6d,
1118 0x38, 0x60, 0xe6, 0x11, 0x0c, 0x46, 0x52, 0x3e },
1123 * SHA512 HMAC test vectors from RFC4231
1126 #define HMAC_SHA512_TEST_VECTORS 4
1128 static struct hash_testvec hmac_sha512_tv_template
[] = {
1130 .key
= { 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
1131 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
1132 0x0b, 0x0b, 0x0b, 0x0b }, // (20 bytes)
1134 .plaintext
= { 0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65 }, // ("Hi There")
1136 .digest
= { 0x87, 0xaa, 0x7c, 0xde, 0xa5, 0xef, 0x61, 0x9d,
1137 0x4f, 0xf0, 0xb4, 0x24, 0x1a, 0x1d, 0x6c, 0xb0,
1138 0x23, 0x79, 0xf4, 0xe2, 0xce, 0x4e, 0xc2, 0x78,
1139 0x7a, 0xd0, 0xb3, 0x05, 0x45, 0xe1, 0x7c, 0xde,
1140 0xda, 0xa8, 0x33, 0xb7, 0xd6, 0xb8, 0xa7, 0x02,
1141 0x03, 0x8b, 0x27, 0x4e, 0xae, 0xa3, 0xf4, 0xe4,
1142 0xbe, 0x9d, 0x91, 0x4e, 0xeb, 0x61, 0xf1, 0x70,
1143 0x2e, 0x69, 0x6c, 0x20, 0x3a, 0x12, 0x68, 0x54 },
1145 .key
= { 0x4a, 0x65, 0x66, 0x65 }, // ("Jefe")
1147 .plaintext
= { 0x77, 0x68, 0x61, 0x74, 0x20, 0x64, 0x6f, 0x20,
1148 0x79, 0x61, 0x20, 0x77, 0x61, 0x6e, 0x74, 0x20, // ("what do ya want ")
1149 0x66, 0x6f, 0x72, 0x20, 0x6e, 0x6f, 0x74, 0x68,
1150 0x69, 0x6e, 0x67, 0x3f }, // ("for nothing?")
1152 .digest
= { 0x16, 0x4b, 0x7a, 0x7b, 0xfc, 0xf8, 0x19, 0xe2,
1153 0xe3, 0x95, 0xfb, 0xe7, 0x3b, 0x56, 0xe0, 0xa3,
1154 0x87, 0xbd, 0x64, 0x22, 0x2e, 0x83, 0x1f, 0xd6,
1155 0x10, 0x27, 0x0c, 0xd7, 0xea, 0x25, 0x05, 0x54,
1156 0x97, 0x58, 0xbf, 0x75, 0xc0, 0x5a, 0x99, 0x4a,
1157 0x6d, 0x03, 0x4f, 0x65, 0xf8, 0xf0, 0xe6, 0xfd,
1158 0xca, 0xea, 0xb1, 0xa3, 0x4d, 0x4a, 0x6b, 0x4b,
1159 0x63, 0x6e, 0x07, 0x0a, 0x38, 0xbc, 0xe7, 0x37 },
1161 .tap
= { 7, 7, 7, 7 }
1163 .key
= { 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1164 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1165 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1166 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1167 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1168 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1169 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1170 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1171 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1172 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1173 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1174 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1175 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1176 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1177 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1178 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1179 0xaa, 0xaa, 0xaa }, // (131 bytes)
1181 .plaintext
= { 0x54, 0x65, 0x73, 0x74, 0x20, 0x55, 0x73, 0x69,
1182 0x6e, 0x67, 0x20, 0x4c, 0x61, 0x72, 0x67, 0x65, // ("Test Using Large")
1183 0x72, 0x20, 0x54, 0x68, 0x61, 0x6e, 0x20, 0x42,
1184 0x6c, 0x6f, 0x63, 0x6b, 0x2d, 0x53, 0x69, 0x7a, // ("r Than Block-Siz")
1185 0x65, 0x20, 0x4b, 0x65, 0x79, 0x20, 0x2d, 0x20,
1186 0x48, 0x61, 0x73, 0x68, 0x20, 0x4b, 0x65, 0x79, // ("e Key - Hash Key")
1187 0x20, 0x46, 0x69, 0x72, 0x73, 0x74 }, // (" First")
1189 .digest
= { 0x80, 0xb2, 0x42, 0x63, 0xc7, 0xc1, 0xa3, 0xeb,
1190 0xb7, 0x14, 0x93, 0xc1, 0xdd, 0x7b, 0xe8, 0xb4,
1191 0x9b, 0x46, 0xd1, 0xf4, 0x1b, 0x4a, 0xee, 0xc1,
1192 0x12, 0x1b, 0x01, 0x37, 0x83, 0xf8, 0xf3, 0x52,
1193 0x6b, 0x56, 0xd0, 0x37, 0xe0, 0x5f, 0x25, 0x98,
1194 0xbd, 0x0f, 0xd2, 0x21, 0x5d, 0x6a, 0x1e, 0x52,
1195 0x95, 0xe6, 0x4f, 0x73, 0xf6, 0x3f, 0x0a, 0xec,
1196 0x8b, 0x91, 0x5a, 0x98, 0x5d, 0x78, 0x65, 0x98 },
1198 .key
= { 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1199 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1200 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1201 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1202 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1203 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1204 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1205 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1206 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1207 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1208 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1209 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1210 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1211 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1212 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1213 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
1214 0xaa, 0xaa, 0xaa }, // (131 bytes)
1216 .plaintext
= { 0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20,
1217 0x61, 0x20, 0x74, 0x65, 0x73, 0x74, 0x20, 0x75, // ("This is a test u")
1218 0x73, 0x69, 0x6e, 0x67, 0x20, 0x61, 0x20, 0x6c,
1219 0x61, 0x72, 0x67, 0x65, 0x72, 0x20, 0x74, 0x68, // ("sing a larger th")
1220 0x61, 0x6e, 0x20, 0x62, 0x6c, 0x6f, 0x63, 0x6b,
1221 0x2d, 0x73, 0x69, 0x7a, 0x65, 0x20, 0x6b, 0x65, // ("an block-size ke")
1222 0x79, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x61, 0x20,
1223 0x6c, 0x61, 0x72, 0x67, 0x65, 0x72, 0x20, 0x74, // ("y and a larger t")
1224 0x68, 0x61, 0x6e, 0x20, 0x62, 0x6c, 0x6f, 0x63,
1225 0x6b, 0x2d, 0x73, 0x69, 0x7a, 0x65, 0x20, 0x64, // ("han block-size d")
1226 0x61, 0x74, 0x61, 0x2e, 0x20, 0x54, 0x68, 0x65,
1227 0x20, 0x6b, 0x65, 0x79, 0x20, 0x6e, 0x65, 0x65, // ("ata. The key nee")
1228 0x64, 0x73, 0x20, 0x74, 0x6f, 0x20, 0x62, 0x65,
1229 0x20, 0x68, 0x61, 0x73, 0x68, 0x65, 0x64, 0x20, // ("ds to be hashed ")
1230 0x62, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x20, 0x62,
1231 0x65, 0x69, 0x6e, 0x67, 0x20, 0x75, 0x73, 0x65, // ("before being use")
1232 0x64, 0x20, 0x62, 0x79, 0x20, 0x74, 0x68, 0x65,
1233 0x20, 0x48, 0x4d, 0x41, 0x43, 0x20, 0x61, 0x6c, // ("d by the HMAC al")
1234 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x2e }, // ("gorithm.")
1236 .digest
= { 0xe3, 0x7b, 0x6a, 0x77, 0x5d, 0xc8, 0x7d, 0xba,
1237 0xa4, 0xdf, 0xa9, 0xf9, 0x6e, 0x5e, 0x3f, 0xfd,
1238 0xde, 0xbd, 0x71, 0xf8, 0x86, 0x72, 0x89, 0x86,
1239 0x5d, 0xf5, 0xa3, 0x2d, 0x20, 0xcd, 0xc9, 0x44,
1240 0xb6, 0x02, 0x2c, 0xac, 0x3c, 0x49, 0x82, 0xb1,
1241 0x0d, 0x5e, 0xeb, 0x55, 0xc3, 0xe4, 0xde, 0x15,
1242 0x13, 0x46, 0x76, 0xfb, 0x6d, 0xe0, 0x44, 0x60,
1243 0x65, 0xc9, 0x74, 0x40, 0xfa, 0x8c, 0x6a, 0x58 },
1250 #define DES_ENC_TEST_VECTORS 10
1251 #define DES_DEC_TEST_VECTORS 4
1252 #define DES_CBC_ENC_TEST_VECTORS 5
1253 #define DES_CBC_DEC_TEST_VECTORS 4
1254 #define DES3_EDE_ENC_TEST_VECTORS 3
1255 #define DES3_EDE_DEC_TEST_VECTORS 3
1257 static struct cipher_testvec des_enc_tv_template
[] = {
1258 { /* From Applied Cryptography */
1259 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1261 .input
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xe7 },
1263 .result
= { 0xc9, 0x57, 0x44, 0x25, 0x6a, 0x5e, 0xd3, 0x1d },
1265 }, { /* Same key, different plaintext block */
1266 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1268 .input
= { 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99 },
1270 .result
= { 0xf7, 0x9c, 0x89, 0x2a, 0x33, 0x8f, 0x4a, 0x8b },
1272 }, { /* Sbox test from NBS */
1273 .key
= { 0x7c, 0xa1, 0x10, 0x45, 0x4a, 0x1a, 0x6e, 0x57 },
1275 .input
= { 0x01, 0xa1, 0xd6, 0xd0, 0x39, 0x77, 0x67, 0x42 },
1277 .result
= { 0x69, 0x0f, 0x5b, 0x0d, 0x9a, 0x26, 0x93, 0x9b },
1279 }, { /* Three blocks */
1280 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1282 .input
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xe7,
1283 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99,
1284 0xca, 0xfe, 0xba, 0xbe, 0xfe, 0xed, 0xbe, 0xef },
1286 .result
= { 0xc9, 0x57, 0x44, 0x25, 0x6a, 0x5e, 0xd3, 0x1d,
1287 0xf7, 0x9c, 0x89, 0x2a, 0x33, 0x8f, 0x4a, 0x8b,
1288 0xb4, 0x99, 0x26, 0xf7, 0x1f, 0xe1, 0xd4, 0x90 },
1293 .key
= { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 },
1295 .input
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xe7 },
1297 .result
= { 0xc9, 0x57, 0x44, 0x25, 0x6a, 0x5e, 0xd3, 0x1d },
1299 }, { /* Two blocks -- for testing encryption across pages */
1300 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1302 .input
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xe7,
1303 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99 },
1305 .result
= { 0xc9, 0x57, 0x44, 0x25, 0x6a, 0x5e, 0xd3, 0x1d,
1306 0xf7, 0x9c, 0x89, 0x2a, 0x33, 0x8f, 0x4a, 0x8b },
1310 }, { /* Four blocks -- for testing encryption with chunking */
1311 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1313 .input
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xe7,
1314 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99,
1315 0xca, 0xfe, 0xba, 0xbe, 0xfe, 0xed, 0xbe, 0xef,
1316 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99 },
1318 .result
= { 0xc9, 0x57, 0x44, 0x25, 0x6a, 0x5e, 0xd3, 0x1d,
1319 0xf7, 0x9c, 0x89, 0x2a, 0x33, 0x8f, 0x4a, 0x8b,
1320 0xb4, 0x99, 0x26, 0xf7, 0x1f, 0xe1, 0xd4, 0x90,
1321 0xf7, 0x9c, 0x89, 0x2a, 0x33, 0x8f, 0x4a, 0x8b },
1324 .tap
= { 14, 10, 8 }
1326 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1328 .input
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xe7,
1329 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99,
1330 0xca, 0xfe, 0xba, 0xbe, 0xfe, 0xed, 0xbe, 0xef },
1332 .result
= { 0xc9, 0x57, 0x44, 0x25, 0x6a, 0x5e, 0xd3, 0x1d,
1333 0xf7, 0x9c, 0x89, 0x2a, 0x33, 0x8f, 0x4a, 0x8b,
1334 0xb4, 0x99, 0x26, 0xf7, 0x1f, 0xe1, 0xd4, 0x90 },
1337 .tap
= { 2, 1, 3, 18 }
1339 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1341 .input
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xe7,
1342 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99 },
1344 .result
= { 0xc9, 0x57, 0x44, 0x25, 0x6a, 0x5e, 0xd3, 0x1d,
1345 0xf7, 0x9c, 0x89, 0x2a, 0x33, 0x8f, 0x4a, 0x8b },
1348 .tap
= { 2, 2, 2, 2, 8 }
1350 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1352 .input
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xe7 },
1354 .result
= { 0xc9, 0x57, 0x44, 0x25, 0x6a, 0x5e, 0xd3, 0x1d },
1357 .tap
= { 1, 1, 1, 1, 1, 1, 1, 1 }
1361 static struct cipher_testvec des_dec_tv_template
[] = {
1362 { /* From Applied Cryptography */
1363 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1365 .input
= { 0xc9, 0x57, 0x44, 0x25, 0x6a, 0x5e, 0xd3, 0x1d },
1367 .result
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xe7 },
1369 }, { /* Sbox test from NBS */
1370 .key
= { 0x7c, 0xa1, 0x10, 0x45, 0x4a, 0x1a, 0x6e, 0x57 },
1372 .input
= { 0x69, 0x0f, 0x5b, 0x0d, 0x9a, 0x26, 0x93, 0x9b },
1374 .result
= { 0x01, 0xa1, 0xd6, 0xd0, 0x39, 0x77, 0x67, 0x42 },
1376 }, { /* Two blocks, for chunking test */
1377 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1379 .input
= { 0xc9, 0x57, 0x44, 0x25, 0x6a, 0x5e, 0xd3, 0x1d,
1380 0x69, 0x0f, 0x5b, 0x0d, 0x9a, 0x26, 0x93, 0x9b },
1382 .result
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xe7,
1383 0xa3, 0x99, 0x7b, 0xca, 0xaf, 0x69, 0xa0, 0xf5 },
1388 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1390 .input
= { 0xc9, 0x57, 0x44, 0x25, 0x6a, 0x5e, 0xd3, 0x1d,
1391 0x69, 0x0f, 0x5b, 0x0d, 0x9a, 0x26, 0x93, 0x9b },
1393 .result
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xe7,
1394 0xa3, 0x99, 0x7b, 0xca, 0xaf, 0x69, 0xa0, 0xf5 },
1401 static struct cipher_testvec des_cbc_enc_tv_template
[] = {
1402 { /* From OpenSSL */
1403 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef},
1405 .iv
= { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10},
1406 .input
= { 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x31, 0x20,
1407 0x4e, 0x6f, 0x77, 0x20, 0x69, 0x73, 0x20, 0x74,
1408 0x68, 0x65, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x20 },
1410 .result
= { 0xcc, 0xd1, 0x73, 0xff, 0xab, 0x20, 0x39, 0xf4,
1411 0xac, 0xd8, 0xae, 0xfd, 0xdf, 0xd8, 0xa1, 0xeb,
1412 0x46, 0x8e, 0x91, 0x15, 0x78, 0x88, 0xba, 0x68 },
1414 }, { /* FIPS Pub 81 */
1415 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1417 .iv
= { 0x12, 0x34, 0x56, 0x78, 0x90, 0xab, 0xcd, 0xef },
1418 .input
= { 0x4e, 0x6f, 0x77, 0x20, 0x69, 0x73, 0x20, 0x74 },
1420 .result
= { 0xe5, 0xc7, 0xcd, 0xde, 0x87, 0x2b, 0xf2, 0x7c },
1423 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1425 .iv
= { 0xe5, 0xc7, 0xcd, 0xde, 0x87, 0x2b, 0xf2, 0x7c },
1426 .input
= { 0x68, 0x65, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x20 },
1428 .result
= { 0x43, 0xe9, 0x34, 0x00, 0x8c, 0x38, 0x9c, 0x0f },
1431 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1433 .iv
= { 0x43, 0xe9, 0x34, 0x00, 0x8c, 0x38, 0x9c, 0x0f },
1434 .input
= { 0x66, 0x6f, 0x72, 0x20, 0x61, 0x6c, 0x6c, 0x20 },
1436 .result
= { 0x68, 0x37, 0x88, 0x49, 0x9a, 0x7c, 0x05, 0xf6 },
1438 }, { /* Copy of openssl vector for chunk testing */
1440 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef},
1442 .iv
= { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10},
1443 .input
= { 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x31, 0x20,
1444 0x4e, 0x6f, 0x77, 0x20, 0x69, 0x73, 0x20, 0x74,
1445 0x68, 0x65, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x20 },
1447 .result
= { 0xcc, 0xd1, 0x73, 0xff, 0xab, 0x20, 0x39, 0xf4,
1448 0xac, 0xd8, 0xae, 0xfd, 0xdf, 0xd8, 0xa1, 0xeb,
1449 0x46, 0x8e, 0x91, 0x15, 0x78, 0x88, 0xba, 0x68 },
1456 static struct cipher_testvec des_cbc_dec_tv_template
[] = {
1458 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1460 .iv
= { 0x12, 0x34, 0x56, 0x78, 0x90, 0xab, 0xcd, 0xef },
1461 .input
= { 0xe5, 0xc7, 0xcd, 0xde, 0x87, 0x2b, 0xf2, 0x7c },
1463 .result
= { 0x4e, 0x6f, 0x77, 0x20, 0x69, 0x73, 0x20, 0x74 },
1466 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1468 .iv
= { 0xe5, 0xc7, 0xcd, 0xde, 0x87, 0x2b, 0xf2, 0x7c },
1469 .input
= { 0x43, 0xe9, 0x34, 0x00, 0x8c, 0x38, 0x9c, 0x0f },
1471 .result
= { 0x68, 0x65, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x20 },
1474 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1476 .iv
= { 0x43, 0xe9, 0x34, 0x00, 0x8c, 0x38, 0x9c, 0x0f },
1477 .input
= { 0x68, 0x37, 0x88, 0x49, 0x9a, 0x7c, 0x05, 0xf6 },
1479 .result
= { 0x66, 0x6f, 0x72, 0x20, 0x61, 0x6c, 0x6c, 0x20 },
1481 }, { /* Copy of above, for chunk testing */
1482 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1484 .iv
= { 0x43, 0xe9, 0x34, 0x00, 0x8c, 0x38, 0x9c, 0x0f },
1485 .input
= { 0x68, 0x37, 0x88, 0x49, 0x9a, 0x7c, 0x05, 0xf6 },
1487 .result
= { 0x66, 0x6f, 0x72, 0x20, 0x61, 0x6c, 0x6c, 0x20 },
1495 * We really need some more test vectors, especially for DES3 CBC.
1497 static struct cipher_testvec des3_ede_enc_tv_template
[] = {
1498 { /* These are from openssl */
1499 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
1500 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
1501 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10},
1503 .input
= { 0x73, 0x6f, 0x6d, 0x65, 0x64, 0x61, 0x74, 0x61 },
1505 .result
= { 0x18, 0xd7, 0x48, 0xe5, 0x63, 0x62, 0x05, 0x72 },
1508 .key
= { 0x03, 0x52, 0x02, 0x07, 0x67, 0x20, 0x82, 0x17,
1509 0x86, 0x02, 0x87, 0x66, 0x59, 0x08, 0x21, 0x98,
1510 0x64, 0x05, 0x6a, 0xbd, 0xfe, 0xa9, 0x34, 0x57 },
1512 .input
= { 0x73, 0x71, 0x75, 0x69, 0x67, 0x67, 0x6c, 0x65 },
1514 .result
= { 0xc0, 0x7d, 0x2a, 0x0f, 0xa5, 0x66, 0xfa, 0x30 },
1517 .key
= { 0x10, 0x46, 0x10, 0x34, 0x89, 0x98, 0x80, 0x20,
1518 0x91, 0x07, 0xd0, 0x15, 0x89, 0x19, 0x01, 0x01,
1519 0x19, 0x07, 0x92, 0x10, 0x98, 0x1a, 0x01, 0x01 },
1521 .input
= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
1523 .result
= { 0xe1, 0xef, 0x62, 0xc3, 0x32, 0xfe, 0x82, 0x5b },
1528 static struct cipher_testvec des3_ede_dec_tv_template
[] = {
1529 { /* These are from openssl */
1530 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
1531 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
1532 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10},
1534 .input
= { 0x18, 0xd7, 0x48, 0xe5, 0x63, 0x62, 0x05, 0x72 },
1536 .result
= { 0x73, 0x6f, 0x6d, 0x65, 0x64, 0x61, 0x74, 0x61 },
1539 .key
= { 0x03, 0x52, 0x02, 0x07, 0x67, 0x20, 0x82, 0x17,
1540 0x86, 0x02, 0x87, 0x66, 0x59, 0x08, 0x21, 0x98,
1541 0x64, 0x05, 0x6a, 0xbd, 0xfe, 0xa9, 0x34, 0x57 },
1543 .input
= { 0xc0, 0x7d, 0x2a, 0x0f, 0xa5, 0x66, 0xfa, 0x30 },
1545 .result
= { 0x73, 0x71, 0x75, 0x69, 0x67, 0x67, 0x6c, 0x65 },
1548 .key
= { 0x10, 0x46, 0x10, 0x34, 0x89, 0x98, 0x80, 0x20,
1549 0x91, 0x07, 0xd0, 0x15, 0x89, 0x19, 0x01, 0x01,
1550 0x19, 0x07, 0x92, 0x10, 0x98, 0x1a, 0x01, 0x01 },
1552 .input
= { 0xe1, 0xef, 0x62, 0xc3, 0x32, 0xfe, 0x82, 0x5b },
1554 .result
= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
1560 * Blowfish test vectors.
1562 #define BF_ENC_TEST_VECTORS 6
1563 #define BF_DEC_TEST_VECTORS 6
1564 #define BF_CBC_ENC_TEST_VECTORS 1
1565 #define BF_CBC_DEC_TEST_VECTORS 1
1567 static struct cipher_testvec bf_enc_tv_template
[] = {
1568 { /* DES test vectors from OpenSSL */
1569 .key
= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, },
1571 .input
= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
1573 .result
= { 0x4e, 0xf9, 0x97, 0x45, 0x61, 0x98, 0xdd, 0x78 },
1576 .key
= { 0x1f, 0x1f, 0x1f, 0x1f, 0x0e, 0x0e, 0x0e, 0x0e },
1578 .input
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1580 .result
= { 0xa7, 0x90, 0x79, 0x51, 0x08, 0xea, 0x3c, 0xae },
1583 .key
= { 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87 },
1585 .input
= { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 },
1587 .result
= { 0xe8, 0x7a, 0x24, 0x4e, 0x2c, 0xc8, 0x5e, 0x82 },
1589 }, { /* Vary the keylength... */
1590 .key
= { 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87,
1591 0x78, 0x69, 0x5a, 0x4b, 0x3c, 0x2d, 0x1e, 0x0f },
1593 .input
= { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 },
1595 .result
= { 0x93, 0x14, 0x28, 0x87, 0xee, 0x3b, 0xe1, 0x5c },
1598 .key
= { 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87,
1599 0x78, 0x69, 0x5a, 0x4b, 0x3c, 0x2d, 0x1e, 0x0f,
1600 0x00, 0x11, 0x22, 0x33, 0x44 },
1602 .input
= { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 },
1604 .result
= { 0xe6, 0xf5, 0x1e, 0xd7, 0x9b, 0x9d, 0xb2, 0x1f },
1606 }, { /* Generated with bf488 */
1607 .key
= { 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87,
1608 0x78, 0x69, 0x5a, 0x4b, 0x3c, 0x2d, 0x1e, 0x0f,
1609 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
1610 0x04, 0x68, 0x91, 0x04, 0xc2, 0xfd, 0x3b, 0x2f,
1611 0x58, 0x40, 0x23, 0x64, 0x1a, 0xba, 0x61, 0x76,
1612 0x1f, 0x1f, 0x1f, 0x1f, 0x0e, 0x0e, 0x0e, 0x0e,
1613 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff },
1615 .input
= { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 },
1617 .result
= { 0xc0, 0x45, 0x04, 0x01, 0x2e, 0x4e, 0x1f, 0x53 },
1622 static struct cipher_testvec bf_dec_tv_template
[] = {
1623 { /* DES test vectors from OpenSSL */
1624 .key
= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
1626 .input
= { 0x4e, 0xf9, 0x97, 0x45, 0x61, 0x98, 0xdd, 0x78 },
1628 .result
= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
1631 .key
= { 0x1f, 0x1f, 0x1f, 0x1f, 0x0e, 0x0e, 0x0e, 0x0e },
1633 .input
= { 0xa7, 0x90, 0x79, 0x51, 0x08, 0xea, 0x3c, 0xae },
1635 .result
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1638 .key
= { 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87 },
1640 .input
= { 0xe8, 0x7a, 0x24, 0x4e, 0x2c, 0xc8, 0x5e, 0x82 },
1642 .result
= { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 },
1644 }, { /* Vary the keylength... */
1645 .key
= { 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87,
1646 0x78, 0x69, 0x5a, 0x4b, 0x3c, 0x2d, 0x1e, 0x0f },
1648 .input
= { 0x93, 0x14, 0x28, 0x87, 0xee, 0x3b, 0xe1, 0x5c },
1650 .result
= { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 },
1653 .key
= { 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87,
1654 0x78, 0x69, 0x5a, 0x4b, 0x3c, 0x2d, 0x1e, 0x0f,
1655 0x00, 0x11, 0x22, 0x33, 0x44 },
1657 .input
= { 0xe6, 0xf5, 0x1e, 0xd7, 0x9b, 0x9d, 0xb2, 0x1f },
1659 .result
= { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 },
1661 }, { /* Generated with bf488, using OpenSSL, Libgcrypt and Nettle */
1662 .key
= { 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87,
1663 0x78, 0x69, 0x5a, 0x4b, 0x3c, 0x2d, 0x1e, 0x0f,
1664 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
1665 0x04, 0x68, 0x91, 0x04, 0xc2, 0xfd, 0x3b, 0x2f,
1666 0x58, 0x40, 0x23, 0x64, 0x1a, 0xba, 0x61, 0x76,
1667 0x1f, 0x1f, 0x1f, 0x1f, 0x0e, 0x0e, 0x0e, 0x0e,
1668 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff },
1670 .input
= { 0xc0, 0x45, 0x04, 0x01, 0x2e, 0x4e, 0x1f, 0x53 },
1672 .result
= { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 },
1677 static struct cipher_testvec bf_cbc_enc_tv_template
[] = {
1678 { /* From OpenSSL */
1679 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
1680 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87 },
1682 .iv
= { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 },
1683 .input
= { 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x31, 0x20,
1684 0x4e, 0x6f, 0x77, 0x20, 0x69, 0x73, 0x20, 0x74,
1685 0x68, 0x65, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x20,
1686 0x66, 0x6f, 0x72, 0x20, 0x00, 0x00, 0x00, 0x00 },
1688 .result
= { 0x6b, 0x77, 0xb4, 0xd6, 0x30, 0x06, 0xde, 0xe6,
1689 0x05, 0xb1, 0x56, 0xe2, 0x74, 0x03, 0x97, 0x93,
1690 0x58, 0xde, 0xb9, 0xe7, 0x15, 0x46, 0x16, 0xd9,
1691 0x59, 0xf1, 0x65, 0x2b, 0xd5, 0xff, 0x92, 0xcc },
1696 static struct cipher_testvec bf_cbc_dec_tv_template
[] = {
1697 { /* From OpenSSL */
1698 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
1699 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87 },
1701 .iv
= { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 },
1702 .input
= { 0x6b, 0x77, 0xb4, 0xd6, 0x30, 0x06, 0xde, 0xe6,
1703 0x05, 0xb1, 0x56, 0xe2, 0x74, 0x03, 0x97, 0x93,
1704 0x58, 0xde, 0xb9, 0xe7, 0x15, 0x46, 0x16, 0xd9,
1705 0x59, 0xf1, 0x65, 0x2b, 0xd5, 0xff, 0x92, 0xcc },
1707 .result
= { 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x31, 0x20,
1708 0x4e, 0x6f, 0x77, 0x20, 0x69, 0x73, 0x20, 0x74,
1709 0x68, 0x65, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x20,
1710 0x66, 0x6f, 0x72, 0x20, 0x00, 0x00, 0x00, 0x00 },
1716 * Twofish test vectors.
1718 #define TF_ENC_TEST_VECTORS 3
1719 #define TF_DEC_TEST_VECTORS 3
1720 #define TF_CBC_ENC_TEST_VECTORS 4
1721 #define TF_CBC_DEC_TEST_VECTORS 4
1723 static struct cipher_testvec tf_enc_tv_template
[] = {
1725 .key
= { [0 ... 15] = 0x00 },
1727 .input
= { [0 ... 15] = 0x00 },
1729 .result
= { 0x9f, 0x58, 0x9f, 0x5c, 0xf6, 0x12, 0x2c, 0x32,
1730 0xb6, 0xbf, 0xec, 0x2f, 0x2a, 0xe8, 0xc3, 0x5a },
1733 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
1734 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10,
1735 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77 },
1737 .input
= { [0 ... 15] = 0x00 },
1739 .result
= { 0xcf, 0xd1, 0xd2, 0xe5, 0xa9, 0xbe, 0x9c, 0xdf,
1740 0x50, 0x1f, 0x13, 0xb8, 0x92, 0xbd, 0x22, 0x48 },
1743 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
1744 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10,
1745 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
1746 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff },
1748 .input
= { [0 ... 15] = 0x00 },
1750 .result
= { 0x37, 0x52, 0x7b, 0xe0, 0x05, 0x23, 0x34, 0xb8,
1751 0x9f, 0x0c, 0xfc, 0xca, 0xe8, 0x7c, 0xfa, 0x20 },
1756 static struct cipher_testvec tf_dec_tv_template
[] = {
1758 .key
= { [0 ... 15] = 0x00 },
1760 .input
= { 0x9f, 0x58, 0x9f, 0x5c, 0xf6, 0x12, 0x2c, 0x32,
1761 0xb6, 0xbf, 0xec, 0x2f, 0x2a, 0xe8, 0xc3, 0x5a },
1763 .result
= { [0 ... 15] = 0x00 },
1766 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
1767 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10,
1768 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77 },
1770 .input
= { 0xcf, 0xd1, 0xd2, 0xe5, 0xa9, 0xbe, 0x9c, 0xdf,
1771 0x50, 0x1f, 0x13, 0xb8, 0x92, 0xbd, 0x22, 0x48 },
1773 .result
= { [0 ... 15] = 0x00 },
1776 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
1777 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10,
1778 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
1779 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff },
1781 .input
= { 0x37, 0x52, 0x7b, 0xe0, 0x05, 0x23, 0x34, 0xb8,
1782 0x9f, 0x0c, 0xfc, 0xca, 0xe8, 0x7c, 0xfa, 0x20 },
1784 .result
= { [0 ... 15] = 0x00 },
1789 static struct cipher_testvec tf_cbc_enc_tv_template
[] = {
1790 { /* Generated with Nettle */
1791 .key
= { [0 ... 15] = 0x00 },
1793 .iv
= { [0 ... 15] = 0x00 },
1794 .input
= { [0 ... 15] = 0x00 },
1796 .result
= { 0x9f, 0x58, 0x9f, 0x5c, 0xf6, 0x12, 0x2c, 0x32,
1797 0xb6, 0xbf, 0xec, 0x2f, 0x2a, 0xe8, 0xc3, 0x5a },
1800 .key
= { [0 ... 15] = 0x00 },
1802 .iv
= { 0x9f, 0x58, 0x9f, 0x5c, 0xf6, 0x12, 0x2c, 0x32,
1803 0xb6, 0xbf, 0xec, 0x2f, 0x2a, 0xe8, 0xc3, 0x5a },
1804 .input
= { [0 ... 15] = 0x00 },
1806 .result
= { 0xd4, 0x91, 0xdb, 0x16, 0xe7, 0xb1, 0xc3, 0x9e,
1807 0x86, 0xcb, 0x08, 0x6b, 0x78, 0x9f, 0x54, 0x19 },
1810 .key
= { [0 ... 15] = 0x00 },
1812 .iv
= { 0xd4, 0x91, 0xdb, 0x16, 0xe7, 0xb1, 0xc3, 0x9e,
1813 0x86, 0xcb, 0x08, 0x6b, 0x78, 0x9f, 0x54, 0x19 },
1814 .input
= { [0 ... 15] = 0x00 },
1816 .result
= { 0x05, 0xef, 0x8c, 0x61, 0xa8, 0x11, 0x58, 0x26,
1817 0x34, 0xba, 0x5c, 0xb7, 0x10, 0x6a, 0xa6, 0x41 },
1820 .key
= { [0 ... 15] = 0x00 },
1822 .iv
= { [0 ... 15] = 0x00 },
1823 .input
= { [0 ... 47] = 0x00 },
1825 .result
= { 0x9f, 0x58, 0x9f, 0x5c, 0xf6, 0x12, 0x2c, 0x32,
1826 0xb6, 0xbf, 0xec, 0x2f, 0x2a, 0xe8, 0xc3, 0x5a,
1827 0xd4, 0x91, 0xdb, 0x16, 0xe7, 0xb1, 0xc3, 0x9e,
1828 0x86, 0xcb, 0x08, 0x6b, 0x78, 0x9f, 0x54, 0x19,
1829 0x05, 0xef, 0x8c, 0x61, 0xa8, 0x11, 0x58, 0x26,
1830 0x34, 0xba, 0x5c, 0xb7, 0x10, 0x6a, 0xa6, 0x41 },
1835 static struct cipher_testvec tf_cbc_dec_tv_template
[] = {
1836 { /* Reverse of the first four above */
1837 .key
= { [0 ... 15] = 0x00 },
1839 .iv
= { [0 ... 15] = 0x00 },
1840 .input
= { 0x9f, 0x58, 0x9f, 0x5c, 0xf6, 0x12, 0x2c, 0x32,
1841 0xb6, 0xbf, 0xec, 0x2f, 0x2a, 0xe8, 0xc3, 0x5a },
1843 .result
= { [0 ... 15] = 0x00 },
1846 .key
= { [0 ... 15] = 0x00 },
1848 .iv
= { 0x9f, 0x58, 0x9f, 0x5c, 0xf6, 0x12, 0x2c, 0x32,
1849 0xb6, 0xbf, 0xec, 0x2f, 0x2a, 0xe8, 0xc3, 0x5a },
1850 .input
= { 0xd4, 0x91, 0xdb, 0x16, 0xe7, 0xb1, 0xc3, 0x9e,
1851 0x86, 0xcb, 0x08, 0x6b, 0x78, 0x9f, 0x54, 0x19 },
1853 .result
= { [0 ... 15] = 0x00 },
1856 .key
= { [0 ... 15] = 0x00 },
1858 .iv
= { 0xd4, 0x91, 0xdb, 0x16, 0xe7, 0xb1, 0xc3, 0x9e,
1859 0x86, 0xcb, 0x08, 0x6b, 0x78, 0x9f, 0x54, 0x19 },
1860 .input
= { 0x05, 0xef, 0x8c, 0x61, 0xa8, 0x11, 0x58, 0x26,
1861 0x34, 0xba, 0x5c, 0xb7, 0x10, 0x6a, 0xa6, 0x41 },
1863 .result
= { [0 ... 15] = 0x00 },
1866 .key
= { [0 ... 15] = 0x00 },
1868 .iv
= { [0 ... 15] = 0x00 },
1869 .input
= { 0x9f, 0x58, 0x9f, 0x5c, 0xf6, 0x12, 0x2c, 0x32,
1870 0xb6, 0xbf, 0xec, 0x2f, 0x2a, 0xe8, 0xc3, 0x5a,
1871 0xd4, 0x91, 0xdb, 0x16, 0xe7, 0xb1, 0xc3, 0x9e,
1872 0x86, 0xcb, 0x08, 0x6b, 0x78, 0x9f, 0x54, 0x19,
1873 0x05, 0xef, 0x8c, 0x61, 0xa8, 0x11, 0x58, 0x26,
1874 0x34, 0xba, 0x5c, 0xb7, 0x10, 0x6a, 0xa6, 0x41 },
1876 .result
= { [0 ... 47] = 0x00 },
1882 * Serpent test vectors. These are backwards because Serpent writes
1883 * octet sequences in right-to-left mode.
1885 #define SERPENT_ENC_TEST_VECTORS 4
1886 #define SERPENT_DEC_TEST_VECTORS 4
1888 #define TNEPRES_ENC_TEST_VECTORS 4
1889 #define TNEPRES_DEC_TEST_VECTORS 4
1891 static struct cipher_testvec serpent_enc_tv_template
[] = {
1893 .input
= { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1894 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
1896 .result
= { 0x12, 0x07, 0xfc, 0xce, 0x9b, 0xd0, 0xd6, 0x47,
1897 0x6a, 0xe9, 0x8f, 0xbe, 0xd1, 0x43, 0xa0, 0xe2 },
1900 .key
= { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1901 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
1903 .input
= { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1904 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
1906 .result
= { 0x4c, 0x7d, 0x8a, 0x32, 0x80, 0x72, 0xa2, 0x2c,
1907 0x82, 0x3e, 0x4a, 0x1f, 0x3a, 0xcd, 0xa1, 0x6d },
1910 .key
= { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1911 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
1912 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
1913 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f },
1915 .input
= { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1916 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
1918 .result
= { 0xde, 0x26, 0x9f, 0xf8, 0x33, 0xe4, 0x32, 0xb8,
1919 0x5b, 0x2e, 0x88, 0xd2, 0x70, 0x1c, 0xe7, 0x5c },
1922 .key
= { [15] = 0x80 },
1924 .input
= { [0 ... 15] = 0x00 },
1926 .result
= { 0xdd, 0xd2, 0x6b, 0x98, 0xa5, 0xff, 0xd8, 0x2c,
1927 0x05, 0x34, 0x5a, 0x9d, 0xad, 0xbf, 0xaf, 0x49},
1932 static struct cipher_testvec tnepres_enc_tv_template
[] = {
1933 { /* KeySize=128, PT=0, I=1 */
1934 .input
= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1935 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
1936 .key
= { 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1937 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
1940 .result
= { 0x49, 0xaf, 0xbf, 0xad, 0x9d, 0x5a, 0x34, 0x05,
1941 0x2c, 0xd8, 0xff, 0xa5, 0x98, 0x6b, 0xd2, 0xdd },
1943 }, { /* KeySize=192, PT=0, I=1 */
1944 .key
= { 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1945 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1946 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
1948 .input
= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1949 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
1951 .result
= { 0xe7, 0x8e, 0x54, 0x02, 0xc7, 0x19, 0x55, 0x68,
1952 0xac, 0x36, 0x78, 0xf7, 0xa3, 0xf6, 0x0c, 0x66 },
1954 }, { /* KeySize=256, PT=0, I=1 */
1955 .key
= { 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1956 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1957 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1958 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
1960 .input
= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1961 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
1963 .result
= { 0xab, 0xed, 0x96, 0xe7, 0x66, 0xbf, 0x28, 0xcb,
1964 0xc0, 0xeb, 0xd2, 0x1a, 0x82, 0xef, 0x08, 0x19 },
1966 }, { /* KeySize=256, I=257 */
1967 .key
= { 0x1f, 0x1e, 0x1d, 0x1c, 0x1b, 0x1a, 0x19, 0x18,
1968 0x17, 0x16, 0x15, 0x14, 0x13, 0x12, 0x11, 0x10,
1969 0x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x08,
1970 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00 },
1972 .input
= { 0x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x08,
1973 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00 },
1975 .result
= { 0x5c, 0xe7, 0x1c, 0x70, 0xd2, 0x88, 0x2e, 0x5b,
1976 0xb8, 0x32, 0xe4, 0x33, 0xf8, 0x9f, 0x26, 0xde },
1982 static struct cipher_testvec serpent_dec_tv_template
[] = {
1984 .input
= { 0x12, 0x07, 0xfc, 0xce, 0x9b, 0xd0, 0xd6, 0x47,
1985 0x6a, 0xe9, 0x8f, 0xbe, 0xd1, 0x43, 0xa0, 0xe2 },
1987 .result
= { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1988 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
1991 .key
= { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1992 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
1994 .input
= { 0x4c, 0x7d, 0x8a, 0x32, 0x80, 0x72, 0xa2, 0x2c,
1995 0x82, 0x3e, 0x4a, 0x1f, 0x3a, 0xcd, 0xa1, 0x6d },
1997 .result
= { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1998 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
2001 .key
= { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
2002 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
2003 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
2004 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f },
2006 .input
= { 0xde, 0x26, 0x9f, 0xf8, 0x33, 0xe4, 0x32, 0xb8,
2007 0x5b, 0x2e, 0x88, 0xd2, 0x70, 0x1c, 0xe7, 0x5c },
2009 .result
= { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
2010 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
2013 .key
= { [15] = 0x80 },
2015 .input
= { 0xdd, 0xd2, 0x6b, 0x98, 0xa5, 0xff, 0xd8, 0x2c,
2016 0x05, 0x34, 0x5a, 0x9d, 0xad, 0xbf, 0xaf, 0x49},
2018 .result
= { [0 ... 15] = 0x00 },
2023 static struct cipher_testvec tnepres_dec_tv_template
[] = {
2025 .input
= { 0x41, 0xcc, 0x6b, 0x31, 0x59, 0x31, 0x45, 0x97,
2026 0x6d, 0x6f, 0xbb, 0x38, 0x4b, 0x37, 0x21, 0x28 },
2028 .result
= { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
2029 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
2032 .key
= { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
2033 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
2035 .input
= { 0xea, 0xf4, 0xd7, 0xfc, 0xd8, 0x01, 0x34, 0x47,
2036 0x81, 0x45, 0x0b, 0xfa, 0x0c, 0xd6, 0xad, 0x6e },
2038 .result
= { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
2039 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
2042 .key
= { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
2043 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
2044 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
2045 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f },
2047 .input
= { 0x64, 0xa9, 0x1a, 0x37, 0xed, 0x9f, 0xe7, 0x49,
2048 0xa8, 0x4e, 0x76, 0xd6, 0xf5, 0x0d, 0x78, 0xee },
2050 .result
= { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
2051 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
2053 }, { /* KeySize=128, I=121 */
2054 .key
= { [15] = 0x80 },
2056 .input
= { 0x3d, 0xda, 0xbf, 0xc0, 0x06, 0xda, 0xab, 0x06,
2057 0x46, 0x2a, 0xf4, 0xef, 0x81, 0x54, 0x4e, 0x26 },
2059 .result
= { [0 ... 15] = 0x00 },
2065 /* Cast6 test vectors from RFC 2612 */
2066 #define CAST6_ENC_TEST_VECTORS 3
2067 #define CAST6_DEC_TEST_VECTORS 3
2069 static struct cipher_testvec cast6_enc_tv_template
[] = {
2071 .key
= { 0x23, 0x42, 0xbb, 0x9e, 0xfa, 0x38, 0x54, 0x2c,
2072 0x0a, 0xf7, 0x56, 0x47, 0xf2, 0x9f, 0x61, 0x5d },
2074 .input
= { [0 ... 15] = 0x00 },
2076 .result
= { 0xc8, 0x42, 0xa0, 0x89, 0x72, 0xb4, 0x3d, 0x20,
2077 0x83, 0x6c, 0x91, 0xd1, 0xb7, 0x53, 0x0f, 0x6b },
2080 .key
= { 0x23, 0x42, 0xbb, 0x9e, 0xfa, 0x38, 0x54, 0x2c,
2081 0xbe, 0xd0, 0xac, 0x83, 0x94, 0x0a, 0xc2, 0x98,
2082 0xba, 0xc7, 0x7a, 0x77, 0x17, 0x94, 0x28, 0x63 },
2084 .input
= { [0 ... 15] = 0x00 },
2086 .result
= { 0x1b, 0x38, 0x6c, 0x02, 0x10, 0xdc, 0xad, 0xcb,
2087 0xdd, 0x0e, 0x41, 0xaa, 0x08, 0xa7, 0xa7, 0xe8 },
2090 .key
= { 0x23, 0x42, 0xbb, 0x9e, 0xfa, 0x38, 0x54, 0x2c,
2091 0xbe, 0xd0, 0xac, 0x83, 0x94, 0x0a, 0xc2, 0x98,
2092 0x8d, 0x7c, 0x47, 0xce, 0x26, 0x49, 0x08, 0x46,
2093 0x1c, 0xc1, 0xb5, 0x13, 0x7a, 0xe6, 0xb6, 0x04 },
2095 .input
= { [0 ... 15] = 0x00 },
2097 .result
= { 0x4f, 0x6a, 0x20, 0x38, 0x28, 0x68, 0x97, 0xb9,
2098 0xc9, 0x87, 0x01, 0x36, 0x55, 0x33, 0x17, 0xfa },
2103 static struct cipher_testvec cast6_dec_tv_template
[] = {
2105 .key
= { 0x23, 0x42, 0xbb, 0x9e, 0xfa, 0x38, 0x54, 0x2c,
2106 0x0a, 0xf7, 0x56, 0x47, 0xf2, 0x9f, 0x61, 0x5d },
2108 .input
= { 0xc8, 0x42, 0xa0, 0x89, 0x72, 0xb4, 0x3d, 0x20,
2109 0x83, 0x6c, 0x91, 0xd1, 0xb7, 0x53, 0x0f, 0x6b },
2111 .result
= { [0 ... 15] = 0x00 },
2114 .key
= { 0x23, 0x42, 0xbb, 0x9e, 0xfa, 0x38, 0x54, 0x2c,
2115 0xbe, 0xd0, 0xac, 0x83, 0x94, 0x0a, 0xc2, 0x98,
2116 0xba, 0xc7, 0x7a, 0x77, 0x17, 0x94, 0x28, 0x63 },
2118 .input
= { 0x1b, 0x38, 0x6c, 0x02, 0x10, 0xdc, 0xad, 0xcb,
2119 0xdd, 0x0e, 0x41, 0xaa, 0x08, 0xa7, 0xa7, 0xe8 },
2121 .result
= { [0 ... 15] = 0x00 },
2124 .key
= { 0x23, 0x42, 0xbb, 0x9e, 0xfa, 0x38, 0x54, 0x2c,
2125 0xbe, 0xd0, 0xac, 0x83, 0x94, 0x0a, 0xc2, 0x98,
2126 0x8d, 0x7c, 0x47, 0xce, 0x26, 0x49, 0x08, 0x46,
2127 0x1c, 0xc1, 0xb5, 0x13, 0x7a, 0xe6, 0xb6, 0x04 },
2129 .input
= { 0x4f, 0x6a, 0x20, 0x38, 0x28, 0x68, 0x97, 0xb9,
2130 0xc9, 0x87, 0x01, 0x36, 0x55, 0x33, 0x17, 0xfa },
2132 .result
= { [0 ... 15] = 0x00 },
2141 #define AES_ENC_TEST_VECTORS 3
2142 #define AES_DEC_TEST_VECTORS 3
2143 #define AES_CBC_ENC_TEST_VECTORS 2
2144 #define AES_CBC_DEC_TEST_VECTORS 2
2145 #define AES_LRW_ENC_TEST_VECTORS 8
2146 #define AES_LRW_DEC_TEST_VECTORS 8
2148 static struct cipher_testvec aes_enc_tv_template
[] = {
2149 { /* From FIPS-197 */
2150 .key
= { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
2151 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
2153 .input
= { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
2154 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff },
2156 .result
= { 0x69, 0xc4, 0xe0, 0xd8, 0x6a, 0x7b, 0x04, 0x30,
2157 0xd8, 0xcd, 0xb7, 0x80, 0x70, 0xb4, 0xc5, 0x5a },
2160 .key
= { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
2161 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
2162 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17 },
2164 .input
= { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
2165 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff },
2167 .result
= { 0xdd, 0xa9, 0x7c, 0xa4, 0x86, 0x4c, 0xdf, 0xe0,
2168 0x6e, 0xaf, 0x70, 0xa0, 0xec, 0x0d, 0x71, 0x91 },
2171 .key
= { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
2172 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
2173 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
2174 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f },
2176 .input
= { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
2177 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff },
2179 .result
= { 0x8e, 0xa2, 0xb7, 0xca, 0x51, 0x67, 0x45, 0xbf,
2180 0xea, 0xfc, 0x49, 0x90, 0x4b, 0x49, 0x60, 0x89 },
2185 static struct cipher_testvec aes_dec_tv_template
[] = {
2186 { /* From FIPS-197 */
2187 .key
= { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
2188 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
2190 .input
= { 0x69, 0xc4, 0xe0, 0xd8, 0x6a, 0x7b, 0x04, 0x30,
2191 0xd8, 0xcd, 0xb7, 0x80, 0x70, 0xb4, 0xc5, 0x5a },
2193 .result
= { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
2194 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff },
2197 .key
= { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
2198 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
2199 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17 },
2201 .input
= { 0xdd, 0xa9, 0x7c, 0xa4, 0x86, 0x4c, 0xdf, 0xe0,
2202 0x6e, 0xaf, 0x70, 0xa0, 0xec, 0x0d, 0x71, 0x91 },
2204 .result
= { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
2205 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff },
2208 .key
= { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
2209 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
2210 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
2211 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f },
2213 .input
= { 0x8e, 0xa2, 0xb7, 0xca, 0x51, 0x67, 0x45, 0xbf,
2214 0xea, 0xfc, 0x49, 0x90, 0x4b, 0x49, 0x60, 0x89 },
2216 .result
= { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
2217 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff },
2222 static struct cipher_testvec aes_cbc_enc_tv_template
[] = {
2223 { /* From RFC 3602 */
2224 .key
= { 0x06, 0xa9, 0x21, 0x40, 0x36, 0xb8, 0xa1, 0x5b,
2225 0x51, 0x2e, 0x03, 0xd5, 0x34, 0x12, 0x00, 0x06 },
2227 .iv
= { 0x3d, 0xaf, 0xba, 0x42, 0x9d, 0x9e, 0xb4, 0x30,
2228 0xb4, 0x22, 0xda, 0x80, 0x2c, 0x9f, 0xac, 0x41 },
2229 .input
= { "Single block msg" },
2231 .result
= { 0xe3, 0x53, 0x77, 0x9c, 0x10, 0x79, 0xae, 0xb8,
2232 0x27, 0x08, 0x94, 0x2d, 0xbe, 0x77, 0x18, 0x1a },
2235 .key
= { 0xc2, 0x86, 0x69, 0x6d, 0x88, 0x7c, 0x9a, 0xa0,
2236 0x61, 0x1b, 0xbb, 0x3e, 0x20, 0x25, 0xa4, 0x5a },
2238 .iv
= { 0x56, 0x2e, 0x17, 0x99, 0x6d, 0x09, 0x3d, 0x28,
2239 0xdd, 0xb3, 0xba, 0x69, 0x5a, 0x2e, 0x6f, 0x58 },
2240 .input
= { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
2241 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
2242 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
2243 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f },
2245 .result
= { 0xd2, 0x96, 0xcd, 0x94, 0xc2, 0xcc, 0xcf, 0x8a,
2246 0x3a, 0x86, 0x30, 0x28, 0xb5, 0xe1, 0xdc, 0x0a,
2247 0x75, 0x86, 0x60, 0x2d, 0x25, 0x3c, 0xff, 0xf9,
2248 0x1b, 0x82, 0x66, 0xbe, 0xa6, 0xd6, 0x1a, 0xb1 },
2253 static struct cipher_testvec aes_cbc_dec_tv_template
[] = {
2254 { /* From RFC 3602 */
2255 .key
= { 0x06, 0xa9, 0x21, 0x40, 0x36, 0xb8, 0xa1, 0x5b,
2256 0x51, 0x2e, 0x03, 0xd5, 0x34, 0x12, 0x00, 0x06 },
2258 .iv
= { 0x3d, 0xaf, 0xba, 0x42, 0x9d, 0x9e, 0xb4, 0x30,
2259 0xb4, 0x22, 0xda, 0x80, 0x2c, 0x9f, 0xac, 0x41 },
2260 .input
= { 0xe3, 0x53, 0x77, 0x9c, 0x10, 0x79, 0xae, 0xb8,
2261 0x27, 0x08, 0x94, 0x2d, 0xbe, 0x77, 0x18, 0x1a },
2263 .result
= { "Single block msg" },
2266 .key
= { 0xc2, 0x86, 0x69, 0x6d, 0x88, 0x7c, 0x9a, 0xa0,
2267 0x61, 0x1b, 0xbb, 0x3e, 0x20, 0x25, 0xa4, 0x5a },
2269 .iv
= { 0x56, 0x2e, 0x17, 0x99, 0x6d, 0x09, 0x3d, 0x28,
2270 0xdd, 0xb3, 0xba, 0x69, 0x5a, 0x2e, 0x6f, 0x58 },
2271 .input
= { 0xd2, 0x96, 0xcd, 0x94, 0xc2, 0xcc, 0xcf, 0x8a,
2272 0x3a, 0x86, 0x30, 0x28, 0xb5, 0xe1, 0xdc, 0x0a,
2273 0x75, 0x86, 0x60, 0x2d, 0x25, 0x3c, 0xff, 0xf9,
2274 0x1b, 0x82, 0x66, 0xbe, 0xa6, 0xd6, 0x1a, 0xb1 },
2276 .result
= { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
2277 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
2278 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
2279 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f },
2284 static struct cipher_testvec aes_lrw_enc_tv_template
[] = {
2285 /* from http://grouper.ieee.org/groups/1619/email/pdf00017.pdf */
2286 { /* LRW-32-AES 1 */
2287 .key
= { 0x45, 0x62, 0xac, 0x25, 0xf8, 0x28, 0x17, 0x6d,
2288 0x4c, 0x26, 0x84, 0x14, 0xb5, 0x68, 0x01, 0x85,
2289 0x25, 0x8e, 0x2a, 0x05, 0xe7, 0x3e, 0x9d, 0x03,
2290 0xee, 0x5a, 0x83, 0x0c, 0xcc, 0x09, 0x4c, 0x87 },
2292 .iv
= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2293 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 },
2294 .input
= { 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
2295 0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46 },
2297 .result
= { 0xf1, 0xb2, 0x73, 0xcd, 0x65, 0xa3, 0xdf, 0x5f,
2298 0xe9, 0x5d, 0x48, 0x92, 0x54, 0x63, 0x4e, 0xb8 },
2300 }, { /* LRW-32-AES 2 */
2301 .key
= { 0x59, 0x70, 0x47, 0x14, 0xf5, 0x57, 0x47, 0x8c,
2302 0xd7, 0x79, 0xe8, 0x0f, 0x54, 0x88, 0x79, 0x44,
2303 0x0d, 0x48, 0xf0, 0xb7, 0xb1, 0x5a, 0x53, 0xea,
2304 0x1c, 0xaa, 0x6b, 0x29, 0xc2, 0xca, 0xfb, 0xaf
2307 .iv
= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2308 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02 },
2309 .input
= { 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
2310 0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46 },
2312 .result
= { 0x00, 0xc8, 0x2b, 0xae, 0x95, 0xbb, 0xcd, 0xe5,
2313 0x27, 0x4f, 0x07, 0x69, 0xb2, 0x60, 0xe1, 0x36 },
2315 }, { /* LRW-32-AES 3 */
2316 .key
= { 0xd8, 0x2a, 0x91, 0x34, 0xb2, 0x6a, 0x56, 0x50,
2317 0x30, 0xfe, 0x69, 0xe2, 0x37, 0x7f, 0x98, 0x47,
2318 0xcd, 0xf9, 0x0b, 0x16, 0x0c, 0x64, 0x8f, 0xb6,
2319 0xb0, 0x0d, 0x0d, 0x1b, 0xae, 0x85, 0x87, 0x1f },
2321 .iv
= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2322 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00 },
2323 .input
= { 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
2324 0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46 },
2326 .result
= { 0x76, 0x32, 0x21, 0x83, 0xed, 0x8f, 0xf1, 0x82,
2327 0xf9, 0x59, 0x62, 0x03, 0x69, 0x0e, 0x5e, 0x01 },
2329 }, { /* LRW-32-AES 4 */
2330 .key
= { 0x0f, 0x6a, 0xef, 0xf8, 0xd3, 0xd2, 0xbb, 0x15,
2331 0x25, 0x83, 0xf7, 0x3c, 0x1f, 0x01, 0x28, 0x74,
2332 0xca, 0xc6, 0xbc, 0x35, 0x4d, 0x4a, 0x65, 0x54,
2333 0x90, 0xae, 0x61, 0xcf, 0x7b, 0xae, 0xbd, 0xcc,
2334 0xad, 0xe4, 0x94, 0xc5, 0x4a, 0x29, 0xae, 0x70 },
2336 .iv
= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2337 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 },
2338 .input
= { 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
2339 0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46 },
2341 .result
= { 0x9c, 0x0f, 0x15, 0x2f, 0x55, 0xa2, 0xd8, 0xf0,
2342 0xd6, 0x7b, 0x8f, 0x9e, 0x28, 0x22, 0xbc, 0x41 },
2344 }, { /* LRW-32-AES 5 */
2345 .key
= { 0x8a, 0xd4, 0xee, 0x10, 0x2f, 0xbd, 0x81, 0xff,
2346 0xf8, 0x86, 0xce, 0xac, 0x93, 0xc5, 0xad, 0xc6,
2347 0xa0, 0x19, 0x07, 0xc0, 0x9d, 0xf7, 0xbb, 0xdd,
2348 0x52, 0x13, 0xb2, 0xb7, 0xf0, 0xff, 0x11, 0xd8,
2349 0xd6, 0x08, 0xd0, 0xcd, 0x2e, 0xb1, 0x17, 0x6f },
2351 .iv
= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2352 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00 },
2353 .input
= { 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
2354 0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46 },
2356 .result
= { 0xd4, 0x27, 0x6a, 0x7f, 0x14, 0x91, 0x3d, 0x65,
2357 0xc8, 0x60, 0x48, 0x02, 0x87, 0xe3, 0x34, 0x06 },
2359 }, { /* LRW-32-AES 6 */
2360 .key
= { 0xf8, 0xd4, 0x76, 0xff, 0xd6, 0x46, 0xee, 0x6c,
2361 0x23, 0x84, 0xcb, 0x1c, 0x77, 0xd6, 0x19, 0x5d,
2362 0xfe, 0xf1, 0xa9, 0xf3, 0x7b, 0xbc, 0x8d, 0x21,
2363 0xa7, 0x9c, 0x21, 0xf8, 0xcb, 0x90, 0x02, 0x89,
2364 0xa8, 0x45, 0x34, 0x8e, 0xc8, 0xc5, 0xb5, 0xf1,
2365 0x26, 0xf5, 0x0e, 0x76, 0xfe, 0xfd, 0x1b, 0x1e },
2367 .iv
= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2368 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 },
2369 .input
= { 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
2370 0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46 },
2372 .result
= { 0xbd, 0x06, 0xb8, 0xe1, 0xdb, 0x98, 0x89, 0x9e,
2373 0xc4, 0x98, 0xe4, 0x91, 0xcf, 0x1c, 0x70, 0x2b },
2375 }, { /* LRW-32-AES 7 */
2376 .key
= { 0xfb, 0x76, 0x15, 0xb2, 0x3d, 0x80, 0x89, 0x1d,
2377 0xd4, 0x70, 0x98, 0x0b, 0xc7, 0x95, 0x84, 0xc8,
2378 0xb2, 0xfb, 0x64, 0xce, 0x60, 0x97, 0x87, 0x8d,
2379 0x17, 0xfc, 0xe4, 0x5a, 0x49, 0xe8, 0x30, 0xb7,
2380 0x6e, 0x78, 0x17, 0xe7, 0x2d, 0x5e, 0x12, 0xd4,
2381 0x60, 0x64, 0x04, 0x7a, 0xf1, 0x2f, 0x9e, 0x0c },
2383 .iv
= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2384 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00 },
2385 .input
= { 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
2386 0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46 },
2388 .result
= { 0x5b, 0x90, 0x8e, 0xc1, 0xab, 0xdd, 0x67, 0x5f,
2389 0x3d, 0x69, 0x8a, 0x95, 0x53, 0xc8, 0x9c, 0xe5 },
2392 /* http://www.mail-archive.com/stds-p1619@listserv.ieee.org/msg00173.html */
2393 .key
= { 0xf8, 0xd4, 0x76, 0xff, 0xd6, 0x46, 0xee, 0x6c,
2394 0x23, 0x84, 0xcb, 0x1c, 0x77, 0xd6, 0x19, 0x5d,
2395 0xfe, 0xf1, 0xa9, 0xf3, 0x7b, 0xbc, 0x8d, 0x21,
2396 0xa7, 0x9c, 0x21, 0xf8, 0xcb, 0x90, 0x02, 0x89,
2397 0xa8, 0x45, 0x34, 0x8e, 0xc8, 0xc5, 0xb5, 0xf1,
2398 0x26, 0xf5, 0x0e, 0x76, 0xfe, 0xfd, 0x1b, 0x1e },
2400 .iv
= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2401 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 },
2402 .input
= { 0x05, 0x11, 0xb7, 0x18, 0xab, 0xc6, 0x2d, 0xac,
2403 0x70, 0x5d, 0xf6, 0x22, 0x94, 0xcd, 0xe5, 0x6c,
2404 0x17, 0x6b, 0xf6, 0x1c, 0xf0, 0xf3, 0x6e, 0xf8,
2405 0x50, 0x38, 0x1f, 0x71, 0x49, 0xb6, 0x57, 0xd6,
2406 0x8f, 0xcb, 0x8d, 0x6b, 0xe3, 0xa6, 0x29, 0x90,
2407 0xfe, 0x2a, 0x62, 0x82, 0xae, 0x6d, 0x8b, 0xf6,
2408 0xad, 0x1e, 0x9e, 0x20, 0x5f, 0x38, 0xbe, 0x04,
2409 0xda, 0x10, 0x8e, 0xed, 0xa2, 0xa4, 0x87, 0xab,
2410 0xda, 0x6b, 0xb4, 0x0c, 0x75, 0xba, 0xd3, 0x7c,
2411 0xc9, 0xac, 0x42, 0x31, 0x95, 0x7c, 0xc9, 0x04,
2412 0xeb, 0xd5, 0x6e, 0x32, 0x69, 0x8a, 0xdb, 0xa6,
2413 0x15, 0xd7, 0x3f, 0x4f, 0x2f, 0x66, 0x69, 0x03,
2414 0x9c, 0x1f, 0x54, 0x0f, 0xde, 0x1f, 0xf3, 0x65,
2415 0x4c, 0x96, 0x12, 0xed, 0x7c, 0x92, 0x03, 0x01,
2416 0x6f, 0xbc, 0x35, 0x93, 0xac, 0xf1, 0x27, 0xf1,
2417 0xb4, 0x96, 0x82, 0x5a, 0x5f, 0xb0, 0xa0, 0x50,
2418 0x89, 0xa4, 0x8e, 0x66, 0x44, 0x85, 0xcc, 0xfd,
2419 0x33, 0x14, 0x70, 0xe3, 0x96, 0xb2, 0xc3, 0xd3,
2420 0xbb, 0x54, 0x5a, 0x1a, 0xf9, 0x74, 0xa2, 0xc5,
2421 0x2d, 0x64, 0x75, 0xdd, 0xb4, 0x54, 0xe6, 0x74,
2422 0x8c, 0xd3, 0x9d, 0x9e, 0x86, 0xab, 0x51, 0x53,
2423 0xb7, 0x93, 0x3e, 0x6f, 0xd0, 0x4e, 0x2c, 0x40,
2424 0xf6, 0xa8, 0x2e, 0x3e, 0x9d, 0xf4, 0x66, 0xa5,
2425 0x76, 0x12, 0x73, 0x44, 0x1a, 0x56, 0xd7, 0x72,
2426 0x88, 0xcd, 0x21, 0x8c, 0x4c, 0x0f, 0xfe, 0xda,
2427 0x95, 0xe0, 0x3a, 0xa6, 0xa5, 0x84, 0x46, 0xcd,
2428 0xd5, 0x3e, 0x9d, 0x3a, 0xe2, 0x67, 0xe6, 0x60,
2429 0x1a, 0xe2, 0x70, 0x85, 0x58, 0xc2, 0x1b, 0x09,
2430 0xe1, 0xd7, 0x2c, 0xca, 0xad, 0xa8, 0x8f, 0xf9,
2431 0xac, 0xb3, 0x0e, 0xdb, 0xca, 0x2e, 0xe2, 0xb8,
2432 0x51, 0x71, 0xd9, 0x3c, 0x6c, 0xf1, 0x56, 0xf8,
2433 0xea, 0x9c, 0xf1, 0xfb, 0x0c, 0xe6, 0xb7, 0x10,
2434 0x1c, 0xf8, 0xa9, 0x7c, 0xe8, 0x53, 0x35, 0xc1,
2435 0x90, 0x3e, 0x76, 0x4a, 0x74, 0xa4, 0x21, 0x2c,
2436 0xf6, 0x2c, 0x4e, 0x0f, 0x94, 0x3a, 0x88, 0x2e,
2437 0x41, 0x09, 0x6a, 0x33, 0x7d, 0xf6, 0xdd, 0x3f,
2438 0x8d, 0x23, 0x31, 0x74, 0x84, 0xeb, 0x88, 0x6e,
2439 0xcc, 0xb9, 0xbc, 0x22, 0x83, 0x19, 0x07, 0x22,
2440 0xa5, 0x2d, 0xdf, 0xa5, 0xf3, 0x80, 0x85, 0x78,
2441 0x84, 0x39, 0x6a, 0x6d, 0x6a, 0x99, 0x4f, 0xa5,
2442 0x15, 0xfe, 0x46, 0xb0, 0xe4, 0x6c, 0xa5, 0x41,
2443 0x3c, 0xce, 0x8f, 0x42, 0x60, 0x71, 0xa7, 0x75,
2444 0x08, 0x40, 0x65, 0x8a, 0x82, 0xbf, 0xf5, 0x43,
2445 0x71, 0x96, 0xa9, 0x4d, 0x44, 0x8a, 0x20, 0xbe,
2446 0xfa, 0x4d, 0xbb, 0xc0, 0x7d, 0x31, 0x96, 0x65,
2447 0xe7, 0x75, 0xe5, 0x3e, 0xfd, 0x92, 0x3b, 0xc9,
2448 0x55, 0xbb, 0x16, 0x7e, 0xf7, 0xc2, 0x8c, 0xa4,
2449 0x40, 0x1d, 0xe5, 0xef, 0x0e, 0xdf, 0xe4, 0x9a,
2450 0x62, 0x73, 0x65, 0xfd, 0x46, 0x63, 0x25, 0x3d,
2451 0x2b, 0xaf, 0xe5, 0x64, 0xfe, 0xa5, 0x5c, 0xcf,
2452 0x24, 0xf3, 0xb4, 0xac, 0x64, 0xba, 0xdf, 0x4b,
2453 0xc6, 0x96, 0x7d, 0x81, 0x2d, 0x8d, 0x97, 0xf7,
2454 0xc5, 0x68, 0x77, 0x84, 0x32, 0x2b, 0xcc, 0x85,
2455 0x74, 0x96, 0xf0, 0x12, 0x77, 0x61, 0xb9, 0xeb,
2456 0x71, 0xaa, 0x82, 0xcb, 0x1c, 0xdb, 0x89, 0xc8,
2457 0xc6, 0xb5, 0xe3, 0x5c, 0x7d, 0x39, 0x07, 0x24,
2458 0xda, 0x39, 0x87, 0x45, 0xc0, 0x2b, 0xbb, 0x01,
2459 0xac, 0xbc, 0x2a, 0x5c, 0x7f, 0xfc, 0xe8, 0xce,
2460 0x6d, 0x9c, 0x6f, 0xed, 0xd3, 0xc1, 0xa1, 0xd6,
2461 0xc5, 0x55, 0xa9, 0x66, 0x2f, 0xe1, 0xc8, 0x32,
2462 0xa6, 0x5d, 0xa4, 0x3a, 0x98, 0x73, 0xe8, 0x45,
2463 0xa4, 0xc7, 0xa8, 0xb4, 0xf6, 0x13, 0x03, 0xf6,
2464 0xe9, 0x2e, 0xc4, 0x29, 0x0f, 0x84, 0xdb, 0xc4,
2465 0x21, 0xc4, 0xc2, 0x75, 0x67, 0x89, 0x37, 0x0a },
2467 .result
= { 0x1a, 0x1d, 0xa9, 0x30, 0xad, 0xf9, 0x2f, 0x9b,
2468 0xb6, 0x1d, 0xae, 0xef, 0xf0, 0x2f, 0xf8, 0x5a,
2469 0x39, 0x3c, 0xbf, 0x2a, 0xb2, 0x45, 0xb2, 0x23,
2470 0x1b, 0x63, 0x3c, 0xcf, 0xaa, 0xbe, 0xcf, 0x4e,
2471 0xfa, 0xe8, 0x29, 0xc2, 0x20, 0x68, 0x2b, 0x3c,
2472 0x2e, 0x8b, 0xf7, 0x6e, 0x25, 0xbd, 0xe3, 0x3d,
2473 0x66, 0x27, 0xd6, 0xaf, 0xd6, 0x64, 0x3e, 0xe3,
2474 0xe8, 0x58, 0x46, 0x97, 0x39, 0x51, 0x07, 0xde,
2475 0xcb, 0x37, 0xbc, 0xa9, 0xc0, 0x5f, 0x75, 0xc3,
2476 0x0e, 0x84, 0x23, 0x1d, 0x16, 0xd4, 0x1c, 0x59,
2477 0x9c, 0x1a, 0x02, 0x55, 0xab, 0x3a, 0x97, 0x1d,
2478 0xdf, 0xdd, 0xc7, 0x06, 0x51, 0xd7, 0x70, 0xae,
2479 0x23, 0xc6, 0x8c, 0xf5, 0x1e, 0xa0, 0xe5, 0x82,
2480 0xb8, 0xb2, 0xbf, 0x04, 0xa0, 0x32, 0x8e, 0x68,
2481 0xeb, 0xaf, 0x6e, 0x2d, 0x94, 0x22, 0x2f, 0xce,
2482 0x4c, 0xb5, 0x59, 0xe2, 0xa2, 0x2f, 0xa0, 0x98,
2483 0x1a, 0x97, 0xc6, 0xd4, 0xb5, 0x00, 0x59, 0xf2,
2484 0x84, 0x14, 0x72, 0xb1, 0x9a, 0x6e, 0xa3, 0x7f,
2485 0xea, 0x20, 0xe7, 0xcb, 0x65, 0x77, 0x3a, 0xdf,
2486 0xc8, 0x97, 0x67, 0x15, 0xc2, 0x2a, 0x27, 0xcc,
2487 0x18, 0x55, 0xa1, 0x24, 0x0b, 0x24, 0x24, 0xaf,
2488 0x5b, 0xec, 0x68, 0xb8, 0xc8, 0xf5, 0xba, 0x63,
2489 0xff, 0xed, 0x89, 0xce, 0xd5, 0x3d, 0x88, 0xf3,
2490 0x25, 0xef, 0x05, 0x7c, 0x3a, 0xef, 0xeb, 0xd8,
2491 0x7a, 0x32, 0x0d, 0xd1, 0x1e, 0x58, 0x59, 0x99,
2492 0x90, 0x25, 0xb5, 0x26, 0xb0, 0xe3, 0x2b, 0x6c,
2493 0x4c, 0xa9, 0x8b, 0x84, 0x4f, 0x5e, 0x01, 0x50,
2494 0x41, 0x30, 0x58, 0xc5, 0x62, 0x74, 0x52, 0x1d,
2495 0x45, 0x24, 0x6a, 0x42, 0x64, 0x4f, 0x97, 0x1c,
2496 0xa8, 0x66, 0xb5, 0x6d, 0x79, 0xd4, 0x0d, 0x48,
2497 0xc5, 0x5f, 0xf3, 0x90, 0x32, 0xdd, 0xdd, 0xe1,
2498 0xe4, 0xa9, 0x9f, 0xfc, 0xc3, 0x52, 0x5a, 0x46,
2499 0xe4, 0x81, 0x84, 0x95, 0x36, 0x59, 0x7a, 0x6b,
2500 0xaa, 0xb3, 0x60, 0xad, 0xce, 0x9f, 0x9f, 0x28,
2501 0xe0, 0x01, 0x75, 0x22, 0xc4, 0x4e, 0xa9, 0x62,
2502 0x5c, 0x62, 0x0d, 0x00, 0xcb, 0x13, 0xe8, 0x43,
2503 0x72, 0xd4, 0x2d, 0x53, 0x46, 0xb5, 0xd1, 0x16,
2504 0x22, 0x18, 0xdf, 0x34, 0x33, 0xf5, 0xd6, 0x1c,
2505 0xb8, 0x79, 0x78, 0x97, 0x94, 0xff, 0x72, 0x13,
2506 0x4c, 0x27, 0xfc, 0xcb, 0xbf, 0x01, 0x53, 0xa6,
2507 0xb4, 0x50, 0x6e, 0xde, 0xdf, 0xb5, 0x43, 0xa4,
2508 0x59, 0xdf, 0x52, 0xf9, 0x7c, 0xe0, 0x11, 0x6f,
2509 0x2d, 0x14, 0x8e, 0x24, 0x61, 0x2c, 0xe1, 0x17,
2510 0xcc, 0xce, 0x51, 0x0c, 0x19, 0x8a, 0x82, 0x30,
2511 0x94, 0xd5, 0x3d, 0x6a, 0x53, 0x06, 0x5e, 0xbd,
2512 0xb7, 0xeb, 0xfa, 0xfd, 0x27, 0x51, 0xde, 0x85,
2513 0x1e, 0x86, 0x53, 0x11, 0x53, 0x94, 0x00, 0xee,
2514 0x2b, 0x8c, 0x08, 0x2a, 0xbf, 0xdd, 0xae, 0x11,
2515 0xcb, 0x1e, 0xa2, 0x07, 0x9a, 0x80, 0xcf, 0x62,
2516 0x9b, 0x09, 0xdc, 0x95, 0x3c, 0x96, 0x8e, 0xb1,
2517 0x09, 0xbd, 0xe4, 0xeb, 0xdb, 0xca, 0x70, 0x7a,
2518 0x9e, 0xfa, 0x31, 0x18, 0x45, 0x3c, 0x21, 0x33,
2519 0xb0, 0xb3, 0x2b, 0xea, 0xf3, 0x71, 0x2d, 0xe1,
2520 0x03, 0xad, 0x1b, 0x48, 0xd4, 0x67, 0x27, 0xf0,
2521 0x62, 0xe4, 0x3d, 0xfb, 0x9b, 0x08, 0x76, 0xe7,
2522 0xdd, 0x2b, 0x01, 0x39, 0x04, 0x5a, 0x58, 0x7a,
2523 0xf7, 0x11, 0x90, 0xec, 0xbd, 0x51, 0x5c, 0x32,
2524 0x6b, 0xd7, 0x35, 0x39, 0x02, 0x6b, 0xf2, 0xa6,
2525 0xd0, 0x0d, 0x07, 0xe1, 0x06, 0xc4, 0x5b, 0x7d,
2526 0xe4, 0x6a, 0xd7, 0xee, 0x15, 0x1f, 0x83, 0xb4,
2527 0xa3, 0xa7, 0x5e, 0xc3, 0x90, 0xb7, 0xef, 0xd3,
2528 0xb7, 0x4f, 0xf8, 0x92, 0x4c, 0xb7, 0x3c, 0x29,
2529 0xcd, 0x7e, 0x2b, 0x5d, 0x43, 0xea, 0x42, 0xe7,
2530 0x74, 0x3f, 0x7d, 0x58, 0x88, 0x75, 0xde, 0x3e },
2535 static struct cipher_testvec aes_lrw_dec_tv_template
[] = {
2536 /* from http://grouper.ieee.org/groups/1619/email/pdf00017.pdf */
2537 /* same as enc vectors with input and result reversed */
2538 { /* LRW-32-AES 1 */
2539 .key
= { 0x45, 0x62, 0xac, 0x25, 0xf8, 0x28, 0x17, 0x6d,
2540 0x4c, 0x26, 0x84, 0x14, 0xb5, 0x68, 0x01, 0x85,
2541 0x25, 0x8e, 0x2a, 0x05, 0xe7, 0x3e, 0x9d, 0x03,
2542 0xee, 0x5a, 0x83, 0x0c, 0xcc, 0x09, 0x4c, 0x87 },
2544 .iv
= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2545 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 },
2546 .input
= { 0xf1, 0xb2, 0x73, 0xcd, 0x65, 0xa3, 0xdf, 0x5f,
2547 0xe9, 0x5d, 0x48, 0x92, 0x54, 0x63, 0x4e, 0xb8 },
2549 .result
= { 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
2550 0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46 },
2552 }, { /* LRW-32-AES 2 */
2553 .key
= { 0x59, 0x70, 0x47, 0x14, 0xf5, 0x57, 0x47, 0x8c,
2554 0xd7, 0x79, 0xe8, 0x0f, 0x54, 0x88, 0x79, 0x44,
2555 0x0d, 0x48, 0xf0, 0xb7, 0xb1, 0x5a, 0x53, 0xea,
2556 0x1c, 0xaa, 0x6b, 0x29, 0xc2, 0xca, 0xfb, 0xaf
2559 .iv
= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2560 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02 },
2561 .input
= { 0x00, 0xc8, 0x2b, 0xae, 0x95, 0xbb, 0xcd, 0xe5,
2562 0x27, 0x4f, 0x07, 0x69, 0xb2, 0x60, 0xe1, 0x36 },
2564 .result
= { 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
2565 0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46 },
2567 }, { /* LRW-32-AES 3 */
2568 .key
= { 0xd8, 0x2a, 0x91, 0x34, 0xb2, 0x6a, 0x56, 0x50,
2569 0x30, 0xfe, 0x69, 0xe2, 0x37, 0x7f, 0x98, 0x47,
2570 0xcd, 0xf9, 0x0b, 0x16, 0x0c, 0x64, 0x8f, 0xb6,
2571 0xb0, 0x0d, 0x0d, 0x1b, 0xae, 0x85, 0x87, 0x1f },
2573 .iv
= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2574 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00 },
2575 .input
= { 0x76, 0x32, 0x21, 0x83, 0xed, 0x8f, 0xf1, 0x82,
2576 0xf9, 0x59, 0x62, 0x03, 0x69, 0x0e, 0x5e, 0x01 },
2578 .result
= { 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
2579 0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46 },
2581 }, { /* LRW-32-AES 4 */
2582 .key
= { 0x0f, 0x6a, 0xef, 0xf8, 0xd3, 0xd2, 0xbb, 0x15,
2583 0x25, 0x83, 0xf7, 0x3c, 0x1f, 0x01, 0x28, 0x74,
2584 0xca, 0xc6, 0xbc, 0x35, 0x4d, 0x4a, 0x65, 0x54,
2585 0x90, 0xae, 0x61, 0xcf, 0x7b, 0xae, 0xbd, 0xcc,
2586 0xad, 0xe4, 0x94, 0xc5, 0x4a, 0x29, 0xae, 0x70 },
2588 .iv
= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2589 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 },
2590 .input
= { 0x9c, 0x0f, 0x15, 0x2f, 0x55, 0xa2, 0xd8, 0xf0,
2591 0xd6, 0x7b, 0x8f, 0x9e, 0x28, 0x22, 0xbc, 0x41 },
2593 .result
= { 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
2594 0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46 },
2596 }, { /* LRW-32-AES 5 */
2597 .key
= { 0x8a, 0xd4, 0xee, 0x10, 0x2f, 0xbd, 0x81, 0xff,
2598 0xf8, 0x86, 0xce, 0xac, 0x93, 0xc5, 0xad, 0xc6,
2599 0xa0, 0x19, 0x07, 0xc0, 0x9d, 0xf7, 0xbb, 0xdd,
2600 0x52, 0x13, 0xb2, 0xb7, 0xf0, 0xff, 0x11, 0xd8,
2601 0xd6, 0x08, 0xd0, 0xcd, 0x2e, 0xb1, 0x17, 0x6f },
2603 .iv
= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2604 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00 },
2605 .input
= { 0xd4, 0x27, 0x6a, 0x7f, 0x14, 0x91, 0x3d, 0x65,
2606 0xc8, 0x60, 0x48, 0x02, 0x87, 0xe3, 0x34, 0x06 },
2608 .result
= { 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
2609 0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46 },
2611 }, { /* LRW-32-AES 6 */
2612 .key
= { 0xf8, 0xd4, 0x76, 0xff, 0xd6, 0x46, 0xee, 0x6c,
2613 0x23, 0x84, 0xcb, 0x1c, 0x77, 0xd6, 0x19, 0x5d,
2614 0xfe, 0xf1, 0xa9, 0xf3, 0x7b, 0xbc, 0x8d, 0x21,
2615 0xa7, 0x9c, 0x21, 0xf8, 0xcb, 0x90, 0x02, 0x89,
2616 0xa8, 0x45, 0x34, 0x8e, 0xc8, 0xc5, 0xb5, 0xf1,
2617 0x26, 0xf5, 0x0e, 0x76, 0xfe, 0xfd, 0x1b, 0x1e },
2619 .iv
= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2620 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 },
2621 .input
= { 0xbd, 0x06, 0xb8, 0xe1, 0xdb, 0x98, 0x89, 0x9e,
2622 0xc4, 0x98, 0xe4, 0x91, 0xcf, 0x1c, 0x70, 0x2b },
2624 .result
= { 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
2625 0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46 },
2627 }, { /* LRW-32-AES 7 */
2628 .key
= { 0xfb, 0x76, 0x15, 0xb2, 0x3d, 0x80, 0x89, 0x1d,
2629 0xd4, 0x70, 0x98, 0x0b, 0xc7, 0x95, 0x84, 0xc8,
2630 0xb2, 0xfb, 0x64, 0xce, 0x60, 0x97, 0x87, 0x8d,
2631 0x17, 0xfc, 0xe4, 0x5a, 0x49, 0xe8, 0x30, 0xb7,
2632 0x6e, 0x78, 0x17, 0xe7, 0x2d, 0x5e, 0x12, 0xd4,
2633 0x60, 0x64, 0x04, 0x7a, 0xf1, 0x2f, 0x9e, 0x0c },
2635 .iv
= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2636 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00 },
2637 .input
= { 0x5b, 0x90, 0x8e, 0xc1, 0xab, 0xdd, 0x67, 0x5f,
2638 0x3d, 0x69, 0x8a, 0x95, 0x53, 0xc8, 0x9c, 0xe5 },
2640 .result
= { 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
2641 0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46 },
2644 /* http://www.mail-archive.com/stds-p1619@listserv.ieee.org/msg00173.html */
2645 .key
= { 0xf8, 0xd4, 0x76, 0xff, 0xd6, 0x46, 0xee, 0x6c,
2646 0x23, 0x84, 0xcb, 0x1c, 0x77, 0xd6, 0x19, 0x5d,
2647 0xfe, 0xf1, 0xa9, 0xf3, 0x7b, 0xbc, 0x8d, 0x21,
2648 0xa7, 0x9c, 0x21, 0xf8, 0xcb, 0x90, 0x02, 0x89,
2649 0xa8, 0x45, 0x34, 0x8e, 0xc8, 0xc5, 0xb5, 0xf1,
2650 0x26, 0xf5, 0x0e, 0x76, 0xfe, 0xfd, 0x1b, 0x1e },
2652 .iv
= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2653 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 },
2654 .input
= { 0x1a, 0x1d, 0xa9, 0x30, 0xad, 0xf9, 0x2f, 0x9b,
2655 0xb6, 0x1d, 0xae, 0xef, 0xf0, 0x2f, 0xf8, 0x5a,
2656 0x39, 0x3c, 0xbf, 0x2a, 0xb2, 0x45, 0xb2, 0x23,
2657 0x1b, 0x63, 0x3c, 0xcf, 0xaa, 0xbe, 0xcf, 0x4e,
2658 0xfa, 0xe8, 0x29, 0xc2, 0x20, 0x68, 0x2b, 0x3c,
2659 0x2e, 0x8b, 0xf7, 0x6e, 0x25, 0xbd, 0xe3, 0x3d,
2660 0x66, 0x27, 0xd6, 0xaf, 0xd6, 0x64, 0x3e, 0xe3,
2661 0xe8, 0x58, 0x46, 0x97, 0x39, 0x51, 0x07, 0xde,
2662 0xcb, 0x37, 0xbc, 0xa9, 0xc0, 0x5f, 0x75, 0xc3,
2663 0x0e, 0x84, 0x23, 0x1d, 0x16, 0xd4, 0x1c, 0x59,
2664 0x9c, 0x1a, 0x02, 0x55, 0xab, 0x3a, 0x97, 0x1d,
2665 0xdf, 0xdd, 0xc7, 0x06, 0x51, 0xd7, 0x70, 0xae,
2666 0x23, 0xc6, 0x8c, 0xf5, 0x1e, 0xa0, 0xe5, 0x82,
2667 0xb8, 0xb2, 0xbf, 0x04, 0xa0, 0x32, 0x8e, 0x68,
2668 0xeb, 0xaf, 0x6e, 0x2d, 0x94, 0x22, 0x2f, 0xce,
2669 0x4c, 0xb5, 0x59, 0xe2, 0xa2, 0x2f, 0xa0, 0x98,
2670 0x1a, 0x97, 0xc6, 0xd4, 0xb5, 0x00, 0x59, 0xf2,
2671 0x84, 0x14, 0x72, 0xb1, 0x9a, 0x6e, 0xa3, 0x7f,
2672 0xea, 0x20, 0xe7, 0xcb, 0x65, 0x77, 0x3a, 0xdf,
2673 0xc8, 0x97, 0x67, 0x15, 0xc2, 0x2a, 0x27, 0xcc,
2674 0x18, 0x55, 0xa1, 0x24, 0x0b, 0x24, 0x24, 0xaf,
2675 0x5b, 0xec, 0x68, 0xb8, 0xc8, 0xf5, 0xba, 0x63,
2676 0xff, 0xed, 0x89, 0xce, 0xd5, 0x3d, 0x88, 0xf3,
2677 0x25, 0xef, 0x05, 0x7c, 0x3a, 0xef, 0xeb, 0xd8,
2678 0x7a, 0x32, 0x0d, 0xd1, 0x1e, 0x58, 0x59, 0x99,
2679 0x90, 0x25, 0xb5, 0x26, 0xb0, 0xe3, 0x2b, 0x6c,
2680 0x4c, 0xa9, 0x8b, 0x84, 0x4f, 0x5e, 0x01, 0x50,
2681 0x41, 0x30, 0x58, 0xc5, 0x62, 0x74, 0x52, 0x1d,
2682 0x45, 0x24, 0x6a, 0x42, 0x64, 0x4f, 0x97, 0x1c,
2683 0xa8, 0x66, 0xb5, 0x6d, 0x79, 0xd4, 0x0d, 0x48,
2684 0xc5, 0x5f, 0xf3, 0x90, 0x32, 0xdd, 0xdd, 0xe1,
2685 0xe4, 0xa9, 0x9f, 0xfc, 0xc3, 0x52, 0x5a, 0x46,
2686 0xe4, 0x81, 0x84, 0x95, 0x36, 0x59, 0x7a, 0x6b,
2687 0xaa, 0xb3, 0x60, 0xad, 0xce, 0x9f, 0x9f, 0x28,
2688 0xe0, 0x01, 0x75, 0x22, 0xc4, 0x4e, 0xa9, 0x62,
2689 0x5c, 0x62, 0x0d, 0x00, 0xcb, 0x13, 0xe8, 0x43,
2690 0x72, 0xd4, 0x2d, 0x53, 0x46, 0xb5, 0xd1, 0x16,
2691 0x22, 0x18, 0xdf, 0x34, 0x33, 0xf5, 0xd6, 0x1c,
2692 0xb8, 0x79, 0x78, 0x97, 0x94, 0xff, 0x72, 0x13,
2693 0x4c, 0x27, 0xfc, 0xcb, 0xbf, 0x01, 0x53, 0xa6,
2694 0xb4, 0x50, 0x6e, 0xde, 0xdf, 0xb5, 0x43, 0xa4,
2695 0x59, 0xdf, 0x52, 0xf9, 0x7c, 0xe0, 0x11, 0x6f,
2696 0x2d, 0x14, 0x8e, 0x24, 0x61, 0x2c, 0xe1, 0x17,
2697 0xcc, 0xce, 0x51, 0x0c, 0x19, 0x8a, 0x82, 0x30,
2698 0x94, 0xd5, 0x3d, 0x6a, 0x53, 0x06, 0x5e, 0xbd,
2699 0xb7, 0xeb, 0xfa, 0xfd, 0x27, 0x51, 0xde, 0x85,
2700 0x1e, 0x86, 0x53, 0x11, 0x53, 0x94, 0x00, 0xee,
2701 0x2b, 0x8c, 0x08, 0x2a, 0xbf, 0xdd, 0xae, 0x11,
2702 0xcb, 0x1e, 0xa2, 0x07, 0x9a, 0x80, 0xcf, 0x62,
2703 0x9b, 0x09, 0xdc, 0x95, 0x3c, 0x96, 0x8e, 0xb1,
2704 0x09, 0xbd, 0xe4, 0xeb, 0xdb, 0xca, 0x70, 0x7a,
2705 0x9e, 0xfa, 0x31, 0x18, 0x45, 0x3c, 0x21, 0x33,
2706 0xb0, 0xb3, 0x2b, 0xea, 0xf3, 0x71, 0x2d, 0xe1,
2707 0x03, 0xad, 0x1b, 0x48, 0xd4, 0x67, 0x27, 0xf0,
2708 0x62, 0xe4, 0x3d, 0xfb, 0x9b, 0x08, 0x76, 0xe7,
2709 0xdd, 0x2b, 0x01, 0x39, 0x04, 0x5a, 0x58, 0x7a,
2710 0xf7, 0x11, 0x90, 0xec, 0xbd, 0x51, 0x5c, 0x32,
2711 0x6b, 0xd7, 0x35, 0x39, 0x02, 0x6b, 0xf2, 0xa6,
2712 0xd0, 0x0d, 0x07, 0xe1, 0x06, 0xc4, 0x5b, 0x7d,
2713 0xe4, 0x6a, 0xd7, 0xee, 0x15, 0x1f, 0x83, 0xb4,
2714 0xa3, 0xa7, 0x5e, 0xc3, 0x90, 0xb7, 0xef, 0xd3,
2715 0xb7, 0x4f, 0xf8, 0x92, 0x4c, 0xb7, 0x3c, 0x29,
2716 0xcd, 0x7e, 0x2b, 0x5d, 0x43, 0xea, 0x42, 0xe7,
2717 0x74, 0x3f, 0x7d, 0x58, 0x88, 0x75, 0xde, 0x3e },
2719 .result
= { 0x05, 0x11, 0xb7, 0x18, 0xab, 0xc6, 0x2d, 0xac,
2720 0x70, 0x5d, 0xf6, 0x22, 0x94, 0xcd, 0xe5, 0x6c,
2721 0x17, 0x6b, 0xf6, 0x1c, 0xf0, 0xf3, 0x6e, 0xf8,
2722 0x50, 0x38, 0x1f, 0x71, 0x49, 0xb6, 0x57, 0xd6,
2723 0x8f, 0xcb, 0x8d, 0x6b, 0xe3, 0xa6, 0x29, 0x90,
2724 0xfe, 0x2a, 0x62, 0x82, 0xae, 0x6d, 0x8b, 0xf6,
2725 0xad, 0x1e, 0x9e, 0x20, 0x5f, 0x38, 0xbe, 0x04,
2726 0xda, 0x10, 0x8e, 0xed, 0xa2, 0xa4, 0x87, 0xab,
2727 0xda, 0x6b, 0xb4, 0x0c, 0x75, 0xba, 0xd3, 0x7c,
2728 0xc9, 0xac, 0x42, 0x31, 0x95, 0x7c, 0xc9, 0x04,
2729 0xeb, 0xd5, 0x6e, 0x32, 0x69, 0x8a, 0xdb, 0xa6,
2730 0x15, 0xd7, 0x3f, 0x4f, 0x2f, 0x66, 0x69, 0x03,
2731 0x9c, 0x1f, 0x54, 0x0f, 0xde, 0x1f, 0xf3, 0x65,
2732 0x4c, 0x96, 0x12, 0xed, 0x7c, 0x92, 0x03, 0x01,
2733 0x6f, 0xbc, 0x35, 0x93, 0xac, 0xf1, 0x27, 0xf1,
2734 0xb4, 0x96, 0x82, 0x5a, 0x5f, 0xb0, 0xa0, 0x50,
2735 0x89, 0xa4, 0x8e, 0x66, 0x44, 0x85, 0xcc, 0xfd,
2736 0x33, 0x14, 0x70, 0xe3, 0x96, 0xb2, 0xc3, 0xd3,
2737 0xbb, 0x54, 0x5a, 0x1a, 0xf9, 0x74, 0xa2, 0xc5,
2738 0x2d, 0x64, 0x75, 0xdd, 0xb4, 0x54, 0xe6, 0x74,
2739 0x8c, 0xd3, 0x9d, 0x9e, 0x86, 0xab, 0x51, 0x53,
2740 0xb7, 0x93, 0x3e, 0x6f, 0xd0, 0x4e, 0x2c, 0x40,
2741 0xf6, 0xa8, 0x2e, 0x3e, 0x9d, 0xf4, 0x66, 0xa5,
2742 0x76, 0x12, 0x73, 0x44, 0x1a, 0x56, 0xd7, 0x72,
2743 0x88, 0xcd, 0x21, 0x8c, 0x4c, 0x0f, 0xfe, 0xda,
2744 0x95, 0xe0, 0x3a, 0xa6, 0xa5, 0x84, 0x46, 0xcd,
2745 0xd5, 0x3e, 0x9d, 0x3a, 0xe2, 0x67, 0xe6, 0x60,
2746 0x1a, 0xe2, 0x70, 0x85, 0x58, 0xc2, 0x1b, 0x09,
2747 0xe1, 0xd7, 0x2c, 0xca, 0xad, 0xa8, 0x8f, 0xf9,
2748 0xac, 0xb3, 0x0e, 0xdb, 0xca, 0x2e, 0xe2, 0xb8,
2749 0x51, 0x71, 0xd9, 0x3c, 0x6c, 0xf1, 0x56, 0xf8,
2750 0xea, 0x9c, 0xf1, 0xfb, 0x0c, 0xe6, 0xb7, 0x10,
2751 0x1c, 0xf8, 0xa9, 0x7c, 0xe8, 0x53, 0x35, 0xc1,
2752 0x90, 0x3e, 0x76, 0x4a, 0x74, 0xa4, 0x21, 0x2c,
2753 0xf6, 0x2c, 0x4e, 0x0f, 0x94, 0x3a, 0x88, 0x2e,
2754 0x41, 0x09, 0x6a, 0x33, 0x7d, 0xf6, 0xdd, 0x3f,
2755 0x8d, 0x23, 0x31, 0x74, 0x84, 0xeb, 0x88, 0x6e,
2756 0xcc, 0xb9, 0xbc, 0x22, 0x83, 0x19, 0x07, 0x22,
2757 0xa5, 0x2d, 0xdf, 0xa5, 0xf3, 0x80, 0x85, 0x78,
2758 0x84, 0x39, 0x6a, 0x6d, 0x6a, 0x99, 0x4f, 0xa5,
2759 0x15, 0xfe, 0x46, 0xb0, 0xe4, 0x6c, 0xa5, 0x41,
2760 0x3c, 0xce, 0x8f, 0x42, 0x60, 0x71, 0xa7, 0x75,
2761 0x08, 0x40, 0x65, 0x8a, 0x82, 0xbf, 0xf5, 0x43,
2762 0x71, 0x96, 0xa9, 0x4d, 0x44, 0x8a, 0x20, 0xbe,
2763 0xfa, 0x4d, 0xbb, 0xc0, 0x7d, 0x31, 0x96, 0x65,
2764 0xe7, 0x75, 0xe5, 0x3e, 0xfd, 0x92, 0x3b, 0xc9,
2765 0x55, 0xbb, 0x16, 0x7e, 0xf7, 0xc2, 0x8c, 0xa4,
2766 0x40, 0x1d, 0xe5, 0xef, 0x0e, 0xdf, 0xe4, 0x9a,
2767 0x62, 0x73, 0x65, 0xfd, 0x46, 0x63, 0x25, 0x3d,
2768 0x2b, 0xaf, 0xe5, 0x64, 0xfe, 0xa5, 0x5c, 0xcf,
2769 0x24, 0xf3, 0xb4, 0xac, 0x64, 0xba, 0xdf, 0x4b,
2770 0xc6, 0x96, 0x7d, 0x81, 0x2d, 0x8d, 0x97, 0xf7,
2771 0xc5, 0x68, 0x77, 0x84, 0x32, 0x2b, 0xcc, 0x85,
2772 0x74, 0x96, 0xf0, 0x12, 0x77, 0x61, 0xb9, 0xeb,
2773 0x71, 0xaa, 0x82, 0xcb, 0x1c, 0xdb, 0x89, 0xc8,
2774 0xc6, 0xb5, 0xe3, 0x5c, 0x7d, 0x39, 0x07, 0x24,
2775 0xda, 0x39, 0x87, 0x45, 0xc0, 0x2b, 0xbb, 0x01,
2776 0xac, 0xbc, 0x2a, 0x5c, 0x7f, 0xfc, 0xe8, 0xce,
2777 0x6d, 0x9c, 0x6f, 0xed, 0xd3, 0xc1, 0xa1, 0xd6,
2778 0xc5, 0x55, 0xa9, 0x66, 0x2f, 0xe1, 0xc8, 0x32,
2779 0xa6, 0x5d, 0xa4, 0x3a, 0x98, 0x73, 0xe8, 0x45,
2780 0xa4, 0xc7, 0xa8, 0xb4, 0xf6, 0x13, 0x03, 0xf6,
2781 0xe9, 0x2e, 0xc4, 0x29, 0x0f, 0x84, 0xdb, 0xc4,
2782 0x21, 0xc4, 0xc2, 0x75, 0x67, 0x89, 0x37, 0x0a },
2787 /* Cast5 test vectors from RFC 2144 */
2788 #define CAST5_ENC_TEST_VECTORS 3
2789 #define CAST5_DEC_TEST_VECTORS 3
2791 static struct cipher_testvec cast5_enc_tv_template
[] = {
2793 .key
= { 0x01, 0x23, 0x45, 0x67, 0x12, 0x34, 0x56, 0x78,
2794 0x23, 0x45, 0x67, 0x89, 0x34, 0x56, 0x78, 0x9a },
2796 .input
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
2798 .result
= { 0x23, 0x8b, 0x4f, 0xe5, 0x84, 0x7e, 0x44, 0xb2 },
2801 .key
= { 0x01, 0x23, 0x45, 0x67, 0x12, 0x34, 0x56, 0x78,
2804 .input
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
2806 .result
= { 0xeb, 0x6a, 0x71, 0x1a, 0x2c, 0x02, 0x27, 0x1b },
2809 .key
= { 0x01, 0x23, 0x45, 0x67, 0x12 },
2811 .input
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
2813 .result
= { 0x7a, 0xc8, 0x16, 0xd1, 0x6e, 0x9b, 0x30, 0x2e },
2818 static struct cipher_testvec cast5_dec_tv_template
[] = {
2820 .key
= { 0x01, 0x23, 0x45, 0x67, 0x12, 0x34, 0x56, 0x78,
2821 0x23, 0x45, 0x67, 0x89, 0x34, 0x56, 0x78, 0x9a },
2823 .input
= { 0x23, 0x8b, 0x4f, 0xe5, 0x84, 0x7e, 0x44, 0xb2 },
2825 .result
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
2828 .key
= { 0x01, 0x23, 0x45, 0x67, 0x12, 0x34, 0x56, 0x78,
2831 .input
= { 0xeb, 0x6a, 0x71, 0x1a, 0x2c, 0x02, 0x27, 0x1b },
2833 .result
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
2836 .key
= { 0x01, 0x23, 0x45, 0x67, 0x12 },
2838 .input
= { 0x7a, 0xc8, 0x16, 0xd1, 0x6e, 0x9b, 0x30, 0x2e },
2840 .result
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
2846 * ARC4 test vectors from OpenSSL
2848 #define ARC4_ENC_TEST_VECTORS 7
2849 #define ARC4_DEC_TEST_VECTORS 7
2851 static struct cipher_testvec arc4_enc_tv_template
[] = {
2853 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
2855 .input
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
2857 .result
= { 0x75, 0xb7, 0x87, 0x80, 0x99, 0xe0, 0xc5, 0x96 },
2860 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
2862 .input
= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
2864 .result
= { 0x74, 0x94, 0xc2, 0xe7, 0x10, 0x4b, 0x08, 0x79 },
2867 .key
= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
2869 .input
= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
2871 .result
= { 0xde, 0x18, 0x89, 0x41, 0xa3, 0x37, 0x5d, 0x3a },
2874 .key
= { 0xef, 0x01, 0x23, 0x45},
2876 .input
= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2877 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2878 0x00, 0x00, 0x00, 0x00 },
2880 .result
= { 0xd6, 0xa1, 0x41, 0xa7, 0xec, 0x3c, 0x38, 0xdf,
2881 0xbd, 0x61, 0x5a, 0x11, 0x62, 0xe1, 0xc7, 0xba,
2882 0x36, 0xb6, 0x78, 0x58 },
2885 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
2887 .input
= { 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0,
2888 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0,
2889 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0,
2890 0x12, 0x34, 0x56, 0x78 },
2892 .result
= { 0x66, 0xa0, 0x94, 0x9f, 0x8a, 0xf7, 0xd6, 0x89,
2893 0x1f, 0x7f, 0x83, 0x2b, 0xa8, 0x33, 0xc0, 0x0c,
2894 0x89, 0x2e, 0xbe, 0x30, 0x14, 0x3c, 0xe2, 0x87,
2895 0x40, 0x01, 0x1e, 0xcf },
2898 .key
= { 0xef, 0x01, 0x23, 0x45 },
2900 .input
= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2903 .result
= { 0xd6, 0xa1, 0x41, 0xa7, 0xec, 0x3c, 0x38, 0xdf,
2907 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF,
2908 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
2910 .input
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF },
2912 .result
= { 0x69, 0x72, 0x36, 0x59, 0x1B, 0x52, 0x42, 0xB1 },
2917 static struct cipher_testvec arc4_dec_tv_template
[] = {
2919 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
2921 .input
= { 0x75, 0xb7, 0x87, 0x80, 0x99, 0xe0, 0xc5, 0x96 },
2923 .result
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
2926 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
2928 .input
= { 0x74, 0x94, 0xc2, 0xe7, 0x10, 0x4b, 0x08, 0x79 },
2930 .result
= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
2933 .key
= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
2935 .input
= { 0xde, 0x18, 0x89, 0x41, 0xa3, 0x37, 0x5d, 0x3a },
2937 .result
= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
2940 .key
= { 0xef, 0x01, 0x23, 0x45},
2942 .input
= { 0xd6, 0xa1, 0x41, 0xa7, 0xec, 0x3c, 0x38, 0xdf,
2943 0xbd, 0x61, 0x5a, 0x11, 0x62, 0xe1, 0xc7, 0xba,
2944 0x36, 0xb6, 0x78, 0x58 },
2946 .result
= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2947 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2948 0x00, 0x00, 0x00, 0x00 },
2951 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
2953 .input
= { 0x66, 0xa0, 0x94, 0x9f, 0x8a, 0xf7, 0xd6, 0x89,
2954 0x1f, 0x7f, 0x83, 0x2b, 0xa8, 0x33, 0xc0, 0x0c,
2955 0x89, 0x2e, 0xbe, 0x30, 0x14, 0x3c, 0xe2, 0x87,
2956 0x40, 0x01, 0x1e, 0xcf },
2958 .result
= { 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0,
2959 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0,
2960 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0,
2961 0x12, 0x34, 0x56, 0x78 },
2964 .key
= { 0xef, 0x01, 0x23, 0x45 },
2966 .input
= { 0xd6, 0xa1, 0x41, 0xa7, 0xec, 0x3c, 0x38, 0xdf,
2969 .result
= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2973 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF,
2974 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
2976 .input
= { 0x69, 0x72, 0x36, 0x59, 0x1B, 0x52, 0x42, 0xB1 },
2978 .result
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF },
2986 #define TEA_ENC_TEST_VECTORS 4
2987 #define TEA_DEC_TEST_VECTORS 4
2989 static struct cipher_testvec tea_enc_tv_template
[] = {
2991 .key
= { [0 ... 15] = 0x00 },
2993 .input
= { [0 ... 8] = 0x00 },
2995 .result
= { 0x0a, 0x3a, 0xea, 0x41, 0x40, 0xa9, 0xba, 0x94 },
2998 .key
= { 0x2b, 0x02, 0x05, 0x68, 0x06, 0x14, 0x49, 0x76,
2999 0x77, 0x5d, 0x0e, 0x26, 0x6c, 0x28, 0x78, 0x43 },
3001 .input
= { 0x74, 0x65, 0x73, 0x74, 0x20, 0x6d, 0x65, 0x2e },
3003 .result
= { 0x77, 0x5d, 0x2a, 0x6a, 0xf6, 0xce, 0x92, 0x09 },
3006 .key
= { 0x09, 0x65, 0x43, 0x11, 0x66, 0x44, 0x39, 0x25,
3007 0x51, 0x3a, 0x16, 0x10, 0x0a, 0x08, 0x12, 0x6e },
3009 .input
= { 0x6c, 0x6f, 0x6e, 0x67, 0x65, 0x72, 0x5f, 0x74,
3010 0x65, 0x73, 0x74, 0x5f, 0x76, 0x65, 0x63, 0x74 },
3012 .result
= { 0xbe, 0x7a, 0xbb, 0x81, 0x95, 0x2d, 0x1f, 0x1e,
3013 0xdd, 0x89, 0xa1, 0x25, 0x04, 0x21, 0xdf, 0x95 },
3016 .key
= { 0x4d, 0x76, 0x32, 0x17, 0x05, 0x3f, 0x75, 0x2c,
3017 0x5d, 0x04, 0x16, 0x36, 0x15, 0x72, 0x63, 0x2f },
3019 .input
= { 0x54, 0x65, 0x61, 0x20, 0x69, 0x73, 0x20, 0x67,
3020 0x6f, 0x6f, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20,
3021 0x79, 0x6f, 0x75, 0x21, 0x21, 0x21, 0x20, 0x72,
3022 0x65, 0x61, 0x6c, 0x6c, 0x79, 0x21, 0x21, 0x21 },
3024 .result
= { 0xe0, 0x4d, 0x5d, 0x3c, 0xb7, 0x8c, 0x36, 0x47,
3025 0x94, 0x18, 0x95, 0x91, 0xa9, 0xfc, 0x49, 0xf8,
3026 0x44, 0xd1, 0x2d, 0xc2, 0x99, 0xb8, 0x08, 0x2a,
3027 0x07, 0x89, 0x73, 0xc2, 0x45, 0x92, 0xc6, 0x90 },
3032 static struct cipher_testvec tea_dec_tv_template
[] = {
3034 .key
= { [0 ... 15] = 0x00 },
3036 .input
= { 0x0a, 0x3a, 0xea, 0x41, 0x40, 0xa9, 0xba, 0x94 },
3038 .result
= { [0 ... 8] = 0x00 },
3041 .key
= { 0x2b, 0x02, 0x05, 0x68, 0x06, 0x14, 0x49, 0x76,
3042 0x77, 0x5d, 0x0e, 0x26, 0x6c, 0x28, 0x78, 0x43 },
3044 .input
= { 0x77, 0x5d, 0x2a, 0x6a, 0xf6, 0xce, 0x92, 0x09 },
3046 .result
= { 0x74, 0x65, 0x73, 0x74, 0x20, 0x6d, 0x65, 0x2e },
3049 .key
= { 0x09, 0x65, 0x43, 0x11, 0x66, 0x44, 0x39, 0x25,
3050 0x51, 0x3a, 0x16, 0x10, 0x0a, 0x08, 0x12, 0x6e },
3052 .input
= { 0xbe, 0x7a, 0xbb, 0x81, 0x95, 0x2d, 0x1f, 0x1e,
3053 0xdd, 0x89, 0xa1, 0x25, 0x04, 0x21, 0xdf, 0x95 },
3055 .result
= { 0x6c, 0x6f, 0x6e, 0x67, 0x65, 0x72, 0x5f, 0x74,
3056 0x65, 0x73, 0x74, 0x5f, 0x76, 0x65, 0x63, 0x74 },
3059 .key
= { 0x4d, 0x76, 0x32, 0x17, 0x05, 0x3f, 0x75, 0x2c,
3060 0x5d, 0x04, 0x16, 0x36, 0x15, 0x72, 0x63, 0x2f },
3062 .input
= { 0xe0, 0x4d, 0x5d, 0x3c, 0xb7, 0x8c, 0x36, 0x47,
3063 0x94, 0x18, 0x95, 0x91, 0xa9, 0xfc, 0x49, 0xf8,
3064 0x44, 0xd1, 0x2d, 0xc2, 0x99, 0xb8, 0x08, 0x2a,
3065 0x07, 0x89, 0x73, 0xc2, 0x45, 0x92, 0xc6, 0x90 },
3067 .result
= { 0x54, 0x65, 0x61, 0x20, 0x69, 0x73, 0x20, 0x67,
3068 0x6f, 0x6f, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20,
3069 0x79, 0x6f, 0x75, 0x21, 0x21, 0x21, 0x20, 0x72,
3070 0x65, 0x61, 0x6c, 0x6c, 0x79, 0x21, 0x21, 0x21 },
3078 #define XTEA_ENC_TEST_VECTORS 4
3079 #define XTEA_DEC_TEST_VECTORS 4
3081 static struct cipher_testvec xtea_enc_tv_template
[] = {
3083 .key
= { [0 ... 15] = 0x00 },
3085 .input
= { [0 ... 8] = 0x00 },
3087 .result
= { 0xd8, 0xd4, 0xe9, 0xde, 0xd9, 0x1e, 0x13, 0xf7 },
3090 .key
= { 0x2b, 0x02, 0x05, 0x68, 0x06, 0x14, 0x49, 0x76,
3091 0x77, 0x5d, 0x0e, 0x26, 0x6c, 0x28, 0x78, 0x43 },
3093 .input
= { 0x74, 0x65, 0x73, 0x74, 0x20, 0x6d, 0x65, 0x2e },
3095 .result
= { 0x94, 0xeb, 0xc8, 0x96, 0x84, 0x6a, 0x49, 0xa8 },
3098 .key
= { 0x09, 0x65, 0x43, 0x11, 0x66, 0x44, 0x39, 0x25,
3099 0x51, 0x3a, 0x16, 0x10, 0x0a, 0x08, 0x12, 0x6e },
3101 .input
= { 0x3e, 0xce, 0xae, 0x22, 0x60, 0x56, 0xa8, 0x9d,
3102 0x65, 0x73, 0x74, 0x5f, 0x76, 0x65, 0x63, 0x74 },
3104 .result
= { 0xe2, 0x04, 0xdb, 0xf2, 0x89, 0x85, 0x9e, 0xea,
3105 0x61, 0x35, 0xaa, 0xed, 0xb5, 0xcb, 0x71, 0x2c },
3108 .key
= { 0x4d, 0x76, 0x32, 0x17, 0x05, 0x3f, 0x75, 0x2c,
3109 0x5d, 0x04, 0x16, 0x36, 0x15, 0x72, 0x63, 0x2f },
3111 .input
= { 0x54, 0x65, 0x61, 0x20, 0x69, 0x73, 0x20, 0x67,
3112 0x6f, 0x6f, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20,
3113 0x79, 0x6f, 0x75, 0x21, 0x21, 0x21, 0x20, 0x72,
3114 0x65, 0x61, 0x6c, 0x6c, 0x79, 0x21, 0x21, 0x21 },
3116 .result
= { 0x99, 0x81, 0x9f, 0x5d, 0x6f, 0x4b, 0x31, 0x3a,
3117 0x86, 0xff, 0x6f, 0xd0, 0xe3, 0x87, 0x70, 0x07,
3118 0x4d, 0xb8, 0xcf, 0xf3, 0x99, 0x50, 0xb3, 0xd4,
3119 0x73, 0xa2, 0xfa, 0xc9, 0x16, 0x59, 0x5d, 0x81 },
3124 static struct cipher_testvec xtea_dec_tv_template
[] = {
3126 .key
= { [0 ... 15] = 0x00 },
3128 .input
= { 0xd8, 0xd4, 0xe9, 0xde, 0xd9, 0x1e, 0x13, 0xf7 },
3130 .result
= { [0 ... 8] = 0x00 },
3133 .key
= { 0x2b, 0x02, 0x05, 0x68, 0x06, 0x14, 0x49, 0x76,
3134 0x77, 0x5d, 0x0e, 0x26, 0x6c, 0x28, 0x78, 0x43 },
3136 .input
= { 0x94, 0xeb, 0xc8, 0x96, 0x84, 0x6a, 0x49, 0xa8 },
3138 .result
= { 0x74, 0x65, 0x73, 0x74, 0x20, 0x6d, 0x65, 0x2e },
3141 .key
= { 0x09, 0x65, 0x43, 0x11, 0x66, 0x44, 0x39, 0x25,
3142 0x51, 0x3a, 0x16, 0x10, 0x0a, 0x08, 0x12, 0x6e },
3144 .input
= { 0x3e, 0xce, 0xae, 0x22, 0x60, 0x56, 0xa8, 0x9d,
3145 0x77, 0x4d, 0xd4, 0xb4, 0x87, 0x24, 0xe3, 0x9a },
3147 .result
= { 0x6c, 0x6f, 0x6e, 0x67, 0x65, 0x72, 0x5f, 0x74,
3148 0x65, 0x73, 0x74, 0x5f, 0x76, 0x65, 0x63, 0x74 },
3151 .key
= { 0x4d, 0x76, 0x32, 0x17, 0x05, 0x3f, 0x75, 0x2c,
3152 0x5d, 0x04, 0x16, 0x36, 0x15, 0x72, 0x63, 0x2f },
3154 .input
= { 0x99, 0x81, 0x9f, 0x5d, 0x6f, 0x4b, 0x31, 0x3a,
3155 0x86, 0xff, 0x6f, 0xd0, 0xe3, 0x87, 0x70, 0x07,
3156 0x4d, 0xb8, 0xcf, 0xf3, 0x99, 0x50, 0xb3, 0xd4,
3157 0x73, 0xa2, 0xfa, 0xc9, 0x16, 0x59, 0x5d, 0x81 },
3159 .result
= { 0x54, 0x65, 0x61, 0x20, 0x69, 0x73, 0x20, 0x67,
3160 0x6f, 0x6f, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20,
3161 0x79, 0x6f, 0x75, 0x21, 0x21, 0x21, 0x20, 0x72,
3162 0x65, 0x61, 0x6c, 0x6c, 0x79, 0x21, 0x21, 0x21 },
3168 * KHAZAD test vectors.
3170 #define KHAZAD_ENC_TEST_VECTORS 5
3171 #define KHAZAD_DEC_TEST_VECTORS 5
3173 static struct cipher_testvec khazad_enc_tv_template
[] = {
3175 .key
= { 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3176 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
3178 .input
= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
3180 .result
= { 0x49, 0xa4, 0xce, 0x32, 0xac, 0x19, 0x0e, 0x3f },
3183 .key
= { 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38,
3184 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38 },
3186 .input
= { 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38 },
3188 .result
= { 0x7e, 0x82, 0x12, 0xa1, 0Xd9, 0X5b, 0Xe4, 0Xf9 },
3191 .key
= { 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2,
3192 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2 },
3194 .input
= { 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2 },
3196 .result
= { 0Xaa, 0Xbe, 0Xc1, 0X95, 0Xc5, 0X94, 0X1a, 0X9c },
3199 .key
= { 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f,
3200 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f },
3202 .input
= { 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f },
3204 .result
= { 0X04, 0X74, 0Xf5, 0X70, 0X50, 0X16, 0Xd3, 0Xb8 },
3207 .key
= { 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f,
3208 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f },
3210 .input
= { 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f ,
3211 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f },
3213 .result
= { 0X04, 0X74, 0Xf5, 0X70, 0X50, 0X16, 0Xd3, 0Xb8 ,
3214 0X04, 0X74, 0Xf5, 0X70, 0X50, 0X16, 0Xd3, 0Xb8 },
3219 static struct cipher_testvec khazad_dec_tv_template
[] = {
3221 .key
= { 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3222 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
3224 .input
= { 0X49, 0Xa4, 0Xce, 0X32, 0Xac, 0X19, 0X0e, 0X3f },
3226 .result
= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
3229 .key
= { 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38,
3230 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38 },
3232 .input
= { 0X7e, 0X82, 0X12, 0Xa1, 0Xd9, 0X5b, 0Xe4, 0Xf9 },
3234 .result
= { 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38 },
3237 .key
= { 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2,
3238 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2 },
3240 .input
= { 0Xaa, 0Xbe, 0Xc1, 0X95, 0Xc5, 0X94, 0X1a, 0X9c },
3242 .result
= { 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2 },
3245 .key
= { 0x2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f,
3246 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f },
3248 .input
= { 0X04, 0X74, 0Xf5, 0X70, 0X50, 0X16, 0Xd3, 0Xb8 },
3250 .result
= { 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f },
3253 .key
= { 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f,
3254 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f },
3256 .input
= { 0X04, 0X74, 0Xf5, 0X70, 0X50, 0X16, 0Xd3, 0Xb8 ,
3257 0X04, 0X74, 0Xf5, 0X70, 0X50, 0X16, 0Xd3, 0Xb8 },
3259 .result
= { 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f ,
3260 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f },
3266 * Anubis test vectors.
3269 #define ANUBIS_ENC_TEST_VECTORS 5
3270 #define ANUBIS_DEC_TEST_VECTORS 5
3271 #define ANUBIS_CBC_ENC_TEST_VECTORS 2
3272 #define ANUBIS_CBC_DEC_TEST_VECTORS 2
3274 static struct cipher_testvec anubis_enc_tv_template
[] = {
3276 .key
= { 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe,
3277 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe },
3279 .input
= { 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe,
3280 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe },
3282 .result
= { 0x6d, 0xc5, 0xda, 0xa2, 0x26, 0x7d, 0x62, 0x6f,
3283 0x08, 0xb7, 0x52, 0x8e, 0x6e, 0x6e, 0x86, 0x90 },
3287 .key
= { 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
3288 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
3289 0x03, 0x03, 0x03, 0x03 },
3291 .input
= { 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
3292 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03 },
3294 .result
= { 0xdb, 0xf1, 0x42, 0xf4, 0xd1, 0x8a, 0xc7, 0x49,
3295 0x87, 0x41, 0x6f, 0x82, 0x0a, 0x98, 0x64, 0xae },
3298 .key
= { 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24,
3299 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24,
3300 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24,
3301 0x24, 0x24, 0x24, 0x24 },
3303 .input
= { 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24,
3304 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24 },
3306 .result
= { 0xfd, 0x1b, 0x4a, 0xe3, 0xbf, 0xf0, 0xad, 0x3d,
3307 0x06, 0xd3, 0x61, 0x27, 0xfd, 0x13, 0x9e, 0xde },
3310 .key
= { 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25,
3311 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25,
3312 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25,
3313 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25 },
3315 .input
= { 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25,
3316 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25 },
3318 .result
= { 0x1a, 0x91, 0xfb, 0x2b, 0xb7, 0x78, 0x6b, 0xc4,
3319 0x17, 0xd9, 0xff, 0x40, 0x3b, 0x0e, 0xe5, 0xfe },
3322 .key
= { 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
3323 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
3324 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
3325 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
3326 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35 },
3328 .input
= { 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
3329 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35 },
3331 .result
= { 0xa5, 0x2c, 0x85, 0x6f, 0x9c, 0xba, 0xa0, 0x97,
3332 0x9e, 0xc6, 0x84, 0x0f, 0x17, 0x21, 0x07, 0xee },
3337 static struct cipher_testvec anubis_dec_tv_template
[] = {
3339 .key
= { 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe,
3340 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe },
3342 .input
= { 0x6d, 0xc5, 0xda, 0xa2, 0x26, 0x7d, 0x62, 0x6f,
3343 0x08, 0xb7, 0x52, 0x8e, 0x6e, 0x6e, 0x86, 0x90 },
3345 .result
= { 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe,
3346 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe },
3350 .key
= { 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
3351 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
3352 0x03, 0x03, 0x03, 0x03 },
3354 .input
= { 0xdb, 0xf1, 0x42, 0xf4, 0xd1, 0x8a, 0xc7, 0x49,
3355 0x87, 0x41, 0x6f, 0x82, 0x0a, 0x98, 0x64, 0xae },
3357 .result
= { 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
3358 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03 },
3361 .key
= { 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24,
3362 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24,
3363 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24,
3364 0x24, 0x24, 0x24, 0x24 },
3366 .input
= { 0xfd, 0x1b, 0x4a, 0xe3, 0xbf, 0xf0, 0xad, 0x3d,
3367 0x06, 0xd3, 0x61, 0x27, 0xfd, 0x13, 0x9e, 0xde },
3369 .result
= { 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24,
3370 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24 },
3373 .key
= { 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25,
3374 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25,
3375 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25,
3376 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25 },
3378 .input
= { 0x1a, 0x91, 0xfb, 0x2b, 0xb7, 0x78, 0x6b, 0xc4,
3379 0x17, 0xd9, 0xff, 0x40, 0x3b, 0x0e, 0xe5, 0xfe },
3381 .result
= { 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25,
3382 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25 },
3385 .key
= { 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
3386 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
3387 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
3388 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
3389 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35 },
3390 .input
= { 0xa5, 0x2c, 0x85, 0x6f, 0x9c, 0xba, 0xa0, 0x97,
3391 0x9e, 0xc6, 0x84, 0x0f, 0x17, 0x21, 0x07, 0xee },
3394 .result
= { 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
3395 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35 },
3400 static struct cipher_testvec anubis_cbc_enc_tv_template
[] = {
3402 .key
= { 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe,
3403 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe },
3405 .input
= { 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe,
3406 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe,
3407 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe,
3408 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe },
3410 .result
= { 0x6d, 0xc5, 0xda, 0xa2, 0x26, 0x7d, 0x62, 0x6f,
3411 0x08, 0xb7, 0x52, 0x8e, 0x6e, 0x6e, 0x86, 0x90,
3412 0x86, 0xd8, 0xb5, 0x6f, 0x98, 0x5e, 0x8a, 0x66,
3413 0x4f, 0x1f, 0x78, 0xa1, 0xbb, 0x37, 0xf1, 0xbe },
3416 .key
= { 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
3417 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
3418 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
3419 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
3420 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35 },
3422 .input
= { 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
3423 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
3424 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
3425 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35 },
3427 .result
= { 0xa5, 0x2c, 0x85, 0x6f, 0x9c, 0xba, 0xa0, 0x97,
3428 0x9e, 0xc6, 0x84, 0x0f, 0x17, 0x21, 0x07, 0xee,
3429 0xa2, 0xbc, 0x06, 0x98, 0xc6, 0x4b, 0xda, 0x75,
3430 0x2e, 0xaa, 0xbe, 0x58, 0xce, 0x01, 0x5b, 0xc7 },
3435 static struct cipher_testvec anubis_cbc_dec_tv_template
[] = {
3437 .key
= { 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe,
3438 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe },
3440 .input
= { 0x6d, 0xc5, 0xda, 0xa2, 0x26, 0x7d, 0x62, 0x6f,
3441 0x08, 0xb7, 0x52, 0x8e, 0x6e, 0x6e, 0x86, 0x90,
3442 0x86, 0xd8, 0xb5, 0x6f, 0x98, 0x5e, 0x8a, 0x66,
3443 0x4f, 0x1f, 0x78, 0xa1, 0xbb, 0x37, 0xf1, 0xbe },
3445 .result
= { 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe,
3446 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe,
3447 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe,
3448 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe },
3451 .key
= { 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
3452 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
3453 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
3454 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
3455 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35 },
3457 .input
= { 0xa5, 0x2c, 0x85, 0x6f, 0x9c, 0xba, 0xa0, 0x97,
3458 0x9e, 0xc6, 0x84, 0x0f, 0x17, 0x21, 0x07, 0xee,
3459 0xa2, 0xbc, 0x06, 0x98, 0xc6, 0x4b, 0xda, 0x75,
3460 0x2e, 0xaa, 0xbe, 0x58, 0xce, 0x01, 0x5b, 0xc7 },
3462 .result
= { 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
3463 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
3464 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
3465 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35 },
3473 #define XETA_ENC_TEST_VECTORS 4
3474 #define XETA_DEC_TEST_VECTORS 4
3476 static struct cipher_testvec xeta_enc_tv_template
[] = {
3478 .key
= { [0 ... 15] = 0x00 },
3480 .input
= { [0 ... 8] = 0x00 },
3482 .result
= { 0xaa, 0x22, 0x96, 0xe5, 0x6c, 0x61, 0xf3, 0x45 },
3485 .key
= { 0x2b, 0x02, 0x05, 0x68, 0x06, 0x14, 0x49, 0x76,
3486 0x77, 0x5d, 0x0e, 0x26, 0x6c, 0x28, 0x78, 0x43 },
3488 .input
= { 0x74, 0x65, 0x73, 0x74, 0x20, 0x6d, 0x65, 0x2e },
3490 .result
= { 0x82, 0x3e, 0xeb, 0x35, 0xdc, 0xdd, 0xd9, 0xc3 },
3493 .key
= { 0x09, 0x65, 0x43, 0x11, 0x66, 0x44, 0x39, 0x25,
3494 0x51, 0x3a, 0x16, 0x10, 0x0a, 0x08, 0x12, 0x6e },
3496 .input
= { 0x6c, 0x6f, 0x6e, 0x67, 0x65, 0x72, 0x5f, 0x74,
3497 0x65, 0x73, 0x74, 0x5f, 0x76, 0x65, 0x63, 0x74 },
3499 .result
= { 0xe2, 0x04, 0xdb, 0xf2, 0x89, 0x85, 0x9e, 0xea,
3500 0x61, 0x35, 0xaa, 0xed, 0xb5, 0xcb, 0x71, 0x2c },
3503 .key
= { 0x4d, 0x76, 0x32, 0x17, 0x05, 0x3f, 0x75, 0x2c,
3504 0x5d, 0x04, 0x16, 0x36, 0x15, 0x72, 0x63, 0x2f },
3506 .input
= { 0x54, 0x65, 0x61, 0x20, 0x69, 0x73, 0x20, 0x67,
3507 0x6f, 0x6f, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20,
3508 0x79, 0x6f, 0x75, 0x21, 0x21, 0x21, 0x20, 0x72,
3509 0x65, 0x61, 0x6c, 0x6c, 0x79, 0x21, 0x21, 0x21 },
3511 .result
= { 0x0b, 0x03, 0xcd, 0x8a, 0xbe, 0x95, 0xfd, 0xb1,
3512 0xc1, 0x44, 0x91, 0x0b, 0xa5, 0xc9, 0x1b, 0xb4,
3513 0xa9, 0xda, 0x1e, 0x9e, 0xb1, 0x3e, 0x2a, 0x8f,
3514 0xea, 0xa5, 0x6a, 0x85, 0xd1, 0xf4, 0xa8, 0xa5 },
3519 static struct cipher_testvec xeta_dec_tv_template
[] = {
3521 .key
= { [0 ... 15] = 0x00 },
3523 .input
= { 0xaa, 0x22, 0x96, 0xe5, 0x6c, 0x61, 0xf3, 0x45 },
3525 .result
= { [0 ... 8] = 0x00 },
3528 .key
= { 0x2b, 0x02, 0x05, 0x68, 0x06, 0x14, 0x49, 0x76,
3529 0x77, 0x5d, 0x0e, 0x26, 0x6c, 0x28, 0x78, 0x43 },
3531 .input
= { 0x82, 0x3e, 0xeb, 0x35, 0xdc, 0xdd, 0xd9, 0xc3 },
3533 .result
= { 0x74, 0x65, 0x73, 0x74, 0x20, 0x6d, 0x65, 0x2e },
3536 .key
= { 0x09, 0x65, 0x43, 0x11, 0x66, 0x44, 0x39, 0x25,
3537 0x51, 0x3a, 0x16, 0x10, 0x0a, 0x08, 0x12, 0x6e },
3539 .input
= { 0xe2, 0x04, 0xdb, 0xf2, 0x89, 0x85, 0x9e, 0xea,
3540 0x61, 0x35, 0xaa, 0xed, 0xb5, 0xcb, 0x71, 0x2c },
3542 .result
= { 0x6c, 0x6f, 0x6e, 0x67, 0x65, 0x72, 0x5f, 0x74,
3543 0x65, 0x73, 0x74, 0x5f, 0x76, 0x65, 0x63, 0x74 },
3546 .key
= { 0x4d, 0x76, 0x32, 0x17, 0x05, 0x3f, 0x75, 0x2c,
3547 0x5d, 0x04, 0x16, 0x36, 0x15, 0x72, 0x63, 0x2f },
3549 .input
= { 0x0b, 0x03, 0xcd, 0x8a, 0xbe, 0x95, 0xfd, 0xb1,
3550 0xc1, 0x44, 0x91, 0x0b, 0xa5, 0xc9, 0x1b, 0xb4,
3551 0xa9, 0xda, 0x1e, 0x9e, 0xb1, 0x3e, 0x2a, 0x8f,
3552 0xea, 0xa5, 0x6a, 0x85, 0xd1, 0xf4, 0xa8, 0xa5 },
3554 .result
= { 0x54, 0x65, 0x61, 0x20, 0x69, 0x73, 0x20, 0x67,
3555 0x6f, 0x6f, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20,
3556 0x79, 0x6f, 0x75, 0x21, 0x21, 0x21, 0x20, 0x72,
3557 0x65, 0x61, 0x6c, 0x6c, 0x79, 0x21, 0x21, 0x21 },
3563 * FCrypt test vectors
3565 #define FCRYPT_ENC_TEST_VECTORS ARRAY_SIZE(fcrypt_pcbc_enc_tv_template)
3566 #define FCRYPT_DEC_TEST_VECTORS ARRAY_SIZE(fcrypt_pcbc_dec_tv_template)
3568 static struct cipher_testvec fcrypt_pcbc_enc_tv_template
[] = {
3569 { /* http://www.openafs.org/pipermail/openafs-devel/2000-December/005320.html */
3570 .key
= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
3572 .iv
= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
3573 .input
= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
3575 .result
= { 0x0E, 0x09, 0x00, 0xC7, 0x3E, 0xF7, 0xED, 0x41 },
3578 .key
= { 0x11, 0x44, 0x77, 0xAA, 0xDD, 0x00, 0x33, 0x66 },
3580 .iv
= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
3581 .input
= { 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0 },
3583 .result
= { 0xD8, 0xED, 0x78, 0x74, 0x77, 0xEC, 0x06, 0x80 },
3585 }, { /* From Arla */
3586 .key
= { 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87 },
3588 .iv
= { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 },
3589 .input
= "The quick brown fox jumps over the lazy dogs.\0\0",
3591 .result
= { 0x00, 0xf0, 0xe, 0x11, 0x75, 0xe6, 0x23, 0x82,
3592 0xee, 0xac, 0x98, 0x62, 0x44, 0x51, 0xe4, 0x84,
3593 0xc3, 0x59, 0xd8, 0xaa, 0x64, 0x60, 0xae, 0xf7,
3594 0xd2, 0xd9, 0x13, 0x79, 0x72, 0xa3, 0x45, 0x03,
3595 0x23, 0xb5, 0x62, 0xd7, 0x0c, 0xf5, 0x27, 0xd1,
3596 0xf8, 0x91, 0x3c, 0xac, 0x44, 0x22, 0x92, 0xef },
3599 .key
= { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 },
3601 .iv
= { 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87 },
3602 .input
= "The quick brown fox jumps over the lazy dogs.\0\0",
3604 .result
= { 0xca, 0x90, 0xf5, 0x9d, 0xcb, 0xd4, 0xd2, 0x3c,
3605 0x01, 0x88, 0x7f, 0x3e, 0x31, 0x6e, 0x62, 0x9d,
3606 0xd8, 0xe0, 0x57, 0xa3, 0x06, 0x3a, 0x42, 0x58,
3607 0x2a, 0x28, 0xfe, 0x72, 0x52, 0x2f, 0xdd, 0xe0,
3608 0x19, 0x89, 0x09, 0x1c, 0x2a, 0x8e, 0x8c, 0x94,
3609 0xfc, 0xc7, 0x68, 0xe4, 0x88, 0xaa, 0xde, 0x0f },
3611 }, { /* split-page version */
3612 .key
= { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 },
3614 .iv
= { 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87 },
3615 .input
= "The quick brown fox jumps over the lazy dogs.\0\0",
3617 .result
= { 0xca, 0x90, 0xf5, 0x9d, 0xcb, 0xd4, 0xd2, 0x3c,
3618 0x01, 0x88, 0x7f, 0x3e, 0x31, 0x6e, 0x62, 0x9d,
3619 0xd8, 0xe0, 0x57, 0xa3, 0x06, 0x3a, 0x42, 0x58,
3620 0x2a, 0x28, 0xfe, 0x72, 0x52, 0x2f, 0xdd, 0xe0,
3621 0x19, 0x89, 0x09, 0x1c, 0x2a, 0x8e, 0x8c, 0x94,
3622 0xfc, 0xc7, 0x68, 0xe4, 0x88, 0xaa, 0xde, 0x0f },
3629 static struct cipher_testvec fcrypt_pcbc_dec_tv_template
[] = {
3630 { /* http://www.openafs.org/pipermail/openafs-devel/2000-December/005320.html */
3631 .key
= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
3633 .iv
= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
3634 .input
= { 0x0E, 0x09, 0x00, 0xC7, 0x3E, 0xF7, 0xED, 0x41 },
3636 .result
= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
3639 .key
= { 0x11, 0x44, 0x77, 0xAA, 0xDD, 0x00, 0x33, 0x66 },
3641 .iv
= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
3642 .input
= { 0xD8, 0xED, 0x78, 0x74, 0x77, 0xEC, 0x06, 0x80 },
3644 .result
= { 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0 },
3646 }, { /* From Arla */
3647 .key
= { 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87 },
3649 .iv
= { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 },
3650 .input
= { 0x00, 0xf0, 0xe, 0x11, 0x75, 0xe6, 0x23, 0x82,
3651 0xee, 0xac, 0x98, 0x62, 0x44, 0x51, 0xe4, 0x84,
3652 0xc3, 0x59, 0xd8, 0xaa, 0x64, 0x60, 0xae, 0xf7,
3653 0xd2, 0xd9, 0x13, 0x79, 0x72, 0xa3, 0x45, 0x03,
3654 0x23, 0xb5, 0x62, 0xd7, 0x0c, 0xf5, 0x27, 0xd1,
3655 0xf8, 0x91, 0x3c, 0xac, 0x44, 0x22, 0x92, 0xef },
3657 .result
= "The quick brown fox jumps over the lazy dogs.\0\0",
3660 .key
= { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 },
3662 .iv
= { 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87 },
3663 .input
= { 0xca, 0x90, 0xf5, 0x9d, 0xcb, 0xd4, 0xd2, 0x3c,
3664 0x01, 0x88, 0x7f, 0x3e, 0x31, 0x6e, 0x62, 0x9d,
3665 0xd8, 0xe0, 0x57, 0xa3, 0x06, 0x3a, 0x42, 0x58,
3666 0x2a, 0x28, 0xfe, 0x72, 0x52, 0x2f, 0xdd, 0xe0,
3667 0x19, 0x89, 0x09, 0x1c, 0x2a, 0x8e, 0x8c, 0x94,
3668 0xfc, 0xc7, 0x68, 0xe4, 0x88, 0xaa, 0xde, 0x0f },
3670 .result
= "The quick brown fox jumps over the lazy dogs.\0\0",
3672 }, { /* split-page version */
3673 .key
= { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 },
3675 .iv
= { 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87 },
3676 .input
= { 0xca, 0x90, 0xf5, 0x9d, 0xcb, 0xd4, 0xd2, 0x3c,
3677 0x01, 0x88, 0x7f, 0x3e, 0x31, 0x6e, 0x62, 0x9d,
3678 0xd8, 0xe0, 0x57, 0xa3, 0x06, 0x3a, 0x42, 0x58,
3679 0x2a, 0x28, 0xfe, 0x72, 0x52, 0x2f, 0xdd, 0xe0,
3680 0x19, 0x89, 0x09, 0x1c, 0x2a, 0x8e, 0x8c, 0x94,
3681 0xfc, 0xc7, 0x68, 0xe4, 0x88, 0xaa, 0xde, 0x0f },
3683 .result
= "The quick brown fox jumps over the lazy dogs.\0\0",
3691 * CAMELLIA test vectors.
3693 #define CAMELLIA_ENC_TEST_VECTORS 3
3694 #define CAMELLIA_DEC_TEST_VECTORS 3
3695 #define CAMELLIA_CBC_ENC_TEST_VECTORS 2
3696 #define CAMELLIA_CBC_DEC_TEST_VECTORS 2
3698 static struct cipher_testvec camellia_enc_tv_template
[] = {
3700 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
3701 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 },
3703 .input
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
3704 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 },
3706 .result
= { 0x67, 0x67, 0x31, 0x38, 0x54, 0x96, 0x69, 0x73,
3707 0x08, 0x57, 0x06, 0x56, 0x48, 0xea, 0xbe, 0x43 },
3710 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
3711 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10,
3712 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77 },
3714 .input
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
3715 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 },
3717 .result
= { 0xb4, 0x99, 0x34, 0x01, 0xb3, 0xe9, 0x96, 0xf8,
3718 0x4e, 0xe5, 0xce, 0xe7, 0xd7, 0x9b, 0x09, 0xb9 },
3721 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
3722 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10,
3723 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
3724 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff },
3726 .input
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
3727 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 },
3729 .result
= { 0x9a, 0xcc, 0x23, 0x7d, 0xff, 0x16, 0xd7, 0x6c,
3730 0x20, 0xef, 0x7c, 0x91, 0x9e, 0x3a, 0x75, 0x09 },
3735 static struct cipher_testvec camellia_dec_tv_template
[] = {
3737 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
3738 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 },
3740 .input
= { 0x67, 0x67, 0x31, 0x38, 0x54, 0x96, 0x69, 0x73,
3741 0x08, 0x57, 0x06, 0x56, 0x48, 0xea, 0xbe, 0x43 },
3743 .result
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
3744 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 },
3747 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
3748 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10,
3749 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77 },
3751 .input
= { 0xb4, 0x99, 0x34, 0x01, 0xb3, 0xe9, 0x96, 0xf8,
3752 0x4e, 0xe5, 0xce, 0xe7, 0xd7, 0x9b, 0x09, 0xb9 },
3754 .result
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
3755 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 },
3758 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
3759 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10,
3760 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
3761 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff },
3763 .input
= { 0x9a, 0xcc, 0x23, 0x7d, 0xff, 0x16, 0xd7, 0x6c,
3764 0x20, 0xef, 0x7c, 0x91, 0x9e, 0x3a, 0x75, 0x09 },
3766 .result
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
3767 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 },
3772 static struct cipher_testvec camellia_cbc_enc_tv_template
[] = {
3774 .key
= { 0x06, 0xa9, 0x21, 0x40, 0x36, 0xb8, 0xa1, 0x5b,
3775 0x51, 0x2e, 0x03, 0xd5, 0x34, 0x12, 0x00, 0x06 },
3777 .iv
= { 0x3d, 0xaf, 0xba, 0x42, 0x9d, 0x9e, 0xb4, 0x30,
3778 0xb4, 0x22, 0xda, 0x80, 0x2c, 0x9f, 0xac, 0x41 },
3779 .input
= { "Single block msg" },
3781 .result
= { 0xea, 0x32, 0x12, 0x76, 0x3b, 0x50, 0x10, 0xe7,
3782 0x18, 0xf6, 0xfd, 0x5d, 0xf6, 0x8f, 0x13, 0x51 },
3785 .key
= { 0xc2, 0x86, 0x69, 0x6d, 0x88, 0x7c, 0x9a, 0xa0,
3786 0x61, 0x1b, 0xbb, 0x3e, 0x20, 0x25, 0xa4, 0x5a },
3788 .iv
= { 0x56, 0x2e, 0x17, 0x99, 0x6d, 0x09, 0x3d, 0x28,
3789 0xdd, 0xb3, 0xba, 0x69, 0x5a, 0x2e, 0x6f, 0x58 },
3790 .input
= { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
3791 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
3792 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
3793 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f },
3795 .result
= { 0xa5, 0xdf, 0x6e, 0x50, 0xda, 0x70, 0x6c, 0x01,
3796 0x4a, 0xab, 0xf3, 0xf2, 0xd6, 0xfc, 0x6c, 0xfd,
3797 0x19, 0xb4, 0x3e, 0x57, 0x1c, 0x02, 0x5e, 0xa0,
3798 0x15, 0x78, 0xe0, 0x5e, 0xf2, 0xcb, 0x87, 0x16 },
3803 static struct cipher_testvec camellia_cbc_dec_tv_template
[] = {
3805 .key
= { 0x06, 0xa9, 0x21, 0x40, 0x36, 0xb8, 0xa1, 0x5b,
3806 0x51, 0x2e, 0x03, 0xd5, 0x34, 0x12, 0x00, 0x06 },
3808 .iv
= { 0x3d, 0xaf, 0xba, 0x42, 0x9d, 0x9e, 0xb4, 0x30,
3809 0xb4, 0x22, 0xda, 0x80, 0x2c, 0x9f, 0xac, 0x41 },
3810 .input
= { 0xea, 0x32, 0x12, 0x76, 0x3b, 0x50, 0x10, 0xe7,
3811 0x18, 0xf6, 0xfd, 0x5d, 0xf6, 0x8f, 0x13, 0x51 },
3813 .result
= { "Single block msg" },
3816 .key
= { 0xc2, 0x86, 0x69, 0x6d, 0x88, 0x7c, 0x9a, 0xa0,
3817 0x61, 0x1b, 0xbb, 0x3e, 0x20, 0x25, 0xa4, 0x5a },
3819 .iv
= { 0x56, 0x2e, 0x17, 0x99, 0x6d, 0x09, 0x3d, 0x28,
3820 0xdd, 0xb3, 0xba, 0x69, 0x5a, 0x2e, 0x6f, 0x58 },
3821 .input
= { 0xa5, 0xdf, 0x6e, 0x50, 0xda, 0x70, 0x6c, 0x01,
3822 0x4a, 0xab, 0xf3, 0xf2, 0xd6, 0xfc, 0x6c, 0xfd,
3823 0x19, 0xb4, 0x3e, 0x57, 0x1c, 0x02, 0x5e, 0xa0,
3824 0x15, 0x78, 0xe0, 0x5e, 0xf2, 0xcb, 0x87, 0x16 },
3826 .result
= { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
3827 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
3828 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
3829 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f },
3835 * Compression stuff.
3837 #define COMP_BUF_SIZE 512
3839 struct comp_testvec
{
3841 char input
[COMP_BUF_SIZE
];
3842 char output
[COMP_BUF_SIZE
];
3846 * Deflate test vectors (null-terminated strings).
3847 * Params: winbits=11, Z_DEFAULT_COMPRESSION, MAX_MEM_LEVEL.
3849 #define DEFLATE_COMP_TEST_VECTORS 2
3850 #define DEFLATE_DECOMP_TEST_VECTORS 2
3852 static struct comp_testvec deflate_comp_tv_template
[] = {
3856 .input
= "Join us now and share the software "
3857 "Join us now and share the software ",
3858 .output
= { 0xf3, 0xca, 0xcf, 0xcc, 0x53, 0x28, 0x2d, 0x56,
3859 0xc8, 0xcb, 0x2f, 0x57, 0x48, 0xcc, 0x4b, 0x51,
3860 0x28, 0xce, 0x48, 0x2c, 0x4a, 0x55, 0x28, 0xc9,
3861 0x48, 0x55, 0x28, 0xce, 0x4f, 0x2b, 0x29, 0x07,
3862 0x71, 0xbc, 0x08, 0x2b, 0x01, 0x00 },
3866 .input
= "This document describes a compression method based on the DEFLATE"
3867 "compression algorithm. This document defines the application of "
3868 "the DEFLATE algorithm to the IP Payload Compression Protocol.",
3869 .output
= { 0x5d, 0x8d, 0x31, 0x0e, 0xc2, 0x30, 0x10, 0x04,
3870 0xbf, 0xb2, 0x2f, 0xc8, 0x1f, 0x10, 0x04, 0x09,
3871 0x89, 0xc2, 0x85, 0x3f, 0x70, 0xb1, 0x2f, 0xf8,
3872 0x24, 0xdb, 0x67, 0xd9, 0x47, 0xc1, 0xef, 0x49,
3873 0x68, 0x12, 0x51, 0xae, 0x76, 0x67, 0xd6, 0x27,
3874 0x19, 0x88, 0x1a, 0xde, 0x85, 0xab, 0x21, 0xf2,
3875 0x08, 0x5d, 0x16, 0x1e, 0x20, 0x04, 0x2d, 0xad,
3876 0xf3, 0x18, 0xa2, 0x15, 0x85, 0x2d, 0x69, 0xc4,
3877 0x42, 0x83, 0x23, 0xb6, 0x6c, 0x89, 0x71, 0x9b,
3878 0xef, 0xcf, 0x8b, 0x9f, 0xcf, 0x33, 0xca, 0x2f,
3879 0xed, 0x62, 0xa9, 0x4c, 0x80, 0xff, 0x13, 0xaf,
3880 0x52, 0x37, 0xed, 0x0e, 0x52, 0x6b, 0x59, 0x02,
3881 0xd9, 0x4e, 0xe8, 0x7a, 0x76, 0x1d, 0x02, 0x98,
3882 0xfe, 0x8a, 0x87, 0x83, 0xa3, 0x4f, 0x56, 0x8a,
3883 0xb8, 0x9e, 0x8e, 0x5c, 0x57, 0xd3, 0xa0, 0x79,
3888 static struct comp_testvec deflate_decomp_tv_template
[] = {
3892 .input
= { 0x5d, 0x8d, 0x31, 0x0e, 0xc2, 0x30, 0x10, 0x04,
3893 0xbf, 0xb2, 0x2f, 0xc8, 0x1f, 0x10, 0x04, 0x09,
3894 0x89, 0xc2, 0x85, 0x3f, 0x70, 0xb1, 0x2f, 0xf8,
3895 0x24, 0xdb, 0x67, 0xd9, 0x47, 0xc1, 0xef, 0x49,
3896 0x68, 0x12, 0x51, 0xae, 0x76, 0x67, 0xd6, 0x27,
3897 0x19, 0x88, 0x1a, 0xde, 0x85, 0xab, 0x21, 0xf2,
3898 0x08, 0x5d, 0x16, 0x1e, 0x20, 0x04, 0x2d, 0xad,
3899 0xf3, 0x18, 0xa2, 0x15, 0x85, 0x2d, 0x69, 0xc4,
3900 0x42, 0x83, 0x23, 0xb6, 0x6c, 0x89, 0x71, 0x9b,
3901 0xef, 0xcf, 0x8b, 0x9f, 0xcf, 0x33, 0xca, 0x2f,
3902 0xed, 0x62, 0xa9, 0x4c, 0x80, 0xff, 0x13, 0xaf,
3903 0x52, 0x37, 0xed, 0x0e, 0x52, 0x6b, 0x59, 0x02,
3904 0xd9, 0x4e, 0xe8, 0x7a, 0x76, 0x1d, 0x02, 0x98,
3905 0xfe, 0x8a, 0x87, 0x83, 0xa3, 0x4f, 0x56, 0x8a,
3906 0xb8, 0x9e, 0x8e, 0x5c, 0x57, 0xd3, 0xa0, 0x79,
3908 .output
= "This document describes a compression method based on the DEFLATE"
3909 "compression algorithm. This document defines the application of "
3910 "the DEFLATE algorithm to the IP Payload Compression Protocol.",
3914 .input
= { 0xf3, 0xca, 0xcf, 0xcc, 0x53, 0x28, 0x2d, 0x56,
3915 0xc8, 0xcb, 0x2f, 0x57, 0x48, 0xcc, 0x4b, 0x51,
3916 0x28, 0xce, 0x48, 0x2c, 0x4a, 0x55, 0x28, 0xc9,
3917 0x48, 0x55, 0x28, 0xce, 0x4f, 0x2b, 0x29, 0x07,
3918 0x71, 0xbc, 0x08, 0x2b, 0x01, 0x00 },
3919 .output
= "Join us now and share the software "
3920 "Join us now and share the software ",
3925 * Michael MIC test vectors from IEEE 802.11i
3927 #define MICHAEL_MIC_TEST_VECTORS 6
3929 static struct hash_testvec michael_mic_tv_template
[] = {
3931 .key
= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
3935 .digest
= { 0x82, 0x92, 0x5c, 0x1c, 0xa1, 0xd1, 0x30, 0xb8 }
3938 .key
= { 0x82, 0x92, 0x5c, 0x1c, 0xa1, 0xd1, 0x30, 0xb8 },
3940 .plaintext
= { 'M' },
3942 .digest
= { 0x43, 0x47, 0x21, 0xca, 0x40, 0x63, 0x9b, 0x3f }
3945 .key
= { 0x43, 0x47, 0x21, 0xca, 0x40, 0x63, 0x9b, 0x3f },
3947 .plaintext
= { 'M', 'i' },
3949 .digest
= { 0xe8, 0xf9, 0xbe, 0xca, 0xe9, 0x7e, 0x5d, 0x29 }
3952 .key
= { 0xe8, 0xf9, 0xbe, 0xca, 0xe9, 0x7e, 0x5d, 0x29 },
3954 .plaintext
= { 'M', 'i', 'c' },
3956 .digest
= { 0x90, 0x03, 0x8f, 0xc6, 0xcf, 0x13, 0xc1, 0xdb }
3959 .key
= { 0x90, 0x03, 0x8f, 0xc6, 0xcf, 0x13, 0xc1, 0xdb },
3961 .plaintext
= { 'M', 'i', 'c', 'h' },
3963 .digest
= { 0xd5, 0x5e, 0x10, 0x05, 0x10, 0x12, 0x89, 0x86 }
3966 .key
= { 0xd5, 0x5e, 0x10, 0x05, 0x10, 0x12, 0x89, 0x86 },
3968 .plaintext
= { 'M', 'i', 'c', 'h', 'a', 'e', 'l' },
3970 .digest
= { 0x0a, 0x94, 0x2b, 0x12, 0x4e, 0xca, 0xa5, 0x46 },
3975 * CRC32C test vectors
3977 #define CRC32C_TEST_VECTORS 14
3979 static struct hash_testvec crc32c_tv_template
[] = {
3982 .digest
= { 0x00, 0x00, 0x00, 0x00 }
3985 .key
= { 0x87, 0xa9, 0xcb, 0xed },
3988 .digest
= { 0x78, 0x56, 0x34, 0x12 },
3991 .key
= { 0xff, 0xff, 0xff, 0xff },
3993 .plaintext
= { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
3994 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
3995 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
3996 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20,
3997 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28 },
3999 .digest
= { 0x7f, 0x15, 0x2c, 0x0e }
4002 .key
= { 0xff, 0xff, 0xff, 0xff },
4004 .plaintext
= { 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30,
4005 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38,
4006 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x40,
4007 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48,
4008 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50 },
4010 .digest
= { 0xf6, 0xeb, 0x80, 0xe9 }
4013 .key
= { 0xff, 0xff, 0xff, 0xff },
4015 .plaintext
= { 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
4016 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, 0x60,
4017 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68,
4018 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70,
4019 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78 },
4021 .digest
= { 0xed, 0xbd, 0x74, 0xde }
4024 .key
= { 0xff, 0xff, 0xff, 0xff },
4026 .plaintext
= { 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x80,
4027 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88,
4028 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90,
4029 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98,
4030 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0 },
4032 .digest
= { 0x62, 0xc8, 0x79, 0xd5 }
4035 .key
= { 0xff, 0xff, 0xff, 0xff },
4037 .plaintext
= { 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8,
4038 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0,
4039 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8,
4040 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 0xc0,
4041 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8 },
4043 .digest
= { 0xd0, 0x9a, 0x97, 0xba }
4046 .key
= { 0xff, 0xff, 0xff, 0xff },
4048 .plaintext
= { 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0,
4049 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8,
4050 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, 0xe0,
4051 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8,
4052 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0 },
4054 .digest
= { 0x13, 0xd9, 0x29, 0x2b }
4057 .key
= { 0x80, 0xea, 0xd3, 0xf1 },
4059 .plaintext
= { 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30,
4060 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38,
4061 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x40,
4062 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48,
4063 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50 },
4065 .digest
= { 0x0c, 0xb5, 0xe2, 0xa2 }
4068 .key
= { 0xf3, 0x4a, 0x1d, 0x5d },
4070 .plaintext
= { 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
4071 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, 0x60,
4072 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68,
4073 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70,
4074 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78 },
4076 .digest
= { 0xd1, 0x7f, 0xfb, 0xa6 }
4079 .key
= { 0x2e, 0x80, 0x04, 0x59 },
4081 .plaintext
= { 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x80,
4082 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88,
4083 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90,
4084 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98,
4085 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0 },
4087 .digest
= { 0x59, 0x33, 0xe6, 0x7a }
4090 .key
= { 0xa6, 0xcc, 0x19, 0x85 },
4092 .plaintext
= { 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8,
4093 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0,
4094 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8,
4095 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 0xc0,
4096 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8 },
4098 .digest
= { 0xbe, 0x03, 0x01, 0xd2 }
4101 .key
= { 0x41, 0xfc, 0xfe, 0x2d },
4103 .plaintext
= { 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0,
4104 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8,
4105 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, 0xe0,
4106 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8,
4107 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0 },
4109 .digest
= { 0x75, 0xd3, 0xc5, 0x24 }
4112 .key
= { 0xff, 0xff, 0xff, 0xff },
4114 .plaintext
= { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
4115 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
4116 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
4117 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20,
4118 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28,
4119 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30,
4120 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38,
4121 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x40,
4122 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48,
4123 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50,
4124 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
4125 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, 0x60,
4126 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68,
4127 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70,
4128 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78,
4129 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x80,
4130 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88,
4131 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90,
4132 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98,
4133 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0,
4134 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8,
4135 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0,
4136 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8,
4137 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 0xc0,
4138 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8,
4139 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0,
4140 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8,
4141 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, 0xe0,
4142 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8,
4143 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0 },
4145 .digest
= { 0x75, 0xd3, 0xc5, 0x24 },
4152 * Cipher speed tests
4154 static struct cipher_speed aes_speed_template
[] = {
4155 { .klen
= 16, .blen
= 16, },
4156 { .klen
= 16, .blen
= 64, },
4157 { .klen
= 16, .blen
= 256, },
4158 { .klen
= 16, .blen
= 1024, },
4159 { .klen
= 16, .blen
= 8192, },
4160 { .klen
= 24, .blen
= 16, },
4161 { .klen
= 24, .blen
= 64, },
4162 { .klen
= 24, .blen
= 256, },
4163 { .klen
= 24, .blen
= 1024, },
4164 { .klen
= 24, .blen
= 8192, },
4165 { .klen
= 32, .blen
= 16, },
4166 { .klen
= 32, .blen
= 64, },
4167 { .klen
= 32, .blen
= 256, },
4168 { .klen
= 32, .blen
= 1024, },
4169 { .klen
= 32, .blen
= 8192, },
4172 { .klen
= 0, .blen
= 0, }
4175 static struct cipher_speed aes_lrw_speed_template
[] = {
4176 { .klen
= 32, .blen
= 16, },
4177 { .klen
= 32, .blen
= 64, },
4178 { .klen
= 32, .blen
= 256, },
4179 { .klen
= 32, .blen
= 1024, },
4180 { .klen
= 32, .blen
= 8192, },
4181 { .klen
= 40, .blen
= 16, },
4182 { .klen
= 40, .blen
= 64, },
4183 { .klen
= 40, .blen
= 256, },
4184 { .klen
= 40, .blen
= 1024, },
4185 { .klen
= 40, .blen
= 8192, },
4186 { .klen
= 48, .blen
= 16, },
4187 { .klen
= 48, .blen
= 64, },
4188 { .klen
= 48, .blen
= 256, },
4189 { .klen
= 48, .blen
= 1024, },
4190 { .klen
= 48, .blen
= 8192, },
4193 { .klen
= 0, .blen
= 0, }
4196 static struct cipher_speed des3_ede_speed_template
[] = {
4197 { .klen
= 24, .blen
= 16, },
4198 { .klen
= 24, .blen
= 64, },
4199 { .klen
= 24, .blen
= 256, },
4200 { .klen
= 24, .blen
= 1024, },
4201 { .klen
= 24, .blen
= 8192, },
4204 { .klen
= 0, .blen
= 0, }
4207 static struct cipher_speed twofish_speed_template
[] = {
4208 { .klen
= 16, .blen
= 16, },
4209 { .klen
= 16, .blen
= 64, },
4210 { .klen
= 16, .blen
= 256, },
4211 { .klen
= 16, .blen
= 1024, },
4212 { .klen
= 16, .blen
= 8192, },
4213 { .klen
= 24, .blen
= 16, },
4214 { .klen
= 24, .blen
= 64, },
4215 { .klen
= 24, .blen
= 256, },
4216 { .klen
= 24, .blen
= 1024, },
4217 { .klen
= 24, .blen
= 8192, },
4218 { .klen
= 32, .blen
= 16, },
4219 { .klen
= 32, .blen
= 64, },
4220 { .klen
= 32, .blen
= 256, },
4221 { .klen
= 32, .blen
= 1024, },
4222 { .klen
= 32, .blen
= 8192, },
4225 { .klen
= 0, .blen
= 0, }
4228 static struct cipher_speed blowfish_speed_template
[] = {
4229 /* Don't support blowfish keys > 256 bit in this test */
4230 { .klen
= 8, .blen
= 16, },
4231 { .klen
= 8, .blen
= 64, },
4232 { .klen
= 8, .blen
= 256, },
4233 { .klen
= 8, .blen
= 1024, },
4234 { .klen
= 8, .blen
= 8192, },
4235 { .klen
= 32, .blen
= 16, },
4236 { .klen
= 32, .blen
= 64, },
4237 { .klen
= 32, .blen
= 256, },
4238 { .klen
= 32, .blen
= 1024, },
4239 { .klen
= 32, .blen
= 8192, },
4242 { .klen
= 0, .blen
= 0, }
4245 static struct cipher_speed des_speed_template
[] = {
4246 { .klen
= 8, .blen
= 16, },
4247 { .klen
= 8, .blen
= 64, },
4248 { .klen
= 8, .blen
= 256, },
4249 { .klen
= 8, .blen
= 1024, },
4250 { .klen
= 8, .blen
= 8192, },
4253 { .klen
= 0, .blen
= 0, }
4257 * Digest speed tests
4259 static struct hash_speed generic_hash_speed_template
[] = {
4260 { .blen
= 16, .plen
= 16, },
4261 { .blen
= 64, .plen
= 16, },
4262 { .blen
= 64, .plen
= 64, },
4263 { .blen
= 256, .plen
= 16, },
4264 { .blen
= 256, .plen
= 64, },
4265 { .blen
= 256, .plen
= 256, },
4266 { .blen
= 1024, .plen
= 16, },
4267 { .blen
= 1024, .plen
= 256, },
4268 { .blen
= 1024, .plen
= 1024, },
4269 { .blen
= 2048, .plen
= 16, },
4270 { .blen
= 2048, .plen
= 256, },
4271 { .blen
= 2048, .plen
= 1024, },
4272 { .blen
= 2048, .plen
= 2048, },
4273 { .blen
= 4096, .plen
= 16, },
4274 { .blen
= 4096, .plen
= 256, },
4275 { .blen
= 4096, .plen
= 1024, },
4276 { .blen
= 4096, .plen
= 4096, },
4277 { .blen
= 8192, .plen
= 16, },
4278 { .blen
= 8192, .plen
= 256, },
4279 { .blen
= 8192, .plen
= 1024, },
4280 { .blen
= 8192, .plen
= 4096, },
4281 { .blen
= 8192, .plen
= 8192, },
4284 { .blen
= 0, .plen
= 0, }
4287 static struct cipher_speed camellia_speed_template
[] = {
4288 { .klen
= 16, .blen
= 16, },
4289 { .klen
= 16, .blen
= 64, },
4290 { .klen
= 16, .blen
= 256, },
4291 { .klen
= 16, .blen
= 1024, },
4292 { .klen
= 16, .blen
= 8192, },
4293 { .klen
= 24, .blen
= 16, },
4294 { .klen
= 24, .blen
= 64, },
4295 { .klen
= 24, .blen
= 256, },
4296 { .klen
= 24, .blen
= 1024, },
4297 { .klen
= 24, .blen
= 8192, },
4298 { .klen
= 32, .blen
= 16, },
4299 { .klen
= 32, .blen
= 64, },
4300 { .klen
= 32, .blen
= 256, },
4301 { .klen
= 32, .blen
= 1024, },
4302 { .klen
= 32, .blen
= 8192, },
4305 { .klen
= 0, .blen
= 0, }
4308 #endif /* _CRYPTO_TCRYPT_H */