MOXA linux-2.6.x / linux-2.6.9-uc0 from sdlinux-moxaart.tgz
[linux-2.6.9-moxart.git] / crypto / tcrypt.h
blob18370befc652b1ef475f0218789c4bb2557e6e5d
1 /*
2 * Quick & dirty crypto testing module.
4 * This will only exist until we have a better testing mechanism
5 * (e.g. a char device).
7 * Copyright (c) 2002 James Morris <jmorris@intercode.com.au>
8 * Copyright (c) 2002 Jean-Francois Dive <jef@linuxbe.org>
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the Free
12 * Software Foundation; either version 2 of the License, or (at your option)
13 * any later version.
15 * 14 - 09 - 2003 Changes by Kartikey Mahendra Bhatt
18 #ifndef _CRYPTO_TCRYPT_H
19 #define _CRYPTO_TCRYPT_H
21 #define MAX_DIGEST_SIZE 64
22 #define MAX_TAP 8
24 #define MAX_KEYLEN 56
25 #define MAX_IVLEN 32
27 struct hash_testvec {
28 char plaintext[128];
29 unsigned char psize;
30 char digest[MAX_DIGEST_SIZE];
31 unsigned char np;
32 unsigned char tap[MAX_TAP];
33 char key[128]; /* only used with keyed hash algorithms */
34 unsigned char ksize;
37 struct hmac_testvec {
38 char key[128];
39 unsigned char ksize;
40 char plaintext[128];
41 unsigned char psize;
42 char digest[MAX_DIGEST_SIZE];
43 unsigned char np;
44 unsigned char tap[MAX_TAP];
47 struct cipher_testvec {
48 unsigned char fail;
49 unsigned char wk; /* weak key flag */
50 char key[MAX_KEYLEN];
51 unsigned char klen;
52 char iv[MAX_IVLEN];
53 char input[48];
54 unsigned char ilen;
55 char result[48];
56 unsigned char rlen;
57 int np;
58 unsigned char tap[MAX_TAP];
62 * MD4 test vectors from RFC1320
64 #define MD4_TEST_VECTORS 7
66 struct hash_testvec md4_tv_template [] = {
68 .plaintext = "",
69 .digest = { 0x31, 0xd6, 0xcf, 0xe0, 0xd1, 0x6a, 0xe9, 0x31,
70 0xb7, 0x3c, 0x59, 0xd7, 0xe0, 0xc0, 0x89, 0xc0 },
71 }, {
72 .plaintext = "a",
73 .psize = 1,
74 .digest = { 0xbd, 0xe5, 0x2c, 0xb3, 0x1d, 0xe3, 0x3e, 0x46,
75 0x24, 0x5e, 0x05, 0xfb, 0xdb, 0xd6, 0xfb, 0x24 },
76 }, {
77 .plaintext = "abc",
78 .psize = 3,
79 .digest = { 0xa4, 0x48, 0x01, 0x7a, 0xaf, 0x21, 0xd8, 0x52,
80 0x5f, 0xc1, 0x0a, 0xe8, 0x7a, 0xa6, 0x72, 0x9d },
81 }, {
82 .plaintext = "message digest",
83 .psize = 14,
84 .digest = { 0xd9, 0x13, 0x0a, 0x81, 0x64, 0x54, 0x9f, 0xe8,
85 0x18, 0x87, 0x48, 0x06, 0xe1, 0xc7, 0x01, 0x4b },
86 }, {
87 .plaintext = "abcdefghijklmnopqrstuvwxyz",
88 .psize = 26,
89 .digest = { 0xd7, 0x9e, 0x1c, 0x30, 0x8a, 0xa5, 0xbb, 0xcd,
90 0xee, 0xa8, 0xed, 0x63, 0xdf, 0x41, 0x2d, 0xa9 },
91 .np = 2,
92 .tap = { 13, 13 },
93 }, {
94 .plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
95 .psize = 62,
96 .digest = { 0x04, 0x3f, 0x85, 0x82, 0xf2, 0x41, 0xdb, 0x35,
97 0x1c, 0xe6, 0x27, 0xe1, 0x53, 0xe7, 0xf0, 0xe4 },
98 }, {
99 .plaintext = "123456789012345678901234567890123456789012345678901234567890123"
100 "45678901234567890",
101 .psize = 80,
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 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 },
116 }, {
117 .plaintext = "a",
118 .psize = 1,
119 .digest = { 0x0c, 0xc1, 0x75, 0xb9, 0xc0, 0xf1, 0xb6, 0xa8,
120 0x31, 0xc3, 0x99, 0xe2, 0x69, 0x77, 0x26, 0x61 },
121 }, {
122 .plaintext = "abc",
123 .psize = 3,
124 .digest = { 0x90, 0x01, 0x50, 0x98, 0x3c, 0xd2, 0x4f, 0xb0,
125 0xd6, 0x96, 0x3f, 0x7d, 0x28, 0xe1, 0x7f, 0x72 },
126 }, {
127 .plaintext = "message digest",
128 .psize = 14,
129 .digest = { 0xf9, 0x6b, 0x69, 0x7d, 0x7c, 0xb7, 0x93, 0x8d,
130 0x52, 0x5a, 0x2f, 0x31, 0xaa, 0xf1, 0x61, 0xd0 },
131 }, {
132 .plaintext = "abcdefghijklmnopqrstuvwxyz",
133 .psize = 26,
134 .digest = { 0xc3, 0xfc, 0xd3, 0xd7, 0x61, 0x92, 0xe4, 0x00,
135 0x7d, 0xfb, 0x49, 0x6c, 0xca, 0x67, 0xe1, 0x3b },
136 .np = 2,
137 .tap = {13, 13}
138 }, {
139 .plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
140 .psize = 62,
141 .digest = { 0xd1, 0x74, 0xab, 0x98, 0xd2, 0x77, 0xd9, 0xf5,
142 0xa5, 0x61, 0x1c, 0x2c, 0x9f, 0x41, 0x9d, 0x9f },
143 }, {
144 .plaintext = "12345678901234567890123456789012345678901234567890123456789012"
145 "345678901234567890",
146 .psize = 80,
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 struct hash_testvec sha1_tv_template[] = {
159 .plaintext = "abc",
160 .psize = 3,
161 .digest = { 0xa9, 0x99, 0x3e, 0x36, 0x47, 0x06, 0x81, 0x6a, 0xba, 0x3e,
162 0x25, 0x71, 0x78, 0x50, 0xc2, 0x6c, 0x9c, 0xd0, 0xd8, 0x9d },
163 }, {
164 .plaintext = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
165 .psize = 56,
166 .digest = { 0x84, 0x98, 0x3e, 0x44, 0x1c, 0x3b, 0xd2, 0x6e, 0xba, 0xae,
167 0x4a, 0xa1, 0xf9, 0x51, 0x29, 0xe5, 0xe5, 0x46, 0x70, 0xf1 },
168 .np = 2,
169 .tap = { 28, 28 }
174 * SHA256 test vectors from from NIST
176 #define SHA256_TEST_VECTORS 2
178 struct hash_testvec sha256_tv_template[] = {
180 .plaintext = "abc",
181 .psize = 3,
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 },
186 }, {
187 .plaintext = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
188 .psize = 56,
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 },
193 .np = 2,
194 .tap = { 28, 28 }
199 * SHA384 test vectors from from NIST and kerneli
201 #define SHA384_TEST_VECTORS 4
203 struct hash_testvec sha384_tv_template[] = {
205 .plaintext= "abc",
206 .psize = 3,
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 },
213 }, {
214 .plaintext = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
215 .psize = 56,
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},
222 }, {
223 .plaintext = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmn"
224 "hijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu",
225 .psize = 112,
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 },
232 }, {
233 .plaintext = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcd"
234 "efghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz",
235 .psize = 104,
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 },
242 .np = 4,
243 .tap = { 26, 26, 26, 26 }
248 * SHA512 test vectors from from NIST and kerneli
250 #define SHA512_TEST_VECTORS 4
252 struct hash_testvec sha512_tv_template[] = {
254 .plaintext = "abc",
255 .psize = 3,
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 },
264 }, {
265 .plaintext = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
266 .psize = 56,
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 },
275 }, {
276 .plaintext = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmn"
277 "hijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu",
278 .psize = 112,
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 },
287 }, {
288 .plaintext = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcd"
289 "efghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz",
290 .psize = 104,
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 },
299 .np = 4,
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
308 * submission
310 #define WP512_TEST_VECTORS 8
312 struct hash_testvec wp512_tv_template[] = {
314 .plaintext = "",
315 .psize = 0,
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 },
326 }, {
327 .plaintext = "a",
328 .psize = 1,
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 },
337 }, {
338 .plaintext = "abc",
339 .psize = 3,
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 },
348 }, {
349 .plaintext = "message digest",
350 .psize = 14,
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 },
359 }, {
360 .plaintext = "abcdefghijklmnopqrstuvwxyz",
361 .psize = 26,
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 },
370 }, {
371 .plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
372 "abcdefghijklmnopqrstuvwxyz0123456789",
373 .psize = 62,
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 },
382 }, {
383 .plaintext = "1234567890123456789012345678901234567890"
384 "1234567890123456789012345678901234567890",
385 .psize = 80,
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 },
394 }, {
395 .plaintext = "abcdbcdecdefdefgefghfghighijhijk",
396 .psize = 32,
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 struct hash_testvec wp384_tv_template[] = {
412 .plaintext = "",
413 .psize = 0,
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 },
422 }, {
423 .plaintext = "a",
424 .psize = 1,
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 },
431 }, {
432 .plaintext = "abc",
433 .psize = 3,
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 },
440 }, {
441 .plaintext = "message digest",
442 .psize = 14,
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 },
449 }, {
450 .plaintext = "abcdefghijklmnopqrstuvwxyz",
451 .psize = 26,
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 },
458 }, {
459 .plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
460 "abcdefghijklmnopqrstuvwxyz0123456789",
461 .psize = 62,
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 },
468 }, {
469 .plaintext = "1234567890123456789012345678901234567890"
470 "1234567890123456789012345678901234567890",
471 .psize = 80,
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 },
478 }, {
479 .plaintext = "abcdbcdecdefdefgefghfghighijhijk",
480 .psize = 32,
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 struct hash_testvec wp256_tv_template[] = {
494 .plaintext = "",
495 .psize = 0,
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 },
502 }, {
503 .plaintext = "a",
504 .psize = 1,
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 },
509 }, {
510 .plaintext = "abc",
511 .psize = 3,
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 },
516 }, {
517 .plaintext = "message digest",
518 .psize = 14,
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 },
523 }, {
524 .plaintext = "abcdefghijklmnopqrstuvwxyz",
525 .psize = 26,
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 },
530 }, {
531 .plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
532 "abcdefghijklmnopqrstuvwxyz0123456789",
533 .psize = 62,
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 },
538 }, {
539 .plaintext = "1234567890123456789012345678901234567890"
540 "1234567890123456789012345678901234567890",
541 .psize = 80,
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 },
546 }, {
547 .plaintext = "abcdbcdecdefdefgefghfghighijhijk",
548 .psize = 32,
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 #ifdef CONFIG_CRYPTO_HMAC
559 * HMAC-MD5 test vectors from RFC2202
560 * (These need to be fixed to not use strlen).
562 #define HMAC_MD5_TEST_VECTORS 7
564 struct hmac_testvec hmac_md5_tv_template[] =
567 .key = { [0 ... 15] = 0x0b },
568 .ksize = 16,
569 .plaintext = "Hi There",
570 .psize = 8,
571 .digest = { 0x92, 0x94, 0x72, 0x7a, 0x36, 0x38, 0xbb, 0x1c,
572 0x13, 0xf4, 0x8e, 0xf8, 0x15, 0x8b, 0xfc, 0x9d },
573 }, {
574 .key = { 'J', 'e', 'f', 'e' },
575 .ksize = 4,
576 .plaintext = "what do ya want for nothing?",
577 .psize = 28,
578 .digest = { 0x75, 0x0c, 0x78, 0x3e, 0x6a, 0xb0, 0xb5, 0x03,
579 0xea, 0xa8, 0x6e, 0x31, 0x0a, 0x5d, 0xb7, 0x38 },
580 .np = 2,
581 .tap = {14, 14}
582 }, {
583 .key = { [0 ... 15] = 0xaa },
584 .ksize = 16,
585 .plaintext = { [0 ... 49] = 0xdd },
586 .psize = 50,
587 .digest = { 0x56, 0xbe, 0x34, 0x52, 0x1d, 0x14, 0x4c, 0x88,
588 0xdb, 0xb8, 0xc7, 0x33, 0xf0, 0xe8, 0xb3, 0xf6 },
589 }, {
590 .key = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
591 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
592 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, },
593 .ksize = 25,
594 .plaintext = { [0 ... 49] = 0xcd },
595 .psize = 50,
596 .digest = { 0x69, 0x7e, 0xaf, 0x0a, 0xca, 0x3a, 0x3a, 0xea,
597 0x3a, 0x75, 0x16, 0x47, 0x46, 0xff, 0xaa, 0x79 },
598 }, {
599 .key = { [0 ... 15] = 0x0c },
600 .ksize = 16,
601 .plaintext = "Test With Truncation",
602 .psize = 20,
603 .digest = { 0x56, 0x46, 0x1e, 0xf2, 0x34, 0x2e, 0xdc, 0x00,
604 0xf9, 0xba, 0xb9, 0x95, 0x69, 0x0e, 0xfd, 0x4c },
605 }, {
606 .key = { [0 ... 79] = 0xaa },
607 .ksize = 80,
608 .plaintext = "Test Using Larger Than Block-Size Key - Hash Key First",
609 .psize = 54,
610 .digest = { 0x6b, 0x1a, 0xb7, 0xfe, 0x4b, 0xd7, 0xbf, 0x8f,
611 0x0b, 0x62, 0xe6, 0xce, 0x61, 0xb9, 0xd0, 0xcd },
612 }, {
613 .key = { [0 ... 79] = 0xaa },
614 .ksize = 80,
615 .plaintext = "Test Using Larger Than Block-Size Key and Larger Than One "
616 "Block-Size Data",
617 .psize = 73,
618 .digest = { 0x6f, 0x63, 0x0f, 0xad, 0x67, 0xcd, 0xa0, 0xee,
619 0x1f, 0xb1, 0xf5, 0x62, 0xdb, 0x3a, 0xa5, 0x3e },
624 * HMAC-SHA1 test vectors from RFC2202
626 #define HMAC_SHA1_TEST_VECTORS 7
628 struct hmac_testvec hmac_sha1_tv_template[] = {
630 .key = { [0 ... 19] = 0x0b },
631 .ksize = 20,
632 .plaintext = "Hi There",
633 .psize = 8,
634 .digest = { 0xb6, 0x17, 0x31, 0x86, 0x55, 0x05, 0x72, 0x64,
635 0xe2, 0x8b, 0xc0, 0xb6, 0xfb, 0x37, 0x8c, 0x8e, 0xf1,
636 0x46, 0xbe },
637 }, {
638 .key = { 'J', 'e', 'f', 'e' },
639 .ksize = 4,
640 .plaintext = "what do ya want for nothing?",
641 .psize = 28,
642 .digest = { 0xef, 0xfc, 0xdf, 0x6a, 0xe5, 0xeb, 0x2f, 0xa2, 0xd2, 0x74,
643 0x16, 0xd5, 0xf1, 0x84, 0xdf, 0x9c, 0x25, 0x9a, 0x7c, 0x79 },
644 .np = 2,
645 .tap = { 14, 14 }
646 }, {
647 .key = { [0 ... 19] = 0xaa },
648 .ksize = 20,
649 .plaintext = { [0 ... 49] = 0xdd },
650 .psize = 50,
651 .digest = { 0x12, 0x5d, 0x73, 0x42, 0xb9, 0xac, 0x11, 0xcd, 0x91, 0xa3,
652 0x9a, 0xf4, 0x8a, 0xa1, 0x7b, 0x4f, 0x63, 0xf1, 0x75, 0xd3 },
653 }, {
654 .key = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
655 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
656 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19 },
657 .ksize = 25,
658 .plaintext = { [0 ... 49] = 0xcd },
659 .psize = 50,
660 .digest = { 0x4c, 0x90, 0x07, 0xf4, 0x02, 0x62, 0x50, 0xc6, 0xbc, 0x84,
661 0x14, 0xf9, 0xbf, 0x50, 0xc8, 0x6c, 0x2d, 0x72, 0x35, 0xda },
662 }, {
663 .key = { [0 ... 19] = 0x0c },
664 .ksize = 20,
665 .plaintext = "Test With Truncation",
666 .psize = 20,
667 .digest = { 0x4c, 0x1a, 0x03, 0x42, 0x4b, 0x55, 0xe0, 0x7f, 0xe7, 0xf2,
668 0x7b, 0xe1, 0xd5, 0x8b, 0xb9, 0x32, 0x4a, 0x9a, 0x5a, 0x04 },
669 }, {
670 .key = { [0 ... 79] = 0xaa },
671 .ksize = 80,
672 .plaintext = "Test Using Larger Than Block-Size Key - Hash Key First",
673 .psize = 54,
674 .digest = { 0xaa, 0x4a, 0xe5, 0xe1, 0x52, 0x72, 0xd0, 0x0e, 0x95, 0x70,
675 0x56, 0x37, 0xce, 0x8a, 0x3b, 0x55, 0xed, 0x40, 0x21, 0x12 },
676 }, {
677 .key = { [0 ... 79] = 0xaa },
678 .ksize = 80,
679 .plaintext = "Test Using Larger Than Block-Size Key and Larger Than One "
680 "Block-Size Data",
681 .psize = 73,
682 .digest = { 0xe8, 0xe9, 0x9d, 0x0f, 0x45, 0x23, 0x7d, 0x78, 0x6d, 0x6b,
683 0xba, 0xa7, 0x96, 0x5c, 0x78, 0x08, 0xbb, 0xff, 0x1a, 0x91 },
688 * HMAC-SHA256 test vectors from
689 * draft-ietf-ipsec-ciph-sha-256-01.txt
691 #define HMAC_SHA256_TEST_VECTORS 10
693 struct hmac_testvec hmac_sha256_tv_template[] = {
695 .key = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
696 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
697 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
698 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20},
699 .ksize = 32,
700 .plaintext = "abc",
701 .psize = 3,
702 .digest = { 0xa2, 0x1b, 0x1f, 0x5d, 0x4c, 0xf4, 0xf7, 0x3a,
703 0x4d, 0xd9, 0x39, 0x75, 0x0f, 0x7a, 0x06, 0x6a,
704 0x7f, 0x98, 0xcc, 0x13, 0x1c, 0xb1, 0x6a, 0x66,
705 0x92, 0x75, 0x90, 0x21, 0xcf, 0xab, 0x81, 0x81 },
706 }, {
707 .key = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
708 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
709 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
710 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20 },
711 .ksize = 32,
712 .plaintext = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
713 .psize = 56,
714 .digest = { 0x10, 0x4f, 0xdc, 0x12, 0x57, 0x32, 0x8f, 0x08,
715 0x18, 0x4b, 0xa7, 0x31, 0x31, 0xc5, 0x3c, 0xae,
716 0xe6, 0x98, 0xe3, 0x61, 0x19, 0x42, 0x11, 0x49,
717 0xea, 0x8c, 0x71, 0x24, 0x56, 0x69, 0x7d, 0x30 },
718 }, {
719 .key = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
720 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
721 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
722 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20 },
723 .ksize = 32,
724 .plaintext = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"
725 "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
726 .psize = 112,
727 .digest = { 0x47, 0x03, 0x05, 0xfc, 0x7e, 0x40, 0xfe, 0x34,
728 0xd3, 0xee, 0xb3, 0xe7, 0x73, 0xd9, 0x5a, 0xab,
729 0x73, 0xac, 0xf0, 0xfd, 0x06, 0x04, 0x47, 0xa5,
730 0xeb, 0x45, 0x95, 0xbf, 0x33, 0xa9, 0xd1, 0xa3 },
731 }, {
732 .key = { [0 ... 31] = 0x0b },
733 .ksize = 32,
734 .plaintext = "Hi There",
735 .psize = 8,
736 .digest = { 0x19, 0x8a, 0x60, 0x7e, 0xb4, 0x4b, 0xfb, 0xc6,
737 0x99, 0x03, 0xa0, 0xf1, 0xcf, 0x2b, 0xbd, 0xc5,
738 0xba, 0x0a, 0xa3, 0xf3, 0xd9, 0xae, 0x3c, 0x1c,
739 0x7a, 0x3b, 0x16, 0x96, 0xa0, 0xb6, 0x8c, 0xf7 },
740 }, {
741 .key = "Jefe",
742 .ksize = 4,
743 .plaintext = "what do ya want for nothing?",
744 .psize = 28,
745 .digest = { 0x5b, 0xdc, 0xc1, 0x46, 0xbf, 0x60, 0x75, 0x4e,
746 0x6a, 0x04, 0x24, 0x26, 0x08, 0x95, 0x75, 0xc7,
747 0x5a, 0x00, 0x3f, 0x08, 0x9d, 0x27, 0x39, 0x83,
748 0x9d, 0xec, 0x58, 0xb9, 0x64, 0xec, 0x38, 0x43 },
749 .np = 2,
750 .tap = { 14, 14 }
751 }, {
752 .key = { [0 ... 31] = 0xaa },
753 .ksize = 32,
754 .plaintext = { [0 ... 49] = 0xdd },
755 .psize = 50,
756 .digest = { 0xcd, 0xcb, 0x12, 0x20, 0xd1, 0xec, 0xcc, 0xea,
757 0x91, 0xe5, 0x3a, 0xba, 0x30, 0x92, 0xf9, 0x62,
758 0xe5, 0x49, 0xfe, 0x6c, 0xe9, 0xed, 0x7f, 0xdc,
759 0x43, 0x19, 0x1f, 0xbd, 0xe4, 0x5c, 0x30, 0xb0 },
760 }, {
761 .key = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
762 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
763 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
764 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20,
765 0x21, 0x22, 0x23, 0x24, 0x25 },
766 .ksize = 37,
767 .plaintext = { [0 ... 49] = 0xcd },
768 .psize = 50,
769 .digest = { 0xd4, 0x63, 0x3c, 0x17, 0xf6, 0xfb, 0x8d, 0x74,
770 0x4c, 0x66, 0xde, 0xe0, 0xf8, 0xf0, 0x74, 0x55,
771 0x6e, 0xc4, 0xaf, 0x55, 0xef, 0x07, 0x99, 0x85,
772 0x41, 0x46, 0x8e, 0xb4, 0x9b, 0xd2, 0xe9, 0x17 },
773 }, {
774 .key = { [0 ... 31] = 0x0c },
775 .ksize = 32,
776 .plaintext = "Test With Truncation",
777 .psize = 20,
778 .digest = { 0x75, 0x46, 0xaf, 0x01, 0x84, 0x1f, 0xc0, 0x9b,
779 0x1a, 0xb9, 0xc3, 0x74, 0x9a, 0x5f, 0x1c, 0x17,
780 0xd4, 0xf5, 0x89, 0x66, 0x8a, 0x58, 0x7b, 0x27,
781 0x00, 0xa9, 0xc9, 0x7c, 0x11, 0x93, 0xcf, 0x42 },
782 }, {
783 .key = { [0 ... 79] = 0xaa },
784 .ksize = 80,
785 .plaintext = "Test Using Larger Than Block-Size Key - Hash Key First",
786 .psize = 54,
787 .digest = { 0x69, 0x53, 0x02, 0x5e, 0xd9, 0x6f, 0x0c, 0x09,
788 0xf8, 0x0a, 0x96, 0xf7, 0x8e, 0x65, 0x38, 0xdb,
789 0xe2, 0xe7, 0xb8, 0x20, 0xe3, 0xdd, 0x97, 0x0e,
790 0x7d, 0xdd, 0x39, 0x09, 0x1b, 0x32, 0x35, 0x2f },
791 }, {
792 .key = { [0 ... 79] = 0xaa },
793 .ksize = 80,
794 .plaintext = "Test Using Larger Than Block-Size Key and Larger Than "
795 "One Block-Size Data",
796 .psize = 73,
797 .digest = { 0x63, 0x55, 0xac, 0x22, 0xe8, 0x90, 0xd0, 0xa3,
798 0xc8, 0x48, 0x1a, 0x5c, 0xa4, 0x82, 0x5b, 0xc8,
799 0x84, 0xd3, 0xe7, 0xa1, 0xff, 0x98, 0xa2, 0xfc,
800 0x2a, 0xc7, 0xd8, 0xe0, 0x64, 0xc3, 0xb2, 0xe6 },
804 #endif /* CONFIG_CRYPTO_HMAC */
807 * DES test vectors.
809 #define DES_ENC_TEST_VECTORS 10
810 #define DES_DEC_TEST_VECTORS 4
811 #define DES_CBC_ENC_TEST_VECTORS 5
812 #define DES_CBC_DEC_TEST_VECTORS 4
813 #define DES3_EDE_ENC_TEST_VECTORS 3
814 #define DES3_EDE_DEC_TEST_VECTORS 3
816 struct cipher_testvec des_enc_tv_template[] = {
817 { /* From Applied Cryptography */
818 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
819 .klen = 8,
820 .input = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xe7 },
821 .ilen = 8,
822 .result = { 0xc9, 0x57, 0x44, 0x25, 0x6a, 0x5e, 0xd3, 0x1d },
823 .rlen = 8,
824 }, { /* Same key, different plaintext block */
825 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
826 .klen = 8,
827 .input = { 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99 },
828 .ilen = 8,
829 .result = { 0xf7, 0x9c, 0x89, 0x2a, 0x33, 0x8f, 0x4a, 0x8b },
830 .rlen = 8,
831 }, { /* Sbox test from NBS */
832 .key = { 0x7c, 0xa1, 0x10, 0x45, 0x4a, 0x1a, 0x6e, 0x57 },
833 .klen = 8,
834 .input = { 0x01, 0xa1, 0xd6, 0xd0, 0x39, 0x77, 0x67, 0x42 },
835 .ilen = 8,
836 .result = { 0x69, 0x0f, 0x5b, 0x0d, 0x9a, 0x26, 0x93, 0x9b },
837 .rlen = 8,
838 }, { /* Three blocks */
839 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
840 .klen = 8,
841 .input = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xe7,
842 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99,
843 0xca, 0xfe, 0xba, 0xbe, 0xfe, 0xed, 0xbe, 0xef },
844 .ilen = 24,
845 .result = { 0xc9, 0x57, 0x44, 0x25, 0x6a, 0x5e, 0xd3, 0x1d,
846 0xf7, 0x9c, 0x89, 0x2a, 0x33, 0x8f, 0x4a, 0x8b,
847 0xb4, 0x99, 0x26, 0xf7, 0x1f, 0xe1, 0xd4, 0x90 },
848 .rlen = 24,
849 }, { /* Weak key */
850 .fail = 1,
851 .wk = 1,
852 .key = { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 },
853 .klen = 8,
854 .input = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xe7 },
855 .ilen = 8,
856 .result = { 0xc9, 0x57, 0x44, 0x25, 0x6a, 0x5e, 0xd3, 0x1d },
857 .rlen = 8,
858 }, { /* Two blocks -- for testing encryption across pages */
859 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
860 .klen = 8,
861 .input = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xe7,
862 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99 },
863 .ilen = 16,
864 .result = { 0xc9, 0x57, 0x44, 0x25, 0x6a, 0x5e, 0xd3, 0x1d,
865 0xf7, 0x9c, 0x89, 0x2a, 0x33, 0x8f, 0x4a, 0x8b },
866 .rlen = 16,
867 .np = 2,
868 .tap = { 8, 8 }
869 }, { /* Four blocks -- for testing encryption with chunking */
870 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
871 .klen = 8,
872 .input = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xe7,
873 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99,
874 0xca, 0xfe, 0xba, 0xbe, 0xfe, 0xed, 0xbe, 0xef,
875 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99 },
876 .ilen = 32,
877 .result = { 0xc9, 0x57, 0x44, 0x25, 0x6a, 0x5e, 0xd3, 0x1d,
878 0xf7, 0x9c, 0x89, 0x2a, 0x33, 0x8f, 0x4a, 0x8b,
879 0xb4, 0x99, 0x26, 0xf7, 0x1f, 0xe1, 0xd4, 0x90,
880 0xf7, 0x9c, 0x89, 0x2a, 0x33, 0x8f, 0x4a, 0x8b },
881 .rlen = 32,
882 .np = 3,
883 .tap = { 14, 10, 8 }
884 }, {
885 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
886 .klen = 8,
887 .input = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xe7,
888 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99,
889 0xca, 0xfe, 0xba, 0xbe, 0xfe, 0xed, 0xbe, 0xef },
890 .ilen = 24,
891 .result = { 0xc9, 0x57, 0x44, 0x25, 0x6a, 0x5e, 0xd3, 0x1d,
892 0xf7, 0x9c, 0x89, 0x2a, 0x33, 0x8f, 0x4a, 0x8b,
893 0xb4, 0x99, 0x26, 0xf7, 0x1f, 0xe1, 0xd4, 0x90 },
894 .rlen = 24,
895 .np = 4,
896 .tap = { 2, 1, 3, 18 }
897 }, {
898 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
899 .klen = 8,
900 .input = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xe7,
901 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99 },
902 .ilen = 16,
903 .result = { 0xc9, 0x57, 0x44, 0x25, 0x6a, 0x5e, 0xd3, 0x1d,
904 0xf7, 0x9c, 0x89, 0x2a, 0x33, 0x8f, 0x4a, 0x8b },
905 .rlen = 16,
906 .np = 5,
907 .tap = { 2, 2, 2, 2, 8 }
908 }, {
909 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
910 .klen = 8,
911 .input = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xe7 },
912 .ilen = 8,
913 .result = { 0xc9, 0x57, 0x44, 0x25, 0x6a, 0x5e, 0xd3, 0x1d },
914 .rlen = 8,
915 .np = 8,
916 .tap = { 1, 1, 1, 1, 1, 1, 1, 1 }
920 struct cipher_testvec des_dec_tv_template[] = {
921 { /* From Applied Cryptography */
922 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
923 .klen = 8,
924 .input = { 0xc9, 0x57, 0x44, 0x25, 0x6a, 0x5e, 0xd3, 0x1d },
925 .ilen = 8,
926 .result = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xe7 },
927 .rlen = 8,
928 }, { /* Sbox test from NBS */
929 .key = { 0x7c, 0xa1, 0x10, 0x45, 0x4a, 0x1a, 0x6e, 0x57 },
930 .klen = 8,
931 .input = { 0x69, 0x0f, 0x5b, 0x0d, 0x9a, 0x26, 0x93, 0x9b },
932 .ilen = 8,
933 .result = { 0x01, 0xa1, 0xd6, 0xd0, 0x39, 0x77, 0x67, 0x42 },
934 .rlen = 8,
935 }, { /* Two blocks, for chunking test */
936 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
937 .klen = 8,
938 .input = { 0xc9, 0x57, 0x44, 0x25, 0x6a, 0x5e, 0xd3, 0x1d,
939 0x69, 0x0f, 0x5b, 0x0d, 0x9a, 0x26, 0x93, 0x9b },
940 .ilen = 16,
941 .result = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xe7,
942 0xa3, 0x99, 0x7b, 0xca, 0xaf, 0x69, 0xa0, 0xf5 },
943 .rlen = 16,
944 .np = 2,
945 .tap = { 8, 8 }
946 }, {
947 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
948 .klen = 8,
949 .input = { 0xc9, 0x57, 0x44, 0x25, 0x6a, 0x5e, 0xd3, 0x1d,
950 0x69, 0x0f, 0x5b, 0x0d, 0x9a, 0x26, 0x93, 0x9b },
951 .ilen = 16,
952 .result = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xe7,
953 0xa3, 0x99, 0x7b, 0xca, 0xaf, 0x69, 0xa0, 0xf5 },
954 .rlen = 16,
955 .np = 3,
956 .tap = { 3, 12, 1 }
960 struct cipher_testvec des_cbc_enc_tv_template[] = {
961 { /* From OpenSSL */
962 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef},
963 .klen = 8,
964 .iv = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10},
965 .input = { 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x31, 0x20,
966 0x4e, 0x6f, 0x77, 0x20, 0x69, 0x73, 0x20, 0x74,
967 0x68, 0x65, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x20 },
968 .ilen = 24,
969 .result = { 0xcc, 0xd1, 0x73, 0xff, 0xab, 0x20, 0x39, 0xf4,
970 0xac, 0xd8, 0xae, 0xfd, 0xdf, 0xd8, 0xa1, 0xeb,
971 0x46, 0x8e, 0x91, 0x15, 0x78, 0x88, 0xba, 0x68 },
972 .rlen = 24,
973 }, { /* FIPS Pub 81 */
974 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
975 .klen = 8,
976 .iv = { 0x12, 0x34, 0x56, 0x78, 0x90, 0xab, 0xcd, 0xef },
977 .input = { 0x4e, 0x6f, 0x77, 0x20, 0x69, 0x73, 0x20, 0x74 },
978 .ilen = 8,
979 .result = { 0xe5, 0xc7, 0xcd, 0xde, 0x87, 0x2b, 0xf2, 0x7c },
980 .rlen = 8,
981 }, {
982 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
983 .klen = 8,
984 .iv = { 0xe5, 0xc7, 0xcd, 0xde, 0x87, 0x2b, 0xf2, 0x7c },
985 .input = { 0x68, 0x65, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x20 },
986 .ilen = 8,
987 .result = { 0x43, 0xe9, 0x34, 0x00, 0x8c, 0x38, 0x9c, 0x0f },
988 .rlen = 8,
989 }, {
990 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
991 .klen = 8,
992 .iv = { 0x43, 0xe9, 0x34, 0x00, 0x8c, 0x38, 0x9c, 0x0f },
993 .input = { 0x66, 0x6f, 0x72, 0x20, 0x61, 0x6c, 0x6c, 0x20 },
994 .ilen = 8,
995 .result = { 0x68, 0x37, 0x88, 0x49, 0x9a, 0x7c, 0x05, 0xf6 },
996 .rlen = 8,
997 }, { /* Copy of openssl vector for chunk testing */
998 /* From OpenSSL */
999 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef},
1000 .klen = 8,
1001 .iv = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10},
1002 .input = { 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x31, 0x20,
1003 0x4e, 0x6f, 0x77, 0x20, 0x69, 0x73, 0x20, 0x74,
1004 0x68, 0x65, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x20 },
1005 .ilen = 24,
1006 .result = { 0xcc, 0xd1, 0x73, 0xff, 0xab, 0x20, 0x39, 0xf4,
1007 0xac, 0xd8, 0xae, 0xfd, 0xdf, 0xd8, 0xa1, 0xeb,
1008 0x46, 0x8e, 0x91, 0x15, 0x78, 0x88, 0xba, 0x68 },
1009 .rlen = 24,
1010 .np = 2,
1011 .tap = { 13, 11 }
1015 struct cipher_testvec des_cbc_dec_tv_template[] = {
1016 { /* FIPS Pub 81 */
1017 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1018 .klen = 8,
1019 .iv = { 0x12, 0x34, 0x56, 0x78, 0x90, 0xab, 0xcd, 0xef },
1020 .input = { 0xe5, 0xc7, 0xcd, 0xde, 0x87, 0x2b, 0xf2, 0x7c },
1021 .ilen = 8,
1022 .result = { 0x4e, 0x6f, 0x77, 0x20, 0x69, 0x73, 0x20, 0x74 },
1023 .rlen = 8,
1024 }, {
1025 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1026 .klen = 8,
1027 .iv = { 0xe5, 0xc7, 0xcd, 0xde, 0x87, 0x2b, 0xf2, 0x7c },
1028 .input = { 0x43, 0xe9, 0x34, 0x00, 0x8c, 0x38, 0x9c, 0x0f },
1029 .ilen = 8,
1030 .result = { 0x68, 0x65, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x20 },
1031 .rlen = 8,
1032 }, {
1033 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1034 .klen = 8,
1035 .iv = { 0x43, 0xe9, 0x34, 0x00, 0x8c, 0x38, 0x9c, 0x0f },
1036 .input = { 0x68, 0x37, 0x88, 0x49, 0x9a, 0x7c, 0x05, 0xf6 },
1037 .ilen = 8,
1038 .result = { 0x66, 0x6f, 0x72, 0x20, 0x61, 0x6c, 0x6c, 0x20 },
1039 .rlen = 8,
1040 }, { /* Copy of above, for chunk testing */
1041 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1042 .klen = 8,
1043 .iv = { 0x43, 0xe9, 0x34, 0x00, 0x8c, 0x38, 0x9c, 0x0f },
1044 .input = { 0x68, 0x37, 0x88, 0x49, 0x9a, 0x7c, 0x05, 0xf6 },
1045 .ilen = 8,
1046 .result = { 0x66, 0x6f, 0x72, 0x20, 0x61, 0x6c, 0x6c, 0x20 },
1047 .rlen = 8,
1048 .np = 2,
1049 .tap = { 4, 4 }
1054 * We really need some more test vectors, especially for DES3 CBC.
1056 struct cipher_testvec des3_ede_enc_tv_template[] = {
1057 { /* These are from openssl */
1058 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
1059 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
1060 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10},
1061 .klen = 24,
1062 .input = { 0x73, 0x6f, 0x6d, 0x65, 0x64, 0x61, 0x74, 0x61 },
1063 .ilen = 8,
1064 .result = { 0x18, 0xd7, 0x48, 0xe5, 0x63, 0x62, 0x05, 0x72 },
1065 .rlen = 8,
1066 }, {
1067 .key = { 0x03, 0x52, 0x02, 0x07, 0x67, 0x20, 0x82, 0x17,
1068 0x86, 0x02, 0x87, 0x66, 0x59, 0x08, 0x21, 0x98,
1069 0x64, 0x05, 0x6a, 0xbd, 0xfe, 0xa9, 0x34, 0x57 },
1070 .klen = 24,
1071 .input = { 0x73, 0x71, 0x75, 0x69, 0x67, 0x67, 0x6c, 0x65 },
1072 .ilen = 8,
1073 .result = { 0xc0, 0x7d, 0x2a, 0x0f, 0xa5, 0x66, 0xfa, 0x30 },
1074 .rlen = 8,
1075 }, {
1076 .key = { 0x10, 0x46, 0x10, 0x34, 0x89, 0x98, 0x80, 0x20,
1077 0x91, 0x07, 0xd0, 0x15, 0x89, 0x19, 0x01, 0x01,
1078 0x19, 0x07, 0x92, 0x10, 0x98, 0x1a, 0x01, 0x01 },
1079 .klen = 24,
1080 .input = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
1081 .ilen = 8,
1082 .result = { 0xe1, 0xef, 0x62, 0xc3, 0x32, 0xfe, 0x82, 0x5b },
1083 .rlen = 8,
1087 struct cipher_testvec des3_ede_dec_tv_template[] = {
1088 { /* These are from openssl */
1089 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
1090 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
1091 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10},
1092 .klen = 24,
1093 .input = { 0x18, 0xd7, 0x48, 0xe5, 0x63, 0x62, 0x05, 0x72 },
1094 .ilen = 8,
1095 .result = { 0x73, 0x6f, 0x6d, 0x65, 0x64, 0x61, 0x74, 0x61 },
1096 .rlen = 8,
1097 }, {
1098 .key = { 0x03, 0x52, 0x02, 0x07, 0x67, 0x20, 0x82, 0x17,
1099 0x86, 0x02, 0x87, 0x66, 0x59, 0x08, 0x21, 0x98,
1100 0x64, 0x05, 0x6a, 0xbd, 0xfe, 0xa9, 0x34, 0x57 },
1101 .klen = 24,
1102 .input = { 0xc0, 0x7d, 0x2a, 0x0f, 0xa5, 0x66, 0xfa, 0x30 },
1103 .ilen = 8,
1104 .result = { 0x73, 0x71, 0x75, 0x69, 0x67, 0x67, 0x6c, 0x65 },
1105 .rlen = 8,
1106 }, {
1107 .key = { 0x10, 0x46, 0x10, 0x34, 0x89, 0x98, 0x80, 0x20,
1108 0x91, 0x07, 0xd0, 0x15, 0x89, 0x19, 0x01, 0x01,
1109 0x19, 0x07, 0x92, 0x10, 0x98, 0x1a, 0x01, 0x01 },
1110 .klen = 24,
1111 .input = { 0xe1, 0xef, 0x62, 0xc3, 0x32, 0xfe, 0x82, 0x5b },
1112 .ilen = 8,
1113 .result = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
1114 .rlen = 8,
1119 * Blowfish test vectors.
1121 #define BF_ENC_TEST_VECTORS 6
1122 #define BF_DEC_TEST_VECTORS 6
1123 #define BF_CBC_ENC_TEST_VECTORS 1
1124 #define BF_CBC_DEC_TEST_VECTORS 1
1126 struct cipher_testvec bf_enc_tv_template[] = {
1127 { /* DES test vectors from OpenSSL */
1128 .key = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, },
1129 .klen = 8,
1130 .input = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
1131 .ilen = 8,
1132 .result = { 0x4e, 0xf9, 0x97, 0x45, 0x61, 0x98, 0xdd, 0x78 },
1133 .rlen = 8,
1134 }, {
1135 .key = { 0x1f, 0x1f, 0x1f, 0x1f, 0x0e, 0x0e, 0x0e, 0x0e },
1136 .klen = 8,
1137 .input = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1138 .ilen = 8,
1139 .result = { 0xa7, 0x90, 0x79, 0x51, 0x08, 0xea, 0x3c, 0xae },
1140 .rlen = 8,
1141 }, {
1142 .key = { 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87 },
1143 .klen = 8,
1144 .input = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 },
1145 .ilen = 8,
1146 .result = { 0xe8, 0x7a, 0x24, 0x4e, 0x2c, 0xc8, 0x5e, 0x82 },
1147 .rlen = 8,
1148 }, { /* Vary the keylength... */
1149 .key = { 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87,
1150 0x78, 0x69, 0x5a, 0x4b, 0x3c, 0x2d, 0x1e, 0x0f },
1151 .klen = 16,
1152 .input = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 },
1153 .ilen = 8,
1154 .result = { 0x93, 0x14, 0x28, 0x87, 0xee, 0x3b, 0xe1, 0x5c },
1155 .rlen = 8,
1156 }, {
1157 .key = { 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87,
1158 0x78, 0x69, 0x5a, 0x4b, 0x3c, 0x2d, 0x1e, 0x0f,
1159 0x00, 0x11, 0x22, 0x33, 0x44 },
1160 .klen = 21,
1161 .input = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 },
1162 .ilen = 8,
1163 .result = { 0xe6, 0xf5, 0x1e, 0xd7, 0x9b, 0x9d, 0xb2, 0x1f },
1164 .rlen = 8,
1165 }, { /* Generated with bf488 */
1166 .key = { 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87,
1167 0x78, 0x69, 0x5a, 0x4b, 0x3c, 0x2d, 0x1e, 0x0f,
1168 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
1169 0x04, 0x68, 0x91, 0x04, 0xc2, 0xfd, 0x3b, 0x2f,
1170 0x58, 0x40, 0x23, 0x64, 0x1a, 0xba, 0x61, 0x76,
1171 0x1f, 0x1f, 0x1f, 0x1f, 0x0e, 0x0e, 0x0e, 0x0e,
1172 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff },
1173 .klen = 56,
1174 .input = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 },
1175 .ilen = 8,
1176 .result = { 0xc0, 0x45, 0x04, 0x01, 0x2e, 0x4e, 0x1f, 0x53 },
1177 .rlen = 8,
1181 struct cipher_testvec bf_dec_tv_template[] = {
1182 { /* DES test vectors from OpenSSL */
1183 .key = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
1184 .klen = 8,
1185 .input = { 0x4e, 0xf9, 0x97, 0x45, 0x61, 0x98, 0xdd, 0x78 },
1186 .ilen = 8,
1187 .result = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
1188 .rlen = 8,
1189 }, {
1190 .key = { 0x1f, 0x1f, 0x1f, 0x1f, 0x0e, 0x0e, 0x0e, 0x0e },
1191 .klen = 8,
1192 .input = { 0xa7, 0x90, 0x79, 0x51, 0x08, 0xea, 0x3c, 0xae },
1193 .ilen = 8,
1194 .result = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1195 .rlen = 8,
1196 }, {
1197 .key = { 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87 },
1198 .klen = 8,
1199 .input = { 0xe8, 0x7a, 0x24, 0x4e, 0x2c, 0xc8, 0x5e, 0x82 },
1200 .ilen = 8,
1201 .result = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 },
1202 .rlen = 8,
1203 }, { /* Vary the keylength... */
1204 .key = { 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87,
1205 0x78, 0x69, 0x5a, 0x4b, 0x3c, 0x2d, 0x1e, 0x0f },
1206 .klen = 16,
1207 .input = { 0x93, 0x14, 0x28, 0x87, 0xee, 0x3b, 0xe1, 0x5c },
1208 .ilen = 8,
1209 .result = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 },
1210 .rlen = 8,
1211 }, {
1212 .key = { 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87,
1213 0x78, 0x69, 0x5a, 0x4b, 0x3c, 0x2d, 0x1e, 0x0f,
1214 0x00, 0x11, 0x22, 0x33, 0x44 },
1215 .klen = 21,
1216 .input = { 0xe6, 0xf5, 0x1e, 0xd7, 0x9b, 0x9d, 0xb2, 0x1f },
1217 .ilen = 8,
1218 .result = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 },
1219 .rlen = 8,
1220 }, { /* Generated with bf488, using OpenSSL, Libgcrypt and Nettle */
1221 .key = { 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87,
1222 0x78, 0x69, 0x5a, 0x4b, 0x3c, 0x2d, 0x1e, 0x0f,
1223 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
1224 0x04, 0x68, 0x91, 0x04, 0xc2, 0xfd, 0x3b, 0x2f,
1225 0x58, 0x40, 0x23, 0x64, 0x1a, 0xba, 0x61, 0x76,
1226 0x1f, 0x1f, 0x1f, 0x1f, 0x0e, 0x0e, 0x0e, 0x0e,
1227 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff },
1228 .klen = 56,
1229 .input = { 0xc0, 0x45, 0x04, 0x01, 0x2e, 0x4e, 0x1f, 0x53 },
1230 .ilen = 8,
1231 .result = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 },
1232 .rlen = 8,
1236 struct cipher_testvec bf_cbc_enc_tv_template[] = {
1237 { /* From OpenSSL */
1238 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
1239 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87 },
1240 .klen = 16,
1241 .iv = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 },
1242 .input = { 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x31, 0x20,
1243 0x4e, 0x6f, 0x77, 0x20, 0x69, 0x73, 0x20, 0x74,
1244 0x68, 0x65, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x20,
1245 0x66, 0x6f, 0x72, 0x20, 0x00, 0x00, 0x00, 0x00 },
1246 .ilen = 32,
1247 .result = { 0x6b, 0x77, 0xb4, 0xd6, 0x30, 0x06, 0xde, 0xe6,
1248 0x05, 0xb1, 0x56, 0xe2, 0x74, 0x03, 0x97, 0x93,
1249 0x58, 0xde, 0xb9, 0xe7, 0x15, 0x46, 0x16, 0xd9,
1250 0x59, 0xf1, 0x65, 0x2b, 0xd5, 0xff, 0x92, 0xcc },
1251 .rlen = 32,
1255 struct cipher_testvec bf_cbc_dec_tv_template[] = {
1256 { /* From OpenSSL */
1257 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
1258 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87 },
1259 .klen = 16,
1260 .iv = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 },
1261 .input = { 0x6b, 0x77, 0xb4, 0xd6, 0x30, 0x06, 0xde, 0xe6,
1262 0x05, 0xb1, 0x56, 0xe2, 0x74, 0x03, 0x97, 0x93,
1263 0x58, 0xde, 0xb9, 0xe7, 0x15, 0x46, 0x16, 0xd9,
1264 0x59, 0xf1, 0x65, 0x2b, 0xd5, 0xff, 0x92, 0xcc },
1265 .ilen = 32,
1266 .result = { 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x31, 0x20,
1267 0x4e, 0x6f, 0x77, 0x20, 0x69, 0x73, 0x20, 0x74,
1268 0x68, 0x65, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x20,
1269 0x66, 0x6f, 0x72, 0x20, 0x00, 0x00, 0x00, 0x00 },
1270 .rlen = 32,
1275 * Twofish test vectors.
1277 #define TF_ENC_TEST_VECTORS 3
1278 #define TF_DEC_TEST_VECTORS 3
1279 #define TF_CBC_ENC_TEST_VECTORS 4
1280 #define TF_CBC_DEC_TEST_VECTORS 4
1282 struct cipher_testvec tf_enc_tv_template[] = {
1284 .key = { [0 ... 15] = 0x00 },
1285 .klen = 16,
1286 .input = { [0 ... 15] = 0x00 },
1287 .ilen = 16,
1288 .result = { 0x9f, 0x58, 0x9f, 0x5c, 0xf6, 0x12, 0x2c, 0x32,
1289 0xb6, 0xbf, 0xec, 0x2f, 0x2a, 0xe8, 0xc3, 0x5a },
1290 .rlen = 16,
1291 }, {
1292 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
1293 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10,
1294 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77 },
1295 .klen = 24,
1296 .input = { [0 ... 15] = 0x00 },
1297 .ilen = 16,
1298 .result = { 0xcf, 0xd1, 0xd2, 0xe5, 0xa9, 0xbe, 0x9c, 0xdf,
1299 0x50, 0x1f, 0x13, 0xb8, 0x92, 0xbd, 0x22, 0x48 },
1300 .rlen = 16,
1301 }, {
1302 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
1303 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10,
1304 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
1305 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff },
1306 .klen = 32,
1307 .input = { [0 ... 15] = 0x00 },
1308 .ilen = 16,
1309 .result = { 0x37, 0x52, 0x7b, 0xe0, 0x05, 0x23, 0x34, 0xb8,
1310 0x9f, 0x0c, 0xfc, 0xca, 0xe8, 0x7c, 0xfa, 0x20 },
1311 .rlen = 16,
1315 struct cipher_testvec tf_dec_tv_template[] = {
1317 .key = { [0 ... 15] = 0x00 },
1318 .klen = 16,
1319 .input = { 0x9f, 0x58, 0x9f, 0x5c, 0xf6, 0x12, 0x2c, 0x32,
1320 0xb6, 0xbf, 0xec, 0x2f, 0x2a, 0xe8, 0xc3, 0x5a },
1321 .ilen = 16,
1322 .result = { [0 ... 15] = 0x00 },
1323 .rlen = 16,
1324 }, {
1325 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
1326 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10,
1327 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77 },
1328 .klen = 24,
1329 .input = { 0xcf, 0xd1, 0xd2, 0xe5, 0xa9, 0xbe, 0x9c, 0xdf,
1330 0x50, 0x1f, 0x13, 0xb8, 0x92, 0xbd, 0x22, 0x48 },
1331 .ilen = 16,
1332 .result = { [0 ... 15] = 0x00 },
1333 .rlen = 16,
1334 }, {
1335 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
1336 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10,
1337 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
1338 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff },
1339 .klen = 32,
1340 .input = { 0x37, 0x52, 0x7b, 0xe0, 0x05, 0x23, 0x34, 0xb8,
1341 0x9f, 0x0c, 0xfc, 0xca, 0xe8, 0x7c, 0xfa, 0x20 },
1342 .ilen = 16,
1343 .result = { [0 ... 15] = 0x00 },
1344 .rlen = 16,
1348 struct cipher_testvec tf_cbc_enc_tv_template[] = {
1349 { /* Generated with Nettle */
1350 .key = { [0 ... 15] = 0x00 },
1351 .klen = 16,
1352 .iv = { [0 ... 15] = 0x00 },
1353 .input = { [0 ... 15] = 0x00 },
1354 .ilen = 16,
1355 .result = { 0x9f, 0x58, 0x9f, 0x5c, 0xf6, 0x12, 0x2c, 0x32,
1356 0xb6, 0xbf, 0xec, 0x2f, 0x2a, 0xe8, 0xc3, 0x5a },
1357 .rlen = 16,
1358 }, {
1359 .key = { [0 ... 15] = 0x00 },
1360 .klen = 16,
1361 .iv = { 0x9f, 0x58, 0x9f, 0x5c, 0xf6, 0x12, 0x2c, 0x32,
1362 0xb6, 0xbf, 0xec, 0x2f, 0x2a, 0xe8, 0xc3, 0x5a },
1363 .input = { [0 ... 15] = 0x00 },
1364 .ilen = 16,
1365 .result = { 0xd4, 0x91, 0xdb, 0x16, 0xe7, 0xb1, 0xc3, 0x9e,
1366 0x86, 0xcb, 0x08, 0x6b, 0x78, 0x9f, 0x54, 0x19 },
1367 .rlen = 16,
1368 }, {
1369 .key = { [0 ... 15] = 0x00 },
1370 .klen = 16,
1371 .iv = { 0xd4, 0x91, 0xdb, 0x16, 0xe7, 0xb1, 0xc3, 0x9e,
1372 0x86, 0xcb, 0x08, 0x6b, 0x78, 0x9f, 0x54, 0x19 },
1373 .input = { [0 ... 15] = 0x00 },
1374 .ilen = 16,
1375 .result = { 0x05, 0xef, 0x8c, 0x61, 0xa8, 0x11, 0x58, 0x26,
1376 0x34, 0xba, 0x5c, 0xb7, 0x10, 0x6a, 0xa6, 0x41 },
1377 .rlen = 16,
1378 }, {
1379 .key = { [0 ... 15] = 0x00 },
1380 .klen = 16,
1381 .iv = { [0 ... 15] = 0x00 },
1382 .input = { [0 ... 47] = 0x00 },
1383 .ilen = 48,
1384 .result = { 0x9f, 0x58, 0x9f, 0x5c, 0xf6, 0x12, 0x2c, 0x32,
1385 0xb6, 0xbf, 0xec, 0x2f, 0x2a, 0xe8, 0xc3, 0x5a,
1386 0xd4, 0x91, 0xdb, 0x16, 0xe7, 0xb1, 0xc3, 0x9e,
1387 0x86, 0xcb, 0x08, 0x6b, 0x78, 0x9f, 0x54, 0x19,
1388 0x05, 0xef, 0x8c, 0x61, 0xa8, 0x11, 0x58, 0x26,
1389 0x34, 0xba, 0x5c, 0xb7, 0x10, 0x6a, 0xa6, 0x41 },
1390 .rlen = 48,
1394 struct cipher_testvec tf_cbc_dec_tv_template[] = {
1395 { /* Reverse of the first four above */
1396 .key = { [0 ... 15] = 0x00 },
1397 .klen = 16,
1398 .iv = { [0 ... 15] = 0x00 },
1399 .input = { 0x9f, 0x58, 0x9f, 0x5c, 0xf6, 0x12, 0x2c, 0x32,
1400 0xb6, 0xbf, 0xec, 0x2f, 0x2a, 0xe8, 0xc3, 0x5a },
1401 .ilen = 16,
1402 .result = { [0 ... 15] = 0x00 },
1403 .rlen = 16,
1404 }, {
1405 .key = { [0 ... 15] = 0x00 },
1406 .klen = 16,
1407 .iv = { 0x9f, 0x58, 0x9f, 0x5c, 0xf6, 0x12, 0x2c, 0x32,
1408 0xb6, 0xbf, 0xec, 0x2f, 0x2a, 0xe8, 0xc3, 0x5a },
1409 .input = { 0xd4, 0x91, 0xdb, 0x16, 0xe7, 0xb1, 0xc3, 0x9e,
1410 0x86, 0xcb, 0x08, 0x6b, 0x78, 0x9f, 0x54, 0x19 },
1411 .ilen = 16,
1412 .result = { [0 ... 15] = 0x00 },
1413 .rlen = 16,
1414 }, {
1415 .key = { [0 ... 15] = 0x00 },
1416 .klen = 16,
1417 .iv = { 0xd4, 0x91, 0xdb, 0x16, 0xe7, 0xb1, 0xc3, 0x9e,
1418 0x86, 0xcb, 0x08, 0x6b, 0x78, 0x9f, 0x54, 0x19 },
1419 .input = { 0x05, 0xef, 0x8c, 0x61, 0xa8, 0x11, 0x58, 0x26,
1420 0x34, 0xba, 0x5c, 0xb7, 0x10, 0x6a, 0xa6, 0x41 },
1421 .ilen = 16,
1422 .result = { [0 ... 15] = 0x00 },
1423 .rlen = 16,
1424 }, {
1425 .key = { [0 ... 15] = 0x00 },
1426 .klen = 16,
1427 .iv = { [0 ... 15] = 0x00 },
1428 .input = { 0x9f, 0x58, 0x9f, 0x5c, 0xf6, 0x12, 0x2c, 0x32,
1429 0xb6, 0xbf, 0xec, 0x2f, 0x2a, 0xe8, 0xc3, 0x5a,
1430 0xd4, 0x91, 0xdb, 0x16, 0xe7, 0xb1, 0xc3, 0x9e,
1431 0x86, 0xcb, 0x08, 0x6b, 0x78, 0x9f, 0x54, 0x19,
1432 0x05, 0xef, 0x8c, 0x61, 0xa8, 0x11, 0x58, 0x26,
1433 0x34, 0xba, 0x5c, 0xb7, 0x10, 0x6a, 0xa6, 0x41 },
1434 .ilen = 48,
1435 .result = { [0 ... 47] = 0x00 },
1436 .rlen = 48,
1441 * Serpent test vectors. These are backwards because Serpent writes
1442 * octet sequences in right-to-left mode.
1444 #define SERPENT_ENC_TEST_VECTORS 4
1445 #define SERPENT_DEC_TEST_VECTORS 4
1447 struct cipher_testvec serpent_enc_tv_template[] =
1450 .input = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1451 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
1452 .ilen = 16,
1453 .result = { 0x12, 0x07, 0xfc, 0xce, 0x9b, 0xd0, 0xd6, 0x47,
1454 0x6a, 0xe9, 0x8f, 0xbe, 0xd1, 0x43, 0xa0, 0xe2 },
1455 .rlen = 16,
1456 }, {
1457 .key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1458 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
1459 .klen = 16,
1460 .input = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1461 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
1462 .ilen = 16,
1463 .result = { 0x4c, 0x7d, 0x8a, 0x32, 0x80, 0x72, 0xa2, 0x2c,
1464 0x82, 0x3e, 0x4a, 0x1f, 0x3a, 0xcd, 0xa1, 0x6d },
1465 .rlen = 16,
1466 }, {
1467 .key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1468 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
1469 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
1470 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f },
1471 .klen = 32,
1472 .input = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1473 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
1474 .ilen = 16,
1475 .result = { 0xde, 0x26, 0x9f, 0xf8, 0x33, 0xe4, 0x32, 0xb8,
1476 0x5b, 0x2e, 0x88, 0xd2, 0x70, 0x1c, 0xe7, 0x5c },
1477 .rlen = 16,
1478 }, {
1479 .key = { [15] = 0x80 },
1480 .klen = 16,
1481 .input = { [0 ... 15] = 0x00 },
1482 .ilen = 16,
1483 .result = { 0xdd, 0xd2, 0x6b, 0x98, 0xa5, 0xff, 0xd8, 0x2c,
1484 0x05, 0x34, 0x5a, 0x9d, 0xad, 0xbf, 0xaf, 0x49},
1485 .rlen = 16,
1489 struct cipher_testvec serpent_dec_tv_template[] =
1492 .input = { 0x12, 0x07, 0xfc, 0xce, 0x9b, 0xd0, 0xd6, 0x47,
1493 0x6a, 0xe9, 0x8f, 0xbe, 0xd1, 0x43, 0xa0, 0xe2 },
1494 .ilen = 16,
1495 .result = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1496 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
1497 .rlen = 16,
1498 }, {
1499 .key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1500 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
1501 .klen = 16,
1502 .input = { 0x4c, 0x7d, 0x8a, 0x32, 0x80, 0x72, 0xa2, 0x2c,
1503 0x82, 0x3e, 0x4a, 0x1f, 0x3a, 0xcd, 0xa1, 0x6d },
1504 .ilen = 16,
1505 .result = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1506 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
1507 .rlen = 16,
1508 }, {
1509 .key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1510 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
1511 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
1512 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f },
1513 .klen = 32,
1514 .input = { 0xde, 0x26, 0x9f, 0xf8, 0x33, 0xe4, 0x32, 0xb8,
1515 0x5b, 0x2e, 0x88, 0xd2, 0x70, 0x1c, 0xe7, 0x5c },
1516 .ilen = 16,
1517 .result = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1518 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
1519 .rlen = 16,
1520 }, {
1521 .key = { [15] = 0x80 },
1522 .klen = 16,
1523 .input = { 0xdd, 0xd2, 0x6b, 0x98, 0xa5, 0xff, 0xd8, 0x2c,
1524 0x05, 0x34, 0x5a, 0x9d, 0xad, 0xbf, 0xaf, 0x49},
1525 .ilen = 16,
1526 .result = { [0 ... 15] = 0x00 },
1527 .rlen = 16,
1531 /* Cast6 test vectors from RFC 2612 */
1532 #define CAST6_ENC_TEST_VECTORS 3
1533 #define CAST6_DEC_TEST_VECTORS 3
1535 struct cipher_testvec cast6_enc_tv_template[] =
1538 .key = { 0x23, 0x42, 0xbb, 0x9e, 0xfa, 0x38, 0x54, 0x2c,
1539 0x0a, 0xf7, 0x56, 0x47, 0xf2, 0x9f, 0x61, 0x5d },
1540 .klen = 16,
1541 .input = { [0 ... 15] = 0x00 },
1542 .ilen = 16,
1543 .result = { 0xc8, 0x42, 0xa0, 0x89, 0x72, 0xb4, 0x3d, 0x20,
1544 0x83, 0x6c, 0x91, 0xd1, 0xb7, 0x53, 0x0f, 0x6b },
1545 .rlen = 16,
1546 }, {
1547 .key = { 0x23, 0x42, 0xbb, 0x9e, 0xfa, 0x38, 0x54, 0x2c,
1548 0xbe, 0xd0, 0xac, 0x83, 0x94, 0x0a, 0xc2, 0x98,
1549 0xba, 0xc7, 0x7a, 0x77, 0x17, 0x94, 0x28, 0x63 },
1550 .klen = 24,
1551 .input = { [0 ... 15] = 0x00 },
1552 .ilen = 16,
1553 .result = { 0x1b, 0x38, 0x6c, 0x02, 0x10, 0xdc, 0xad, 0xcb,
1554 0xdd, 0x0e, 0x41, 0xaa, 0x08, 0xa7, 0xa7, 0xe8 },
1555 .rlen = 16,
1556 }, {
1557 .key = { 0x23, 0x42, 0xbb, 0x9e, 0xfa, 0x38, 0x54, 0x2c,
1558 0xbe, 0xd0, 0xac, 0x83, 0x94, 0x0a, 0xc2, 0x98,
1559 0x8d, 0x7c, 0x47, 0xce, 0x26, 0x49, 0x08, 0x46,
1560 0x1c, 0xc1, 0xb5, 0x13, 0x7a, 0xe6, 0xb6, 0x04 },
1561 .klen = 32,
1562 .input = { [0 ... 15] = 0x00 },
1563 .ilen = 16,
1564 .result = { 0x4f, 0x6a, 0x20, 0x38, 0x28, 0x68, 0x97, 0xb9,
1565 0xc9, 0x87, 0x01, 0x36, 0x55, 0x33, 0x17, 0xfa },
1566 .rlen = 16,
1570 struct cipher_testvec cast6_dec_tv_template[] =
1573 .key = { 0x23, 0x42, 0xbb, 0x9e, 0xfa, 0x38, 0x54, 0x2c,
1574 0x0a, 0xf7, 0x56, 0x47, 0xf2, 0x9f, 0x61, 0x5d },
1575 .klen = 16,
1576 .input = { 0xc8, 0x42, 0xa0, 0x89, 0x72, 0xb4, 0x3d, 0x20,
1577 0x83, 0x6c, 0x91, 0xd1, 0xb7, 0x53, 0x0f, 0x6b },
1578 .ilen = 16,
1579 .result = { [0 ... 15] = 0x00 },
1580 .rlen = 16,
1581 }, {
1582 .key = { 0x23, 0x42, 0xbb, 0x9e, 0xfa, 0x38, 0x54, 0x2c,
1583 0xbe, 0xd0, 0xac, 0x83, 0x94, 0x0a, 0xc2, 0x98,
1584 0xba, 0xc7, 0x7a, 0x77, 0x17, 0x94, 0x28, 0x63 },
1585 .klen = 24,
1586 .input = { 0x1b, 0x38, 0x6c, 0x02, 0x10, 0xdc, 0xad, 0xcb,
1587 0xdd, 0x0e, 0x41, 0xaa, 0x08, 0xa7, 0xa7, 0xe8 },
1588 .ilen = 16,
1589 .result = { [0 ... 15] = 0x00 },
1590 .rlen = 16,
1591 }, {
1592 .key = { 0x23, 0x42, 0xbb, 0x9e, 0xfa, 0x38, 0x54, 0x2c,
1593 0xbe, 0xd0, 0xac, 0x83, 0x94, 0x0a, 0xc2, 0x98,
1594 0x8d, 0x7c, 0x47, 0xce, 0x26, 0x49, 0x08, 0x46,
1595 0x1c, 0xc1, 0xb5, 0x13, 0x7a, 0xe6, 0xb6, 0x04 },
1596 .klen = 32,
1597 .input = { 0x4f, 0x6a, 0x20, 0x38, 0x28, 0x68, 0x97, 0xb9,
1598 0xc9, 0x87, 0x01, 0x36, 0x55, 0x33, 0x17, 0xfa },
1599 .ilen = 16,
1600 .result = { [0 ... 15] = 0x00 },
1601 .rlen = 16,
1607 * AES test vectors.
1609 #define AES_ENC_TEST_VECTORS 3
1610 #define AES_DEC_TEST_VECTORS 3
1612 struct cipher_testvec aes_enc_tv_template[] = {
1613 { /* From FIPS-197 */
1614 .key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1615 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
1616 .klen = 16,
1617 .input = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
1618 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff },
1619 .ilen = 16,
1620 .result = { 0x69, 0xc4, 0xe0, 0xd8, 0x6a, 0x7b, 0x04, 0x30,
1621 0xd8, 0xcd, 0xb7, 0x80, 0x70, 0xb4, 0xc5, 0x5a },
1622 .rlen = 16,
1623 }, {
1624 .key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1625 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
1626 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17 },
1627 .klen = 24,
1628 .input = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
1629 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff },
1630 .ilen = 16,
1631 .result = { 0xdd, 0xa9, 0x7c, 0xa4, 0x86, 0x4c, 0xdf, 0xe0,
1632 0x6e, 0xaf, 0x70, 0xa0, 0xec, 0x0d, 0x71, 0x91 },
1633 .rlen = 16,
1634 }, {
1635 .key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1636 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
1637 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
1638 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f },
1639 .klen = 32,
1640 .input = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
1641 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff },
1642 .ilen = 16,
1643 .result = { 0x8e, 0xa2, 0xb7, 0xca, 0x51, 0x67, 0x45, 0xbf,
1644 0xea, 0xfc, 0x49, 0x90, 0x4b, 0x49, 0x60, 0x89 },
1645 .rlen = 16,
1649 struct cipher_testvec aes_dec_tv_template[] = {
1650 { /* From FIPS-197 */
1651 .key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1652 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
1653 .klen = 16,
1654 .input = { 0x69, 0xc4, 0xe0, 0xd8, 0x6a, 0x7b, 0x04, 0x30,
1655 0xd8, 0xcd, 0xb7, 0x80, 0x70, 0xb4, 0xc5, 0x5a },
1656 .ilen = 16,
1657 .result = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
1658 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff },
1659 .rlen = 16,
1660 }, {
1661 .key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1662 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
1663 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17 },
1664 .klen = 24,
1665 .input = { 0xdd, 0xa9, 0x7c, 0xa4, 0x86, 0x4c, 0xdf, 0xe0,
1666 0x6e, 0xaf, 0x70, 0xa0, 0xec, 0x0d, 0x71, 0x91 },
1667 .ilen = 16,
1668 .result = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
1669 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff },
1670 .rlen = 16,
1671 }, {
1672 .key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1673 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
1674 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
1675 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f },
1676 .klen = 32,
1677 .input = { 0x8e, 0xa2, 0xb7, 0xca, 0x51, 0x67, 0x45, 0xbf,
1678 0xea, 0xfc, 0x49, 0x90, 0x4b, 0x49, 0x60, 0x89 },
1679 .ilen = 16,
1680 .result = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
1681 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff },
1682 .rlen = 16,
1686 /* Cast5 test vectors from RFC 2144 */
1687 #define CAST5_ENC_TEST_VECTORS 3
1688 #define CAST5_DEC_TEST_VECTORS 3
1690 struct cipher_testvec cast5_enc_tv_template[] =
1693 .key = { 0x01, 0x23, 0x45, 0x67, 0x12, 0x34, 0x56, 0x78,
1694 0x23, 0x45, 0x67, 0x89, 0x34, 0x56, 0x78, 0x9a },
1695 .klen = 16,
1696 .input = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1697 .ilen = 8,
1698 .result = { 0x23, 0x8b, 0x4f, 0xe5, 0x84, 0x7e, 0x44, 0xb2 },
1699 .rlen = 8,
1700 }, {
1701 .key = { 0x01, 0x23, 0x45, 0x67, 0x12, 0x34, 0x56, 0x78,
1702 0x23, 0x45 },
1703 .klen = 10,
1704 .input = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1705 .ilen = 8,
1706 .result = { 0xeb, 0x6a, 0x71, 0x1a, 0x2c, 0x02, 0x27, 0x1b },
1707 .rlen = 8,
1708 }, {
1709 .key = { 0x01, 0x23, 0x45, 0x67, 0x12 },
1710 .klen = 5,
1711 .input = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1712 .ilen = 8,
1713 .result = { 0x7a, 0xc8, 0x16, 0xd1, 0x6e, 0x9b, 0x30, 0x2e },
1714 .rlen = 8,
1718 struct cipher_testvec cast5_dec_tv_template[] =
1721 .key = { 0x01, 0x23, 0x45, 0x67, 0x12, 0x34, 0x56, 0x78,
1722 0x23, 0x45, 0x67, 0x89, 0x34, 0x56, 0x78, 0x9a },
1723 .klen = 16,
1724 .input = { 0x23, 0x8b, 0x4f, 0xe5, 0x84, 0x7e, 0x44, 0xb2 },
1725 .ilen = 8,
1726 .result = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1727 .rlen = 8,
1728 }, {
1729 .key = { 0x01, 0x23, 0x45, 0x67, 0x12, 0x34, 0x56, 0x78,
1730 0x23, 0x45 },
1731 .klen = 10,
1732 .input = { 0xeb, 0x6a, 0x71, 0x1a, 0x2c, 0x02, 0x27, 0x1b },
1733 .ilen = 8,
1734 .result = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1735 .rlen = 8,
1736 }, {
1737 .key = { 0x01, 0x23, 0x45, 0x67, 0x12 },
1738 .klen = 5,
1739 .input = { 0x7a, 0xc8, 0x16, 0xd1, 0x6e, 0x9b, 0x30, 0x2e },
1740 .ilen = 8,
1741 .result = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1742 .rlen = 8,
1747 * ARC4 test vectors from OpenSSL
1749 #define ARC4_ENC_TEST_VECTORS 7
1750 #define ARC4_DEC_TEST_VECTORS 7
1752 struct cipher_testvec arc4_enc_tv_template[] =
1755 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1756 .klen = 8,
1757 .input = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1758 .ilen = 8,
1759 .result = { 0x75, 0xb7, 0x87, 0x80, 0x99, 0xe0, 0xc5, 0x96 },
1760 .rlen = 8,
1761 }, {
1762 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1763 .klen = 8,
1764 .input = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
1765 .ilen = 8,
1766 .result = { 0x74, 0x94, 0xc2, 0xe7, 0x10, 0x4b, 0x08, 0x79 },
1767 .rlen = 8,
1768 }, {
1769 .key = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
1770 .klen = 8,
1771 .input = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
1772 .ilen = 8,
1773 .result = { 0xde, 0x18, 0x89, 0x41, 0xa3, 0x37, 0x5d, 0x3a },
1774 .rlen = 8,
1775 }, {
1776 .key = { 0xef, 0x01, 0x23, 0x45},
1777 .klen = 4,
1778 .input = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1779 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1780 0x00, 0x00, 0x00, 0x00 },
1781 .ilen = 20,
1782 .result = { 0xd6, 0xa1, 0x41, 0xa7, 0xec, 0x3c, 0x38, 0xdf,
1783 0xbd, 0x61, 0x5a, 0x11, 0x62, 0xe1, 0xc7, 0xba,
1784 0x36, 0xb6, 0x78, 0x58 },
1785 .rlen = 20,
1786 }, {
1787 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1788 .klen = 8,
1789 .input = { 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0,
1790 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0,
1791 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0,
1792 0x12, 0x34, 0x56, 0x78 },
1793 .ilen = 28,
1794 .result = { 0x66, 0xa0, 0x94, 0x9f, 0x8a, 0xf7, 0xd6, 0x89,
1795 0x1f, 0x7f, 0x83, 0x2b, 0xa8, 0x33, 0xc0, 0x0c,
1796 0x89, 0x2e, 0xbe, 0x30, 0x14, 0x3c, 0xe2, 0x87,
1797 0x40, 0x01, 0x1e, 0xcf },
1798 .rlen = 28,
1799 }, {
1800 .key = { 0xef, 0x01, 0x23, 0x45 },
1801 .klen = 4,
1802 .input = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1803 0x00, 0x00 },
1804 .ilen = 10,
1805 .result = { 0xd6, 0xa1, 0x41, 0xa7, 0xec, 0x3c, 0x38, 0xdf,
1806 0xbd, 0x61 },
1807 .rlen = 10,
1808 }, {
1809 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF,
1810 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
1811 .klen = 16,
1812 .input = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF },
1813 .ilen = 8,
1814 .result = { 0x69, 0x72, 0x36, 0x59, 0x1B, 0x52, 0x42, 0xB1 },
1815 .rlen = 8,
1819 struct cipher_testvec arc4_dec_tv_template[] =
1822 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1823 .klen = 8,
1824 .input = { 0x75, 0xb7, 0x87, 0x80, 0x99, 0xe0, 0xc5, 0x96 },
1825 .ilen = 8,
1826 .result = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1827 .rlen = 8,
1828 }, {
1829 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1830 .klen = 8,
1831 .input = { 0x74, 0x94, 0xc2, 0xe7, 0x10, 0x4b, 0x08, 0x79 },
1832 .ilen = 8,
1833 .result = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
1834 .rlen = 8,
1835 }, {
1836 .key = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
1837 .klen = 8,
1838 .input = { 0xde, 0x18, 0x89, 0x41, 0xa3, 0x37, 0x5d, 0x3a },
1839 .ilen = 8,
1840 .result = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
1841 .rlen = 8,
1842 }, {
1843 .key = { 0xef, 0x01, 0x23, 0x45},
1844 .klen = 4,
1845 .input = { 0xd6, 0xa1, 0x41, 0xa7, 0xec, 0x3c, 0x38, 0xdf,
1846 0xbd, 0x61, 0x5a, 0x11, 0x62, 0xe1, 0xc7, 0xba,
1847 0x36, 0xb6, 0x78, 0x58 },
1848 .ilen = 20,
1849 .result = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1850 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1851 0x00, 0x00, 0x00, 0x00 },
1852 .rlen = 20,
1853 }, {
1854 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1855 .klen = 8,
1856 .input = { 0x66, 0xa0, 0x94, 0x9f, 0x8a, 0xf7, 0xd6, 0x89,
1857 0x1f, 0x7f, 0x83, 0x2b, 0xa8, 0x33, 0xc0, 0x0c,
1858 0x89, 0x2e, 0xbe, 0x30, 0x14, 0x3c, 0xe2, 0x87,
1859 0x40, 0x01, 0x1e, 0xcf },
1860 .ilen = 28,
1861 .result = { 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0,
1862 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0,
1863 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0,
1864 0x12, 0x34, 0x56, 0x78 },
1865 .rlen = 28,
1866 }, {
1867 .key = { 0xef, 0x01, 0x23, 0x45 },
1868 .klen = 4,
1869 .input = { 0xd6, 0xa1, 0x41, 0xa7, 0xec, 0x3c, 0x38, 0xdf,
1870 0xbd, 0x61 },
1871 .ilen = 10,
1872 .result = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1873 0x00, 0x00 },
1874 .rlen = 10,
1875 }, {
1876 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF,
1877 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
1878 .klen = 16,
1879 .input = { 0x69, 0x72, 0x36, 0x59, 0x1B, 0x52, 0x42, 0xB1 },
1880 .ilen = 8,
1881 .result = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF },
1882 .rlen = 8,
1887 * TEA test vectors
1889 #define TEA_ENC_TEST_VECTORS 4
1890 #define TEA_DEC_TEST_VECTORS 4
1892 struct cipher_testvec tea_enc_tv_template[] =
1895 .key = { [0 ... 15] = 0x00 },
1896 .klen = 16,
1897 .input = { [0 ... 8] = 0x00 },
1898 .ilen = 8,
1899 .result = { 0x0a, 0x3a, 0xea, 0x41, 0x40, 0xa9, 0xba, 0x94 },
1900 .rlen = 8,
1901 }, {
1902 .key = { 0x2b, 0x02, 0x05, 0x68, 0x06, 0x14, 0x49, 0x76,
1903 0x77, 0x5d, 0x0e, 0x26, 0x6c, 0x28, 0x78, 0x43 },
1904 .klen = 16,
1905 .input = { 0x74, 0x65, 0x73, 0x74, 0x20, 0x6d, 0x65, 0x2e },
1906 .ilen = 8,
1907 .result = { 0x77, 0x5d, 0x2a, 0x6a, 0xf6, 0xce, 0x92, 0x09 },
1908 .rlen = 8,
1909 }, {
1910 .key = { 0x09, 0x65, 0x43, 0x11, 0x66, 0x44, 0x39, 0x25,
1911 0x51, 0x3a, 0x16, 0x10, 0x0a, 0x08, 0x12, 0x6e },
1912 .klen = 16,
1913 .input = { 0x6c, 0x6f, 0x6e, 0x67, 0x65, 0x72, 0x5f, 0x74,
1914 0x65, 0x73, 0x74, 0x5f, 0x76, 0x65, 0x63, 0x74 },
1915 .ilen = 16,
1916 .result = { 0xbe, 0x7a, 0xbb, 0x81, 0x95, 0x2d, 0x1f, 0x1e,
1917 0xdd, 0x89, 0xa1, 0x25, 0x04, 0x21, 0xdf, 0x95 },
1918 .rlen = 16,
1919 }, {
1920 .key = { 0x4d, 0x76, 0x32, 0x17, 0x05, 0x3f, 0x75, 0x2c,
1921 0x5d, 0x04, 0x16, 0x36, 0x15, 0x72, 0x63, 0x2f },
1922 .klen = 16,
1923 .input = { 0x54, 0x65, 0x61, 0x20, 0x69, 0x73, 0x20, 0x67,
1924 0x6f, 0x6f, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20,
1925 0x79, 0x6f, 0x75, 0x21, 0x21, 0x21, 0x20, 0x72,
1926 0x65, 0x61, 0x6c, 0x6c, 0x79, 0x21, 0x21, 0x21 },
1927 .ilen = 32,
1928 .result = { 0xe0, 0x4d, 0x5d, 0x3c, 0xb7, 0x8c, 0x36, 0x47,
1929 0x94, 0x18, 0x95, 0x91, 0xa9, 0xfc, 0x49, 0xf8,
1930 0x44, 0xd1, 0x2d, 0xc2, 0x99, 0xb8, 0x08, 0x2a,
1931 0x07, 0x89, 0x73, 0xc2, 0x45, 0x92, 0xc6, 0x90 },
1932 .rlen = 32,
1936 struct cipher_testvec tea_dec_tv_template[] =
1939 .key = { [0 ... 15] = 0x00 },
1940 .klen = 16,
1941 .input = { 0x0a, 0x3a, 0xea, 0x41, 0x40, 0xa9, 0xba, 0x94 },
1942 .ilen = 8,
1943 .result = { [0 ... 8] = 0x00 },
1944 .rlen = 8,
1945 }, {
1946 .key = { 0x2b, 0x02, 0x05, 0x68, 0x06, 0x14, 0x49, 0x76,
1947 0x77, 0x5d, 0x0e, 0x26, 0x6c, 0x28, 0x78, 0x43 },
1948 .klen = 16,
1949 .input = { 0x77, 0x5d, 0x2a, 0x6a, 0xf6, 0xce, 0x92, 0x09 },
1950 .ilen = 8,
1951 .result = { 0x74, 0x65, 0x73, 0x74, 0x20, 0x6d, 0x65, 0x2e },
1952 .rlen = 8,
1953 }, {
1954 .key = { 0x09, 0x65, 0x43, 0x11, 0x66, 0x44, 0x39, 0x25,
1955 0x51, 0x3a, 0x16, 0x10, 0x0a, 0x08, 0x12, 0x6e },
1956 .klen = 16,
1957 .input = { 0xbe, 0x7a, 0xbb, 0x81, 0x95, 0x2d, 0x1f, 0x1e,
1958 0xdd, 0x89, 0xa1, 0x25, 0x04, 0x21, 0xdf, 0x95 },
1959 .ilen = 16,
1960 .result = { 0x6c, 0x6f, 0x6e, 0x67, 0x65, 0x72, 0x5f, 0x74,
1961 0x65, 0x73, 0x74, 0x5f, 0x76, 0x65, 0x63, 0x74 },
1962 .rlen = 16,
1963 }, {
1964 .key = { 0x4d, 0x76, 0x32, 0x17, 0x05, 0x3f, 0x75, 0x2c,
1965 0x5d, 0x04, 0x16, 0x36, 0x15, 0x72, 0x63, 0x2f },
1966 .klen = 16,
1967 .input = { 0xe0, 0x4d, 0x5d, 0x3c, 0xb7, 0x8c, 0x36, 0x47,
1968 0x94, 0x18, 0x95, 0x91, 0xa9, 0xfc, 0x49, 0xf8,
1969 0x44, 0xd1, 0x2d, 0xc2, 0x99, 0xb8, 0x08, 0x2a,
1970 0x07, 0x89, 0x73, 0xc2, 0x45, 0x92, 0xc6, 0x90 },
1971 .ilen = 32,
1972 .result = { 0x54, 0x65, 0x61, 0x20, 0x69, 0x73, 0x20, 0x67,
1973 0x6f, 0x6f, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20,
1974 0x79, 0x6f, 0x75, 0x21, 0x21, 0x21, 0x20, 0x72,
1975 0x65, 0x61, 0x6c, 0x6c, 0x79, 0x21, 0x21, 0x21 },
1976 .rlen = 32,
1981 * XTEA test vectors
1983 #define XTEA_ENC_TEST_VECTORS 4
1984 #define XTEA_DEC_TEST_VECTORS 4
1986 struct cipher_testvec xtea_enc_tv_template[] =
1989 .key = { [0 ... 15] = 0x00 },
1990 .klen = 16,
1991 .input = { [0 ... 8] = 0x00 },
1992 .ilen = 8,
1993 .result = { 0xaa, 0x22, 0x96, 0xe5, 0x6c, 0x61, 0xf3, 0x45 },
1994 .rlen = 8,
1995 }, {
1996 .key = { 0x2b, 0x02, 0x05, 0x68, 0x06, 0x14, 0x49, 0x76,
1997 0x77, 0x5d, 0x0e, 0x26, 0x6c, 0x28, 0x78, 0x43 },
1998 .klen = 16,
1999 .input = { 0x74, 0x65, 0x73, 0x74, 0x20, 0x6d, 0x65, 0x2e },
2000 .ilen = 8,
2001 .result = { 0x82, 0x3e, 0xeb, 0x35, 0xdc, 0xdd, 0xd9, 0xc3 },
2002 .rlen = 8,
2003 }, {
2004 .key = { 0x09, 0x65, 0x43, 0x11, 0x66, 0x44, 0x39, 0x25,
2005 0x51, 0x3a, 0x16, 0x10, 0x0a, 0x08, 0x12, 0x6e },
2006 .klen = 16,
2007 .input = { 0x6c, 0x6f, 0x6e, 0x67, 0x65, 0x72, 0x5f, 0x74,
2008 0x65, 0x73, 0x74, 0x5f, 0x76, 0x65, 0x63, 0x74 },
2009 .ilen = 16,
2010 .result = { 0xe2, 0x04, 0xdb, 0xf2, 0x89, 0x85, 0x9e, 0xea,
2011 0x61, 0x35, 0xaa, 0xed, 0xb5, 0xcb, 0x71, 0x2c },
2012 .rlen = 16,
2013 }, {
2014 .key = { 0x4d, 0x76, 0x32, 0x17, 0x05, 0x3f, 0x75, 0x2c,
2015 0x5d, 0x04, 0x16, 0x36, 0x15, 0x72, 0x63, 0x2f },
2016 .klen = 16,
2017 .input = { 0x54, 0x65, 0x61, 0x20, 0x69, 0x73, 0x20, 0x67,
2018 0x6f, 0x6f, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20,
2019 0x79, 0x6f, 0x75, 0x21, 0x21, 0x21, 0x20, 0x72,
2020 0x65, 0x61, 0x6c, 0x6c, 0x79, 0x21, 0x21, 0x21 },
2021 .ilen = 32,
2022 .result = { 0x0b, 0x03, 0xcd, 0x8a, 0xbe, 0x95, 0xfd, 0xb1,
2023 0xc1, 0x44, 0x91, 0x0b, 0xa5, 0xc9, 0x1b, 0xb4,
2024 0xa9, 0xda, 0x1e, 0x9e, 0xb1, 0x3e, 0x2a, 0x8f,
2025 0xea, 0xa5, 0x6a, 0x85, 0xd1, 0xf4, 0xa8, 0xa5 },
2026 .rlen = 32,
2030 struct cipher_testvec xtea_dec_tv_template[] =
2033 .key = { [0 ... 15] = 0x00 },
2034 .klen = 16,
2035 .input = { 0xaa, 0x22, 0x96, 0xe5, 0x6c, 0x61, 0xf3, 0x45 },
2036 .ilen = 8,
2037 .result = { [0 ... 8] = 0x00 },
2038 .rlen = 8,
2039 }, {
2040 .key = { 0x2b, 0x02, 0x05, 0x68, 0x06, 0x14, 0x49, 0x76,
2041 0x77, 0x5d, 0x0e, 0x26, 0x6c, 0x28, 0x78, 0x43 },
2042 .klen = 16,
2043 .input = { 0x82, 0x3e, 0xeb, 0x35, 0xdc, 0xdd, 0xd9, 0xc3 },
2044 .ilen = 8,
2045 .result = { 0x74, 0x65, 0x73, 0x74, 0x20, 0x6d, 0x65, 0x2e },
2046 .rlen = 8,
2047 }, {
2048 .key = { 0x09, 0x65, 0x43, 0x11, 0x66, 0x44, 0x39, 0x25,
2049 0x51, 0x3a, 0x16, 0x10, 0x0a, 0x08, 0x12, 0x6e },
2050 .klen = 16,
2051 .input = { 0xe2, 0x04, 0xdb, 0xf2, 0x89, 0x85, 0x9e, 0xea,
2052 0x61, 0x35, 0xaa, 0xed, 0xb5, 0xcb, 0x71, 0x2c },
2053 .ilen = 16,
2054 .result = { 0x6c, 0x6f, 0x6e, 0x67, 0x65, 0x72, 0x5f, 0x74,
2055 0x65, 0x73, 0x74, 0x5f, 0x76, 0x65, 0x63, 0x74 },
2056 .rlen = 16,
2057 }, {
2058 .key = { 0x4d, 0x76, 0x32, 0x17, 0x05, 0x3f, 0x75, 0x2c,
2059 0x5d, 0x04, 0x16, 0x36, 0x15, 0x72, 0x63, 0x2f },
2060 .klen = 16,
2061 .input = { 0x0b, 0x03, 0xcd, 0x8a, 0xbe, 0x95, 0xfd, 0xb1,
2062 0xc1, 0x44, 0x91, 0x0b, 0xa5, 0xc9, 0x1b, 0xb4,
2063 0xa9, 0xda, 0x1e, 0x9e, 0xb1, 0x3e, 0x2a, 0x8f,
2064 0xea, 0xa5, 0x6a, 0x85, 0xd1, 0xf4, 0xa8, 0xa5 },
2065 .ilen = 32,
2066 .result = { 0x54, 0x65, 0x61, 0x20, 0x69, 0x73, 0x20, 0x67,
2067 0x6f, 0x6f, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20,
2068 0x79, 0x6f, 0x75, 0x21, 0x21, 0x21, 0x20, 0x72,
2069 0x65, 0x61, 0x6c, 0x6c, 0x79, 0x21, 0x21, 0x21 },
2070 .rlen = 32,
2075 * KHAZAD test vectors.
2077 #define KHAZAD_ENC_TEST_VECTORS 5
2078 #define KHAZAD_DEC_TEST_VECTORS 5
2080 struct cipher_testvec khazad_enc_tv_template[] = {
2082 .key = { 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2083 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
2084 .klen = 16,
2085 .input = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
2086 .ilen = 8,
2087 .result = { 0x49, 0xa4, 0xce, 0x32, 0xac, 0x19, 0x0e, 0x3f },
2088 .rlen = 8,
2089 }, {
2090 .key = { 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38,
2091 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38 },
2092 .klen = 16,
2093 .input = { 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38 },
2094 .ilen = 8,
2095 .result = { 0x7e, 0x82, 0x12, 0xa1, 0Xd9, 0X5b, 0Xe4, 0Xf9 },
2096 .rlen = 8,
2097 }, {
2098 .key = { 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2,
2099 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2 },
2100 .klen = 16,
2101 .input = { 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2 },
2102 .ilen = 8,
2103 .result = { 0Xaa, 0Xbe, 0Xc1, 0X95, 0Xc5, 0X94, 0X1a, 0X9c },
2104 .rlen = 8,
2105 }, {
2106 .key = { 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f,
2107 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f },
2108 .klen = 16,
2109 .input = { 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f },
2110 .ilen = 8,
2111 .result = { 0X04, 0X74, 0Xf5, 0X70, 0X50, 0X16, 0Xd3, 0Xb8 },
2112 .rlen = 8,
2113 }, {
2114 .key = { 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f,
2115 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f },
2116 .klen = 16,
2117 .input = { 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f ,
2118 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f },
2119 .ilen = 16,
2120 .result = { 0X04, 0X74, 0Xf5, 0X70, 0X50, 0X16, 0Xd3, 0Xb8 ,
2121 0X04, 0X74, 0Xf5, 0X70, 0X50, 0X16, 0Xd3, 0Xb8 },
2122 .rlen = 16,
2126 struct cipher_testvec khazad_dec_tv_template[] = {
2128 .key = { 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2129 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
2130 .klen = 16,
2131 .input = { 0X49, 0Xa4, 0Xce, 0X32, 0Xac, 0X19, 0X0e, 0X3f },
2132 .ilen = 8,
2133 .result = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
2134 .rlen = 8,
2135 }, {
2136 .key = { 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38,
2137 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38 },
2138 .klen = 16,
2139 .input = { 0X7e, 0X82, 0X12, 0Xa1, 0Xd9, 0X5b, 0Xe4, 0Xf9 },
2140 .ilen = 8,
2141 .result = { 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38 },
2142 .rlen = 8,
2143 }, {
2144 .key = { 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2,
2145 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2 },
2146 .klen = 16,
2147 .input = { 0Xaa, 0Xbe, 0Xc1, 0X95, 0Xc5, 0X94, 0X1a, 0X9c },
2148 .ilen = 8,
2149 .result = { 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2 },
2150 .rlen = 8,
2151 }, {
2152 .key = { 0x2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f,
2153 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f },
2154 .klen = 16,
2155 .input = { 0X04, 0X74, 0Xf5, 0X70, 0X50, 0X16, 0Xd3, 0Xb8 },
2156 .ilen = 8,
2157 .result = { 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f },
2158 .rlen = 8,
2159 }, {
2160 .key = { 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f,
2161 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f },
2162 .klen = 16,
2163 .input = { 0X04, 0X74, 0Xf5, 0X70, 0X50, 0X16, 0Xd3, 0Xb8 ,
2164 0X04, 0X74, 0Xf5, 0X70, 0X50, 0X16, 0Xd3, 0Xb8 },
2165 .ilen = 16,
2166 .result = { 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f ,
2167 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f },
2168 .rlen = 16,
2173 * Compression stuff.
2175 #define COMP_BUF_SIZE 512
2177 struct comp_testvec {
2178 int inlen, outlen;
2179 char input[COMP_BUF_SIZE];
2180 char output[COMP_BUF_SIZE];
2184 * Deflate test vectors (null-terminated strings).
2185 * Params: winbits=11, Z_DEFAULT_COMPRESSION, MAX_MEM_LEVEL.
2187 #define DEFLATE_COMP_TEST_VECTORS 2
2188 #define DEFLATE_DECOMP_TEST_VECTORS 2
2190 struct comp_testvec deflate_comp_tv_template[] = {
2192 .inlen = 70,
2193 .outlen = 38,
2194 .input = "Join us now and share the software "
2195 "Join us now and share the software ",
2196 .output = { 0xf3, 0xca, 0xcf, 0xcc, 0x53, 0x28, 0x2d, 0x56,
2197 0xc8, 0xcb, 0x2f, 0x57, 0x48, 0xcc, 0x4b, 0x51,
2198 0x28, 0xce, 0x48, 0x2c, 0x4a, 0x55, 0x28, 0xc9,
2199 0x48, 0x55, 0x28, 0xce, 0x4f, 0x2b, 0x29, 0x07,
2200 0x71, 0xbc, 0x08, 0x2b, 0x01, 0x00 },
2201 }, {
2202 .inlen = 191,
2203 .outlen = 122,
2204 .input = "This document describes a compression method based on the DEFLATE"
2205 "compression algorithm. This document defines the application of "
2206 "the DEFLATE algorithm to the IP Payload Compression Protocol.",
2207 .output = { 0x5d, 0x8d, 0x31, 0x0e, 0xc2, 0x30, 0x10, 0x04,
2208 0xbf, 0xb2, 0x2f, 0xc8, 0x1f, 0x10, 0x04, 0x09,
2209 0x89, 0xc2, 0x85, 0x3f, 0x70, 0xb1, 0x2f, 0xf8,
2210 0x24, 0xdb, 0x67, 0xd9, 0x47, 0xc1, 0xef, 0x49,
2211 0x68, 0x12, 0x51, 0xae, 0x76, 0x67, 0xd6, 0x27,
2212 0x19, 0x88, 0x1a, 0xde, 0x85, 0xab, 0x21, 0xf2,
2213 0x08, 0x5d, 0x16, 0x1e, 0x20, 0x04, 0x2d, 0xad,
2214 0xf3, 0x18, 0xa2, 0x15, 0x85, 0x2d, 0x69, 0xc4,
2215 0x42, 0x83, 0x23, 0xb6, 0x6c, 0x89, 0x71, 0x9b,
2216 0xef, 0xcf, 0x8b, 0x9f, 0xcf, 0x33, 0xca, 0x2f,
2217 0xed, 0x62, 0xa9, 0x4c, 0x80, 0xff, 0x13, 0xaf,
2218 0x52, 0x37, 0xed, 0x0e, 0x52, 0x6b, 0x59, 0x02,
2219 0xd9, 0x4e, 0xe8, 0x7a, 0x76, 0x1d, 0x02, 0x98,
2220 0xfe, 0x8a, 0x87, 0x83, 0xa3, 0x4f, 0x56, 0x8a,
2221 0xb8, 0x9e, 0x8e, 0x5c, 0x57, 0xd3, 0xa0, 0x79,
2222 0xfa, 0x02 },
2226 struct comp_testvec deflate_decomp_tv_template[] = {
2228 .inlen = 122,
2229 .outlen = 191,
2230 .input = { 0x5d, 0x8d, 0x31, 0x0e, 0xc2, 0x30, 0x10, 0x04,
2231 0xbf, 0xb2, 0x2f, 0xc8, 0x1f, 0x10, 0x04, 0x09,
2232 0x89, 0xc2, 0x85, 0x3f, 0x70, 0xb1, 0x2f, 0xf8,
2233 0x24, 0xdb, 0x67, 0xd9, 0x47, 0xc1, 0xef, 0x49,
2234 0x68, 0x12, 0x51, 0xae, 0x76, 0x67, 0xd6, 0x27,
2235 0x19, 0x88, 0x1a, 0xde, 0x85, 0xab, 0x21, 0xf2,
2236 0x08, 0x5d, 0x16, 0x1e, 0x20, 0x04, 0x2d, 0xad,
2237 0xf3, 0x18, 0xa2, 0x15, 0x85, 0x2d, 0x69, 0xc4,
2238 0x42, 0x83, 0x23, 0xb6, 0x6c, 0x89, 0x71, 0x9b,
2239 0xef, 0xcf, 0x8b, 0x9f, 0xcf, 0x33, 0xca, 0x2f,
2240 0xed, 0x62, 0xa9, 0x4c, 0x80, 0xff, 0x13, 0xaf,
2241 0x52, 0x37, 0xed, 0x0e, 0x52, 0x6b, 0x59, 0x02,
2242 0xd9, 0x4e, 0xe8, 0x7a, 0x76, 0x1d, 0x02, 0x98,
2243 0xfe, 0x8a, 0x87, 0x83, 0xa3, 0x4f, 0x56, 0x8a,
2244 0xb8, 0x9e, 0x8e, 0x5c, 0x57, 0xd3, 0xa0, 0x79,
2245 0xfa, 0x02 },
2246 .output = "This document describes a compression method based on the DEFLATE"
2247 "compression algorithm. This document defines the application of "
2248 "the DEFLATE algorithm to the IP Payload Compression Protocol.",
2249 }, {
2250 .inlen = 38,
2251 .outlen = 70,
2252 .input = { 0xf3, 0xca, 0xcf, 0xcc, 0x53, 0x28, 0x2d, 0x56,
2253 0xc8, 0xcb, 0x2f, 0x57, 0x48, 0xcc, 0x4b, 0x51,
2254 0x28, 0xce, 0x48, 0x2c, 0x4a, 0x55, 0x28, 0xc9,
2255 0x48, 0x55, 0x28, 0xce, 0x4f, 0x2b, 0x29, 0x07,
2256 0x71, 0xbc, 0x08, 0x2b, 0x01, 0x00 },
2257 .output = "Join us now and share the software "
2258 "Join us now and share the software ",
2263 * Michael MIC test vectors from IEEE 802.11i
2265 #define MICHAEL_MIC_TEST_VECTORS 6
2267 struct hash_testvec michael_mic_tv_template[] =
2270 .key = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
2271 .ksize = 8,
2272 .plaintext = { },
2273 .psize = 0,
2274 .digest = { 0x82, 0x92, 0x5c, 0x1c, 0xa1, 0xd1, 0x30, 0xb8 }
2277 .key = { 0x82, 0x92, 0x5c, 0x1c, 0xa1, 0xd1, 0x30, 0xb8 },
2278 .ksize = 8,
2279 .plaintext = { 'M' },
2280 .psize = 1,
2281 .digest = { 0x43, 0x47, 0x21, 0xca, 0x40, 0x63, 0x9b, 0x3f }
2284 .key = { 0x43, 0x47, 0x21, 0xca, 0x40, 0x63, 0x9b, 0x3f },
2285 .ksize = 8,
2286 .plaintext = { 'M', 'i' },
2287 .psize = 2,
2288 .digest = { 0xe8, 0xf9, 0xbe, 0xca, 0xe9, 0x7e, 0x5d, 0x29 }
2291 .key = { 0xe8, 0xf9, 0xbe, 0xca, 0xe9, 0x7e, 0x5d, 0x29 },
2292 .ksize = 8,
2293 .plaintext = { 'M', 'i', 'c' },
2294 .psize = 3,
2295 .digest = { 0x90, 0x03, 0x8f, 0xc6, 0xcf, 0x13, 0xc1, 0xdb }
2298 .key = { 0x90, 0x03, 0x8f, 0xc6, 0xcf, 0x13, 0xc1, 0xdb },
2299 .ksize = 8,
2300 .plaintext = { 'M', 'i', 'c', 'h' },
2301 .psize = 4,
2302 .digest = { 0xd5, 0x5e, 0x10, 0x05, 0x10, 0x12, 0x89, 0x86 }
2305 .key = { 0xd5, 0x5e, 0x10, 0x05, 0x10, 0x12, 0x89, 0x86 },
2306 .ksize = 8,
2307 .plaintext = { 'M', 'i', 'c', 'h', 'a', 'e', 'l' },
2308 .psize = 7,
2309 .digest = { 0x0a, 0x94, 0x2b, 0x12, 0x4e, 0xca, 0xa5, 0x46 },
2313 #endif /* _CRYPTO_TCRYPT_H */