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 * 14 - 09 - 2003 Changes by Kartikey Mahendra Bhatt
18 #ifndef _CRYPTO_TCRYPT_H
19 #define _CRYPTO_TCRYPT_H
21 #define MAX_DIGEST_SIZE 64
30 char digest
[MAX_DIGEST_SIZE
];
32 unsigned char tap
[MAX_TAP
];
33 char key
[128]; /* only used with keyed hash algorithms */
42 char digest
[MAX_DIGEST_SIZE
];
44 unsigned char tap
[MAX_TAP
];
47 struct cipher_testvec
{
49 unsigned char wk
; /* weak key flag */
58 unsigned char tap
[MAX_TAP
];
62 * MD4 test vectors from RFC1320
64 #define MD4_TEST_VECTORS 7
66 static struct hash_testvec md4_tv_template
[] = {
69 .digest
= { 0x31, 0xd6, 0xcf, 0xe0, 0xd1, 0x6a, 0xe9, 0x31,
70 0xb7, 0x3c, 0x59, 0xd7, 0xe0, 0xc0, 0x89, 0xc0 },
74 .digest
= { 0xbd, 0xe5, 0x2c, 0xb3, 0x1d, 0xe3, 0x3e, 0x46,
75 0x24, 0x5e, 0x05, 0xfb, 0xdb, 0xd6, 0xfb, 0x24 },
79 .digest
= { 0xa4, 0x48, 0x01, 0x7a, 0xaf, 0x21, 0xd8, 0x52,
80 0x5f, 0xc1, 0x0a, 0xe8, 0x7a, 0xa6, 0x72, 0x9d },
82 .plaintext
= "message digest",
84 .digest
= { 0xd9, 0x13, 0x0a, 0x81, 0x64, 0x54, 0x9f, 0xe8,
85 0x18, 0x87, 0x48, 0x06, 0xe1, 0xc7, 0x01, 0x4b },
87 .plaintext
= "abcdefghijklmnopqrstuvwxyz",
89 .digest
= { 0xd7, 0x9e, 0x1c, 0x30, 0x8a, 0xa5, 0xbb, 0xcd,
90 0xee, 0xa8, 0xed, 0x63, 0xdf, 0x41, 0x2d, 0xa9 },
94 .plaintext
= "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
96 .digest
= { 0x04, 0x3f, 0x85, 0x82, 0xf2, 0x41, 0xdb, 0x35,
97 0x1c, 0xe6, 0x27, 0xe1, 0x53, 0xe7, 0xf0, 0xe4 },
99 .plaintext
= "123456789012345678901234567890123456789012345678901234567890123"
102 .digest
= { 0xe3, 0x3b, 0x4d, 0xdc, 0x9c, 0x38, 0xf2, 0x19,
103 0x9c, 0x3e, 0x7b, 0x16, 0x4f, 0xcc, 0x05, 0x36 },
108 * MD5 test vectors from RFC1321
110 #define MD5_TEST_VECTORS 7
112 static struct hash_testvec md5_tv_template
[] = {
114 .digest
= { 0xd4, 0x1d, 0x8c, 0xd9, 0x8f, 0x00, 0xb2, 0x04,
115 0xe9, 0x80, 0x09, 0x98, 0xec, 0xf8, 0x42, 0x7e },
119 .digest
= { 0x0c, 0xc1, 0x75, 0xb9, 0xc0, 0xf1, 0xb6, 0xa8,
120 0x31, 0xc3, 0x99, 0xe2, 0x69, 0x77, 0x26, 0x61 },
124 .digest
= { 0x90, 0x01, 0x50, 0x98, 0x3c, 0xd2, 0x4f, 0xb0,
125 0xd6, 0x96, 0x3f, 0x7d, 0x28, 0xe1, 0x7f, 0x72 },
127 .plaintext
= "message digest",
129 .digest
= { 0xf9, 0x6b, 0x69, 0x7d, 0x7c, 0xb7, 0x93, 0x8d,
130 0x52, 0x5a, 0x2f, 0x31, 0xaa, 0xf1, 0x61, 0xd0 },
132 .plaintext
= "abcdefghijklmnopqrstuvwxyz",
134 .digest
= { 0xc3, 0xfc, 0xd3, 0xd7, 0x61, 0x92, 0xe4, 0x00,
135 0x7d, 0xfb, 0x49, 0x6c, 0xca, 0x67, 0xe1, 0x3b },
139 .plaintext
= "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
141 .digest
= { 0xd1, 0x74, 0xab, 0x98, 0xd2, 0x77, 0xd9, 0xf5,
142 0xa5, 0x61, 0x1c, 0x2c, 0x9f, 0x41, 0x9d, 0x9f },
144 .plaintext
= "12345678901234567890123456789012345678901234567890123456789012"
145 "345678901234567890",
147 .digest
= { 0x57, 0xed, 0xf4, 0xa2, 0x2b, 0xe3, 0xc9, 0x55,
148 0xac, 0x49, 0xda, 0x2e, 0x21, 0x07, 0xb6, 0x7a },
153 * SHA1 test vectors from from FIPS PUB 180-1
155 #define SHA1_TEST_VECTORS 2
157 static struct hash_testvec sha1_tv_template
[] = {
161 .digest
= { 0xa9, 0x99, 0x3e, 0x36, 0x47, 0x06, 0x81, 0x6a, 0xba, 0x3e,
162 0x25, 0x71, 0x78, 0x50, 0xc2, 0x6c, 0x9c, 0xd0, 0xd8, 0x9d },
164 .plaintext
= "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
166 .digest
= { 0x84, 0x98, 0x3e, 0x44, 0x1c, 0x3b, 0xd2, 0x6e, 0xba, 0xae,
167 0x4a, 0xa1, 0xf9, 0x51, 0x29, 0xe5, 0xe5, 0x46, 0x70, 0xf1 },
174 * SHA256 test vectors from from NIST
176 #define SHA256_TEST_VECTORS 2
178 static struct hash_testvec sha256_tv_template
[] = {
182 .digest
= { 0xba, 0x78, 0x16, 0xbf, 0x8f, 0x01, 0xcf, 0xea,
183 0x41, 0x41, 0x40, 0xde, 0x5d, 0xae, 0x22, 0x23,
184 0xb0, 0x03, 0x61, 0xa3, 0x96, 0x17, 0x7a, 0x9c,
185 0xb4, 0x10, 0xff, 0x61, 0xf2, 0x00, 0x15, 0xad },
187 .plaintext
= "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
189 .digest
= { 0x24, 0x8d, 0x6a, 0x61, 0xd2, 0x06, 0x38, 0xb8,
190 0xe5, 0xc0, 0x26, 0x93, 0x0c, 0x3e, 0x60, 0x39,
191 0xa3, 0x3c, 0xe4, 0x59, 0x64, 0xff, 0x21, 0x67,
192 0xf6, 0xec, 0xed, 0xd4, 0x19, 0xdb, 0x06, 0xc1 },
199 * SHA384 test vectors from from NIST and kerneli
201 #define SHA384_TEST_VECTORS 4
203 static struct hash_testvec sha384_tv_template
[] = {
207 .digest
= { 0xcb, 0x00, 0x75, 0x3f, 0x45, 0xa3, 0x5e, 0x8b,
208 0xb5, 0xa0, 0x3d, 0x69, 0x9a, 0xc6, 0x50, 0x07,
209 0x27, 0x2c, 0x32, 0xab, 0x0e, 0xde, 0xd1, 0x63,
210 0x1a, 0x8b, 0x60, 0x5a, 0x43, 0xff, 0x5b, 0xed,
211 0x80, 0x86, 0x07, 0x2b, 0xa1, 0xe7, 0xcc, 0x23,
212 0x58, 0xba, 0xec, 0xa1, 0x34, 0xc8, 0x25, 0xa7 },
214 .plaintext
= "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
216 .digest
= { 0x33, 0x91, 0xfd, 0xdd, 0xfc, 0x8d, 0xc7, 0x39,
217 0x37, 0x07, 0xa6, 0x5b, 0x1b, 0x47, 0x09, 0x39,
218 0x7c, 0xf8, 0xb1, 0xd1, 0x62, 0xaf, 0x05, 0xab,
219 0xfe, 0x8f, 0x45, 0x0d, 0xe5, 0xf3, 0x6b, 0xc6,
220 0xb0, 0x45, 0x5a, 0x85, 0x20, 0xbc, 0x4e, 0x6f,
221 0x5f, 0xe9, 0x5b, 0x1f, 0xe3, 0xc8, 0x45, 0x2b},
223 .plaintext
= "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmn"
224 "hijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu",
226 .digest
= { 0x09, 0x33, 0x0c, 0x33, 0xf7, 0x11, 0x47, 0xe8,
227 0x3d, 0x19, 0x2f, 0xc7, 0x82, 0xcd, 0x1b, 0x47,
228 0x53, 0x11, 0x1b, 0x17, 0x3b, 0x3b, 0x05, 0xd2,
229 0x2f, 0xa0, 0x80, 0x86, 0xe3, 0xb0, 0xf7, 0x12,
230 0xfc, 0xc7, 0xc7, 0x1a, 0x55, 0x7e, 0x2d, 0xb9,
231 0x66, 0xc3, 0xe9, 0xfa, 0x91, 0x74, 0x60, 0x39 },
233 .plaintext
= "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcd"
234 "efghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz",
236 .digest
= { 0x3d, 0x20, 0x89, 0x73, 0xab, 0x35, 0x08, 0xdb,
237 0xbd, 0x7e, 0x2c, 0x28, 0x62, 0xba, 0x29, 0x0a,
238 0xd3, 0x01, 0x0e, 0x49, 0x78, 0xc1, 0x98, 0xdc,
239 0x4d, 0x8f, 0xd0, 0x14, 0xe5, 0x82, 0x82, 0x3a,
240 0x89, 0xe1, 0x6f, 0x9b, 0x2a, 0x7b, 0xbc, 0x1a,
241 0xc9, 0x38, 0xe2, 0xd1, 0x99, 0xe8, 0xbe, 0xa4 },
243 .tap
= { 26, 26, 26, 26 }
248 * SHA512 test vectors from from NIST and kerneli
250 #define SHA512_TEST_VECTORS 4
252 static struct hash_testvec sha512_tv_template
[] = {
256 .digest
= { 0xdd, 0xaf, 0x35, 0xa1, 0x93, 0x61, 0x7a, 0xba,
257 0xcc, 0x41, 0x73, 0x49, 0xae, 0x20, 0x41, 0x31,
258 0x12, 0xe6, 0xfa, 0x4e, 0x89, 0xa9, 0x7e, 0xa2,
259 0x0a, 0x9e, 0xee, 0xe6, 0x4b, 0x55, 0xd3, 0x9a,
260 0x21, 0x92, 0x99, 0x2a, 0x27, 0x4f, 0xc1, 0xa8,
261 0x36, 0xba, 0x3c, 0x23, 0xa3, 0xfe, 0xeb, 0xbd,
262 0x45, 0x4d, 0x44, 0x23, 0x64, 0x3c, 0xe8, 0x0e,
263 0x2a, 0x9a, 0xc9, 0x4f, 0xa5, 0x4c, 0xa4, 0x9f },
265 .plaintext
= "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
267 .digest
= { 0x20, 0x4a, 0x8f, 0xc6, 0xdd, 0xa8, 0x2f, 0x0a,
268 0x0c, 0xed, 0x7b, 0xeb, 0x8e, 0x08, 0xa4, 0x16,
269 0x57, 0xc1, 0x6e, 0xf4, 0x68, 0xb2, 0x28, 0xa8,
270 0x27, 0x9b, 0xe3, 0x31, 0xa7, 0x03, 0xc3, 0x35,
271 0x96, 0xfd, 0x15, 0xc1, 0x3b, 0x1b, 0x07, 0xf9,
272 0xaa, 0x1d, 0x3b, 0xea, 0x57, 0x78, 0x9c, 0xa0,
273 0x31, 0xad, 0x85, 0xc7, 0xa7, 0x1d, 0xd7, 0x03,
274 0x54, 0xec, 0x63, 0x12, 0x38, 0xca, 0x34, 0x45 },
276 .plaintext
= "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmn"
277 "hijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu",
279 .digest
= { 0x8e, 0x95, 0x9b, 0x75, 0xda, 0xe3, 0x13, 0xda,
280 0x8c, 0xf4, 0xf7, 0x28, 0x14, 0xfc, 0x14, 0x3f,
281 0x8f, 0x77, 0x79, 0xc6, 0xeb, 0x9f, 0x7f, 0xa1,
282 0x72, 0x99, 0xae, 0xad, 0xb6, 0x88, 0x90, 0x18,
283 0x50, 0x1d, 0x28, 0x9e, 0x49, 0x00, 0xf7, 0xe4,
284 0x33, 0x1b, 0x99, 0xde, 0xc4, 0xb5, 0x43, 0x3a,
285 0xc7, 0xd3, 0x29, 0xee, 0xb6, 0xdd, 0x26, 0x54,
286 0x5e, 0x96, 0xe5, 0x5b, 0x87, 0x4b, 0xe9, 0x09 },
288 .plaintext
= "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcd"
289 "efghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz",
291 .digest
= { 0x93, 0x0d, 0x0c, 0xef, 0xcb, 0x30, 0xff, 0x11,
292 0x33, 0xb6, 0x89, 0x81, 0x21, 0xf1, 0xcf, 0x3d,
293 0x27, 0x57, 0x8a, 0xfc, 0xaf, 0xe8, 0x67, 0x7c,
294 0x52, 0x57, 0xcf, 0x06, 0x99, 0x11, 0xf7, 0x5d,
295 0x8f, 0x58, 0x31, 0xb5, 0x6e, 0xbf, 0xda, 0x67,
296 0xb2, 0x78, 0xe6, 0x6d, 0xff, 0x8b, 0x84, 0xfe,
297 0x2b, 0x28, 0x70, 0xf7, 0x42, 0xa5, 0x80, 0xd8,
298 0xed, 0xb4, 0x19, 0x87, 0x23, 0x28, 0x50, 0xc9 },
300 .tap
= { 26, 26, 26, 26 }
306 * WHIRLPOOL test vectors from Whirlpool package
307 * by Vincent Rijmen and Paulo S. L. M. Barreto as part of the NESSIE
310 #define WP512_TEST_VECTORS 8
312 static struct hash_testvec wp512_tv_template
[] = {
316 .digest
= { 0x19, 0xFA, 0x61, 0xD7, 0x55, 0x22, 0xA4, 0x66,
317 0x9B, 0x44, 0xE3, 0x9C, 0x1D, 0x2E, 0x17, 0x26,
318 0xC5, 0x30, 0x23, 0x21, 0x30, 0xD4, 0x07, 0xF8,
319 0x9A, 0xFE, 0xE0, 0x96, 0x49, 0x97, 0xF7, 0xA7,
320 0x3E, 0x83, 0xBE, 0x69, 0x8B, 0x28, 0x8F, 0xEB,
321 0xCF, 0x88, 0xE3, 0xE0, 0x3C, 0x4F, 0x07, 0x57,
322 0xEA, 0x89, 0x64, 0xE5, 0x9B, 0x63, 0xD9, 0x37,
323 0x08, 0xB1, 0x38, 0xCC, 0x42, 0xA6, 0x6E, 0xB3 },
329 .digest
= { 0x8A, 0xCA, 0x26, 0x02, 0x79, 0x2A, 0xEC, 0x6F,
330 0x11, 0xA6, 0x72, 0x06, 0x53, 0x1F, 0xB7, 0xD7,
331 0xF0, 0xDF, 0xF5, 0x94, 0x13, 0x14, 0x5E, 0x69,
332 0x73, 0xC4, 0x50, 0x01, 0xD0, 0x08, 0x7B, 0x42,
333 0xD1, 0x1B, 0xC6, 0x45, 0x41, 0x3A, 0xEF, 0xF6,
334 0x3A, 0x42, 0x39, 0x1A, 0x39, 0x14, 0x5A, 0x59,
335 0x1A, 0x92, 0x20, 0x0D, 0x56, 0x01, 0x95, 0xE5,
336 0x3B, 0x47, 0x85, 0x84, 0xFD, 0xAE, 0x23, 0x1A },
340 .digest
= { 0x4E, 0x24, 0x48, 0xA4, 0xC6, 0xF4, 0x86, 0xBB,
341 0x16, 0xB6, 0x56, 0x2C, 0x73, 0xB4, 0x02, 0x0B,
342 0xF3, 0x04, 0x3E, 0x3A, 0x73, 0x1B, 0xCE, 0x72,
343 0x1A, 0xE1, 0xB3, 0x03, 0xD9, 0x7E, 0x6D, 0x4C,
344 0x71, 0x81, 0xEE, 0xBD, 0xB6, 0xC5, 0x7E, 0x27,
345 0x7D, 0x0E, 0x34, 0x95, 0x71, 0x14, 0xCB, 0xD6,
346 0xC7, 0x97, 0xFC, 0x9D, 0x95, 0xD8, 0xB5, 0x82,
347 0xD2, 0x25, 0x29, 0x20, 0x76, 0xD4, 0xEE, 0xF5 },
349 .plaintext
= "message digest",
351 .digest
= { 0x37, 0x8C, 0x84, 0xA4, 0x12, 0x6E, 0x2D, 0xC6,
352 0xE5, 0x6D, 0xCC, 0x74, 0x58, 0x37, 0x7A, 0xAC,
353 0x83, 0x8D, 0x00, 0x03, 0x22, 0x30, 0xF5, 0x3C,
354 0xE1, 0xF5, 0x70, 0x0C, 0x0F, 0xFB, 0x4D, 0x3B,
355 0x84, 0x21, 0x55, 0x76, 0x59, 0xEF, 0x55, 0xC1,
356 0x06, 0xB4, 0xB5, 0x2A, 0xC5, 0xA4, 0xAA, 0xA6,
357 0x92, 0xED, 0x92, 0x00, 0x52, 0x83, 0x8F, 0x33,
358 0x62, 0xE8, 0x6D, 0xBD, 0x37, 0xA8, 0x90, 0x3E },
360 .plaintext
= "abcdefghijklmnopqrstuvwxyz",
362 .digest
= { 0xF1, 0xD7, 0x54, 0x66, 0x26, 0x36, 0xFF, 0xE9,
363 0x2C, 0x82, 0xEB, 0xB9, 0x21, 0x2A, 0x48, 0x4A,
364 0x8D, 0x38, 0x63, 0x1E, 0xAD, 0x42, 0x38, 0xF5,
365 0x44, 0x2E, 0xE1, 0x3B, 0x80, 0x54, 0xE4, 0x1B,
366 0x08, 0xBF, 0x2A, 0x92, 0x51, 0xC3, 0x0B, 0x6A,
367 0x0B, 0x8A, 0xAE, 0x86, 0x17, 0x7A, 0xB4, 0xA6,
368 0xF6, 0x8F, 0x67, 0x3E, 0x72, 0x07, 0x86, 0x5D,
369 0x5D, 0x98, 0x19, 0xA3, 0xDB, 0xA4, 0xEB, 0x3B },
371 .plaintext
= "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
372 "abcdefghijklmnopqrstuvwxyz0123456789",
374 .digest
= { 0xDC, 0x37, 0xE0, 0x08, 0xCF, 0x9E, 0xE6, 0x9B,
375 0xF1, 0x1F, 0x00, 0xED, 0x9A, 0xBA, 0x26, 0x90,
376 0x1D, 0xD7, 0xC2, 0x8C, 0xDE, 0xC0, 0x66, 0xCC,
377 0x6A, 0xF4, 0x2E, 0x40, 0xF8, 0x2F, 0x3A, 0x1E,
378 0x08, 0xEB, 0xA2, 0x66, 0x29, 0x12, 0x9D, 0x8F,
379 0xB7, 0xCB, 0x57, 0x21, 0x1B, 0x92, 0x81, 0xA6,
380 0x55, 0x17, 0xCC, 0x87, 0x9D, 0x7B, 0x96, 0x21,
381 0x42, 0xC6, 0x5F, 0x5A, 0x7A, 0xF0, 0x14, 0x67 },
383 .plaintext
= "1234567890123456789012345678901234567890"
384 "1234567890123456789012345678901234567890",
386 .digest
= { 0x46, 0x6E, 0xF1, 0x8B, 0xAB, 0xB0, 0x15, 0x4D,
387 0x25, 0xB9, 0xD3, 0x8A, 0x64, 0x14, 0xF5, 0xC0,
388 0x87, 0x84, 0x37, 0x2B, 0xCC, 0xB2, 0x04, 0xD6,
389 0x54, 0x9C, 0x4A, 0xFA, 0xDB, 0x60, 0x14, 0x29,
390 0x4D, 0x5B, 0xD8, 0xDF, 0x2A, 0x6C, 0x44, 0xE5,
391 0x38, 0xCD, 0x04, 0x7B, 0x26, 0x81, 0xA5, 0x1A,
392 0x2C, 0x60, 0x48, 0x1E, 0x88, 0xC5, 0xA2, 0x0B,
393 0x2C, 0x2A, 0x80, 0xCF, 0x3A, 0x9A, 0x08, 0x3B },
395 .plaintext
= "abcdbcdecdefdefgefghfghighijhijk",
397 .digest
= { 0x2A, 0x98, 0x7E, 0xA4, 0x0F, 0x91, 0x70, 0x61,
398 0xF5, 0xD6, 0xF0, 0xA0, 0xE4, 0x64, 0x4F, 0x48,
399 0x8A, 0x7A, 0x5A, 0x52, 0xDE, 0xEE, 0x65, 0x62,
400 0x07, 0xC5, 0x62, 0xF9, 0x88, 0xE9, 0x5C, 0x69,
401 0x16, 0xBD, 0xC8, 0x03, 0x1B, 0xC5, 0xBE, 0x1B,
402 0x7B, 0x94, 0x76, 0x39, 0xFE, 0x05, 0x0B, 0x56,
403 0x93, 0x9B, 0xAA, 0xA0, 0xAD, 0xFF, 0x9A, 0xE6,
404 0x74, 0x5B, 0x7B, 0x18, 0x1C, 0x3B, 0xE3, 0xFD },
408 #define WP384_TEST_VECTORS 8
410 static struct hash_testvec wp384_tv_template
[] = {
414 .digest
= { 0x19, 0xFA, 0x61, 0xD7, 0x55, 0x22, 0xA4, 0x66,
415 0x9B, 0x44, 0xE3, 0x9C, 0x1D, 0x2E, 0x17, 0x26,
416 0xC5, 0x30, 0x23, 0x21, 0x30, 0xD4, 0x07, 0xF8,
417 0x9A, 0xFE, 0xE0, 0x96, 0x49, 0x97, 0xF7, 0xA7,
418 0x3E, 0x83, 0xBE, 0x69, 0x8B, 0x28, 0x8F, 0xEB,
419 0xCF, 0x88, 0xE3, 0xE0, 0x3C, 0x4F, 0x07, 0x57 },
425 .digest
= { 0x8A, 0xCA, 0x26, 0x02, 0x79, 0x2A, 0xEC, 0x6F,
426 0x11, 0xA6, 0x72, 0x06, 0x53, 0x1F, 0xB7, 0xD7,
427 0xF0, 0xDF, 0xF5, 0x94, 0x13, 0x14, 0x5E, 0x69,
428 0x73, 0xC4, 0x50, 0x01, 0xD0, 0x08, 0x7B, 0x42,
429 0xD1, 0x1B, 0xC6, 0x45, 0x41, 0x3A, 0xEF, 0xF6,
430 0x3A, 0x42, 0x39, 0x1A, 0x39, 0x14, 0x5A, 0x59 },
434 .digest
= { 0x4E, 0x24, 0x48, 0xA4, 0xC6, 0xF4, 0x86, 0xBB,
435 0x16, 0xB6, 0x56, 0x2C, 0x73, 0xB4, 0x02, 0x0B,
436 0xF3, 0x04, 0x3E, 0x3A, 0x73, 0x1B, 0xCE, 0x72,
437 0x1A, 0xE1, 0xB3, 0x03, 0xD9, 0x7E, 0x6D, 0x4C,
438 0x71, 0x81, 0xEE, 0xBD, 0xB6, 0xC5, 0x7E, 0x27,
439 0x7D, 0x0E, 0x34, 0x95, 0x71, 0x14, 0xCB, 0xD6 },
441 .plaintext
= "message digest",
443 .digest
= { 0x37, 0x8C, 0x84, 0xA4, 0x12, 0x6E, 0x2D, 0xC6,
444 0xE5, 0x6D, 0xCC, 0x74, 0x58, 0x37, 0x7A, 0xAC,
445 0x83, 0x8D, 0x00, 0x03, 0x22, 0x30, 0xF5, 0x3C,
446 0xE1, 0xF5, 0x70, 0x0C, 0x0F, 0xFB, 0x4D, 0x3B,
447 0x84, 0x21, 0x55, 0x76, 0x59, 0xEF, 0x55, 0xC1,
448 0x06, 0xB4, 0xB5, 0x2A, 0xC5, 0xA4, 0xAA, 0xA6 },
450 .plaintext
= "abcdefghijklmnopqrstuvwxyz",
452 .digest
= { 0xF1, 0xD7, 0x54, 0x66, 0x26, 0x36, 0xFF, 0xE9,
453 0x2C, 0x82, 0xEB, 0xB9, 0x21, 0x2A, 0x48, 0x4A,
454 0x8D, 0x38, 0x63, 0x1E, 0xAD, 0x42, 0x38, 0xF5,
455 0x44, 0x2E, 0xE1, 0x3B, 0x80, 0x54, 0xE4, 0x1B,
456 0x08, 0xBF, 0x2A, 0x92, 0x51, 0xC3, 0x0B, 0x6A,
457 0x0B, 0x8A, 0xAE, 0x86, 0x17, 0x7A, 0xB4, 0xA6 },
459 .plaintext
= "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
460 "abcdefghijklmnopqrstuvwxyz0123456789",
462 .digest
= { 0xDC, 0x37, 0xE0, 0x08, 0xCF, 0x9E, 0xE6, 0x9B,
463 0xF1, 0x1F, 0x00, 0xED, 0x9A, 0xBA, 0x26, 0x90,
464 0x1D, 0xD7, 0xC2, 0x8C, 0xDE, 0xC0, 0x66, 0xCC,
465 0x6A, 0xF4, 0x2E, 0x40, 0xF8, 0x2F, 0x3A, 0x1E,
466 0x08, 0xEB, 0xA2, 0x66, 0x29, 0x12, 0x9D, 0x8F,
467 0xB7, 0xCB, 0x57, 0x21, 0x1B, 0x92, 0x81, 0xA6 },
469 .plaintext
= "1234567890123456789012345678901234567890"
470 "1234567890123456789012345678901234567890",
472 .digest
= { 0x46, 0x6E, 0xF1, 0x8B, 0xAB, 0xB0, 0x15, 0x4D,
473 0x25, 0xB9, 0xD3, 0x8A, 0x64, 0x14, 0xF5, 0xC0,
474 0x87, 0x84, 0x37, 0x2B, 0xCC, 0xB2, 0x04, 0xD6,
475 0x54, 0x9C, 0x4A, 0xFA, 0xDB, 0x60, 0x14, 0x29,
476 0x4D, 0x5B, 0xD8, 0xDF, 0x2A, 0x6C, 0x44, 0xE5,
477 0x38, 0xCD, 0x04, 0x7B, 0x26, 0x81, 0xA5, 0x1A },
479 .plaintext
= "abcdbcdecdefdefgefghfghighijhijk",
481 .digest
= { 0x2A, 0x98, 0x7E, 0xA4, 0x0F, 0x91, 0x70, 0x61,
482 0xF5, 0xD6, 0xF0, 0xA0, 0xE4, 0x64, 0x4F, 0x48,
483 0x8A, 0x7A, 0x5A, 0x52, 0xDE, 0xEE, 0x65, 0x62,
484 0x07, 0xC5, 0x62, 0xF9, 0x88, 0xE9, 0x5C, 0x69,
485 0x16, 0xBD, 0xC8, 0x03, 0x1B, 0xC5, 0xBE, 0x1B,
486 0x7B, 0x94, 0x76, 0x39, 0xFE, 0x05, 0x0B, 0x56 },
490 #define WP256_TEST_VECTORS 8
492 static struct hash_testvec wp256_tv_template
[] = {
496 .digest
= { 0x19, 0xFA, 0x61, 0xD7, 0x55, 0x22, 0xA4, 0x66,
497 0x9B, 0x44, 0xE3, 0x9C, 0x1D, 0x2E, 0x17, 0x26,
498 0xC5, 0x30, 0x23, 0x21, 0x30, 0xD4, 0x07, 0xF8,
499 0x9A, 0xFE, 0xE0, 0x96, 0x49, 0x97, 0xF7, 0xA7 },
505 .digest
= { 0x8A, 0xCA, 0x26, 0x02, 0x79, 0x2A, 0xEC, 0x6F,
506 0x11, 0xA6, 0x72, 0x06, 0x53, 0x1F, 0xB7, 0xD7,
507 0xF0, 0xDF, 0xF5, 0x94, 0x13, 0x14, 0x5E, 0x69,
508 0x73, 0xC4, 0x50, 0x01, 0xD0, 0x08, 0x7B, 0x42 },
512 .digest
= { 0x4E, 0x24, 0x48, 0xA4, 0xC6, 0xF4, 0x86, 0xBB,
513 0x16, 0xB6, 0x56, 0x2C, 0x73, 0xB4, 0x02, 0x0B,
514 0xF3, 0x04, 0x3E, 0x3A, 0x73, 0x1B, 0xCE, 0x72,
515 0x1A, 0xE1, 0xB3, 0x03, 0xD9, 0x7E, 0x6D, 0x4C },
517 .plaintext
= "message digest",
519 .digest
= { 0x37, 0x8C, 0x84, 0xA4, 0x12, 0x6E, 0x2D, 0xC6,
520 0xE5, 0x6D, 0xCC, 0x74, 0x58, 0x37, 0x7A, 0xAC,
521 0x83, 0x8D, 0x00, 0x03, 0x22, 0x30, 0xF5, 0x3C,
522 0xE1, 0xF5, 0x70, 0x0C, 0x0F, 0xFB, 0x4D, 0x3B },
524 .plaintext
= "abcdefghijklmnopqrstuvwxyz",
526 .digest
= { 0xF1, 0xD7, 0x54, 0x66, 0x26, 0x36, 0xFF, 0xE9,
527 0x2C, 0x82, 0xEB, 0xB9, 0x21, 0x2A, 0x48, 0x4A,
528 0x8D, 0x38, 0x63, 0x1E, 0xAD, 0x42, 0x38, 0xF5,
529 0x44, 0x2E, 0xE1, 0x3B, 0x80, 0x54, 0xE4, 0x1B },
531 .plaintext
= "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
532 "abcdefghijklmnopqrstuvwxyz0123456789",
534 .digest
= { 0xDC, 0x37, 0xE0, 0x08, 0xCF, 0x9E, 0xE6, 0x9B,
535 0xF1, 0x1F, 0x00, 0xED, 0x9A, 0xBA, 0x26, 0x90,
536 0x1D, 0xD7, 0xC2, 0x8C, 0xDE, 0xC0, 0x66, 0xCC,
537 0x6A, 0xF4, 0x2E, 0x40, 0xF8, 0x2F, 0x3A, 0x1E },
539 .plaintext
= "1234567890123456789012345678901234567890"
540 "1234567890123456789012345678901234567890",
542 .digest
= { 0x46, 0x6E, 0xF1, 0x8B, 0xAB, 0xB0, 0x15, 0x4D,
543 0x25, 0xB9, 0xD3, 0x8A, 0x64, 0x14, 0xF5, 0xC0,
544 0x87, 0x84, 0x37, 0x2B, 0xCC, 0xB2, 0x04, 0xD6,
545 0x54, 0x9C, 0x4A, 0xFA, 0xDB, 0x60, 0x14, 0x29 },
547 .plaintext
= "abcdbcdecdefdefgefghfghighijhijk",
549 .digest
= { 0x2A, 0x98, 0x7E, 0xA4, 0x0F, 0x91, 0x70, 0x61,
550 0xF5, 0xD6, 0xF0, 0xA0, 0xE4, 0x64, 0x4F, 0x48,
551 0x8A, 0x7A, 0x5A, 0x52, 0xDE, 0xEE, 0x65, 0x62,
552 0x07, 0xC5, 0x62, 0xF9, 0x88, 0xE9, 0x5C, 0x69 },
557 * TIGER test vectors from Tiger website
559 #define TGR192_TEST_VECTORS 6
561 static struct hash_testvec tgr192_tv_template
[] = {
565 .digest
= { 0x24, 0xf0, 0x13, 0x0c, 0x63, 0xac, 0x93, 0x32,
566 0x16, 0x16, 0x6e, 0x76, 0xb1, 0xbb, 0x92, 0x5f,
567 0xf3, 0x73, 0xde, 0x2d, 0x49, 0x58, 0x4e, 0x7a },
571 .digest
= { 0xf2, 0x58, 0xc1, 0xe8, 0x84, 0x14, 0xab, 0x2a,
572 0x52, 0x7a, 0xb5, 0x41, 0xff, 0xc5, 0xb8, 0xbf,
573 0x93, 0x5f, 0x7b, 0x95, 0x1c, 0x13, 0x29, 0x51 },
575 .plaintext
= "Tiger",
577 .digest
= { 0x9f, 0x00, 0xf5, 0x99, 0x07, 0x23, 0x00, 0xdd,
578 0x27, 0x6a, 0xbb, 0x38, 0xc8, 0xeb, 0x6d, 0xec,
579 0x37, 0x79, 0x0c, 0x11, 0x6f, 0x9d, 0x2b, 0xdf },
581 .plaintext
= "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-",
583 .digest
= { 0x87, 0xfb, 0x2a, 0x90, 0x83, 0x85, 0x1c, 0xf7,
584 0x47, 0x0d, 0x2c, 0xf8, 0x10, 0xe6, 0xdf, 0x9e,
585 0xb5, 0x86, 0x44, 0x50, 0x34, 0xa5, 0xa3, 0x86 },
587 .plaintext
= "ABCDEFGHIJKLMNOPQRSTUVWXYZ=abcdefghijklmnopqrstuvwxyz+0123456789",
589 .digest
= { 0x46, 0x7d, 0xb8, 0x08, 0x63, 0xeb, 0xce, 0x48,
590 0x8d, 0xf1, 0xcd, 0x12, 0x61, 0x65, 0x5d, 0xe9,
591 0x57, 0x89, 0x65, 0x65, 0x97, 0x5f, 0x91, 0x97 },
593 .plaintext
= "Tiger - A Fast New Hash Function, "
594 "by Ross Anderson and Eli Biham, "
595 "proceedings of Fast Software Encryption 3, "
598 .digest
= { 0x3d, 0x9a, 0xeb, 0x03, 0xd1, 0xbd, 0x1a, 0x63,
599 0x57, 0xb2, 0x77, 0x4d, 0xfd, 0x6d, 0x5b, 0x24,
600 0xdd, 0x68, 0x15, 0x1d, 0x50, 0x39, 0x74, 0xfc },
604 #define TGR160_TEST_VECTORS 6
606 static struct hash_testvec tgr160_tv_template
[] = {
610 .digest
= { 0x24, 0xf0, 0x13, 0x0c, 0x63, 0xac, 0x93, 0x32,
611 0x16, 0x16, 0x6e, 0x76, 0xb1, 0xbb, 0x92, 0x5f,
612 0xf3, 0x73, 0xde, 0x2d },
616 .digest
= { 0xf2, 0x58, 0xc1, 0xe8, 0x84, 0x14, 0xab, 0x2a,
617 0x52, 0x7a, 0xb5, 0x41, 0xff, 0xc5, 0xb8, 0xbf,
618 0x93, 0x5f, 0x7b, 0x95 },
620 .plaintext
= "Tiger",
622 .digest
= { 0x9f, 0x00, 0xf5, 0x99, 0x07, 0x23, 0x00, 0xdd,
623 0x27, 0x6a, 0xbb, 0x38, 0xc8, 0xeb, 0x6d, 0xec,
624 0x37, 0x79, 0x0c, 0x11 },
626 .plaintext
= "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-",
628 .digest
= { 0x87, 0xfb, 0x2a, 0x90, 0x83, 0x85, 0x1c, 0xf7,
629 0x47, 0x0d, 0x2c, 0xf8, 0x10, 0xe6, 0xdf, 0x9e,
630 0xb5, 0x86, 0x44, 0x50 },
632 .plaintext
= "ABCDEFGHIJKLMNOPQRSTUVWXYZ=abcdefghijklmnopqrstuvwxyz+0123456789",
634 .digest
= { 0x46, 0x7d, 0xb8, 0x08, 0x63, 0xeb, 0xce, 0x48,
635 0x8d, 0xf1, 0xcd, 0x12, 0x61, 0x65, 0x5d, 0xe9,
636 0x57, 0x89, 0x65, 0x65 },
638 .plaintext
= "Tiger - A Fast New Hash Function, "
639 "by Ross Anderson and Eli Biham, "
640 "proceedings of Fast Software Encryption 3, "
643 .digest
= { 0x3d, 0x9a, 0xeb, 0x03, 0xd1, 0xbd, 0x1a, 0x63,
644 0x57, 0xb2, 0x77, 0x4d, 0xfd, 0x6d, 0x5b, 0x24,
645 0xdd, 0x68, 0x15, 0x1d },
649 #define TGR128_TEST_VECTORS 6
651 static struct hash_testvec tgr128_tv_template
[] = {
655 .digest
= { 0x24, 0xf0, 0x13, 0x0c, 0x63, 0xac, 0x93, 0x32,
656 0x16, 0x16, 0x6e, 0x76, 0xb1, 0xbb, 0x92, 0x5f },
660 .digest
= { 0xf2, 0x58, 0xc1, 0xe8, 0x84, 0x14, 0xab, 0x2a,
661 0x52, 0x7a, 0xb5, 0x41, 0xff, 0xc5, 0xb8, 0xbf },
663 .plaintext
= "Tiger",
665 .digest
= { 0x9f, 0x00, 0xf5, 0x99, 0x07, 0x23, 0x00, 0xdd,
666 0x27, 0x6a, 0xbb, 0x38, 0xc8, 0xeb, 0x6d, 0xec },
668 .plaintext
= "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-",
670 .digest
= { 0x87, 0xfb, 0x2a, 0x90, 0x83, 0x85, 0x1c, 0xf7,
671 0x47, 0x0d, 0x2c, 0xf8, 0x10, 0xe6, 0xdf, 0x9e },
673 .plaintext
= "ABCDEFGHIJKLMNOPQRSTUVWXYZ=abcdefghijklmnopqrstuvwxyz+0123456789",
675 .digest
= { 0x46, 0x7d, 0xb8, 0x08, 0x63, 0xeb, 0xce, 0x48,
676 0x8d, 0xf1, 0xcd, 0x12, 0x61, 0x65, 0x5d, 0xe9 },
678 .plaintext
= "Tiger - A Fast New Hash Function, "
679 "by Ross Anderson and Eli Biham, "
680 "proceedings of Fast Software Encryption 3, "
683 .digest
= { 0x3d, 0x9a, 0xeb, 0x03, 0xd1, 0xbd, 0x1a, 0x63,
684 0x57, 0xb2, 0x77, 0x4d, 0xfd, 0x6d, 0x5b, 0x24 },
688 #ifdef CONFIG_CRYPTO_HMAC
690 * HMAC-MD5 test vectors from RFC2202
691 * (These need to be fixed to not use strlen).
693 #define HMAC_MD5_TEST_VECTORS 7
695 static struct hmac_testvec hmac_md5_tv_template
[] =
698 .key
= { [0 ... 15] = 0x0b },
700 .plaintext
= "Hi There",
702 .digest
= { 0x92, 0x94, 0x72, 0x7a, 0x36, 0x38, 0xbb, 0x1c,
703 0x13, 0xf4, 0x8e, 0xf8, 0x15, 0x8b, 0xfc, 0x9d },
705 .key
= { 'J', 'e', 'f', 'e' },
707 .plaintext
= "what do ya want for nothing?",
709 .digest
= { 0x75, 0x0c, 0x78, 0x3e, 0x6a, 0xb0, 0xb5, 0x03,
710 0xea, 0xa8, 0x6e, 0x31, 0x0a, 0x5d, 0xb7, 0x38 },
714 .key
= { [0 ... 15] = 0xaa },
716 .plaintext
= { [0 ... 49] = 0xdd },
718 .digest
= { 0x56, 0xbe, 0x34, 0x52, 0x1d, 0x14, 0x4c, 0x88,
719 0xdb, 0xb8, 0xc7, 0x33, 0xf0, 0xe8, 0xb3, 0xf6 },
721 .key
= { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
722 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
723 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, },
725 .plaintext
= { [0 ... 49] = 0xcd },
727 .digest
= { 0x69, 0x7e, 0xaf, 0x0a, 0xca, 0x3a, 0x3a, 0xea,
728 0x3a, 0x75, 0x16, 0x47, 0x46, 0xff, 0xaa, 0x79 },
730 .key
= { [0 ... 15] = 0x0c },
732 .plaintext
= "Test With Truncation",
734 .digest
= { 0x56, 0x46, 0x1e, 0xf2, 0x34, 0x2e, 0xdc, 0x00,
735 0xf9, 0xba, 0xb9, 0x95, 0x69, 0x0e, 0xfd, 0x4c },
737 .key
= { [0 ... 79] = 0xaa },
739 .plaintext
= "Test Using Larger Than Block-Size Key - Hash Key First",
741 .digest
= { 0x6b, 0x1a, 0xb7, 0xfe, 0x4b, 0xd7, 0xbf, 0x8f,
742 0x0b, 0x62, 0xe6, 0xce, 0x61, 0xb9, 0xd0, 0xcd },
744 .key
= { [0 ... 79] = 0xaa },
746 .plaintext
= "Test Using Larger Than Block-Size Key and Larger Than One "
749 .digest
= { 0x6f, 0x63, 0x0f, 0xad, 0x67, 0xcd, 0xa0, 0xee,
750 0x1f, 0xb1, 0xf5, 0x62, 0xdb, 0x3a, 0xa5, 0x3e },
755 * HMAC-SHA1 test vectors from RFC2202
757 #define HMAC_SHA1_TEST_VECTORS 7
759 static struct hmac_testvec hmac_sha1_tv_template
[] = {
761 .key
= { [0 ... 19] = 0x0b },
763 .plaintext
= "Hi There",
765 .digest
= { 0xb6, 0x17, 0x31, 0x86, 0x55, 0x05, 0x72, 0x64,
766 0xe2, 0x8b, 0xc0, 0xb6, 0xfb, 0x37, 0x8c, 0x8e, 0xf1,
769 .key
= { 'J', 'e', 'f', 'e' },
771 .plaintext
= "what do ya want for nothing?",
773 .digest
= { 0xef, 0xfc, 0xdf, 0x6a, 0xe5, 0xeb, 0x2f, 0xa2, 0xd2, 0x74,
774 0x16, 0xd5, 0xf1, 0x84, 0xdf, 0x9c, 0x25, 0x9a, 0x7c, 0x79 },
778 .key
= { [0 ... 19] = 0xaa },
780 .plaintext
= { [0 ... 49] = 0xdd },
782 .digest
= { 0x12, 0x5d, 0x73, 0x42, 0xb9, 0xac, 0x11, 0xcd, 0x91, 0xa3,
783 0x9a, 0xf4, 0x8a, 0xa1, 0x7b, 0x4f, 0x63, 0xf1, 0x75, 0xd3 },
785 .key
= { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
786 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
787 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19 },
789 .plaintext
= { [0 ... 49] = 0xcd },
791 .digest
= { 0x4c, 0x90, 0x07, 0xf4, 0x02, 0x62, 0x50, 0xc6, 0xbc, 0x84,
792 0x14, 0xf9, 0xbf, 0x50, 0xc8, 0x6c, 0x2d, 0x72, 0x35, 0xda },
794 .key
= { [0 ... 19] = 0x0c },
796 .plaintext
= "Test With Truncation",
798 .digest
= { 0x4c, 0x1a, 0x03, 0x42, 0x4b, 0x55, 0xe0, 0x7f, 0xe7, 0xf2,
799 0x7b, 0xe1, 0xd5, 0x8b, 0xb9, 0x32, 0x4a, 0x9a, 0x5a, 0x04 },
801 .key
= { [0 ... 79] = 0xaa },
803 .plaintext
= "Test Using Larger Than Block-Size Key - Hash Key First",
805 .digest
= { 0xaa, 0x4a, 0xe5, 0xe1, 0x52, 0x72, 0xd0, 0x0e, 0x95, 0x70,
806 0x56, 0x37, 0xce, 0x8a, 0x3b, 0x55, 0xed, 0x40, 0x21, 0x12 },
808 .key
= { [0 ... 79] = 0xaa },
810 .plaintext
= "Test Using Larger Than Block-Size Key and Larger Than One "
813 .digest
= { 0xe8, 0xe9, 0x9d, 0x0f, 0x45, 0x23, 0x7d, 0x78, 0x6d, 0x6b,
814 0xba, 0xa7, 0x96, 0x5c, 0x78, 0x08, 0xbb, 0xff, 0x1a, 0x91 },
819 * HMAC-SHA256 test vectors from
820 * draft-ietf-ipsec-ciph-sha-256-01.txt
822 #define HMAC_SHA256_TEST_VECTORS 10
824 static struct hmac_testvec hmac_sha256_tv_template
[] = {
826 .key
= { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
827 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
828 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
829 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20},
833 .digest
= { 0xa2, 0x1b, 0x1f, 0x5d, 0x4c, 0xf4, 0xf7, 0x3a,
834 0x4d, 0xd9, 0x39, 0x75, 0x0f, 0x7a, 0x06, 0x6a,
835 0x7f, 0x98, 0xcc, 0x13, 0x1c, 0xb1, 0x6a, 0x66,
836 0x92, 0x75, 0x90, 0x21, 0xcf, 0xab, 0x81, 0x81 },
838 .key
= { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
839 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
840 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
841 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20 },
843 .plaintext
= "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
845 .digest
= { 0x10, 0x4f, 0xdc, 0x12, 0x57, 0x32, 0x8f, 0x08,
846 0x18, 0x4b, 0xa7, 0x31, 0x31, 0xc5, 0x3c, 0xae,
847 0xe6, 0x98, 0xe3, 0x61, 0x19, 0x42, 0x11, 0x49,
848 0xea, 0x8c, 0x71, 0x24, 0x56, 0x69, 0x7d, 0x30 },
850 .key
= { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
851 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
852 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
853 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20 },
855 .plaintext
= "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"
856 "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
858 .digest
= { 0x47, 0x03, 0x05, 0xfc, 0x7e, 0x40, 0xfe, 0x34,
859 0xd3, 0xee, 0xb3, 0xe7, 0x73, 0xd9, 0x5a, 0xab,
860 0x73, 0xac, 0xf0, 0xfd, 0x06, 0x04, 0x47, 0xa5,
861 0xeb, 0x45, 0x95, 0xbf, 0x33, 0xa9, 0xd1, 0xa3 },
863 .key
= { [0 ... 31] = 0x0b },
865 .plaintext
= "Hi There",
867 .digest
= { 0x19, 0x8a, 0x60, 0x7e, 0xb4, 0x4b, 0xfb, 0xc6,
868 0x99, 0x03, 0xa0, 0xf1, 0xcf, 0x2b, 0xbd, 0xc5,
869 0xba, 0x0a, 0xa3, 0xf3, 0xd9, 0xae, 0x3c, 0x1c,
870 0x7a, 0x3b, 0x16, 0x96, 0xa0, 0xb6, 0x8c, 0xf7 },
874 .plaintext
= "what do ya want for nothing?",
876 .digest
= { 0x5b, 0xdc, 0xc1, 0x46, 0xbf, 0x60, 0x75, 0x4e,
877 0x6a, 0x04, 0x24, 0x26, 0x08, 0x95, 0x75, 0xc7,
878 0x5a, 0x00, 0x3f, 0x08, 0x9d, 0x27, 0x39, 0x83,
879 0x9d, 0xec, 0x58, 0xb9, 0x64, 0xec, 0x38, 0x43 },
883 .key
= { [0 ... 31] = 0xaa },
885 .plaintext
= { [0 ... 49] = 0xdd },
887 .digest
= { 0xcd, 0xcb, 0x12, 0x20, 0xd1, 0xec, 0xcc, 0xea,
888 0x91, 0xe5, 0x3a, 0xba, 0x30, 0x92, 0xf9, 0x62,
889 0xe5, 0x49, 0xfe, 0x6c, 0xe9, 0xed, 0x7f, 0xdc,
890 0x43, 0x19, 0x1f, 0xbd, 0xe4, 0x5c, 0x30, 0xb0 },
892 .key
= { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
893 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
894 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
895 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20,
896 0x21, 0x22, 0x23, 0x24, 0x25 },
898 .plaintext
= { [0 ... 49] = 0xcd },
900 .digest
= { 0xd4, 0x63, 0x3c, 0x17, 0xf6, 0xfb, 0x8d, 0x74,
901 0x4c, 0x66, 0xde, 0xe0, 0xf8, 0xf0, 0x74, 0x55,
902 0x6e, 0xc4, 0xaf, 0x55, 0xef, 0x07, 0x99, 0x85,
903 0x41, 0x46, 0x8e, 0xb4, 0x9b, 0xd2, 0xe9, 0x17 },
905 .key
= { [0 ... 31] = 0x0c },
907 .plaintext
= "Test With Truncation",
909 .digest
= { 0x75, 0x46, 0xaf, 0x01, 0x84, 0x1f, 0xc0, 0x9b,
910 0x1a, 0xb9, 0xc3, 0x74, 0x9a, 0x5f, 0x1c, 0x17,
911 0xd4, 0xf5, 0x89, 0x66, 0x8a, 0x58, 0x7b, 0x27,
912 0x00, 0xa9, 0xc9, 0x7c, 0x11, 0x93, 0xcf, 0x42 },
914 .key
= { [0 ... 79] = 0xaa },
916 .plaintext
= "Test Using Larger Than Block-Size Key - Hash Key First",
918 .digest
= { 0x69, 0x53, 0x02, 0x5e, 0xd9, 0x6f, 0x0c, 0x09,
919 0xf8, 0x0a, 0x96, 0xf7, 0x8e, 0x65, 0x38, 0xdb,
920 0xe2, 0xe7, 0xb8, 0x20, 0xe3, 0xdd, 0x97, 0x0e,
921 0x7d, 0xdd, 0x39, 0x09, 0x1b, 0x32, 0x35, 0x2f },
923 .key
= { [0 ... 79] = 0xaa },
925 .plaintext
= "Test Using Larger Than Block-Size Key and Larger Than "
926 "One Block-Size Data",
928 .digest
= { 0x63, 0x55, 0xac, 0x22, 0xe8, 0x90, 0xd0, 0xa3,
929 0xc8, 0x48, 0x1a, 0x5c, 0xa4, 0x82, 0x5b, 0xc8,
930 0x84, 0xd3, 0xe7, 0xa1, 0xff, 0x98, 0xa2, 0xfc,
931 0x2a, 0xc7, 0xd8, 0xe0, 0x64, 0xc3, 0xb2, 0xe6 },
935 #endif /* CONFIG_CRYPTO_HMAC */
940 #define DES_ENC_TEST_VECTORS 10
941 #define DES_DEC_TEST_VECTORS 4
942 #define DES_CBC_ENC_TEST_VECTORS 5
943 #define DES_CBC_DEC_TEST_VECTORS 4
944 #define DES3_EDE_ENC_TEST_VECTORS 3
945 #define DES3_EDE_DEC_TEST_VECTORS 3
947 static struct cipher_testvec des_enc_tv_template
[] = {
948 { /* From Applied Cryptography */
949 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
951 .input
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xe7 },
953 .result
= { 0xc9, 0x57, 0x44, 0x25, 0x6a, 0x5e, 0xd3, 0x1d },
955 }, { /* Same key, different plaintext block */
956 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
958 .input
= { 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99 },
960 .result
= { 0xf7, 0x9c, 0x89, 0x2a, 0x33, 0x8f, 0x4a, 0x8b },
962 }, { /* Sbox test from NBS */
963 .key
= { 0x7c, 0xa1, 0x10, 0x45, 0x4a, 0x1a, 0x6e, 0x57 },
965 .input
= { 0x01, 0xa1, 0xd6, 0xd0, 0x39, 0x77, 0x67, 0x42 },
967 .result
= { 0x69, 0x0f, 0x5b, 0x0d, 0x9a, 0x26, 0x93, 0x9b },
969 }, { /* Three blocks */
970 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
972 .input
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xe7,
973 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99,
974 0xca, 0xfe, 0xba, 0xbe, 0xfe, 0xed, 0xbe, 0xef },
976 .result
= { 0xc9, 0x57, 0x44, 0x25, 0x6a, 0x5e, 0xd3, 0x1d,
977 0xf7, 0x9c, 0x89, 0x2a, 0x33, 0x8f, 0x4a, 0x8b,
978 0xb4, 0x99, 0x26, 0xf7, 0x1f, 0xe1, 0xd4, 0x90 },
983 .key
= { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 },
985 .input
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xe7 },
987 .result
= { 0xc9, 0x57, 0x44, 0x25, 0x6a, 0x5e, 0xd3, 0x1d },
989 }, { /* Two blocks -- for testing encryption across pages */
990 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
992 .input
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xe7,
993 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99 },
995 .result
= { 0xc9, 0x57, 0x44, 0x25, 0x6a, 0x5e, 0xd3, 0x1d,
996 0xf7, 0x9c, 0x89, 0x2a, 0x33, 0x8f, 0x4a, 0x8b },
1000 }, { /* Four blocks -- for testing encryption with chunking */
1001 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1003 .input
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xe7,
1004 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99,
1005 0xca, 0xfe, 0xba, 0xbe, 0xfe, 0xed, 0xbe, 0xef,
1006 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99 },
1008 .result
= { 0xc9, 0x57, 0x44, 0x25, 0x6a, 0x5e, 0xd3, 0x1d,
1009 0xf7, 0x9c, 0x89, 0x2a, 0x33, 0x8f, 0x4a, 0x8b,
1010 0xb4, 0x99, 0x26, 0xf7, 0x1f, 0xe1, 0xd4, 0x90,
1011 0xf7, 0x9c, 0x89, 0x2a, 0x33, 0x8f, 0x4a, 0x8b },
1014 .tap
= { 14, 10, 8 }
1016 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1018 .input
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xe7,
1019 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99,
1020 0xca, 0xfe, 0xba, 0xbe, 0xfe, 0xed, 0xbe, 0xef },
1022 .result
= { 0xc9, 0x57, 0x44, 0x25, 0x6a, 0x5e, 0xd3, 0x1d,
1023 0xf7, 0x9c, 0x89, 0x2a, 0x33, 0x8f, 0x4a, 0x8b,
1024 0xb4, 0x99, 0x26, 0xf7, 0x1f, 0xe1, 0xd4, 0x90 },
1027 .tap
= { 2, 1, 3, 18 }
1029 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1031 .input
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xe7,
1032 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99 },
1034 .result
= { 0xc9, 0x57, 0x44, 0x25, 0x6a, 0x5e, 0xd3, 0x1d,
1035 0xf7, 0x9c, 0x89, 0x2a, 0x33, 0x8f, 0x4a, 0x8b },
1038 .tap
= { 2, 2, 2, 2, 8 }
1040 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1042 .input
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xe7 },
1044 .result
= { 0xc9, 0x57, 0x44, 0x25, 0x6a, 0x5e, 0xd3, 0x1d },
1047 .tap
= { 1, 1, 1, 1, 1, 1, 1, 1 }
1051 static struct cipher_testvec des_dec_tv_template
[] = {
1052 { /* From Applied Cryptography */
1053 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1055 .input
= { 0xc9, 0x57, 0x44, 0x25, 0x6a, 0x5e, 0xd3, 0x1d },
1057 .result
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xe7 },
1059 }, { /* Sbox test from NBS */
1060 .key
= { 0x7c, 0xa1, 0x10, 0x45, 0x4a, 0x1a, 0x6e, 0x57 },
1062 .input
= { 0x69, 0x0f, 0x5b, 0x0d, 0x9a, 0x26, 0x93, 0x9b },
1064 .result
= { 0x01, 0xa1, 0xd6, 0xd0, 0x39, 0x77, 0x67, 0x42 },
1066 }, { /* Two blocks, for chunking test */
1067 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1069 .input
= { 0xc9, 0x57, 0x44, 0x25, 0x6a, 0x5e, 0xd3, 0x1d,
1070 0x69, 0x0f, 0x5b, 0x0d, 0x9a, 0x26, 0x93, 0x9b },
1072 .result
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xe7,
1073 0xa3, 0x99, 0x7b, 0xca, 0xaf, 0x69, 0xa0, 0xf5 },
1078 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1080 .input
= { 0xc9, 0x57, 0x44, 0x25, 0x6a, 0x5e, 0xd3, 0x1d,
1081 0x69, 0x0f, 0x5b, 0x0d, 0x9a, 0x26, 0x93, 0x9b },
1083 .result
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xe7,
1084 0xa3, 0x99, 0x7b, 0xca, 0xaf, 0x69, 0xa0, 0xf5 },
1091 static struct cipher_testvec des_cbc_enc_tv_template
[] = {
1092 { /* From OpenSSL */
1093 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef},
1095 .iv
= { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10},
1096 .input
= { 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x31, 0x20,
1097 0x4e, 0x6f, 0x77, 0x20, 0x69, 0x73, 0x20, 0x74,
1098 0x68, 0x65, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x20 },
1100 .result
= { 0xcc, 0xd1, 0x73, 0xff, 0xab, 0x20, 0x39, 0xf4,
1101 0xac, 0xd8, 0xae, 0xfd, 0xdf, 0xd8, 0xa1, 0xeb,
1102 0x46, 0x8e, 0x91, 0x15, 0x78, 0x88, 0xba, 0x68 },
1104 }, { /* FIPS Pub 81 */
1105 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1107 .iv
= { 0x12, 0x34, 0x56, 0x78, 0x90, 0xab, 0xcd, 0xef },
1108 .input
= { 0x4e, 0x6f, 0x77, 0x20, 0x69, 0x73, 0x20, 0x74 },
1110 .result
= { 0xe5, 0xc7, 0xcd, 0xde, 0x87, 0x2b, 0xf2, 0x7c },
1113 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1115 .iv
= { 0xe5, 0xc7, 0xcd, 0xde, 0x87, 0x2b, 0xf2, 0x7c },
1116 .input
= { 0x68, 0x65, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x20 },
1118 .result
= { 0x43, 0xe9, 0x34, 0x00, 0x8c, 0x38, 0x9c, 0x0f },
1121 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1123 .iv
= { 0x43, 0xe9, 0x34, 0x00, 0x8c, 0x38, 0x9c, 0x0f },
1124 .input
= { 0x66, 0x6f, 0x72, 0x20, 0x61, 0x6c, 0x6c, 0x20 },
1126 .result
= { 0x68, 0x37, 0x88, 0x49, 0x9a, 0x7c, 0x05, 0xf6 },
1128 }, { /* Copy of openssl vector for chunk testing */
1130 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef},
1132 .iv
= { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10},
1133 .input
= { 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x31, 0x20,
1134 0x4e, 0x6f, 0x77, 0x20, 0x69, 0x73, 0x20, 0x74,
1135 0x68, 0x65, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x20 },
1137 .result
= { 0xcc, 0xd1, 0x73, 0xff, 0xab, 0x20, 0x39, 0xf4,
1138 0xac, 0xd8, 0xae, 0xfd, 0xdf, 0xd8, 0xa1, 0xeb,
1139 0x46, 0x8e, 0x91, 0x15, 0x78, 0x88, 0xba, 0x68 },
1146 static struct cipher_testvec des_cbc_dec_tv_template
[] = {
1148 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1150 .iv
= { 0x12, 0x34, 0x56, 0x78, 0x90, 0xab, 0xcd, 0xef },
1151 .input
= { 0xe5, 0xc7, 0xcd, 0xde, 0x87, 0x2b, 0xf2, 0x7c },
1153 .result
= { 0x4e, 0x6f, 0x77, 0x20, 0x69, 0x73, 0x20, 0x74 },
1156 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1158 .iv
= { 0xe5, 0xc7, 0xcd, 0xde, 0x87, 0x2b, 0xf2, 0x7c },
1159 .input
= { 0x43, 0xe9, 0x34, 0x00, 0x8c, 0x38, 0x9c, 0x0f },
1161 .result
= { 0x68, 0x65, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x20 },
1164 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1166 .iv
= { 0x43, 0xe9, 0x34, 0x00, 0x8c, 0x38, 0x9c, 0x0f },
1167 .input
= { 0x68, 0x37, 0x88, 0x49, 0x9a, 0x7c, 0x05, 0xf6 },
1169 .result
= { 0x66, 0x6f, 0x72, 0x20, 0x61, 0x6c, 0x6c, 0x20 },
1171 }, { /* Copy of above, for chunk testing */
1172 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1174 .iv
= { 0x43, 0xe9, 0x34, 0x00, 0x8c, 0x38, 0x9c, 0x0f },
1175 .input
= { 0x68, 0x37, 0x88, 0x49, 0x9a, 0x7c, 0x05, 0xf6 },
1177 .result
= { 0x66, 0x6f, 0x72, 0x20, 0x61, 0x6c, 0x6c, 0x20 },
1185 * We really need some more test vectors, especially for DES3 CBC.
1187 static struct cipher_testvec des3_ede_enc_tv_template
[] = {
1188 { /* These are from openssl */
1189 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
1190 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
1191 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10},
1193 .input
= { 0x73, 0x6f, 0x6d, 0x65, 0x64, 0x61, 0x74, 0x61 },
1195 .result
= { 0x18, 0xd7, 0x48, 0xe5, 0x63, 0x62, 0x05, 0x72 },
1198 .key
= { 0x03, 0x52, 0x02, 0x07, 0x67, 0x20, 0x82, 0x17,
1199 0x86, 0x02, 0x87, 0x66, 0x59, 0x08, 0x21, 0x98,
1200 0x64, 0x05, 0x6a, 0xbd, 0xfe, 0xa9, 0x34, 0x57 },
1202 .input
= { 0x73, 0x71, 0x75, 0x69, 0x67, 0x67, 0x6c, 0x65 },
1204 .result
= { 0xc0, 0x7d, 0x2a, 0x0f, 0xa5, 0x66, 0xfa, 0x30 },
1207 .key
= { 0x10, 0x46, 0x10, 0x34, 0x89, 0x98, 0x80, 0x20,
1208 0x91, 0x07, 0xd0, 0x15, 0x89, 0x19, 0x01, 0x01,
1209 0x19, 0x07, 0x92, 0x10, 0x98, 0x1a, 0x01, 0x01 },
1211 .input
= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
1213 .result
= { 0xe1, 0xef, 0x62, 0xc3, 0x32, 0xfe, 0x82, 0x5b },
1218 static struct cipher_testvec des3_ede_dec_tv_template
[] = {
1219 { /* These are from openssl */
1220 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
1221 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
1222 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10},
1224 .input
= { 0x18, 0xd7, 0x48, 0xe5, 0x63, 0x62, 0x05, 0x72 },
1226 .result
= { 0x73, 0x6f, 0x6d, 0x65, 0x64, 0x61, 0x74, 0x61 },
1229 .key
= { 0x03, 0x52, 0x02, 0x07, 0x67, 0x20, 0x82, 0x17,
1230 0x86, 0x02, 0x87, 0x66, 0x59, 0x08, 0x21, 0x98,
1231 0x64, 0x05, 0x6a, 0xbd, 0xfe, 0xa9, 0x34, 0x57 },
1233 .input
= { 0xc0, 0x7d, 0x2a, 0x0f, 0xa5, 0x66, 0xfa, 0x30 },
1235 .result
= { 0x73, 0x71, 0x75, 0x69, 0x67, 0x67, 0x6c, 0x65 },
1238 .key
= { 0x10, 0x46, 0x10, 0x34, 0x89, 0x98, 0x80, 0x20,
1239 0x91, 0x07, 0xd0, 0x15, 0x89, 0x19, 0x01, 0x01,
1240 0x19, 0x07, 0x92, 0x10, 0x98, 0x1a, 0x01, 0x01 },
1242 .input
= { 0xe1, 0xef, 0x62, 0xc3, 0x32, 0xfe, 0x82, 0x5b },
1244 .result
= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
1250 * Blowfish test vectors.
1252 #define BF_ENC_TEST_VECTORS 6
1253 #define BF_DEC_TEST_VECTORS 6
1254 #define BF_CBC_ENC_TEST_VECTORS 1
1255 #define BF_CBC_DEC_TEST_VECTORS 1
1257 static struct cipher_testvec bf_enc_tv_template
[] = {
1258 { /* DES test vectors from OpenSSL */
1259 .key
= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, },
1261 .input
= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
1263 .result
= { 0x4e, 0xf9, 0x97, 0x45, 0x61, 0x98, 0xdd, 0x78 },
1266 .key
= { 0x1f, 0x1f, 0x1f, 0x1f, 0x0e, 0x0e, 0x0e, 0x0e },
1268 .input
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1270 .result
= { 0xa7, 0x90, 0x79, 0x51, 0x08, 0xea, 0x3c, 0xae },
1273 .key
= { 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87 },
1275 .input
= { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 },
1277 .result
= { 0xe8, 0x7a, 0x24, 0x4e, 0x2c, 0xc8, 0x5e, 0x82 },
1279 }, { /* Vary the keylength... */
1280 .key
= { 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87,
1281 0x78, 0x69, 0x5a, 0x4b, 0x3c, 0x2d, 0x1e, 0x0f },
1283 .input
= { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 },
1285 .result
= { 0x93, 0x14, 0x28, 0x87, 0xee, 0x3b, 0xe1, 0x5c },
1288 .key
= { 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87,
1289 0x78, 0x69, 0x5a, 0x4b, 0x3c, 0x2d, 0x1e, 0x0f,
1290 0x00, 0x11, 0x22, 0x33, 0x44 },
1292 .input
= { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 },
1294 .result
= { 0xe6, 0xf5, 0x1e, 0xd7, 0x9b, 0x9d, 0xb2, 0x1f },
1296 }, { /* Generated with bf488 */
1297 .key
= { 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87,
1298 0x78, 0x69, 0x5a, 0x4b, 0x3c, 0x2d, 0x1e, 0x0f,
1299 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
1300 0x04, 0x68, 0x91, 0x04, 0xc2, 0xfd, 0x3b, 0x2f,
1301 0x58, 0x40, 0x23, 0x64, 0x1a, 0xba, 0x61, 0x76,
1302 0x1f, 0x1f, 0x1f, 0x1f, 0x0e, 0x0e, 0x0e, 0x0e,
1303 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff },
1305 .input
= { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 },
1307 .result
= { 0xc0, 0x45, 0x04, 0x01, 0x2e, 0x4e, 0x1f, 0x53 },
1312 static struct cipher_testvec bf_dec_tv_template
[] = {
1313 { /* DES test vectors from OpenSSL */
1314 .key
= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
1316 .input
= { 0x4e, 0xf9, 0x97, 0x45, 0x61, 0x98, 0xdd, 0x78 },
1318 .result
= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
1321 .key
= { 0x1f, 0x1f, 0x1f, 0x1f, 0x0e, 0x0e, 0x0e, 0x0e },
1323 .input
= { 0xa7, 0x90, 0x79, 0x51, 0x08, 0xea, 0x3c, 0xae },
1325 .result
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1328 .key
= { 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87 },
1330 .input
= { 0xe8, 0x7a, 0x24, 0x4e, 0x2c, 0xc8, 0x5e, 0x82 },
1332 .result
= { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 },
1334 }, { /* Vary the keylength... */
1335 .key
= { 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87,
1336 0x78, 0x69, 0x5a, 0x4b, 0x3c, 0x2d, 0x1e, 0x0f },
1338 .input
= { 0x93, 0x14, 0x28, 0x87, 0xee, 0x3b, 0xe1, 0x5c },
1340 .result
= { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 },
1343 .key
= { 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87,
1344 0x78, 0x69, 0x5a, 0x4b, 0x3c, 0x2d, 0x1e, 0x0f,
1345 0x00, 0x11, 0x22, 0x33, 0x44 },
1347 .input
= { 0xe6, 0xf5, 0x1e, 0xd7, 0x9b, 0x9d, 0xb2, 0x1f },
1349 .result
= { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 },
1351 }, { /* Generated with bf488, using OpenSSL, Libgcrypt and Nettle */
1352 .key
= { 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87,
1353 0x78, 0x69, 0x5a, 0x4b, 0x3c, 0x2d, 0x1e, 0x0f,
1354 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
1355 0x04, 0x68, 0x91, 0x04, 0xc2, 0xfd, 0x3b, 0x2f,
1356 0x58, 0x40, 0x23, 0x64, 0x1a, 0xba, 0x61, 0x76,
1357 0x1f, 0x1f, 0x1f, 0x1f, 0x0e, 0x0e, 0x0e, 0x0e,
1358 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff },
1360 .input
= { 0xc0, 0x45, 0x04, 0x01, 0x2e, 0x4e, 0x1f, 0x53 },
1362 .result
= { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 },
1367 static struct cipher_testvec bf_cbc_enc_tv_template
[] = {
1368 { /* From OpenSSL */
1369 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
1370 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87 },
1372 .iv
= { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 },
1373 .input
= { 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x31, 0x20,
1374 0x4e, 0x6f, 0x77, 0x20, 0x69, 0x73, 0x20, 0x74,
1375 0x68, 0x65, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x20,
1376 0x66, 0x6f, 0x72, 0x20, 0x00, 0x00, 0x00, 0x00 },
1378 .result
= { 0x6b, 0x77, 0xb4, 0xd6, 0x30, 0x06, 0xde, 0xe6,
1379 0x05, 0xb1, 0x56, 0xe2, 0x74, 0x03, 0x97, 0x93,
1380 0x58, 0xde, 0xb9, 0xe7, 0x15, 0x46, 0x16, 0xd9,
1381 0x59, 0xf1, 0x65, 0x2b, 0xd5, 0xff, 0x92, 0xcc },
1386 static struct cipher_testvec bf_cbc_dec_tv_template
[] = {
1387 { /* From OpenSSL */
1388 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
1389 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87 },
1391 .iv
= { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 },
1392 .input
= { 0x6b, 0x77, 0xb4, 0xd6, 0x30, 0x06, 0xde, 0xe6,
1393 0x05, 0xb1, 0x56, 0xe2, 0x74, 0x03, 0x97, 0x93,
1394 0x58, 0xde, 0xb9, 0xe7, 0x15, 0x46, 0x16, 0xd9,
1395 0x59, 0xf1, 0x65, 0x2b, 0xd5, 0xff, 0x92, 0xcc },
1397 .result
= { 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x31, 0x20,
1398 0x4e, 0x6f, 0x77, 0x20, 0x69, 0x73, 0x20, 0x74,
1399 0x68, 0x65, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x20,
1400 0x66, 0x6f, 0x72, 0x20, 0x00, 0x00, 0x00, 0x00 },
1406 * Twofish test vectors.
1408 #define TF_ENC_TEST_VECTORS 3
1409 #define TF_DEC_TEST_VECTORS 3
1410 #define TF_CBC_ENC_TEST_VECTORS 4
1411 #define TF_CBC_DEC_TEST_VECTORS 4
1413 static struct cipher_testvec tf_enc_tv_template
[] = {
1415 .key
= { [0 ... 15] = 0x00 },
1417 .input
= { [0 ... 15] = 0x00 },
1419 .result
= { 0x9f, 0x58, 0x9f, 0x5c, 0xf6, 0x12, 0x2c, 0x32,
1420 0xb6, 0xbf, 0xec, 0x2f, 0x2a, 0xe8, 0xc3, 0x5a },
1423 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
1424 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10,
1425 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77 },
1427 .input
= { [0 ... 15] = 0x00 },
1429 .result
= { 0xcf, 0xd1, 0xd2, 0xe5, 0xa9, 0xbe, 0x9c, 0xdf,
1430 0x50, 0x1f, 0x13, 0xb8, 0x92, 0xbd, 0x22, 0x48 },
1433 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
1434 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10,
1435 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
1436 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff },
1438 .input
= { [0 ... 15] = 0x00 },
1440 .result
= { 0x37, 0x52, 0x7b, 0xe0, 0x05, 0x23, 0x34, 0xb8,
1441 0x9f, 0x0c, 0xfc, 0xca, 0xe8, 0x7c, 0xfa, 0x20 },
1446 static struct cipher_testvec tf_dec_tv_template
[] = {
1448 .key
= { [0 ... 15] = 0x00 },
1450 .input
= { 0x9f, 0x58, 0x9f, 0x5c, 0xf6, 0x12, 0x2c, 0x32,
1451 0xb6, 0xbf, 0xec, 0x2f, 0x2a, 0xe8, 0xc3, 0x5a },
1453 .result
= { [0 ... 15] = 0x00 },
1456 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
1457 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10,
1458 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77 },
1460 .input
= { 0xcf, 0xd1, 0xd2, 0xe5, 0xa9, 0xbe, 0x9c, 0xdf,
1461 0x50, 0x1f, 0x13, 0xb8, 0x92, 0xbd, 0x22, 0x48 },
1463 .result
= { [0 ... 15] = 0x00 },
1466 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
1467 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10,
1468 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
1469 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff },
1471 .input
= { 0x37, 0x52, 0x7b, 0xe0, 0x05, 0x23, 0x34, 0xb8,
1472 0x9f, 0x0c, 0xfc, 0xca, 0xe8, 0x7c, 0xfa, 0x20 },
1474 .result
= { [0 ... 15] = 0x00 },
1479 static struct cipher_testvec tf_cbc_enc_tv_template
[] = {
1480 { /* Generated with Nettle */
1481 .key
= { [0 ... 15] = 0x00 },
1483 .iv
= { [0 ... 15] = 0x00 },
1484 .input
= { [0 ... 15] = 0x00 },
1486 .result
= { 0x9f, 0x58, 0x9f, 0x5c, 0xf6, 0x12, 0x2c, 0x32,
1487 0xb6, 0xbf, 0xec, 0x2f, 0x2a, 0xe8, 0xc3, 0x5a },
1490 .key
= { [0 ... 15] = 0x00 },
1492 .iv
= { 0x9f, 0x58, 0x9f, 0x5c, 0xf6, 0x12, 0x2c, 0x32,
1493 0xb6, 0xbf, 0xec, 0x2f, 0x2a, 0xe8, 0xc3, 0x5a },
1494 .input
= { [0 ... 15] = 0x00 },
1496 .result
= { 0xd4, 0x91, 0xdb, 0x16, 0xe7, 0xb1, 0xc3, 0x9e,
1497 0x86, 0xcb, 0x08, 0x6b, 0x78, 0x9f, 0x54, 0x19 },
1500 .key
= { [0 ... 15] = 0x00 },
1502 .iv
= { 0xd4, 0x91, 0xdb, 0x16, 0xe7, 0xb1, 0xc3, 0x9e,
1503 0x86, 0xcb, 0x08, 0x6b, 0x78, 0x9f, 0x54, 0x19 },
1504 .input
= { [0 ... 15] = 0x00 },
1506 .result
= { 0x05, 0xef, 0x8c, 0x61, 0xa8, 0x11, 0x58, 0x26,
1507 0x34, 0xba, 0x5c, 0xb7, 0x10, 0x6a, 0xa6, 0x41 },
1510 .key
= { [0 ... 15] = 0x00 },
1512 .iv
= { [0 ... 15] = 0x00 },
1513 .input
= { [0 ... 47] = 0x00 },
1515 .result
= { 0x9f, 0x58, 0x9f, 0x5c, 0xf6, 0x12, 0x2c, 0x32,
1516 0xb6, 0xbf, 0xec, 0x2f, 0x2a, 0xe8, 0xc3, 0x5a,
1517 0xd4, 0x91, 0xdb, 0x16, 0xe7, 0xb1, 0xc3, 0x9e,
1518 0x86, 0xcb, 0x08, 0x6b, 0x78, 0x9f, 0x54, 0x19,
1519 0x05, 0xef, 0x8c, 0x61, 0xa8, 0x11, 0x58, 0x26,
1520 0x34, 0xba, 0x5c, 0xb7, 0x10, 0x6a, 0xa6, 0x41 },
1525 static struct cipher_testvec tf_cbc_dec_tv_template
[] = {
1526 { /* Reverse of the first four above */
1527 .key
= { [0 ... 15] = 0x00 },
1529 .iv
= { [0 ... 15] = 0x00 },
1530 .input
= { 0x9f, 0x58, 0x9f, 0x5c, 0xf6, 0x12, 0x2c, 0x32,
1531 0xb6, 0xbf, 0xec, 0x2f, 0x2a, 0xe8, 0xc3, 0x5a },
1533 .result
= { [0 ... 15] = 0x00 },
1536 .key
= { [0 ... 15] = 0x00 },
1538 .iv
= { 0x9f, 0x58, 0x9f, 0x5c, 0xf6, 0x12, 0x2c, 0x32,
1539 0xb6, 0xbf, 0xec, 0x2f, 0x2a, 0xe8, 0xc3, 0x5a },
1540 .input
= { 0xd4, 0x91, 0xdb, 0x16, 0xe7, 0xb1, 0xc3, 0x9e,
1541 0x86, 0xcb, 0x08, 0x6b, 0x78, 0x9f, 0x54, 0x19 },
1543 .result
= { [0 ... 15] = 0x00 },
1546 .key
= { [0 ... 15] = 0x00 },
1548 .iv
= { 0xd4, 0x91, 0xdb, 0x16, 0xe7, 0xb1, 0xc3, 0x9e,
1549 0x86, 0xcb, 0x08, 0x6b, 0x78, 0x9f, 0x54, 0x19 },
1550 .input
= { 0x05, 0xef, 0x8c, 0x61, 0xa8, 0x11, 0x58, 0x26,
1551 0x34, 0xba, 0x5c, 0xb7, 0x10, 0x6a, 0xa6, 0x41 },
1553 .result
= { [0 ... 15] = 0x00 },
1556 .key
= { [0 ... 15] = 0x00 },
1558 .iv
= { [0 ... 15] = 0x00 },
1559 .input
= { 0x9f, 0x58, 0x9f, 0x5c, 0xf6, 0x12, 0x2c, 0x32,
1560 0xb6, 0xbf, 0xec, 0x2f, 0x2a, 0xe8, 0xc3, 0x5a,
1561 0xd4, 0x91, 0xdb, 0x16, 0xe7, 0xb1, 0xc3, 0x9e,
1562 0x86, 0xcb, 0x08, 0x6b, 0x78, 0x9f, 0x54, 0x19,
1563 0x05, 0xef, 0x8c, 0x61, 0xa8, 0x11, 0x58, 0x26,
1564 0x34, 0xba, 0x5c, 0xb7, 0x10, 0x6a, 0xa6, 0x41 },
1566 .result
= { [0 ... 47] = 0x00 },
1572 * Serpent test vectors. These are backwards because Serpent writes
1573 * octet sequences in right-to-left mode.
1575 #define SERPENT_ENC_TEST_VECTORS 4
1576 #define SERPENT_DEC_TEST_VECTORS 4
1578 #define TNEPRES_ENC_TEST_VECTORS 4
1579 #define TNEPRES_DEC_TEST_VECTORS 4
1581 static struct cipher_testvec serpent_enc_tv_template
[] =
1584 .input
= { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1585 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
1587 .result
= { 0x12, 0x07, 0xfc, 0xce, 0x9b, 0xd0, 0xd6, 0x47,
1588 0x6a, 0xe9, 0x8f, 0xbe, 0xd1, 0x43, 0xa0, 0xe2 },
1591 .key
= { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1592 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
1594 .input
= { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1595 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
1597 .result
= { 0x4c, 0x7d, 0x8a, 0x32, 0x80, 0x72, 0xa2, 0x2c,
1598 0x82, 0x3e, 0x4a, 0x1f, 0x3a, 0xcd, 0xa1, 0x6d },
1601 .key
= { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1602 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
1603 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
1604 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f },
1606 .input
= { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1607 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
1609 .result
= { 0xde, 0x26, 0x9f, 0xf8, 0x33, 0xe4, 0x32, 0xb8,
1610 0x5b, 0x2e, 0x88, 0xd2, 0x70, 0x1c, 0xe7, 0x5c },
1613 .key
= { [15] = 0x80 },
1615 .input
= { [0 ... 15] = 0x00 },
1617 .result
= { 0xdd, 0xd2, 0x6b, 0x98, 0xa5, 0xff, 0xd8, 0x2c,
1618 0x05, 0x34, 0x5a, 0x9d, 0xad, 0xbf, 0xaf, 0x49},
1623 static struct cipher_testvec tnepres_enc_tv_template
[] =
1625 { /* KeySize=128, PT=0, I=1 */
1626 .input
= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1627 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
1628 .key
= { 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1629 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
1632 .result
= { 0x49, 0xaf, 0xbf, 0xad, 0x9d, 0x5a, 0x34, 0x05,
1633 0x2c, 0xd8, 0xff, 0xa5, 0x98, 0x6b, 0xd2, 0xdd },
1635 }, { /* KeySize=192, PT=0, I=1 */
1636 .key
= { 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1637 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1638 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
1640 .input
= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1641 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
1643 .result
= { 0xe7, 0x8e, 0x54, 0x02, 0xc7, 0x19, 0x55, 0x68,
1644 0xac, 0x36, 0x78, 0xf7, 0xa3, 0xf6, 0x0c, 0x66 },
1646 }, { /* KeySize=256, PT=0, I=1 */
1647 .key
= { 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1648 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1649 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1650 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
1652 .input
= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1653 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
1655 .result
= { 0xab, 0xed, 0x96, 0xe7, 0x66, 0xbf, 0x28, 0xcb,
1656 0xc0, 0xeb, 0xd2, 0x1a, 0x82, 0xef, 0x08, 0x19 },
1658 }, { /* KeySize=256, I=257 */
1659 .key
= { 0x1f, 0x1e, 0x1d, 0x1c, 0x1b, 0x1a, 0x19, 0x18,
1660 0x17, 0x16, 0x15, 0x14, 0x13, 0x12, 0x11, 0x10,
1661 0x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x08,
1662 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00 },
1664 .input
= { 0x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x08,
1665 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00 },
1667 .result
= { 0x5c, 0xe7, 0x1c, 0x70, 0xd2, 0x88, 0x2e, 0x5b,
1668 0xb8, 0x32, 0xe4, 0x33, 0xf8, 0x9f, 0x26, 0xde },
1674 static struct cipher_testvec serpent_dec_tv_template
[] =
1677 .input
= { 0x12, 0x07, 0xfc, 0xce, 0x9b, 0xd0, 0xd6, 0x47,
1678 0x6a, 0xe9, 0x8f, 0xbe, 0xd1, 0x43, 0xa0, 0xe2 },
1680 .result
= { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1681 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
1684 .key
= { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1685 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
1687 .input
= { 0x4c, 0x7d, 0x8a, 0x32, 0x80, 0x72, 0xa2, 0x2c,
1688 0x82, 0x3e, 0x4a, 0x1f, 0x3a, 0xcd, 0xa1, 0x6d },
1690 .result
= { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1691 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
1694 .key
= { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1695 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
1696 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
1697 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f },
1699 .input
= { 0xde, 0x26, 0x9f, 0xf8, 0x33, 0xe4, 0x32, 0xb8,
1700 0x5b, 0x2e, 0x88, 0xd2, 0x70, 0x1c, 0xe7, 0x5c },
1702 .result
= { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1703 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
1706 .key
= { [15] = 0x80 },
1708 .input
= { 0xdd, 0xd2, 0x6b, 0x98, 0xa5, 0xff, 0xd8, 0x2c,
1709 0x05, 0x34, 0x5a, 0x9d, 0xad, 0xbf, 0xaf, 0x49},
1711 .result
= { [0 ... 15] = 0x00 },
1716 static struct cipher_testvec tnepres_dec_tv_template
[] =
1719 .input
= { 0x41, 0xcc, 0x6b, 0x31, 0x59, 0x31, 0x45, 0x97,
1720 0x6d, 0x6f, 0xbb, 0x38, 0x4b, 0x37, 0x21, 0x28 },
1722 .result
= { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1723 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
1726 .key
= { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1727 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
1729 .input
= { 0xea, 0xf4, 0xd7, 0xfc, 0xd8, 0x01, 0x34, 0x47,
1730 0x81, 0x45, 0x0b, 0xfa, 0x0c, 0xd6, 0xad, 0x6e },
1732 .result
= { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1733 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
1736 .key
= { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1737 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
1738 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
1739 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f },
1741 .input
= { 0x64, 0xa9, 0x1a, 0x37, 0xed, 0x9f, 0xe7, 0x49,
1742 0xa8, 0x4e, 0x76, 0xd6, 0xf5, 0x0d, 0x78, 0xee },
1744 .result
= { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1745 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
1747 }, { /* KeySize=128, I=121 */
1748 .key
= { [15] = 0x80 },
1750 .input
= { 0x3d, 0xda, 0xbf, 0xc0, 0x06, 0xda, 0xab, 0x06,
1751 0x46, 0x2a, 0xf4, 0xef, 0x81, 0x54, 0x4e, 0x26 },
1753 .result
= { [0 ... 15] = 0x00 },
1759 /* Cast6 test vectors from RFC 2612 */
1760 #define CAST6_ENC_TEST_VECTORS 3
1761 #define CAST6_DEC_TEST_VECTORS 3
1763 static struct cipher_testvec cast6_enc_tv_template
[] =
1766 .key
= { 0x23, 0x42, 0xbb, 0x9e, 0xfa, 0x38, 0x54, 0x2c,
1767 0x0a, 0xf7, 0x56, 0x47, 0xf2, 0x9f, 0x61, 0x5d },
1769 .input
= { [0 ... 15] = 0x00 },
1771 .result
= { 0xc8, 0x42, 0xa0, 0x89, 0x72, 0xb4, 0x3d, 0x20,
1772 0x83, 0x6c, 0x91, 0xd1, 0xb7, 0x53, 0x0f, 0x6b },
1775 .key
= { 0x23, 0x42, 0xbb, 0x9e, 0xfa, 0x38, 0x54, 0x2c,
1776 0xbe, 0xd0, 0xac, 0x83, 0x94, 0x0a, 0xc2, 0x98,
1777 0xba, 0xc7, 0x7a, 0x77, 0x17, 0x94, 0x28, 0x63 },
1779 .input
= { [0 ... 15] = 0x00 },
1781 .result
= { 0x1b, 0x38, 0x6c, 0x02, 0x10, 0xdc, 0xad, 0xcb,
1782 0xdd, 0x0e, 0x41, 0xaa, 0x08, 0xa7, 0xa7, 0xe8 },
1785 .key
= { 0x23, 0x42, 0xbb, 0x9e, 0xfa, 0x38, 0x54, 0x2c,
1786 0xbe, 0xd0, 0xac, 0x83, 0x94, 0x0a, 0xc2, 0x98,
1787 0x8d, 0x7c, 0x47, 0xce, 0x26, 0x49, 0x08, 0x46,
1788 0x1c, 0xc1, 0xb5, 0x13, 0x7a, 0xe6, 0xb6, 0x04 },
1790 .input
= { [0 ... 15] = 0x00 },
1792 .result
= { 0x4f, 0x6a, 0x20, 0x38, 0x28, 0x68, 0x97, 0xb9,
1793 0xc9, 0x87, 0x01, 0x36, 0x55, 0x33, 0x17, 0xfa },
1798 static struct cipher_testvec cast6_dec_tv_template
[] =
1801 .key
= { 0x23, 0x42, 0xbb, 0x9e, 0xfa, 0x38, 0x54, 0x2c,
1802 0x0a, 0xf7, 0x56, 0x47, 0xf2, 0x9f, 0x61, 0x5d },
1804 .input
= { 0xc8, 0x42, 0xa0, 0x89, 0x72, 0xb4, 0x3d, 0x20,
1805 0x83, 0x6c, 0x91, 0xd1, 0xb7, 0x53, 0x0f, 0x6b },
1807 .result
= { [0 ... 15] = 0x00 },
1810 .key
= { 0x23, 0x42, 0xbb, 0x9e, 0xfa, 0x38, 0x54, 0x2c,
1811 0xbe, 0xd0, 0xac, 0x83, 0x94, 0x0a, 0xc2, 0x98,
1812 0xba, 0xc7, 0x7a, 0x77, 0x17, 0x94, 0x28, 0x63 },
1814 .input
= { 0x1b, 0x38, 0x6c, 0x02, 0x10, 0xdc, 0xad, 0xcb,
1815 0xdd, 0x0e, 0x41, 0xaa, 0x08, 0xa7, 0xa7, 0xe8 },
1817 .result
= { [0 ... 15] = 0x00 },
1820 .key
= { 0x23, 0x42, 0xbb, 0x9e, 0xfa, 0x38, 0x54, 0x2c,
1821 0xbe, 0xd0, 0xac, 0x83, 0x94, 0x0a, 0xc2, 0x98,
1822 0x8d, 0x7c, 0x47, 0xce, 0x26, 0x49, 0x08, 0x46,
1823 0x1c, 0xc1, 0xb5, 0x13, 0x7a, 0xe6, 0xb6, 0x04 },
1825 .input
= { 0x4f, 0x6a, 0x20, 0x38, 0x28, 0x68, 0x97, 0xb9,
1826 0xc9, 0x87, 0x01, 0x36, 0x55, 0x33, 0x17, 0xfa },
1828 .result
= { [0 ... 15] = 0x00 },
1837 #define AES_ENC_TEST_VECTORS 3
1838 #define AES_DEC_TEST_VECTORS 3
1840 static struct cipher_testvec aes_enc_tv_template
[] = {
1841 { /* From FIPS-197 */
1842 .key
= { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1843 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
1845 .input
= { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
1846 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff },
1848 .result
= { 0x69, 0xc4, 0xe0, 0xd8, 0x6a, 0x7b, 0x04, 0x30,
1849 0xd8, 0xcd, 0xb7, 0x80, 0x70, 0xb4, 0xc5, 0x5a },
1852 .key
= { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1853 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
1854 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17 },
1856 .input
= { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
1857 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff },
1859 .result
= { 0xdd, 0xa9, 0x7c, 0xa4, 0x86, 0x4c, 0xdf, 0xe0,
1860 0x6e, 0xaf, 0x70, 0xa0, 0xec, 0x0d, 0x71, 0x91 },
1863 .key
= { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1864 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
1865 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
1866 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f },
1868 .input
= { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
1869 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff },
1871 .result
= { 0x8e, 0xa2, 0xb7, 0xca, 0x51, 0x67, 0x45, 0xbf,
1872 0xea, 0xfc, 0x49, 0x90, 0x4b, 0x49, 0x60, 0x89 },
1877 static struct cipher_testvec aes_dec_tv_template
[] = {
1878 { /* From FIPS-197 */
1879 .key
= { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1880 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
1882 .input
= { 0x69, 0xc4, 0xe0, 0xd8, 0x6a, 0x7b, 0x04, 0x30,
1883 0xd8, 0xcd, 0xb7, 0x80, 0x70, 0xb4, 0xc5, 0x5a },
1885 .result
= { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
1886 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff },
1889 .key
= { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1890 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
1891 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17 },
1893 .input
= { 0xdd, 0xa9, 0x7c, 0xa4, 0x86, 0x4c, 0xdf, 0xe0,
1894 0x6e, 0xaf, 0x70, 0xa0, 0xec, 0x0d, 0x71, 0x91 },
1896 .result
= { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
1897 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff },
1900 .key
= { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1901 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
1902 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
1903 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f },
1905 .input
= { 0x8e, 0xa2, 0xb7, 0xca, 0x51, 0x67, 0x45, 0xbf,
1906 0xea, 0xfc, 0x49, 0x90, 0x4b, 0x49, 0x60, 0x89 },
1908 .result
= { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
1909 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff },
1914 /* Cast5 test vectors from RFC 2144 */
1915 #define CAST5_ENC_TEST_VECTORS 3
1916 #define CAST5_DEC_TEST_VECTORS 3
1918 static struct cipher_testvec cast5_enc_tv_template
[] =
1921 .key
= { 0x01, 0x23, 0x45, 0x67, 0x12, 0x34, 0x56, 0x78,
1922 0x23, 0x45, 0x67, 0x89, 0x34, 0x56, 0x78, 0x9a },
1924 .input
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1926 .result
= { 0x23, 0x8b, 0x4f, 0xe5, 0x84, 0x7e, 0x44, 0xb2 },
1929 .key
= { 0x01, 0x23, 0x45, 0x67, 0x12, 0x34, 0x56, 0x78,
1932 .input
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1934 .result
= { 0xeb, 0x6a, 0x71, 0x1a, 0x2c, 0x02, 0x27, 0x1b },
1937 .key
= { 0x01, 0x23, 0x45, 0x67, 0x12 },
1939 .input
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1941 .result
= { 0x7a, 0xc8, 0x16, 0xd1, 0x6e, 0x9b, 0x30, 0x2e },
1946 static struct cipher_testvec cast5_dec_tv_template
[] =
1949 .key
= { 0x01, 0x23, 0x45, 0x67, 0x12, 0x34, 0x56, 0x78,
1950 0x23, 0x45, 0x67, 0x89, 0x34, 0x56, 0x78, 0x9a },
1952 .input
= { 0x23, 0x8b, 0x4f, 0xe5, 0x84, 0x7e, 0x44, 0xb2 },
1954 .result
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1957 .key
= { 0x01, 0x23, 0x45, 0x67, 0x12, 0x34, 0x56, 0x78,
1960 .input
= { 0xeb, 0x6a, 0x71, 0x1a, 0x2c, 0x02, 0x27, 0x1b },
1962 .result
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1965 .key
= { 0x01, 0x23, 0x45, 0x67, 0x12 },
1967 .input
= { 0x7a, 0xc8, 0x16, 0xd1, 0x6e, 0x9b, 0x30, 0x2e },
1969 .result
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1975 * ARC4 test vectors from OpenSSL
1977 #define ARC4_ENC_TEST_VECTORS 7
1978 #define ARC4_DEC_TEST_VECTORS 7
1980 static struct cipher_testvec arc4_enc_tv_template
[] =
1983 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1985 .input
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1987 .result
= { 0x75, 0xb7, 0x87, 0x80, 0x99, 0xe0, 0xc5, 0x96 },
1990 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1992 .input
= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
1994 .result
= { 0x74, 0x94, 0xc2, 0xe7, 0x10, 0x4b, 0x08, 0x79 },
1997 .key
= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
1999 .input
= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
2001 .result
= { 0xde, 0x18, 0x89, 0x41, 0xa3, 0x37, 0x5d, 0x3a },
2004 .key
= { 0xef, 0x01, 0x23, 0x45},
2006 .input
= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2007 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2008 0x00, 0x00, 0x00, 0x00 },
2010 .result
= { 0xd6, 0xa1, 0x41, 0xa7, 0xec, 0x3c, 0x38, 0xdf,
2011 0xbd, 0x61, 0x5a, 0x11, 0x62, 0xe1, 0xc7, 0xba,
2012 0x36, 0xb6, 0x78, 0x58 },
2015 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
2017 .input
= { 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0,
2018 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0,
2019 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0,
2020 0x12, 0x34, 0x56, 0x78 },
2022 .result
= { 0x66, 0xa0, 0x94, 0x9f, 0x8a, 0xf7, 0xd6, 0x89,
2023 0x1f, 0x7f, 0x83, 0x2b, 0xa8, 0x33, 0xc0, 0x0c,
2024 0x89, 0x2e, 0xbe, 0x30, 0x14, 0x3c, 0xe2, 0x87,
2025 0x40, 0x01, 0x1e, 0xcf },
2028 .key
= { 0xef, 0x01, 0x23, 0x45 },
2030 .input
= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2033 .result
= { 0xd6, 0xa1, 0x41, 0xa7, 0xec, 0x3c, 0x38, 0xdf,
2037 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF,
2038 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
2040 .input
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF },
2042 .result
= { 0x69, 0x72, 0x36, 0x59, 0x1B, 0x52, 0x42, 0xB1 },
2047 static struct cipher_testvec arc4_dec_tv_template
[] =
2050 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
2052 .input
= { 0x75, 0xb7, 0x87, 0x80, 0x99, 0xe0, 0xc5, 0x96 },
2054 .result
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
2057 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
2059 .input
= { 0x74, 0x94, 0xc2, 0xe7, 0x10, 0x4b, 0x08, 0x79 },
2061 .result
= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
2064 .key
= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
2066 .input
= { 0xde, 0x18, 0x89, 0x41, 0xa3, 0x37, 0x5d, 0x3a },
2068 .result
= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
2071 .key
= { 0xef, 0x01, 0x23, 0x45},
2073 .input
= { 0xd6, 0xa1, 0x41, 0xa7, 0xec, 0x3c, 0x38, 0xdf,
2074 0xbd, 0x61, 0x5a, 0x11, 0x62, 0xe1, 0xc7, 0xba,
2075 0x36, 0xb6, 0x78, 0x58 },
2077 .result
= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2078 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2079 0x00, 0x00, 0x00, 0x00 },
2082 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
2084 .input
= { 0x66, 0xa0, 0x94, 0x9f, 0x8a, 0xf7, 0xd6, 0x89,
2085 0x1f, 0x7f, 0x83, 0x2b, 0xa8, 0x33, 0xc0, 0x0c,
2086 0x89, 0x2e, 0xbe, 0x30, 0x14, 0x3c, 0xe2, 0x87,
2087 0x40, 0x01, 0x1e, 0xcf },
2089 .result
= { 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0,
2090 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0,
2091 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0,
2092 0x12, 0x34, 0x56, 0x78 },
2095 .key
= { 0xef, 0x01, 0x23, 0x45 },
2097 .input
= { 0xd6, 0xa1, 0x41, 0xa7, 0xec, 0x3c, 0x38, 0xdf,
2100 .result
= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2104 .key
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF,
2105 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
2107 .input
= { 0x69, 0x72, 0x36, 0x59, 0x1B, 0x52, 0x42, 0xB1 },
2109 .result
= { 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF },
2117 #define TEA_ENC_TEST_VECTORS 4
2118 #define TEA_DEC_TEST_VECTORS 4
2120 static struct cipher_testvec tea_enc_tv_template
[] =
2123 .key
= { [0 ... 15] = 0x00 },
2125 .input
= { [0 ... 8] = 0x00 },
2127 .result
= { 0x0a, 0x3a, 0xea, 0x41, 0x40, 0xa9, 0xba, 0x94 },
2130 .key
= { 0x2b, 0x02, 0x05, 0x68, 0x06, 0x14, 0x49, 0x76,
2131 0x77, 0x5d, 0x0e, 0x26, 0x6c, 0x28, 0x78, 0x43 },
2133 .input
= { 0x74, 0x65, 0x73, 0x74, 0x20, 0x6d, 0x65, 0x2e },
2135 .result
= { 0x77, 0x5d, 0x2a, 0x6a, 0xf6, 0xce, 0x92, 0x09 },
2138 .key
= { 0x09, 0x65, 0x43, 0x11, 0x66, 0x44, 0x39, 0x25,
2139 0x51, 0x3a, 0x16, 0x10, 0x0a, 0x08, 0x12, 0x6e },
2141 .input
= { 0x6c, 0x6f, 0x6e, 0x67, 0x65, 0x72, 0x5f, 0x74,
2142 0x65, 0x73, 0x74, 0x5f, 0x76, 0x65, 0x63, 0x74 },
2144 .result
= { 0xbe, 0x7a, 0xbb, 0x81, 0x95, 0x2d, 0x1f, 0x1e,
2145 0xdd, 0x89, 0xa1, 0x25, 0x04, 0x21, 0xdf, 0x95 },
2148 .key
= { 0x4d, 0x76, 0x32, 0x17, 0x05, 0x3f, 0x75, 0x2c,
2149 0x5d, 0x04, 0x16, 0x36, 0x15, 0x72, 0x63, 0x2f },
2151 .input
= { 0x54, 0x65, 0x61, 0x20, 0x69, 0x73, 0x20, 0x67,
2152 0x6f, 0x6f, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20,
2153 0x79, 0x6f, 0x75, 0x21, 0x21, 0x21, 0x20, 0x72,
2154 0x65, 0x61, 0x6c, 0x6c, 0x79, 0x21, 0x21, 0x21 },
2156 .result
= { 0xe0, 0x4d, 0x5d, 0x3c, 0xb7, 0x8c, 0x36, 0x47,
2157 0x94, 0x18, 0x95, 0x91, 0xa9, 0xfc, 0x49, 0xf8,
2158 0x44, 0xd1, 0x2d, 0xc2, 0x99, 0xb8, 0x08, 0x2a,
2159 0x07, 0x89, 0x73, 0xc2, 0x45, 0x92, 0xc6, 0x90 },
2164 static struct cipher_testvec tea_dec_tv_template
[] =
2167 .key
= { [0 ... 15] = 0x00 },
2169 .input
= { 0x0a, 0x3a, 0xea, 0x41, 0x40, 0xa9, 0xba, 0x94 },
2171 .result
= { [0 ... 8] = 0x00 },
2174 .key
= { 0x2b, 0x02, 0x05, 0x68, 0x06, 0x14, 0x49, 0x76,
2175 0x77, 0x5d, 0x0e, 0x26, 0x6c, 0x28, 0x78, 0x43 },
2177 .input
= { 0x77, 0x5d, 0x2a, 0x6a, 0xf6, 0xce, 0x92, 0x09 },
2179 .result
= { 0x74, 0x65, 0x73, 0x74, 0x20, 0x6d, 0x65, 0x2e },
2182 .key
= { 0x09, 0x65, 0x43, 0x11, 0x66, 0x44, 0x39, 0x25,
2183 0x51, 0x3a, 0x16, 0x10, 0x0a, 0x08, 0x12, 0x6e },
2185 .input
= { 0xbe, 0x7a, 0xbb, 0x81, 0x95, 0x2d, 0x1f, 0x1e,
2186 0xdd, 0x89, 0xa1, 0x25, 0x04, 0x21, 0xdf, 0x95 },
2188 .result
= { 0x6c, 0x6f, 0x6e, 0x67, 0x65, 0x72, 0x5f, 0x74,
2189 0x65, 0x73, 0x74, 0x5f, 0x76, 0x65, 0x63, 0x74 },
2192 .key
= { 0x4d, 0x76, 0x32, 0x17, 0x05, 0x3f, 0x75, 0x2c,
2193 0x5d, 0x04, 0x16, 0x36, 0x15, 0x72, 0x63, 0x2f },
2195 .input
= { 0xe0, 0x4d, 0x5d, 0x3c, 0xb7, 0x8c, 0x36, 0x47,
2196 0x94, 0x18, 0x95, 0x91, 0xa9, 0xfc, 0x49, 0xf8,
2197 0x44, 0xd1, 0x2d, 0xc2, 0x99, 0xb8, 0x08, 0x2a,
2198 0x07, 0x89, 0x73, 0xc2, 0x45, 0x92, 0xc6, 0x90 },
2200 .result
= { 0x54, 0x65, 0x61, 0x20, 0x69, 0x73, 0x20, 0x67,
2201 0x6f, 0x6f, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20,
2202 0x79, 0x6f, 0x75, 0x21, 0x21, 0x21, 0x20, 0x72,
2203 0x65, 0x61, 0x6c, 0x6c, 0x79, 0x21, 0x21, 0x21 },
2211 #define XTEA_ENC_TEST_VECTORS 4
2212 #define XTEA_DEC_TEST_VECTORS 4
2214 static struct cipher_testvec xtea_enc_tv_template
[] =
2217 .key
= { [0 ... 15] = 0x00 },
2219 .input
= { [0 ... 8] = 0x00 },
2221 .result
= { 0xaa, 0x22, 0x96, 0xe5, 0x6c, 0x61, 0xf3, 0x45 },
2224 .key
= { 0x2b, 0x02, 0x05, 0x68, 0x06, 0x14, 0x49, 0x76,
2225 0x77, 0x5d, 0x0e, 0x26, 0x6c, 0x28, 0x78, 0x43 },
2227 .input
= { 0x74, 0x65, 0x73, 0x74, 0x20, 0x6d, 0x65, 0x2e },
2229 .result
= { 0x82, 0x3e, 0xeb, 0x35, 0xdc, 0xdd, 0xd9, 0xc3 },
2232 .key
= { 0x09, 0x65, 0x43, 0x11, 0x66, 0x44, 0x39, 0x25,
2233 0x51, 0x3a, 0x16, 0x10, 0x0a, 0x08, 0x12, 0x6e },
2235 .input
= { 0x6c, 0x6f, 0x6e, 0x67, 0x65, 0x72, 0x5f, 0x74,
2236 0x65, 0x73, 0x74, 0x5f, 0x76, 0x65, 0x63, 0x74 },
2238 .result
= { 0xe2, 0x04, 0xdb, 0xf2, 0x89, 0x85, 0x9e, 0xea,
2239 0x61, 0x35, 0xaa, 0xed, 0xb5, 0xcb, 0x71, 0x2c },
2242 .key
= { 0x4d, 0x76, 0x32, 0x17, 0x05, 0x3f, 0x75, 0x2c,
2243 0x5d, 0x04, 0x16, 0x36, 0x15, 0x72, 0x63, 0x2f },
2245 .input
= { 0x54, 0x65, 0x61, 0x20, 0x69, 0x73, 0x20, 0x67,
2246 0x6f, 0x6f, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20,
2247 0x79, 0x6f, 0x75, 0x21, 0x21, 0x21, 0x20, 0x72,
2248 0x65, 0x61, 0x6c, 0x6c, 0x79, 0x21, 0x21, 0x21 },
2250 .result
= { 0x0b, 0x03, 0xcd, 0x8a, 0xbe, 0x95, 0xfd, 0xb1,
2251 0xc1, 0x44, 0x91, 0x0b, 0xa5, 0xc9, 0x1b, 0xb4,
2252 0xa9, 0xda, 0x1e, 0x9e, 0xb1, 0x3e, 0x2a, 0x8f,
2253 0xea, 0xa5, 0x6a, 0x85, 0xd1, 0xf4, 0xa8, 0xa5 },
2258 static struct cipher_testvec xtea_dec_tv_template
[] =
2261 .key
= { [0 ... 15] = 0x00 },
2263 .input
= { 0xaa, 0x22, 0x96, 0xe5, 0x6c, 0x61, 0xf3, 0x45 },
2265 .result
= { [0 ... 8] = 0x00 },
2268 .key
= { 0x2b, 0x02, 0x05, 0x68, 0x06, 0x14, 0x49, 0x76,
2269 0x77, 0x5d, 0x0e, 0x26, 0x6c, 0x28, 0x78, 0x43 },
2271 .input
= { 0x82, 0x3e, 0xeb, 0x35, 0xdc, 0xdd, 0xd9, 0xc3 },
2273 .result
= { 0x74, 0x65, 0x73, 0x74, 0x20, 0x6d, 0x65, 0x2e },
2276 .key
= { 0x09, 0x65, 0x43, 0x11, 0x66, 0x44, 0x39, 0x25,
2277 0x51, 0x3a, 0x16, 0x10, 0x0a, 0x08, 0x12, 0x6e },
2279 .input
= { 0xe2, 0x04, 0xdb, 0xf2, 0x89, 0x85, 0x9e, 0xea,
2280 0x61, 0x35, 0xaa, 0xed, 0xb5, 0xcb, 0x71, 0x2c },
2282 .result
= { 0x6c, 0x6f, 0x6e, 0x67, 0x65, 0x72, 0x5f, 0x74,
2283 0x65, 0x73, 0x74, 0x5f, 0x76, 0x65, 0x63, 0x74 },
2286 .key
= { 0x4d, 0x76, 0x32, 0x17, 0x05, 0x3f, 0x75, 0x2c,
2287 0x5d, 0x04, 0x16, 0x36, 0x15, 0x72, 0x63, 0x2f },
2289 .input
= { 0x0b, 0x03, 0xcd, 0x8a, 0xbe, 0x95, 0xfd, 0xb1,
2290 0xc1, 0x44, 0x91, 0x0b, 0xa5, 0xc9, 0x1b, 0xb4,
2291 0xa9, 0xda, 0x1e, 0x9e, 0xb1, 0x3e, 0x2a, 0x8f,
2292 0xea, 0xa5, 0x6a, 0x85, 0xd1, 0xf4, 0xa8, 0xa5 },
2294 .result
= { 0x54, 0x65, 0x61, 0x20, 0x69, 0x73, 0x20, 0x67,
2295 0x6f, 0x6f, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20,
2296 0x79, 0x6f, 0x75, 0x21, 0x21, 0x21, 0x20, 0x72,
2297 0x65, 0x61, 0x6c, 0x6c, 0x79, 0x21, 0x21, 0x21 },
2303 * KHAZAD test vectors.
2305 #define KHAZAD_ENC_TEST_VECTORS 5
2306 #define KHAZAD_DEC_TEST_VECTORS 5
2308 static struct cipher_testvec khazad_enc_tv_template
[] = {
2310 .key
= { 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2311 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
2313 .input
= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
2315 .result
= { 0x49, 0xa4, 0xce, 0x32, 0xac, 0x19, 0x0e, 0x3f },
2318 .key
= { 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38,
2319 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38 },
2321 .input
= { 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38 },
2323 .result
= { 0x7e, 0x82, 0x12, 0xa1, 0Xd9, 0X5b, 0Xe4, 0Xf9 },
2326 .key
= { 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2,
2327 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2 },
2329 .input
= { 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2 },
2331 .result
= { 0Xaa, 0Xbe, 0Xc1, 0X95, 0Xc5, 0X94, 0X1a, 0X9c },
2334 .key
= { 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f,
2335 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f },
2337 .input
= { 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f },
2339 .result
= { 0X04, 0X74, 0Xf5, 0X70, 0X50, 0X16, 0Xd3, 0Xb8 },
2342 .key
= { 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f,
2343 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f },
2345 .input
= { 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f ,
2346 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f },
2348 .result
= { 0X04, 0X74, 0Xf5, 0X70, 0X50, 0X16, 0Xd3, 0Xb8 ,
2349 0X04, 0X74, 0Xf5, 0X70, 0X50, 0X16, 0Xd3, 0Xb8 },
2354 static struct cipher_testvec khazad_dec_tv_template
[] = {
2356 .key
= { 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2357 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
2359 .input
= { 0X49, 0Xa4, 0Xce, 0X32, 0Xac, 0X19, 0X0e, 0X3f },
2361 .result
= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
2364 .key
= { 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38,
2365 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38 },
2367 .input
= { 0X7e, 0X82, 0X12, 0Xa1, 0Xd9, 0X5b, 0Xe4, 0Xf9 },
2369 .result
= { 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38 },
2372 .key
= { 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2,
2373 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2 },
2375 .input
= { 0Xaa, 0Xbe, 0Xc1, 0X95, 0Xc5, 0X94, 0X1a, 0X9c },
2377 .result
= { 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2 },
2380 .key
= { 0x2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f,
2381 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f },
2383 .input
= { 0X04, 0X74, 0Xf5, 0X70, 0X50, 0X16, 0Xd3, 0Xb8 },
2385 .result
= { 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f },
2388 .key
= { 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f,
2389 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f },
2391 .input
= { 0X04, 0X74, 0Xf5, 0X70, 0X50, 0X16, 0Xd3, 0Xb8 ,
2392 0X04, 0X74, 0Xf5, 0X70, 0X50, 0X16, 0Xd3, 0Xb8 },
2394 .result
= { 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f ,
2395 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f },
2401 * Anubis test vectors.
2404 #define ANUBIS_ENC_TEST_VECTORS 5
2405 #define ANUBIS_DEC_TEST_VECTORS 5
2406 #define ANUBIS_CBC_ENC_TEST_VECTORS 2
2407 #define ANUBIS_CBC_DEC_TEST_VECTORS 2
2409 static struct cipher_testvec anubis_enc_tv_template
[] = {
2411 .key
= { 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe,
2412 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe },
2414 .input
= { 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe,
2415 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe },
2417 .result
= { 0x6d, 0xc5, 0xda, 0xa2, 0x26, 0x7d, 0x62, 0x6f,
2418 0x08, 0xb7, 0x52, 0x8e, 0x6e, 0x6e, 0x86, 0x90 },
2422 .key
= { 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
2423 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
2424 0x03, 0x03, 0x03, 0x03 },
2426 .input
= { 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
2427 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03 },
2429 .result
= { 0xdb, 0xf1, 0x42, 0xf4, 0xd1, 0x8a, 0xc7, 0x49,
2430 0x87, 0x41, 0x6f, 0x82, 0x0a, 0x98, 0x64, 0xae },
2433 .key
= { 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24,
2434 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24,
2435 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24,
2436 0x24, 0x24, 0x24, 0x24 },
2438 .input
= { 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24,
2439 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24 },
2441 .result
= { 0xfd, 0x1b, 0x4a, 0xe3, 0xbf, 0xf0, 0xad, 0x3d,
2442 0x06, 0xd3, 0x61, 0x27, 0xfd, 0x13, 0x9e, 0xde },
2445 .key
= { 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25,
2446 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25,
2447 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25,
2448 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25 },
2450 .input
= { 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25,
2451 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25 },
2453 .result
= { 0x1a, 0x91, 0xfb, 0x2b, 0xb7, 0x78, 0x6b, 0xc4,
2454 0x17, 0xd9, 0xff, 0x40, 0x3b, 0x0e, 0xe5, 0xfe },
2457 .key
= { 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
2458 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
2459 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
2460 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
2461 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35 },
2463 .input
= { 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
2464 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35 },
2466 .result
= { 0xa5, 0x2c, 0x85, 0x6f, 0x9c, 0xba, 0xa0, 0x97,
2467 0x9e, 0xc6, 0x84, 0x0f, 0x17, 0x21, 0x07, 0xee },
2472 static struct cipher_testvec anubis_dec_tv_template
[] = {
2474 .key
= { 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe,
2475 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe },
2477 .input
= { 0x6d, 0xc5, 0xda, 0xa2, 0x26, 0x7d, 0x62, 0x6f,
2478 0x08, 0xb7, 0x52, 0x8e, 0x6e, 0x6e, 0x86, 0x90 },
2480 .result
= { 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe,
2481 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe },
2485 .key
= { 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
2486 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
2487 0x03, 0x03, 0x03, 0x03 },
2489 .input
= { 0xdb, 0xf1, 0x42, 0xf4, 0xd1, 0x8a, 0xc7, 0x49,
2490 0x87, 0x41, 0x6f, 0x82, 0x0a, 0x98, 0x64, 0xae },
2492 .result
= { 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
2493 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03 },
2496 .key
= { 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24,
2497 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24,
2498 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24,
2499 0x24, 0x24, 0x24, 0x24 },
2501 .input
= { 0xfd, 0x1b, 0x4a, 0xe3, 0xbf, 0xf0, 0xad, 0x3d,
2502 0x06, 0xd3, 0x61, 0x27, 0xfd, 0x13, 0x9e, 0xde },
2504 .result
= { 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24,
2505 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24 },
2508 .key
= { 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25,
2509 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25,
2510 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25,
2511 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25 },
2513 .input
= { 0x1a, 0x91, 0xfb, 0x2b, 0xb7, 0x78, 0x6b, 0xc4,
2514 0x17, 0xd9, 0xff, 0x40, 0x3b, 0x0e, 0xe5, 0xfe },
2516 .result
= { 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25,
2517 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25 },
2520 .key
= { 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
2521 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
2522 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
2523 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
2524 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35 },
2525 .input
= { 0xa5, 0x2c, 0x85, 0x6f, 0x9c, 0xba, 0xa0, 0x97,
2526 0x9e, 0xc6, 0x84, 0x0f, 0x17, 0x21, 0x07, 0xee },
2529 .result
= { 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
2530 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35 },
2535 static struct cipher_testvec anubis_cbc_enc_tv_template
[] = {
2537 .key
= { 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe,
2538 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe },
2540 .input
= { 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe,
2541 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe,
2542 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe,
2543 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe },
2545 .result
= { 0x6d, 0xc5, 0xda, 0xa2, 0x26, 0x7d, 0x62, 0x6f,
2546 0x08, 0xb7, 0x52, 0x8e, 0x6e, 0x6e, 0x86, 0x90,
2547 0x86, 0xd8, 0xb5, 0x6f, 0x98, 0x5e, 0x8a, 0x66,
2548 0x4f, 0x1f, 0x78, 0xa1, 0xbb, 0x37, 0xf1, 0xbe },
2551 .key
= { 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
2552 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
2553 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
2554 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
2555 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35 },
2557 .input
= { 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
2558 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
2559 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
2560 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35 },
2562 .result
= { 0xa5, 0x2c, 0x85, 0x6f, 0x9c, 0xba, 0xa0, 0x97,
2563 0x9e, 0xc6, 0x84, 0x0f, 0x17, 0x21, 0x07, 0xee,
2564 0xa2, 0xbc, 0x06, 0x98, 0xc6, 0x4b, 0xda, 0x75,
2565 0x2e, 0xaa, 0xbe, 0x58, 0xce, 0x01, 0x5b, 0xc7 },
2570 static struct cipher_testvec anubis_cbc_dec_tv_template
[] = {
2572 .key
= { 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe,
2573 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe },
2575 .input
= { 0x6d, 0xc5, 0xda, 0xa2, 0x26, 0x7d, 0x62, 0x6f,
2576 0x08, 0xb7, 0x52, 0x8e, 0x6e, 0x6e, 0x86, 0x90,
2577 0x86, 0xd8, 0xb5, 0x6f, 0x98, 0x5e, 0x8a, 0x66,
2578 0x4f, 0x1f, 0x78, 0xa1, 0xbb, 0x37, 0xf1, 0xbe },
2580 .result
= { 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe,
2581 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe,
2582 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe,
2583 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe },
2586 .key
= { 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
2587 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
2588 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
2589 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
2590 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35 },
2592 .input
= { 0xa5, 0x2c, 0x85, 0x6f, 0x9c, 0xba, 0xa0, 0x97,
2593 0x9e, 0xc6, 0x84, 0x0f, 0x17, 0x21, 0x07, 0xee,
2594 0xa2, 0xbc, 0x06, 0x98, 0xc6, 0x4b, 0xda, 0x75,
2595 0x2e, 0xaa, 0xbe, 0x58, 0xce, 0x01, 0x5b, 0xc7 },
2597 .result
= { 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
2598 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
2599 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35,
2600 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35, 0x35 },
2606 * Compression stuff.
2608 #define COMP_BUF_SIZE 512
2610 struct comp_testvec
{
2612 char input
[COMP_BUF_SIZE
];
2613 char output
[COMP_BUF_SIZE
];
2617 * Deflate test vectors (null-terminated strings).
2618 * Params: winbits=11, Z_DEFAULT_COMPRESSION, MAX_MEM_LEVEL.
2620 #define DEFLATE_COMP_TEST_VECTORS 2
2621 #define DEFLATE_DECOMP_TEST_VECTORS 2
2623 static struct comp_testvec deflate_comp_tv_template
[] = {
2627 .input
= "Join us now and share the software "
2628 "Join us now and share the software ",
2629 .output
= { 0xf3, 0xca, 0xcf, 0xcc, 0x53, 0x28, 0x2d, 0x56,
2630 0xc8, 0xcb, 0x2f, 0x57, 0x48, 0xcc, 0x4b, 0x51,
2631 0x28, 0xce, 0x48, 0x2c, 0x4a, 0x55, 0x28, 0xc9,
2632 0x48, 0x55, 0x28, 0xce, 0x4f, 0x2b, 0x29, 0x07,
2633 0x71, 0xbc, 0x08, 0x2b, 0x01, 0x00 },
2637 .input
= "This document describes a compression method based on the DEFLATE"
2638 "compression algorithm. This document defines the application of "
2639 "the DEFLATE algorithm to the IP Payload Compression Protocol.",
2640 .output
= { 0x5d, 0x8d, 0x31, 0x0e, 0xc2, 0x30, 0x10, 0x04,
2641 0xbf, 0xb2, 0x2f, 0xc8, 0x1f, 0x10, 0x04, 0x09,
2642 0x89, 0xc2, 0x85, 0x3f, 0x70, 0xb1, 0x2f, 0xf8,
2643 0x24, 0xdb, 0x67, 0xd9, 0x47, 0xc1, 0xef, 0x49,
2644 0x68, 0x12, 0x51, 0xae, 0x76, 0x67, 0xd6, 0x27,
2645 0x19, 0x88, 0x1a, 0xde, 0x85, 0xab, 0x21, 0xf2,
2646 0x08, 0x5d, 0x16, 0x1e, 0x20, 0x04, 0x2d, 0xad,
2647 0xf3, 0x18, 0xa2, 0x15, 0x85, 0x2d, 0x69, 0xc4,
2648 0x42, 0x83, 0x23, 0xb6, 0x6c, 0x89, 0x71, 0x9b,
2649 0xef, 0xcf, 0x8b, 0x9f, 0xcf, 0x33, 0xca, 0x2f,
2650 0xed, 0x62, 0xa9, 0x4c, 0x80, 0xff, 0x13, 0xaf,
2651 0x52, 0x37, 0xed, 0x0e, 0x52, 0x6b, 0x59, 0x02,
2652 0xd9, 0x4e, 0xe8, 0x7a, 0x76, 0x1d, 0x02, 0x98,
2653 0xfe, 0x8a, 0x87, 0x83, 0xa3, 0x4f, 0x56, 0x8a,
2654 0xb8, 0x9e, 0x8e, 0x5c, 0x57, 0xd3, 0xa0, 0x79,
2659 static struct comp_testvec deflate_decomp_tv_template
[] = {
2663 .input
= { 0x5d, 0x8d, 0x31, 0x0e, 0xc2, 0x30, 0x10, 0x04,
2664 0xbf, 0xb2, 0x2f, 0xc8, 0x1f, 0x10, 0x04, 0x09,
2665 0x89, 0xc2, 0x85, 0x3f, 0x70, 0xb1, 0x2f, 0xf8,
2666 0x24, 0xdb, 0x67, 0xd9, 0x47, 0xc1, 0xef, 0x49,
2667 0x68, 0x12, 0x51, 0xae, 0x76, 0x67, 0xd6, 0x27,
2668 0x19, 0x88, 0x1a, 0xde, 0x85, 0xab, 0x21, 0xf2,
2669 0x08, 0x5d, 0x16, 0x1e, 0x20, 0x04, 0x2d, 0xad,
2670 0xf3, 0x18, 0xa2, 0x15, 0x85, 0x2d, 0x69, 0xc4,
2671 0x42, 0x83, 0x23, 0xb6, 0x6c, 0x89, 0x71, 0x9b,
2672 0xef, 0xcf, 0x8b, 0x9f, 0xcf, 0x33, 0xca, 0x2f,
2673 0xed, 0x62, 0xa9, 0x4c, 0x80, 0xff, 0x13, 0xaf,
2674 0x52, 0x37, 0xed, 0x0e, 0x52, 0x6b, 0x59, 0x02,
2675 0xd9, 0x4e, 0xe8, 0x7a, 0x76, 0x1d, 0x02, 0x98,
2676 0xfe, 0x8a, 0x87, 0x83, 0xa3, 0x4f, 0x56, 0x8a,
2677 0xb8, 0x9e, 0x8e, 0x5c, 0x57, 0xd3, 0xa0, 0x79,
2679 .output
= "This document describes a compression method based on the DEFLATE"
2680 "compression algorithm. This document defines the application of "
2681 "the DEFLATE algorithm to the IP Payload Compression Protocol.",
2685 .input
= { 0xf3, 0xca, 0xcf, 0xcc, 0x53, 0x28, 0x2d, 0x56,
2686 0xc8, 0xcb, 0x2f, 0x57, 0x48, 0xcc, 0x4b, 0x51,
2687 0x28, 0xce, 0x48, 0x2c, 0x4a, 0x55, 0x28, 0xc9,
2688 0x48, 0x55, 0x28, 0xce, 0x4f, 0x2b, 0x29, 0x07,
2689 0x71, 0xbc, 0x08, 0x2b, 0x01, 0x00 },
2690 .output
= "Join us now and share the software "
2691 "Join us now and share the software ",
2696 * Michael MIC test vectors from IEEE 802.11i
2698 #define MICHAEL_MIC_TEST_VECTORS 6
2700 static struct hash_testvec michael_mic_tv_template
[] =
2703 .key
= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
2707 .digest
= { 0x82, 0x92, 0x5c, 0x1c, 0xa1, 0xd1, 0x30, 0xb8 }
2710 .key
= { 0x82, 0x92, 0x5c, 0x1c, 0xa1, 0xd1, 0x30, 0xb8 },
2712 .plaintext
= { 'M' },
2714 .digest
= { 0x43, 0x47, 0x21, 0xca, 0x40, 0x63, 0x9b, 0x3f }
2717 .key
= { 0x43, 0x47, 0x21, 0xca, 0x40, 0x63, 0x9b, 0x3f },
2719 .plaintext
= { 'M', 'i' },
2721 .digest
= { 0xe8, 0xf9, 0xbe, 0xca, 0xe9, 0x7e, 0x5d, 0x29 }
2724 .key
= { 0xe8, 0xf9, 0xbe, 0xca, 0xe9, 0x7e, 0x5d, 0x29 },
2726 .plaintext
= { 'M', 'i', 'c' },
2728 .digest
= { 0x90, 0x03, 0x8f, 0xc6, 0xcf, 0x13, 0xc1, 0xdb }
2731 .key
= { 0x90, 0x03, 0x8f, 0xc6, 0xcf, 0x13, 0xc1, 0xdb },
2733 .plaintext
= { 'M', 'i', 'c', 'h' },
2735 .digest
= { 0xd5, 0x5e, 0x10, 0x05, 0x10, 0x12, 0x89, 0x86 }
2738 .key
= { 0xd5, 0x5e, 0x10, 0x05, 0x10, 0x12, 0x89, 0x86 },
2740 .plaintext
= { 'M', 'i', 'c', 'h', 'a', 'e', 'l' },
2742 .digest
= { 0x0a, 0x94, 0x2b, 0x12, 0x4e, 0xca, 0xa5, 0x46 },
2746 #endif /* _CRYPTO_TCRYPT_H */