aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2005-06-22 16:26:03 -0400
committerDavid S. Miller <davem@davemloft.net>2005-06-22 16:26:03 -0400
commitef2736fc741316913a457abd3731053071c86241 (patch)
tree849fd884621934ffe56eed023f8cd11ceff85013
parentdd7f0b80926befc8c70a873b5b0c0c7b5fd1e7b9 (diff)
[CRYPTO]: White space and coding style clean up in tcrypt
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--crypto/tcrypt.c333
-rw-r--r--crypto/tcrypt.h357
2 files changed, 336 insertions, 354 deletions
diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c
index 92b0352c8e92..5a95b4a14c2b 100644
--- a/crypto/tcrypt.c
+++ b/crypto/tcrypt.c
@@ -1,4 +1,4 @@
1/* 1/*
2 * Quick & dirty crypto testing module. 2 * Quick & dirty crypto testing module.
3 * 3 *
4 * This will only exist until we have a better testing mechanism 4 * This will only exist until we have a better testing mechanism
@@ -9,7 +9,7 @@
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify it 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 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) 12 * Software Foundation; either version 2 of the License, or (at your option)
13 * any later version. 13 * any later version.
14 * 14 *
15 * 14 - 09 - 2003 15 * 14 - 09 - 2003
@@ -61,13 +61,12 @@ static char *tvmem;
61 61
62static char *check[] = { 62static char *check[] = {
63 "des", "md5", "des3_ede", "rot13", "sha1", "sha256", "blowfish", 63 "des", "md5", "des3_ede", "rot13", "sha1", "sha256", "blowfish",
64 "twofish", "serpent", "sha384", "sha512", "md4", "aes", "cast6", 64 "twofish", "serpent", "sha384", "sha512", "md4", "aes", "cast6",
65 "arc4", "michael_mic", "deflate", "crc32c", "tea", "xtea", 65 "arc4", "michael_mic", "deflate", "crc32c", "tea", "xtea",
66 "khazad", "wp512", "wp384", "wp256", "tnepres", NULL 66 "khazad", "wp512", "wp384", "wp256", "tnepres", NULL
67}; 67};
68 68
69static void 69static void hexdump(unsigned char *buf, unsigned int len)
70hexdump(unsigned char *buf, unsigned int len)
71{ 70{
72 while (len--) 71 while (len--)
73 printk("%02x", *buf++); 72 printk("%02x", *buf++);
@@ -75,29 +74,29 @@ hexdump(unsigned char *buf, unsigned int len)
75 printk("\n"); 74 printk("\n");
76} 75}
77 76
78static void 77static void test_hash(char *algo, struct hash_testvec *template,
79test_hash (char * algo, struct hash_testvec * template, unsigned int tcount) 78 unsigned int tcount)
80{ 79{
81 char *p; 80 char *p;
82 unsigned int i, j, k, temp; 81 unsigned int i, j, k, temp;
83 struct scatterlist sg[8]; 82 struct scatterlist sg[8];
84 char result[64]; 83 char result[64];
85 struct crypto_tfm *tfm; 84 struct crypto_tfm *tfm;
86 struct hash_testvec *hash_tv; 85 struct hash_testvec *hash_tv;
87 unsigned int tsize; 86 unsigned int tsize;
88 87
89 printk("\ntesting %s\n", algo); 88 printk("\ntesting %s\n", algo);
90 89
91 tsize = sizeof (struct hash_testvec); 90 tsize = sizeof(struct hash_testvec);
92 tsize *= tcount; 91 tsize *= tcount;
93 92
94 if (tsize > TVMEMSIZE) { 93 if (tsize > TVMEMSIZE) {
95 printk("template (%u) too big for tvmem (%u)\n", tsize, TVMEMSIZE); 94 printk("template (%u) too big for tvmem (%u)\n", tsize, TVMEMSIZE);
96 return; 95 return;
97 } 96 }
98 97
99 memcpy(tvmem, template, tsize); 98 memcpy(tvmem, template, tsize);
100 hash_tv = (void *) tvmem; 99 hash_tv = (void *)tvmem;
101 tfm = crypto_alloc_tfm(algo, 0); 100 tfm = crypto_alloc_tfm(algo, 0);
102 if (tfm == NULL) { 101 if (tfm == NULL) {
103 printk("failed to load transform for %s\n", algo); 102 printk("failed to load transform for %s\n", algo);
@@ -105,70 +104,71 @@ test_hash (char * algo, struct hash_testvec * template, unsigned int tcount)
105 } 104 }
106 105
107 for (i = 0; i < tcount; i++) { 106 for (i = 0; i < tcount; i++) {
108 printk ("test %u:\n", i + 1); 107 printk("test %u:\n", i + 1);
109 memset (result, 0, 64); 108 memset(result, 0, 64);
110 109
111 p = hash_tv[i].plaintext; 110 p = hash_tv[i].plaintext;
112 sg[0].page = virt_to_page (p); 111 sg[0].page = virt_to_page(p);
113 sg[0].offset = offset_in_page (p); 112 sg[0].offset = offset_in_page(p);
114 sg[0].length = hash_tv[i].psize; 113 sg[0].length = hash_tv[i].psize;
115 114
116 crypto_digest_init (tfm); 115 crypto_digest_init(tfm);
117 if (tfm->crt_u.digest.dit_setkey) { 116 if (tfm->crt_u.digest.dit_setkey) {
118 crypto_digest_setkey (tfm, hash_tv[i].key, 117 crypto_digest_setkey(tfm, hash_tv[i].key,
119 hash_tv[i].ksize); 118 hash_tv[i].ksize);
120 } 119 }
121 crypto_digest_update (tfm, sg, 1); 120 crypto_digest_update(tfm, sg, 1);
122 crypto_digest_final (tfm, result); 121 crypto_digest_final(tfm, result);
123 122
124 hexdump (result, crypto_tfm_alg_digestsize (tfm)); 123 hexdump(result, crypto_tfm_alg_digestsize(tfm));
125 printk("%s\n", 124 printk("%s\n",
126 memcmp(result, hash_tv[i].digest, 125 memcmp(result, hash_tv[i].digest,
127 crypto_tfm_alg_digestsize(tfm)) ? "fail" : 126 crypto_tfm_alg_digestsize(tfm)) ?
128 "pass"); 127 "fail" : "pass");
129 } 128 }
130 129
131 printk ("testing %s across pages\n", algo); 130 printk("testing %s across pages\n", algo);
132 131
133 /* setup the dummy buffer first */ 132 /* setup the dummy buffer first */
134 memset(xbuf, 0, XBUFSIZE); 133 memset(xbuf, 0, XBUFSIZE);
135 134
136 j = 0; 135 j = 0;
137 for (i = 0; i < tcount; i++) { 136 for (i = 0; i < tcount; i++) {
138 if (hash_tv[i].np) { 137 if (hash_tv[i].np) {
139 j++; 138 j++;
140 printk ("test %u:\n", j); 139 printk("test %u:\n", j);
141 memset (result, 0, 64); 140 memset(result, 0, 64);
142 141
143 temp = 0; 142 temp = 0;
144 for (k = 0; k < hash_tv[i].np; k++) { 143 for (k = 0; k < hash_tv[i].np; k++) {
145 memcpy (&xbuf[IDX[k]], hash_tv[i].plaintext + temp, 144 memcpy(&xbuf[IDX[k]],
146 hash_tv[i].tap[k]); 145 hash_tv[i].plaintext + temp,
146 hash_tv[i].tap[k]);
147 temp += hash_tv[i].tap[k]; 147 temp += hash_tv[i].tap[k];
148 p = &xbuf[IDX[k]]; 148 p = &xbuf[IDX[k]];
149 sg[k].page = virt_to_page (p); 149 sg[k].page = virt_to_page(p);
150 sg[k].offset = offset_in_page (p); 150 sg[k].offset = offset_in_page(p);
151 sg[k].length = hash_tv[i].tap[k]; 151 sg[k].length = hash_tv[i].tap[k];
152 } 152 }
153 153
154 crypto_digest_digest (tfm, sg, hash_tv[i].np, result); 154 crypto_digest_digest(tfm, sg, hash_tv[i].np, result);
155 155
156 hexdump (result, crypto_tfm_alg_digestsize (tfm)); 156 hexdump(result, crypto_tfm_alg_digestsize(tfm));
157 printk("%s\n", 157 printk("%s\n",
158 memcmp(result, hash_tv[i].digest, 158 memcmp(result, hash_tv[i].digest,
159 crypto_tfm_alg_digestsize(tfm)) ? "fail" : 159 crypto_tfm_alg_digestsize(tfm)) ?
160 "pass"); 160 "fail" : "pass");
161 } 161 }
162 } 162 }
163 163
164 crypto_free_tfm (tfm); 164 crypto_free_tfm(tfm);
165} 165}
166 166
167 167
168#ifdef CONFIG_CRYPTO_HMAC 168#ifdef CONFIG_CRYPTO_HMAC
169 169
170static void 170static void test_hmac(char *algo, struct hmac_testvec *template,
171test_hmac(char *algo, struct hmac_testvec * template, unsigned int tcount) 171 unsigned int tcount)
172{ 172{
173 char *p; 173 char *p;
174 unsigned int i, j, k, temp; 174 unsigned int i, j, k, temp;
@@ -185,8 +185,8 @@ test_hmac(char *algo, struct hmac_testvec * template, unsigned int tcount)
185 } 185 }
186 186
187 printk("\ntesting hmac_%s\n", algo); 187 printk("\ntesting hmac_%s\n", algo);
188 188
189 tsize = sizeof (struct hmac_testvec); 189 tsize = sizeof(struct hmac_testvec);
190 tsize *= tcount; 190 tsize *= tcount;
191 if (tsize > TVMEMSIZE) { 191 if (tsize > TVMEMSIZE) {
192 printk("template (%u) too big for tvmem (%u)\n", tsize, 192 printk("template (%u) too big for tvmem (%u)\n", tsize,
@@ -195,7 +195,7 @@ test_hmac(char *algo, struct hmac_testvec * template, unsigned int tcount)
195 } 195 }
196 196
197 memcpy(tvmem, template, tsize); 197 memcpy(tvmem, template, tsize);
198 hmac_tv = (void *) tvmem; 198 hmac_tv = (void *)tvmem;
199 199
200 for (i = 0; i < tcount; i++) { 200 for (i = 0; i < tcount; i++) {
201 printk("test %u:\n", i + 1); 201 printk("test %u:\n", i + 1);
@@ -219,34 +219,35 @@ test_hmac(char *algo, struct hmac_testvec * template, unsigned int tcount)
219 printk("\ntesting hmac_%s across pages\n", algo); 219 printk("\ntesting hmac_%s across pages\n", algo);
220 220
221 memset(xbuf, 0, XBUFSIZE); 221 memset(xbuf, 0, XBUFSIZE);
222 222
223 j = 0; 223 j = 0;
224 for (i = 0; i < tcount; i++) { 224 for (i = 0; i < tcount; i++) {
225 if (hmac_tv[i].np) { 225 if (hmac_tv[i].np) {
226 j++; 226 j++;
227 printk ("test %u:\n",j); 227 printk("test %u:\n",j);
228 memset (result, 0, 64); 228 memset(result, 0, 64);
229 229
230 temp = 0; 230 temp = 0;
231 klen = hmac_tv[i].ksize; 231 klen = hmac_tv[i].ksize;
232 for (k = 0; k < hmac_tv[i].np; k++) { 232 for (k = 0; k < hmac_tv[i].np; k++) {
233 memcpy (&xbuf[IDX[k]], hmac_tv[i].plaintext + temp, 233 memcpy(&xbuf[IDX[k]],
234 hmac_tv[i].tap[k]); 234 hmac_tv[i].plaintext + temp,
235 hmac_tv[i].tap[k]);
235 temp += hmac_tv[i].tap[k]; 236 temp += hmac_tv[i].tap[k];
236 p = &xbuf[IDX[k]]; 237 p = &xbuf[IDX[k]];
237 sg[k].page = virt_to_page (p); 238 sg[k].page = virt_to_page(p);
238 sg[k].offset = offset_in_page (p); 239 sg[k].offset = offset_in_page(p);
239 sg[k].length = hmac_tv[i].tap[k]; 240 sg[k].length = hmac_tv[i].tap[k];
240 } 241 }
241 242
242 crypto_hmac(tfm, hmac_tv[i].key, &klen, sg, hmac_tv[i].np, 243 crypto_hmac(tfm, hmac_tv[i].key, &klen, sg,
243 result); 244 hmac_tv[i].np, result);
244 hexdump(result, crypto_tfm_alg_digestsize(tfm)); 245 hexdump(result, crypto_tfm_alg_digestsize(tfm));
245 246
246 printk("%s\n", 247 printk("%s\n",
247 memcmp(result, hmac_tv[i].digest, 248 memcmp(result, hmac_tv[i].digest,
248 crypto_tfm_alg_digestsize(tfm)) ? "fail" : 249 crypto_tfm_alg_digestsize(tfm)) ?
249 "pass"); 250 "fail" : "pass");
250 } 251 }
251 } 252 }
252out: 253out:
@@ -255,8 +256,8 @@ out:
255 256
256#endif /* CONFIG_CRYPTO_HMAC */ 257#endif /* CONFIG_CRYPTO_HMAC */
257 258
258static void 259static void test_cipher(char *algo, int mode, int enc,
259test_cipher(char * algo, int mode, int enc, struct cipher_testvec * template, unsigned int tcount) 260 struct cipher_testvec *template, unsigned int tcount)
260{ 261{
261 unsigned int ret, i, j, k, temp; 262 unsigned int ret, i, j, k, temp;
262 unsigned int tsize; 263 unsigned int tsize;
@@ -270,17 +271,17 @@ test_cipher(char * algo, int mode, int enc, struct cipher_testvec * template, un
270 if (enc == ENCRYPT) 271 if (enc == ENCRYPT)
271 strncpy(e, "encryption", 11); 272 strncpy(e, "encryption", 11);
272 else 273 else
273 strncpy(e, "decryption", 11); 274 strncpy(e, "decryption", 11);
274 if (mode == MODE_ECB) 275 if (mode == MODE_ECB)
275 strncpy(m, "ECB", 4); 276 strncpy(m, "ECB", 4);
276 else 277 else
277 strncpy(m, "CBC", 4); 278 strncpy(m, "CBC", 4);
278 279
279 printk("\ntesting %s %s %s \n", algo, m, e); 280 printk("\ntesting %s %s %s\n", algo, m, e);
280 281
281 tsize = sizeof (struct cipher_testvec); 282 tsize = sizeof (struct cipher_testvec);
282 tsize *= tcount; 283 tsize *= tcount;
283 284
284 if (tsize > TVMEMSIZE) { 285 if (tsize > TVMEMSIZE) {
285 printk("template (%u) too big for tvmem (%u)\n", tsize, 286 printk("template (%u) too big for tvmem (%u)\n", tsize,
286 TVMEMSIZE); 287 TVMEMSIZE);
@@ -288,112 +289,113 @@ test_cipher(char * algo, int mode, int enc, struct cipher_testvec * template, un
288 } 289 }
289 290
290 memcpy(tvmem, template, tsize); 291 memcpy(tvmem, template, tsize);
291 cipher_tv = (void *) tvmem; 292 cipher_tv = (void *)tvmem;
293
294 if (mode)
295 tfm = crypto_alloc_tfm(algo, 0);
296 else
297 tfm = crypto_alloc_tfm(algo, CRYPTO_TFM_MODE_CBC);
292 298
293 if (mode)
294 tfm = crypto_alloc_tfm (algo, 0);
295 else
296 tfm = crypto_alloc_tfm (algo, CRYPTO_TFM_MODE_CBC);
297
298 if (tfm == NULL) { 299 if (tfm == NULL) {
299 printk("failed to load transform for %s %s\n", algo, m); 300 printk("failed to load transform for %s %s\n", algo, m);
300 return; 301 return;
301 } 302 }
302 303
303 j = 0; 304 j = 0;
304 for (i = 0; i < tcount; i++) { 305 for (i = 0; i < tcount; i++) {
305 if (!(cipher_tv[i].np)) { 306 if (!(cipher_tv[i].np)) {
306 j++; 307 j++;
307 printk("test %u (%d bit key):\n", 308 printk("test %u (%d bit key):\n",
308 j, cipher_tv[i].klen * 8); 309 j, cipher_tv[i].klen * 8);
309 310
310 tfm->crt_flags = 0; 311 tfm->crt_flags = 0;
311 if (cipher_tv[i].wk) 312 if (cipher_tv[i].wk)
312 tfm->crt_flags |= CRYPTO_TFM_REQ_WEAK_KEY; 313 tfm->crt_flags |= CRYPTO_TFM_REQ_WEAK_KEY;
313 key = cipher_tv[i].key; 314 key = cipher_tv[i].key;
314 315
315 ret = crypto_cipher_setkey(tfm, key, cipher_tv[i].klen); 316 ret = crypto_cipher_setkey(tfm, key, cipher_tv[i].klen);
316 if (ret) { 317 if (ret) {
317 printk("setkey() failed flags=%x\n", tfm->crt_flags); 318 printk("setkey() failed flags=%x\n", tfm->crt_flags);
318 319
319 if (!cipher_tv[i].fail) 320 if (!cipher_tv[i].fail)
320 goto out; 321 goto out;
321 } 322 }
322 323
323 p = cipher_tv[i].input; 324 p = cipher_tv[i].input;
324 sg[0].page = virt_to_page(p); 325 sg[0].page = virt_to_page(p);
325 sg[0].offset = offset_in_page(p); 326 sg[0].offset = offset_in_page(p);
326 sg[0].length = cipher_tv[i].ilen; 327 sg[0].length = cipher_tv[i].ilen;
327 328
328 if (!mode) { 329 if (!mode) {
329 crypto_cipher_set_iv(tfm, cipher_tv[i].iv, 330 crypto_cipher_set_iv(tfm, cipher_tv[i].iv,
330 crypto_tfm_alg_ivsize (tfm)); 331 crypto_tfm_alg_ivsize(tfm));
331 } 332 }
332 333
333 if (enc) 334 if (enc)
334 ret = crypto_cipher_encrypt(tfm, sg, sg, cipher_tv[i].ilen); 335 ret = crypto_cipher_encrypt(tfm, sg, sg, cipher_tv[i].ilen);
335 else 336 else
336 ret = crypto_cipher_decrypt(tfm, sg, sg, cipher_tv[i].ilen); 337 ret = crypto_cipher_decrypt(tfm, sg, sg, cipher_tv[i].ilen);
337 338
338 339
339 if (ret) { 340 if (ret) {
340 printk("%s () failed flags=%x\n", e, tfm->crt_flags); 341 printk("%s () failed flags=%x\n", e, tfm->crt_flags);
341 goto out; 342 goto out;
342 } 343 }
343 344
344 q = kmap(sg[0].page) + sg[0].offset; 345 q = kmap(sg[0].page) + sg[0].offset;
345 hexdump(q, cipher_tv[i].rlen); 346 hexdump(q, cipher_tv[i].rlen);
346 347
347 printk("%s\n", 348 printk("%s\n",
348 memcmp(q, cipher_tv[i].result, cipher_tv[i].rlen) ? "fail" : 349 memcmp(q, cipher_tv[i].result,
349 "pass"); 350 cipher_tv[i].rlen) ? "fail" : "pass");
350 } 351 }
351 } 352 }
352 353
353 printk("\ntesting %s %s %s across pages (chunking) \n", algo, m, e); 354 printk("\ntesting %s %s %s across pages (chunking)\n", algo, m, e);
354 memset(xbuf, 0, XBUFSIZE); 355 memset(xbuf, 0, XBUFSIZE);
355 356
356 j = 0; 357 j = 0;
357 for (i = 0; i < tcount; i++) { 358 for (i = 0; i < tcount; i++) {
358 if (cipher_tv[i].np) { 359 if (cipher_tv[i].np) {
359 j++; 360 j++;
360 printk("test %u (%d bit key):\n", 361 printk("test %u (%d bit key):\n",
361 j, cipher_tv[i].klen * 8); 362 j, cipher_tv[i].klen * 8);
362 363
363 tfm->crt_flags = 0; 364 tfm->crt_flags = 0;
364 if (cipher_tv[i].wk) 365 if (cipher_tv[i].wk)
365 tfm->crt_flags |= CRYPTO_TFM_REQ_WEAK_KEY; 366 tfm->crt_flags |= CRYPTO_TFM_REQ_WEAK_KEY;
366 key = cipher_tv[i].key; 367 key = cipher_tv[i].key;
367 368
368 ret = crypto_cipher_setkey(tfm, key, cipher_tv[i].klen); 369 ret = crypto_cipher_setkey(tfm, key, cipher_tv[i].klen);
369 if (ret) { 370 if (ret) {
370 printk("setkey() failed flags=%x\n", tfm->crt_flags); 371 printk("setkey() failed flags=%x\n", tfm->crt_flags);
371 372
372 if (!cipher_tv[i].fail) 373 if (!cipher_tv[i].fail)
373 goto out; 374 goto out;
374 } 375 }
375 376
376 temp = 0; 377 temp = 0;
377 for (k = 0; k < cipher_tv[i].np; k++) { 378 for (k = 0; k < cipher_tv[i].np; k++) {
378 memcpy (&xbuf[IDX[k]], cipher_tv[i].input + temp, 379 memcpy(&xbuf[IDX[k]],
379 cipher_tv[i].tap[k]); 380 cipher_tv[i].input + temp,
381 cipher_tv[i].tap[k]);
380 temp += cipher_tv[i].tap[k]; 382 temp += cipher_tv[i].tap[k];
381 p = &xbuf[IDX[k]]; 383 p = &xbuf[IDX[k]];
382 sg[k].page = virt_to_page (p); 384 sg[k].page = virt_to_page(p);
383 sg[k].offset = offset_in_page (p); 385 sg[k].offset = offset_in_page(p);
384 sg[k].length = cipher_tv[i].tap[k]; 386 sg[k].length = cipher_tv[i].tap[k];
385 } 387 }
386 388
387 if (!mode) { 389 if (!mode) {
388 crypto_cipher_set_iv(tfm, cipher_tv[i].iv, 390 crypto_cipher_set_iv(tfm, cipher_tv[i].iv,
389 crypto_tfm_alg_ivsize (tfm)); 391 crypto_tfm_alg_ivsize(tfm));
390 } 392 }
391 393
392 if (enc) 394 if (enc)
393 ret = crypto_cipher_encrypt(tfm, sg, sg, cipher_tv[i].ilen); 395 ret = crypto_cipher_encrypt(tfm, sg, sg, cipher_tv[i].ilen);
394 else 396 else
395 ret = crypto_cipher_decrypt(tfm, sg, sg, cipher_tv[i].ilen); 397 ret = crypto_cipher_decrypt(tfm, sg, sg, cipher_tv[i].ilen);
396 398
397 if (ret) { 399 if (ret) {
398 printk("%s () failed flags=%x\n", e, tfm->crt_flags); 400 printk("%s () failed flags=%x\n", e, tfm->crt_flags);
399 goto out; 401 goto out;
@@ -404,9 +406,9 @@ test_cipher(char * algo, int mode, int enc, struct cipher_testvec * template, un
404 printk("page %u\n", k); 406 printk("page %u\n", k);
405 q = kmap(sg[k].page) + sg[k].offset; 407 q = kmap(sg[k].page) + sg[k].offset;
406 hexdump(q, cipher_tv[i].tap[k]); 408 hexdump(q, cipher_tv[i].tap[k]);
407 printk("%s\n", 409 printk("%s\n",
408 memcmp(q, cipher_tv[i].result + temp, 410 memcmp(q, cipher_tv[i].result + temp,
409 cipher_tv[i].tap[k]) ? "fail" : 411 cipher_tv[i].tap[k]) ? "fail" :
410 "pass"); 412 "pass");
411 temp += cipher_tv[i].tap[k]; 413 temp += cipher_tv[i].tap[k];
412 } 414 }
@@ -417,8 +419,7 @@ out:
417 crypto_free_tfm(tfm); 419 crypto_free_tfm(tfm);
418} 420}
419 421
420static void 422static void test_deflate(void)
421test_deflate(void)
422{ 423{
423 unsigned int i; 424 unsigned int i;
424 char result[COMP_BUF_SIZE]; 425 char result[COMP_BUF_SIZE];
@@ -436,7 +437,7 @@ test_deflate(void)
436 } 437 }
437 438
438 memcpy(tvmem, deflate_comp_tv_template, tsize); 439 memcpy(tvmem, deflate_comp_tv_template, tsize);
439 tv = (void *) tvmem; 440 tv = (void *)tvmem;
440 441
441 tfm = crypto_alloc_tfm("deflate", 0); 442 tfm = crypto_alloc_tfm("deflate", 0);
442 if (tfm == NULL) { 443 if (tfm == NULL) {
@@ -446,7 +447,7 @@ test_deflate(void)
446 447
447 for (i = 0; i < DEFLATE_COMP_TEST_VECTORS; i++) { 448 for (i = 0; i < DEFLATE_COMP_TEST_VECTORS; i++) {
448 int ilen, ret, dlen = COMP_BUF_SIZE; 449 int ilen, ret, dlen = COMP_BUF_SIZE;
449 450
450 printk("test %u:\n", i + 1); 451 printk("test %u:\n", i + 1);
451 memset(result, 0, sizeof (result)); 452 memset(result, 0, sizeof (result));
452 453
@@ -473,11 +474,11 @@ test_deflate(void)
473 } 474 }
474 475
475 memcpy(tvmem, deflate_decomp_tv_template, tsize); 476 memcpy(tvmem, deflate_decomp_tv_template, tsize);
476 tv = (void *) tvmem; 477 tv = (void *)tvmem;
477 478
478 for (i = 0; i < DEFLATE_DECOMP_TEST_VECTORS; i++) { 479 for (i = 0; i < DEFLATE_DECOMP_TEST_VECTORS; i++) {
479 int ilen, ret, dlen = COMP_BUF_SIZE; 480 int ilen, ret, dlen = COMP_BUF_SIZE;
480 481
481 printk("test %u:\n", i + 1); 482 printk("test %u:\n", i + 1);
482 memset(result, 0, sizeof (result)); 483 memset(result, 0, sizeof (result));
483 484
@@ -497,8 +498,7 @@ out:
497 crypto_free_tfm(tfm); 498 crypto_free_tfm(tfm);
498} 499}
499 500
500static void 501static void test_crc32c(void)
501test_crc32c(void)
502{ 502{
503#define NUMVEC 6 503#define NUMVEC 6
504#define VECSIZE 40 504#define VECSIZE 40
@@ -511,7 +511,7 @@ test_crc32c(void)
511 0xd579c862, 0xba979ad0, 0x2b29d913 511 0xd579c862, 0xba979ad0, 0x2b29d913
512 }; 512 };
513 static u32 tot_vec_results = 0x24c5d375; 513 static u32 tot_vec_results = 0x24c5d375;
514 514
515 struct scatterlist sg[NUMVEC]; 515 struct scatterlist sg[NUMVEC];
516 struct crypto_tfm *tfm; 516 struct crypto_tfm *tfm;
517 char *fmtdata = "testing crc32c initialized to %08x: %s\n"; 517 char *fmtdata = "testing crc32c initialized to %08x: %s\n";
@@ -525,18 +525,18 @@ test_crc32c(void)
525 printk("failed to load transform for crc32c\n"); 525 printk("failed to load transform for crc32c\n");
526 return; 526 return;
527 } 527 }
528 528
529 crypto_digest_init(tfm); 529 crypto_digest_init(tfm);
530 crypto_digest_final(tfm, (u8*)&crc); 530 crypto_digest_final(tfm, (u8*)&crc);
531 printk(fmtdata, crc, (crc == 0) ? "pass" : "ERROR"); 531 printk(fmtdata, crc, (crc == 0) ? "pass" : "ERROR");
532 532
533 /* 533 /*
534 * stuff test_vec with known values, simple incrementing 534 * stuff test_vec with known values, simple incrementing
535 * byte values. 535 * byte values.
536 */ 536 */
537 b = 0; 537 b = 0;
538 for (i = 0; i < NUMVEC; i++) { 538 for (i = 0; i < NUMVEC; i++) {
539 for (j = 0; j < VECSIZE; j++) 539 for (j = 0; j < VECSIZE; j++)
540 test_vec[i][j] = ++b; 540 test_vec[i][j] = ++b;
541 sg[i].page = virt_to_page(test_vec[i]); 541 sg[i].page = virt_to_page(test_vec[i]);
542 sg[i].offset = offset_in_page(test_vec[i]); 542 sg[i].offset = offset_in_page(test_vec[i]);
@@ -548,11 +548,11 @@ test_crc32c(void)
548 crypto_digest_final(tfm, (u8*)&crc); 548 crypto_digest_final(tfm, (u8*)&crc);
549 printk("testing crc32c setkey returns %08x : %s\n", crc, (crc == (SEEDTESTVAL ^ ~(u32)0)) ? 549 printk("testing crc32c setkey returns %08x : %s\n", crc, (crc == (SEEDTESTVAL ^ ~(u32)0)) ?
550 "pass" : "ERROR"); 550 "pass" : "ERROR");
551 551
552 printk("testing crc32c using update/final:\n"); 552 printk("testing crc32c using update/final:\n");
553 553
554 pass = 1; /* assume all is well */ 554 pass = 1; /* assume all is well */
555 555
556 for (i = 0; i < NUMVEC; i++) { 556 for (i = 0; i < NUMVEC; i++) {
557 seed = ~(u32)0; 557 seed = ~(u32)0;
558 (void)crypto_digest_setkey(tfm, (const u8*)&seed, sizeof(u32)); 558 (void)crypto_digest_setkey(tfm, (const u8*)&seed, sizeof(u32));
@@ -591,66 +591,64 @@ test_crc32c(void)
591 printk(" %08x:BAD, wanted %08x\n", crc, tot_vec_results); 591 printk(" %08x:BAD, wanted %08x\n", crc, tot_vec_results);
592 pass = 0; 592 pass = 0;
593 } 593 }
594 594
595 printk("\n%s\n", pass ? "pass" : "ERROR"); 595 printk("\n%s\n", pass ? "pass" : "ERROR");
596 596
597 crypto_free_tfm(tfm); 597 crypto_free_tfm(tfm);
598 printk("crc32c test complete\n"); 598 printk("crc32c test complete\n");
599} 599}
600 600
601static void 601static void test_available(void)
602test_available(void)
603{ 602{
604 char **name = check; 603 char **name = check;
605 604
606 while (*name) { 605 while (*name) {
607 printk("alg %s ", *name); 606 printk("alg %s ", *name);
608 printk((crypto_alg_available(*name, 0)) ? 607 printk((crypto_alg_available(*name, 0)) ?
609 "found\n" : "not found\n"); 608 "found\n" : "not found\n");
610 name++; 609 name++;
611 } 610 }
612} 611}
613 612
614static void 613static void do_test(void)
615do_test(void)
616{ 614{
617 switch (mode) { 615 switch (mode) {
618 616
619 case 0: 617 case 0:
620 test_hash("md5", md5_tv_template, MD5_TEST_VECTORS); 618 test_hash("md5", md5_tv_template, MD5_TEST_VECTORS);
621 619
622 test_hash("sha1", sha1_tv_template, SHA1_TEST_VECTORS); 620 test_hash("sha1", sha1_tv_template, SHA1_TEST_VECTORS);
623 621
624 //DES 622 //DES
625 test_cipher ("des", MODE_ECB, ENCRYPT, des_enc_tv_template, DES_ENC_TEST_VECTORS); 623 test_cipher ("des", MODE_ECB, ENCRYPT, des_enc_tv_template, DES_ENC_TEST_VECTORS);
626 test_cipher ("des", MODE_ECB, DECRYPT, des_dec_tv_template, DES_DEC_TEST_VECTORS); 624 test_cipher ("des", MODE_ECB, DECRYPT, des_dec_tv_template, DES_DEC_TEST_VECTORS);
627 test_cipher ("des", MODE_CBC, ENCRYPT, des_cbc_enc_tv_template, DES_CBC_ENC_TEST_VECTORS); 625 test_cipher ("des", MODE_CBC, ENCRYPT, des_cbc_enc_tv_template, DES_CBC_ENC_TEST_VECTORS);
628 test_cipher ("des", MODE_CBC, DECRYPT, des_cbc_dec_tv_template, DES_CBC_DEC_TEST_VECTORS); 626 test_cipher ("des", MODE_CBC, DECRYPT, des_cbc_dec_tv_template, DES_CBC_DEC_TEST_VECTORS);
629 627
630 //DES3_EDE 628 //DES3_EDE
631 test_cipher ("des3_ede", MODE_ECB, ENCRYPT, des3_ede_enc_tv_template, DES3_EDE_ENC_TEST_VECTORS); 629 test_cipher ("des3_ede", MODE_ECB, ENCRYPT, des3_ede_enc_tv_template, DES3_EDE_ENC_TEST_VECTORS);
632 test_cipher ("des3_ede", MODE_ECB, DECRYPT, des3_ede_dec_tv_template, DES3_EDE_DEC_TEST_VECTORS); 630 test_cipher ("des3_ede", MODE_ECB, DECRYPT, des3_ede_dec_tv_template, DES3_EDE_DEC_TEST_VECTORS);
633 631
634 test_hash("md4", md4_tv_template, MD4_TEST_VECTORS); 632 test_hash("md4", md4_tv_template, MD4_TEST_VECTORS);
635 633
636 test_hash("sha256", sha256_tv_template, SHA256_TEST_VECTORS); 634 test_hash("sha256", sha256_tv_template, SHA256_TEST_VECTORS);
637 635
638 //BLOWFISH 636 //BLOWFISH
639 test_cipher ("blowfish", MODE_ECB, ENCRYPT, bf_enc_tv_template, BF_ENC_TEST_VECTORS); 637 test_cipher ("blowfish", MODE_ECB, ENCRYPT, bf_enc_tv_template, BF_ENC_TEST_VECTORS);
640 test_cipher ("blowfish", MODE_ECB, DECRYPT, bf_dec_tv_template, BF_DEC_TEST_VECTORS); 638 test_cipher ("blowfish", MODE_ECB, DECRYPT, bf_dec_tv_template, BF_DEC_TEST_VECTORS);
641 test_cipher ("blowfish", MODE_CBC, ENCRYPT, bf_cbc_enc_tv_template, BF_CBC_ENC_TEST_VECTORS); 639 test_cipher ("blowfish", MODE_CBC, ENCRYPT, bf_cbc_enc_tv_template, BF_CBC_ENC_TEST_VECTORS);
642 test_cipher ("blowfish", MODE_CBC, DECRYPT, bf_cbc_dec_tv_template, BF_CBC_DEC_TEST_VECTORS); 640 test_cipher ("blowfish", MODE_CBC, DECRYPT, bf_cbc_dec_tv_template, BF_CBC_DEC_TEST_VECTORS);
643 641
644 //TWOFISH 642 //TWOFISH
645 test_cipher ("twofish", MODE_ECB, ENCRYPT, tf_enc_tv_template, TF_ENC_TEST_VECTORS); 643 test_cipher ("twofish", MODE_ECB, ENCRYPT, tf_enc_tv_template, TF_ENC_TEST_VECTORS);
646 test_cipher ("twofish", MODE_ECB, DECRYPT, tf_dec_tv_template, TF_DEC_TEST_VECTORS); 644 test_cipher ("twofish", MODE_ECB, DECRYPT, tf_dec_tv_template, TF_DEC_TEST_VECTORS);
647 test_cipher ("twofish", MODE_CBC, ENCRYPT, tf_cbc_enc_tv_template, TF_CBC_ENC_TEST_VECTORS); 645 test_cipher ("twofish", MODE_CBC, ENCRYPT, tf_cbc_enc_tv_template, TF_CBC_ENC_TEST_VECTORS);
648 test_cipher ("twofish", MODE_CBC, DECRYPT, tf_cbc_dec_tv_template, TF_CBC_DEC_TEST_VECTORS); 646 test_cipher ("twofish", MODE_CBC, DECRYPT, tf_cbc_dec_tv_template, TF_CBC_DEC_TEST_VECTORS);
649 647
650 //SERPENT 648 //SERPENT
651 test_cipher ("serpent", MODE_ECB, ENCRYPT, serpent_enc_tv_template, SERPENT_ENC_TEST_VECTORS); 649 test_cipher ("serpent", MODE_ECB, ENCRYPT, serpent_enc_tv_template, SERPENT_ENC_TEST_VECTORS);
652 test_cipher ("serpent", MODE_ECB, DECRYPT, serpent_dec_tv_template, SERPENT_DEC_TEST_VECTORS); 650 test_cipher ("serpent", MODE_ECB, DECRYPT, serpent_dec_tv_template, SERPENT_DEC_TEST_VECTORS);
653 651
654 //TNEPRES 652 //TNEPRES
655 test_cipher ("tnepres", MODE_ECB, ENCRYPT, tnepres_enc_tv_template, TNEPRES_ENC_TEST_VECTORS); 653 test_cipher ("tnepres", MODE_ECB, ENCRYPT, tnepres_enc_tv_template, TNEPRES_ENC_TEST_VECTORS);
656 test_cipher ("tnepres", MODE_ECB, DECRYPT, tnepres_dec_tv_template, TNEPRES_DEC_TEST_VECTORS); 654 test_cipher ("tnepres", MODE_ECB, DECRYPT, tnepres_dec_tv_template, TNEPRES_DEC_TEST_VECTORS);
@@ -662,7 +660,7 @@ do_test(void)
662 //CAST5 660 //CAST5
663 test_cipher ("cast5", MODE_ECB, ENCRYPT, cast5_enc_tv_template, CAST5_ENC_TEST_VECTORS); 661 test_cipher ("cast5", MODE_ECB, ENCRYPT, cast5_enc_tv_template, CAST5_ENC_TEST_VECTORS);
664 test_cipher ("cast5", MODE_ECB, DECRYPT, cast5_dec_tv_template, CAST5_DEC_TEST_VECTORS); 662 test_cipher ("cast5", MODE_ECB, DECRYPT, cast5_dec_tv_template, CAST5_DEC_TEST_VECTORS);
665 663
666 //CAST6 664 //CAST6
667 test_cipher ("cast6", MODE_ECB, ENCRYPT, cast6_enc_tv_template, CAST6_ENC_TEST_VECTORS); 665 test_cipher ("cast6", MODE_ECB, ENCRYPT, cast6_enc_tv_template, CAST6_ENC_TEST_VECTORS);
668 test_cipher ("cast6", MODE_ECB, DECRYPT, cast6_dec_tv_template, CAST6_DEC_TEST_VECTORS); 666 test_cipher ("cast6", MODE_ECB, DECRYPT, cast6_dec_tv_template, CAST6_DEC_TEST_VECTORS);
@@ -702,9 +700,9 @@ do_test(void)
702 test_crc32c(); 700 test_crc32c();
703#ifdef CONFIG_CRYPTO_HMAC 701#ifdef CONFIG_CRYPTO_HMAC
704 test_hmac("md5", hmac_md5_tv_template, HMAC_MD5_TEST_VECTORS); 702 test_hmac("md5", hmac_md5_tv_template, HMAC_MD5_TEST_VECTORS);
705 test_hmac("sha1", hmac_sha1_tv_template, HMAC_SHA1_TEST_VECTORS); 703 test_hmac("sha1", hmac_sha1_tv_template, HMAC_SHA1_TEST_VECTORS);
706 test_hmac("sha256", hmac_sha256_tv_template, HMAC_SHA256_TEST_VECTORS); 704 test_hmac("sha256", hmac_sha256_tv_template, HMAC_SHA256_TEST_VECTORS);
707#endif 705#endif
708 706
709 test_hash("michael_mic", michael_mic_tv_template, MICHAEL_MIC_TEST_VECTORS); 707 test_hash("michael_mic", michael_mic_tv_template, MICHAEL_MIC_TEST_VECTORS);
710 break; 708 break;
@@ -726,17 +724,17 @@ do_test(void)
726 724
727 case 4: 725 case 4:
728 test_cipher ("des3_ede", MODE_ECB, ENCRYPT, des3_ede_enc_tv_template, DES3_EDE_ENC_TEST_VECTORS); 726 test_cipher ("des3_ede", MODE_ECB, ENCRYPT, des3_ede_enc_tv_template, DES3_EDE_ENC_TEST_VECTORS);
729 test_cipher ("des3_ede", MODE_ECB, DECRYPT, des3_ede_dec_tv_template, DES3_EDE_DEC_TEST_VECTORS); 727 test_cipher ("des3_ede", MODE_ECB, DECRYPT, des3_ede_dec_tv_template, DES3_EDE_DEC_TEST_VECTORS);
730 break; 728 break;
731 729
732 case 5: 730 case 5:
733 test_hash("md4", md4_tv_template, MD4_TEST_VECTORS); 731 test_hash("md4", md4_tv_template, MD4_TEST_VECTORS);
734 break; 732 break;
735 733
736 case 6: 734 case 6:
737 test_hash("sha256", sha256_tv_template, SHA256_TEST_VECTORS); 735 test_hash("sha256", sha256_tv_template, SHA256_TEST_VECTORS);
738 break; 736 break;
739 737
740 case 7: 738 case 7:
741 test_cipher ("blowfish", MODE_ECB, ENCRYPT, bf_enc_tv_template, BF_ENC_TEST_VECTORS); 739 test_cipher ("blowfish", MODE_ECB, ENCRYPT, bf_enc_tv_template, BF_ENC_TEST_VECTORS);
742 test_cipher ("blowfish", MODE_ECB, DECRYPT, bf_dec_tv_template, BF_DEC_TEST_VECTORS); 740 test_cipher ("blowfish", MODE_ECB, DECRYPT, bf_dec_tv_template, BF_DEC_TEST_VECTORS);
@@ -750,7 +748,7 @@ do_test(void)
750 test_cipher ("twofish", MODE_CBC, ENCRYPT, tf_cbc_enc_tv_template, TF_CBC_ENC_TEST_VECTORS); 748 test_cipher ("twofish", MODE_CBC, ENCRYPT, tf_cbc_enc_tv_template, TF_CBC_ENC_TEST_VECTORS);
751 test_cipher ("twofish", MODE_CBC, DECRYPT, tf_cbc_dec_tv_template, TF_CBC_DEC_TEST_VECTORS); 749 test_cipher ("twofish", MODE_CBC, DECRYPT, tf_cbc_dec_tv_template, TF_CBC_DEC_TEST_VECTORS);
752 break; 750 break;
753 751
754 case 9: 752 case 9:
755 test_cipher ("serpent", MODE_ECB, ENCRYPT, serpent_enc_tv_template, SERPENT_ENC_TEST_VECTORS); 753 test_cipher ("serpent", MODE_ECB, ENCRYPT, serpent_enc_tv_template, SERPENT_ENC_TEST_VECTORS);
756 test_cipher ("serpent", MODE_ECB, DECRYPT, serpent_dec_tv_template, SERPENT_DEC_TEST_VECTORS); 754 test_cipher ("serpent", MODE_ECB, DECRYPT, serpent_dec_tv_template, SERPENT_DEC_TEST_VECTORS);
@@ -758,13 +756,13 @@ do_test(void)
758 756
759 case 10: 757 case 10:
760 test_cipher ("aes", MODE_ECB, ENCRYPT, aes_enc_tv_template, AES_ENC_TEST_VECTORS); 758 test_cipher ("aes", MODE_ECB, ENCRYPT, aes_enc_tv_template, AES_ENC_TEST_VECTORS);
761 test_cipher ("aes", MODE_ECB, DECRYPT, aes_dec_tv_template, AES_DEC_TEST_VECTORS); 759 test_cipher ("aes", MODE_ECB, DECRYPT, aes_dec_tv_template, AES_DEC_TEST_VECTORS);
762 break; 760 break;
763 761
764 case 11: 762 case 11:
765 test_hash("sha384", sha384_tv_template, SHA384_TEST_VECTORS); 763 test_hash("sha384", sha384_tv_template, SHA384_TEST_VECTORS);
766 break; 764 break;
767 765
768 case 12: 766 case 12:
769 test_hash("sha512", sha512_tv_template, SHA512_TEST_VECTORS); 767 test_hash("sha512", sha512_tv_template, SHA512_TEST_VECTORS);
770 break; 768 break;
@@ -852,11 +850,11 @@ do_test(void)
852 case 100: 850 case 100:
853 test_hmac("md5", hmac_md5_tv_template, HMAC_MD5_TEST_VECTORS); 851 test_hmac("md5", hmac_md5_tv_template, HMAC_MD5_TEST_VECTORS);
854 break; 852 break;
855 853
856 case 101: 854 case 101:
857 test_hmac("sha1", hmac_sha1_tv_template, HMAC_SHA1_TEST_VECTORS); 855 test_hmac("sha1", hmac_sha1_tv_template, HMAC_SHA1_TEST_VECTORS);
858 break; 856 break;
859 857
860 case 102: 858 case 102:
861 test_hmac("sha256", hmac_sha256_tv_template, HMAC_SHA256_TEST_VECTORS); 859 test_hmac("sha256", hmac_sha256_tv_template, HMAC_SHA256_TEST_VECTORS);
862 break; 860 break;
@@ -866,7 +864,7 @@ do_test(void)
866 case 1000: 864 case 1000:
867 test_available(); 865 test_available();
868 break; 866 break;
869 867
870 default: 868 default:
871 /* useful for debugging */ 869 /* useful for debugging */
872 printk("not testing anything\n"); 870 printk("not testing anything\n");
@@ -874,8 +872,7 @@ do_test(void)
874 } 872 }
875} 873}
876 874
877static int __init 875static int __init init(void)
878init(void)
879{ 876{
880 tvmem = kmalloc(TVMEMSIZE, GFP_KERNEL); 877 tvmem = kmalloc(TVMEMSIZE, GFP_KERNEL);
881 if (tvmem == NULL) 878 if (tvmem == NULL)
diff --git a/crypto/tcrypt.h b/crypto/tcrypt.h
index a3097afae593..72d40704042f 100644
--- a/crypto/tcrypt.h
+++ b/crypto/tcrypt.h
@@ -9,7 +9,7 @@
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify it 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 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) 12 * Software Foundation; either version 2 of the License, or (at your option)
13 * any later version. 13 * any later version.
14 * 14 *
15 * 14 - 09 - 2003 Changes by Kartikey Mahendra Bhatt 15 * 14 - 09 - 2003 Changes by Kartikey Mahendra Bhatt
@@ -29,19 +29,19 @@ struct hash_testvec {
29 unsigned char psize; 29 unsigned char psize;
30 char digest[MAX_DIGEST_SIZE]; 30 char digest[MAX_DIGEST_SIZE];
31 unsigned char np; 31 unsigned char np;
32 unsigned char tap[MAX_TAP]; 32 unsigned char tap[MAX_TAP];
33 char key[128]; /* only used with keyed hash algorithms */ 33 char key[128]; /* only used with keyed hash algorithms */
34 unsigned char ksize; 34 unsigned char ksize;
35}; 35};
36 36
37struct hmac_testvec { 37struct hmac_testvec {
38 char key[128]; 38 char key[128];
39 unsigned char ksize; 39 unsigned char ksize;
40 char plaintext[128]; 40 char plaintext[128];
41 unsigned char psize; 41 unsigned char psize;
42 char digest[MAX_DIGEST_SIZE]; 42 char digest[MAX_DIGEST_SIZE];
43 unsigned char np; 43 unsigned char np;
44 unsigned char tap[MAX_TAP]; 44 unsigned char tap[MAX_TAP];
45}; 45};
46 46
47struct cipher_testvec { 47struct cipher_testvec {
@@ -55,7 +55,7 @@ struct cipher_testvec {
55 char result[48]; 55 char result[48];
56 unsigned char rlen; 56 unsigned char rlen;
57 int np; 57 int np;
58 unsigned char tap[MAX_TAP]; 58 unsigned char tap[MAX_TAP];
59}; 59};
60 60
61/* 61/*
@@ -155,7 +155,7 @@ static struct hash_testvec md5_tv_template[] = {
155#define SHA1_TEST_VECTORS 2 155#define SHA1_TEST_VECTORS 2
156 156
157static struct hash_testvec sha1_tv_template[] = { 157static struct hash_testvec sha1_tv_template[] = {
158 { 158 {
159 .plaintext = "abc", 159 .plaintext = "abc",
160 .psize = 3, 160 .psize = 3,
161 .digest = { 0xa9, 0x99, 0x3e, 0x36, 0x47, 0x06, 0x81, 0x6a, 0xba, 0x3e, 161 .digest = { 0xa9, 0x99, 0x3e, 0x36, 0x47, 0x06, 0x81, 0x6a, 0xba, 0x3e,
@@ -175,8 +175,8 @@ static struct hash_testvec sha1_tv_template[] = {
175 */ 175 */
176#define SHA256_TEST_VECTORS 2 176#define SHA256_TEST_VECTORS 2
177 177
178static struct hash_testvec sha256_tv_template[] = { 178static struct hash_testvec sha256_tv_template[] = {
179 { 179 {
180 .plaintext = "abc", 180 .plaintext = "abc",
181 .psize = 3, 181 .psize = 3,
182 .digest = { 0xba, 0x78, 0x16, 0xbf, 0x8f, 0x01, 0xcf, 0xea, 182 .digest = { 0xba, 0x78, 0x16, 0xbf, 0x8f, 0x01, 0xcf, 0xea,
@@ -201,7 +201,7 @@ static struct hash_testvec sha256_tv_template[] = {
201#define SHA384_TEST_VECTORS 4 201#define SHA384_TEST_VECTORS 4
202 202
203static struct hash_testvec sha384_tv_template[] = { 203static struct hash_testvec sha384_tv_template[] = {
204 { 204 {
205 .plaintext= "abc", 205 .plaintext= "abc",
206 .psize = 3, 206 .psize = 3,
207 .digest = { 0xcb, 0x00, 0x75, 0x3f, 0x45, 0xa3, 0x5e, 0x8b, 207 .digest = { 0xcb, 0x00, 0x75, 0x3f, 0x45, 0xa3, 0x5e, 0x8b,
@@ -221,7 +221,7 @@ static struct hash_testvec sha384_tv_template[] = {
221 0x5f, 0xe9, 0x5b, 0x1f, 0xe3, 0xc8, 0x45, 0x2b}, 221 0x5f, 0xe9, 0x5b, 0x1f, 0xe3, 0xc8, 0x45, 0x2b},
222 }, { 222 }, {
223 .plaintext = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmn" 223 .plaintext = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmn"
224 "hijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu", 224 "hijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu",
225 .psize = 112, 225 .psize = 112,
226 .digest = { 0x09, 0x33, 0x0c, 0x33, 0xf7, 0x11, 0x47, 0xe8, 226 .digest = { 0x09, 0x33, 0x0c, 0x33, 0xf7, 0x11, 0x47, 0xe8,
227 0x3d, 0x19, 0x2f, 0xc7, 0x82, 0xcd, 0x1b, 0x47, 227 0x3d, 0x19, 0x2f, 0xc7, 0x82, 0xcd, 0x1b, 0x47,
@@ -250,7 +250,7 @@ static struct hash_testvec sha384_tv_template[] = {
250#define SHA512_TEST_VECTORS 4 250#define SHA512_TEST_VECTORS 4
251 251
252static struct hash_testvec sha512_tv_template[] = { 252static struct hash_testvec sha512_tv_template[] = {
253 { 253 {
254 .plaintext = "abc", 254 .plaintext = "abc",
255 .psize = 3, 255 .psize = 3,
256 .digest = { 0xdd, 0xaf, 0x35, 0xa1, 0x93, 0x61, 0x7a, 0xba, 256 .digest = { 0xdd, 0xaf, 0x35, 0xa1, 0x93, 0x61, 0x7a, 0xba,
@@ -303,14 +303,14 @@ static struct hash_testvec sha512_tv_template[] = {
303 303
304 304
305/* 305/*
306 * WHIRLPOOL test vectors from Whirlpool package 306 * WHIRLPOOL test vectors from Whirlpool package
307 * by Vincent Rijmen and Paulo S. L. M. Barreto as part of the NESSIE 307 * by Vincent Rijmen and Paulo S. L. M. Barreto as part of the NESSIE
308 * submission 308 * submission
309 */ 309 */
310#define WP512_TEST_VECTORS 8 310#define WP512_TEST_VECTORS 8
311 311
312static struct hash_testvec wp512_tv_template[] = { 312static struct hash_testvec wp512_tv_template[] = {
313 { 313 {
314 .plaintext = "", 314 .plaintext = "",
315 .psize = 0, 315 .psize = 0,
316 .digest = { 0x19, 0xFA, 0x61, 0xD7, 0x55, 0x22, 0xA4, 0x66, 316 .digest = { 0x19, 0xFA, 0x61, 0xD7, 0x55, 0x22, 0xA4, 0x66,
@@ -348,13 +348,13 @@ static struct hash_testvec wp512_tv_template[] = {
348 }, { 348 }, {
349 .plaintext = "message digest", 349 .plaintext = "message digest",
350 .psize = 14, 350 .psize = 14,
351 .digest = { 0x37, 0x8C, 0x84, 0xA4, 0x12, 0x6E, 0x2D, 0xC6, 351 .digest = { 0x37, 0x8C, 0x84, 0xA4, 0x12, 0x6E, 0x2D, 0xC6,
352 0xE5, 0x6D, 0xCC, 0x74, 0x58, 0x37, 0x7A, 0xAC, 352 0xE5, 0x6D, 0xCC, 0x74, 0x58, 0x37, 0x7A, 0xAC,
353 0x83, 0x8D, 0x00, 0x03, 0x22, 0x30, 0xF5, 0x3C, 353 0x83, 0x8D, 0x00, 0x03, 0x22, 0x30, 0xF5, 0x3C,
354 0xE1, 0xF5, 0x70, 0x0C, 0x0F, 0xFB, 0x4D, 0x3B, 354 0xE1, 0xF5, 0x70, 0x0C, 0x0F, 0xFB, 0x4D, 0x3B,
355 0x84, 0x21, 0x55, 0x76, 0x59, 0xEF, 0x55, 0xC1, 355 0x84, 0x21, 0x55, 0x76, 0x59, 0xEF, 0x55, 0xC1,
356 0x06, 0xB4, 0xB5, 0x2A, 0xC5, 0xA4, 0xAA, 0xA6, 356 0x06, 0xB4, 0xB5, 0x2A, 0xC5, 0xA4, 0xAA, 0xA6,
357 0x92, 0xED, 0x92, 0x00, 0x52, 0x83, 0x8F, 0x33, 357 0x92, 0xED, 0x92, 0x00, 0x52, 0x83, 0x8F, 0x33,
358 0x62, 0xE8, 0x6D, 0xBD, 0x37, 0xA8, 0x90, 0x3E }, 358 0x62, 0xE8, 0x6D, 0xBD, 0x37, 0xA8, 0x90, 0x3E },
359 }, { 359 }, {
360 .plaintext = "abcdefghijklmnopqrstuvwxyz", 360 .plaintext = "abcdefghijklmnopqrstuvwxyz",
@@ -394,7 +394,7 @@ static struct hash_testvec wp512_tv_template[] = {
394 }, { 394 }, {
395 .plaintext = "abcdbcdecdefdefgefghfghighijhijk", 395 .plaintext = "abcdbcdecdefdefgefghfghighijhijk",
396 .psize = 32, 396 .psize = 32,
397 .digest = { 0x2A, 0x98, 0x7E, 0xA4, 0x0F, 0x91, 0x70, 0x61, 397 .digest = { 0x2A, 0x98, 0x7E, 0xA4, 0x0F, 0x91, 0x70, 0x61,
398 0xF5, 0xD6, 0xF0, 0xA0, 0xE4, 0x64, 0x4F, 0x48, 398 0xF5, 0xD6, 0xF0, 0xA0, 0xE4, 0x64, 0x4F, 0x48,
399 0x8A, 0x7A, 0x5A, 0x52, 0xDE, 0xEE, 0x65, 0x62, 399 0x8A, 0x7A, 0x5A, 0x52, 0xDE, 0xEE, 0x65, 0x62,
400 0x07, 0xC5, 0x62, 0xF9, 0x88, 0xE9, 0x5C, 0x69, 400 0x07, 0xC5, 0x62, 0xF9, 0x88, 0xE9, 0x5C, 0x69,
@@ -408,7 +408,7 @@ static struct hash_testvec wp512_tv_template[] = {
408#define WP384_TEST_VECTORS 8 408#define WP384_TEST_VECTORS 8
409 409
410static struct hash_testvec wp384_tv_template[] = { 410static struct hash_testvec wp384_tv_template[] = {
411 { 411 {
412 .plaintext = "", 412 .plaintext = "",
413 .psize = 0, 413 .psize = 0,
414 .digest = { 0x19, 0xFA, 0x61, 0xD7, 0x55, 0x22, 0xA4, 0x66, 414 .digest = { 0x19, 0xFA, 0x61, 0xD7, 0x55, 0x22, 0xA4, 0x66,
@@ -440,11 +440,11 @@ static struct hash_testvec wp384_tv_template[] = {
440 }, { 440 }, {
441 .plaintext = "message digest", 441 .plaintext = "message digest",
442 .psize = 14, 442 .psize = 14,
443 .digest = { 0x37, 0x8C, 0x84, 0xA4, 0x12, 0x6E, 0x2D, 0xC6, 443 .digest = { 0x37, 0x8C, 0x84, 0xA4, 0x12, 0x6E, 0x2D, 0xC6,
444 0xE5, 0x6D, 0xCC, 0x74, 0x58, 0x37, 0x7A, 0xAC, 444 0xE5, 0x6D, 0xCC, 0x74, 0x58, 0x37, 0x7A, 0xAC,
445 0x83, 0x8D, 0x00, 0x03, 0x22, 0x30, 0xF5, 0x3C, 445 0x83, 0x8D, 0x00, 0x03, 0x22, 0x30, 0xF5, 0x3C,
446 0xE1, 0xF5, 0x70, 0x0C, 0x0F, 0xFB, 0x4D, 0x3B, 446 0xE1, 0xF5, 0x70, 0x0C, 0x0F, 0xFB, 0x4D, 0x3B,
447 0x84, 0x21, 0x55, 0x76, 0x59, 0xEF, 0x55, 0xC1, 447 0x84, 0x21, 0x55, 0x76, 0x59, 0xEF, 0x55, 0xC1,
448 0x06, 0xB4, 0xB5, 0x2A, 0xC5, 0xA4, 0xAA, 0xA6 }, 448 0x06, 0xB4, 0xB5, 0x2A, 0xC5, 0xA4, 0xAA, 0xA6 },
449 }, { 449 }, {
450 .plaintext = "abcdefghijklmnopqrstuvwxyz", 450 .plaintext = "abcdefghijklmnopqrstuvwxyz",
@@ -478,7 +478,7 @@ static struct hash_testvec wp384_tv_template[] = {
478 }, { 478 }, {
479 .plaintext = "abcdbcdecdefdefgefghfghighijhijk", 479 .plaintext = "abcdbcdecdefdefgefghfghighijhijk",
480 .psize = 32, 480 .psize = 32,
481 .digest = { 0x2A, 0x98, 0x7E, 0xA4, 0x0F, 0x91, 0x70, 0x61, 481 .digest = { 0x2A, 0x98, 0x7E, 0xA4, 0x0F, 0x91, 0x70, 0x61,
482 0xF5, 0xD6, 0xF0, 0xA0, 0xE4, 0x64, 0x4F, 0x48, 482 0xF5, 0xD6, 0xF0, 0xA0, 0xE4, 0x64, 0x4F, 0x48,
483 0x8A, 0x7A, 0x5A, 0x52, 0xDE, 0xEE, 0x65, 0x62, 483 0x8A, 0x7A, 0x5A, 0x52, 0xDE, 0xEE, 0x65, 0x62,
484 0x07, 0xC5, 0x62, 0xF9, 0x88, 0xE9, 0x5C, 0x69, 484 0x07, 0xC5, 0x62, 0xF9, 0x88, 0xE9, 0x5C, 0x69,
@@ -490,7 +490,7 @@ static struct hash_testvec wp384_tv_template[] = {
490#define WP256_TEST_VECTORS 8 490#define WP256_TEST_VECTORS 8
491 491
492static struct hash_testvec wp256_tv_template[] = { 492static struct hash_testvec wp256_tv_template[] = {
493 { 493 {
494 .plaintext = "", 494 .plaintext = "",
495 .psize = 0, 495 .psize = 0,
496 .digest = { 0x19, 0xFA, 0x61, 0xD7, 0x55, 0x22, 0xA4, 0x66, 496 .digest = { 0x19, 0xFA, 0x61, 0xD7, 0x55, 0x22, 0xA4, 0x66,
@@ -516,9 +516,9 @@ static struct hash_testvec wp256_tv_template[] = {
516 }, { 516 }, {
517 .plaintext = "message digest", 517 .plaintext = "message digest",
518 .psize = 14, 518 .psize = 14,
519 .digest = { 0x37, 0x8C, 0x84, 0xA4, 0x12, 0x6E, 0x2D, 0xC6, 519 .digest = { 0x37, 0x8C, 0x84, 0xA4, 0x12, 0x6E, 0x2D, 0xC6,
520 0xE5, 0x6D, 0xCC, 0x74, 0x58, 0x37, 0x7A, 0xAC, 520 0xE5, 0x6D, 0xCC, 0x74, 0x58, 0x37, 0x7A, 0xAC,
521 0x83, 0x8D, 0x00, 0x03, 0x22, 0x30, 0xF5, 0x3C, 521 0x83, 0x8D, 0x00, 0x03, 0x22, 0x30, 0xF5, 0x3C,
522 0xE1, 0xF5, 0x70, 0x0C, 0x0F, 0xFB, 0x4D, 0x3B }, 522 0xE1, 0xF5, 0x70, 0x0C, 0x0F, 0xFB, 0x4D, 0x3B },
523 }, { 523 }, {
524 .plaintext = "abcdefghijklmnopqrstuvwxyz", 524 .plaintext = "abcdefghijklmnopqrstuvwxyz",
@@ -546,7 +546,7 @@ static struct hash_testvec wp256_tv_template[] = {
546 }, { 546 }, {
547 .plaintext = "abcdbcdecdefdefgefghfghighijhijk", 547 .plaintext = "abcdbcdecdefdefgefghfghighijhijk",
548 .psize = 32, 548 .psize = 32,
549 .digest = { 0x2A, 0x98, 0x7E, 0xA4, 0x0F, 0x91, 0x70, 0x61, 549 .digest = { 0x2A, 0x98, 0x7E, 0xA4, 0x0F, 0x91, 0x70, 0x61,
550 0xF5, 0xD6, 0xF0, 0xA0, 0xE4, 0x64, 0x4F, 0x48, 550 0xF5, 0xD6, 0xF0, 0xA0, 0xE4, 0x64, 0x4F, 0x48,
551 0x8A, 0x7A, 0x5A, 0x52, 0xDE, 0xEE, 0x65, 0x62, 551 0x8A, 0x7A, 0x5A, 0x52, 0xDE, 0xEE, 0x65, 0x62,
552 0x07, 0xC5, 0x62, 0xF9, 0x88, 0xE9, 0x5C, 0x69 }, 552 0x07, 0xC5, 0x62, 0xF9, 0x88, 0xE9, 0x5C, 0x69 },
@@ -554,7 +554,7 @@ static struct hash_testvec wp256_tv_template[] = {
554}; 554};
555 555
556/* 556/*
557 * TIGER test vectors from Tiger website 557 * TIGER test vectors from Tiger website
558 */ 558 */
559#define TGR192_TEST_VECTORS 6 559#define TGR192_TEST_VECTORS 6
560 560
@@ -693,7 +693,7 @@ static struct hash_testvec tgr128_tv_template[] = {
693#define HMAC_MD5_TEST_VECTORS 7 693#define HMAC_MD5_TEST_VECTORS 7
694 694
695static struct hmac_testvec hmac_md5_tv_template[] = 695static struct hmac_testvec hmac_md5_tv_template[] =
696{ 696{
697 { 697 {
698 .key = { [0 ... 15] = 0x0b }, 698 .key = { [0 ... 15] = 0x0b },
699 .ksize = 16, 699 .ksize = 16,
@@ -756,7 +756,7 @@ static struct hmac_testvec hmac_md5_tv_template[] =
756 */ 756 */
757#define HMAC_SHA1_TEST_VECTORS 7 757#define HMAC_SHA1_TEST_VECTORS 7
758 758
759static struct hmac_testvec hmac_sha1_tv_template[] = { 759static struct hmac_testvec hmac_sha1_tv_template[] = {
760 { 760 {
761 .key = { [0 ... 19] = 0x0b }, 761 .key = { [0 ... 19] = 0x0b },
762 .ksize = 20, 762 .ksize = 20,
@@ -766,11 +766,11 @@ static struct hmac_testvec hmac_sha1_tv_template[] = {
766 0xe2, 0x8b, 0xc0, 0xb6, 0xfb, 0x37, 0x8c, 0x8e, 0xf1, 766 0xe2, 0x8b, 0xc0, 0xb6, 0xfb, 0x37, 0x8c, 0x8e, 0xf1,
767 0x46, 0xbe }, 767 0x46, 0xbe },
768 }, { 768 }, {
769 .key = { 'J', 'e', 'f', 'e' }, 769 .key = { 'J', 'e', 'f', 'e' },
770 .ksize = 4, 770 .ksize = 4,
771 .plaintext = "what do ya want for nothing?", 771 .plaintext = "what do ya want for nothing?",
772 .psize = 28, 772 .psize = 28,
773 .digest = { 0xef, 0xfc, 0xdf, 0x6a, 0xe5, 0xeb, 0x2f, 0xa2, 0xd2, 0x74, 773 .digest = { 0xef, 0xfc, 0xdf, 0x6a, 0xe5, 0xeb, 0x2f, 0xa2, 0xd2, 0x74,
774 0x16, 0xd5, 0xf1, 0x84, 0xdf, 0x9c, 0x25, 0x9a, 0x7c, 0x79 }, 774 0x16, 0xd5, 0xf1, 0x84, 0xdf, 0x9c, 0x25, 0x9a, 0x7c, 0x79 },
775 .np = 2, 775 .np = 2,
776 .tap = { 14, 14 } 776 .tap = { 14, 14 }
@@ -779,30 +779,30 @@ static struct hmac_testvec hmac_sha1_tv_template[] = {
779 .ksize = 20, 779 .ksize = 20,
780 .plaintext = { [0 ... 49] = 0xdd }, 780 .plaintext = { [0 ... 49] = 0xdd },
781 .psize = 50, 781 .psize = 50,
782 .digest = { 0x12, 0x5d, 0x73, 0x42, 0xb9, 0xac, 0x11, 0xcd, 0x91, 0xa3, 782 .digest = { 0x12, 0x5d, 0x73, 0x42, 0xb9, 0xac, 0x11, 0xcd, 0x91, 0xa3,
783 0x9a, 0xf4, 0x8a, 0xa1, 0x7b, 0x4f, 0x63, 0xf1, 0x75, 0xd3 }, 783 0x9a, 0xf4, 0x8a, 0xa1, 0x7b, 0x4f, 0x63, 0xf1, 0x75, 0xd3 },
784 }, { 784 }, {
785 .key = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 785 .key = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
786 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 786 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
787 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19 }, 787 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19 },
788 .ksize = 25, 788 .ksize = 25,
789 .plaintext = { [0 ... 49] = 0xcd }, 789 .plaintext = { [0 ... 49] = 0xcd },
790 .psize = 50, 790 .psize = 50,
791 .digest = { 0x4c, 0x90, 0x07, 0xf4, 0x02, 0x62, 0x50, 0xc6, 0xbc, 0x84, 791 .digest = { 0x4c, 0x90, 0x07, 0xf4, 0x02, 0x62, 0x50, 0xc6, 0xbc, 0x84,
792 0x14, 0xf9, 0xbf, 0x50, 0xc8, 0x6c, 0x2d, 0x72, 0x35, 0xda }, 792 0x14, 0xf9, 0xbf, 0x50, 0xc8, 0x6c, 0x2d, 0x72, 0x35, 0xda },
793 }, { 793 }, {
794 .key = { [0 ... 19] = 0x0c }, 794 .key = { [0 ... 19] = 0x0c },
795 .ksize = 20, 795 .ksize = 20,
796 .plaintext = "Test With Truncation", 796 .plaintext = "Test With Truncation",
797 .psize = 20, 797 .psize = 20,
798 .digest = { 0x4c, 0x1a, 0x03, 0x42, 0x4b, 0x55, 0xe0, 0x7f, 0xe7, 0xf2, 798 .digest = { 0x4c, 0x1a, 0x03, 0x42, 0x4b, 0x55, 0xe0, 0x7f, 0xe7, 0xf2,
799 0x7b, 0xe1, 0xd5, 0x8b, 0xb9, 0x32, 0x4a, 0x9a, 0x5a, 0x04 }, 799 0x7b, 0xe1, 0xd5, 0x8b, 0xb9, 0x32, 0x4a, 0x9a, 0x5a, 0x04 },
800 }, { 800 }, {
801 .key = { [0 ... 79] = 0xaa }, 801 .key = { [0 ... 79] = 0xaa },
802 .ksize = 80, 802 .ksize = 80,
803 .plaintext = "Test Using Larger Than Block-Size Key - Hash Key First", 803 .plaintext = "Test Using Larger Than Block-Size Key - Hash Key First",
804 .psize = 54, 804 .psize = 54,
805 .digest = { 0xaa, 0x4a, 0xe5, 0xe1, 0x52, 0x72, 0xd0, 0x0e, 0x95, 0x70, 805 .digest = { 0xaa, 0x4a, 0xe5, 0xe1, 0x52, 0x72, 0xd0, 0x0e, 0x95, 0x70,
806 0x56, 0x37, 0xce, 0x8a, 0x3b, 0x55, 0xed, 0x40, 0x21, 0x12 }, 806 0x56, 0x37, 0xce, 0x8a, 0x3b, 0x55, 0xed, 0x40, 0x21, 0x12 },
807 }, { 807 }, {
808 .key = { [0 ... 79] = 0xaa }, 808 .key = { [0 ... 79] = 0xaa },
@@ -810,7 +810,7 @@ static struct hmac_testvec hmac_sha1_tv_template[] = {
810 .plaintext = "Test Using Larger Than Block-Size Key and Larger Than One " 810 .plaintext = "Test Using Larger Than Block-Size Key and Larger Than One "
811 "Block-Size Data", 811 "Block-Size Data",
812 .psize = 73, 812 .psize = 73,
813 .digest = { 0xe8, 0xe9, 0x9d, 0x0f, 0x45, 0x23, 0x7d, 0x78, 0x6d, 0x6b, 813 .digest = { 0xe8, 0xe9, 0x9d, 0x0f, 0x45, 0x23, 0x7d, 0x78, 0x6d, 0x6b,
814 0xba, 0xa7, 0x96, 0x5c, 0x78, 0x08, 0xbb, 0xff, 0x1a, 0x91 }, 814 0xba, 0xa7, 0x96, 0x5c, 0x78, 0x08, 0xbb, 0xff, 0x1a, 0x91 },
815 }, 815 },
816}; 816};
@@ -1011,7 +1011,7 @@ static struct cipher_testvec des_enc_tv_template[] = {
1011 0xf7, 0x9c, 0x89, 0x2a, 0x33, 0x8f, 0x4a, 0x8b }, 1011 0xf7, 0x9c, 0x89, 0x2a, 0x33, 0x8f, 0x4a, 0x8b },
1012 .rlen = 32, 1012 .rlen = 32,
1013 .np = 3, 1013 .np = 3,
1014 .tap = { 14, 10, 8 } 1014 .tap = { 14, 10, 8 }
1015 }, { 1015 }, {
1016 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, 1016 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1017 .klen = 8, 1017 .klen = 8,
@@ -1024,7 +1024,7 @@ static struct cipher_testvec des_enc_tv_template[] = {
1024 0xb4, 0x99, 0x26, 0xf7, 0x1f, 0xe1, 0xd4, 0x90 }, 1024 0xb4, 0x99, 0x26, 0xf7, 0x1f, 0xe1, 0xd4, 0x90 },
1025 .rlen = 24, 1025 .rlen = 24,
1026 .np = 4, 1026 .np = 4,
1027 .tap = { 2, 1, 3, 18 } 1027 .tap = { 2, 1, 3, 18 }
1028 }, { 1028 }, {
1029 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, 1029 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1030 .klen = 8, 1030 .klen = 8,
@@ -1035,7 +1035,7 @@ static struct cipher_testvec des_enc_tv_template[] = {
1035 0xf7, 0x9c, 0x89, 0x2a, 0x33, 0x8f, 0x4a, 0x8b }, 1035 0xf7, 0x9c, 0x89, 0x2a, 0x33, 0x8f, 0x4a, 0x8b },
1036 .rlen = 16, 1036 .rlen = 16,
1037 .np = 5, 1037 .np = 5,
1038 .tap = { 2, 2, 2, 2, 8 } 1038 .tap = { 2, 2, 2, 2, 8 }
1039 }, { 1039 }, {
1040 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, 1040 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1041 .klen = 8, 1041 .klen = 8,
@@ -1044,7 +1044,7 @@ static struct cipher_testvec des_enc_tv_template[] = {
1044 .result = { 0xc9, 0x57, 0x44, 0x25, 0x6a, 0x5e, 0xd3, 0x1d }, 1044 .result = { 0xc9, 0x57, 0x44, 0x25, 0x6a, 0x5e, 0xd3, 0x1d },
1045 .rlen = 8, 1045 .rlen = 8,
1046 .np = 8, 1046 .np = 8,
1047 .tap = { 1, 1, 1, 1, 1, 1, 1, 1 } 1047 .tap = { 1, 1, 1, 1, 1, 1, 1, 1 }
1048 }, 1048 },
1049}; 1049};
1050 1050
@@ -1057,7 +1057,7 @@ static struct cipher_testvec des_dec_tv_template[] = {
1057 .result = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xe7 }, 1057 .result = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xe7 },
1058 .rlen = 8, 1058 .rlen = 8,
1059 }, { /* Sbox test from NBS */ 1059 }, { /* Sbox test from NBS */
1060 .key = { 0x7c, 0xa1, 0x10, 0x45, 0x4a, 0x1a, 0x6e, 0x57 }, 1060 .key = { 0x7c, 0xa1, 0x10, 0x45, 0x4a, 0x1a, 0x6e, 0x57 },
1061 .klen = 8, 1061 .klen = 8,
1062 .input = { 0x69, 0x0f, 0x5b, 0x0d, 0x9a, 0x26, 0x93, 0x9b }, 1062 .input = { 0x69, 0x0f, 0x5b, 0x0d, 0x9a, 0x26, 0x93, 0x9b },
1063 .ilen = 8, 1063 .ilen = 8,
@@ -1092,19 +1092,19 @@ static struct cipher_testvec des_cbc_enc_tv_template[] = {
1092 { /* From OpenSSL */ 1092 { /* From OpenSSL */
1093 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef}, 1093 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef},
1094 .klen = 8, 1094 .klen = 8,
1095 .iv = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10}, 1095 .iv = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10},
1096 .input = { 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x31, 0x20, 1096 .input = { 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x31, 0x20,
1097 0x4e, 0x6f, 0x77, 0x20, 0x69, 0x73, 0x20, 0x74, 1097 0x4e, 0x6f, 0x77, 0x20, 0x69, 0x73, 0x20, 0x74,
1098 0x68, 0x65, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x20 }, 1098 0x68, 0x65, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x20 },
1099 .ilen = 24, 1099 .ilen = 24,
1100 .result = { 0xcc, 0xd1, 0x73, 0xff, 0xab, 0x20, 0x39, 0xf4, 1100 .result = { 0xcc, 0xd1, 0x73, 0xff, 0xab, 0x20, 0x39, 0xf4,
1101 0xac, 0xd8, 0xae, 0xfd, 0xdf, 0xd8, 0xa1, 0xeb, 1101 0xac, 0xd8, 0xae, 0xfd, 0xdf, 0xd8, 0xa1, 0xeb,
1102 0x46, 0x8e, 0x91, 0x15, 0x78, 0x88, 0xba, 0x68 }, 1102 0x46, 0x8e, 0x91, 0x15, 0x78, 0x88, 0xba, 0x68 },
1103 .rlen = 24, 1103 .rlen = 24,
1104 }, { /* FIPS Pub 81 */ 1104 }, { /* FIPS Pub 81 */
1105 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, 1105 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1106 .klen = 8, 1106 .klen = 8,
1107 .iv = { 0x12, 0x34, 0x56, 0x78, 0x90, 0xab, 0xcd, 0xef }, 1107 .iv = { 0x12, 0x34, 0x56, 0x78, 0x90, 0xab, 0xcd, 0xef },
1108 .input = { 0x4e, 0x6f, 0x77, 0x20, 0x69, 0x73, 0x20, 0x74 }, 1108 .input = { 0x4e, 0x6f, 0x77, 0x20, 0x69, 0x73, 0x20, 0x74 },
1109 .ilen = 8, 1109 .ilen = 8,
1110 .result = { 0xe5, 0xc7, 0xcd, 0xde, 0x87, 0x2b, 0xf2, 0x7c }, 1110 .result = { 0xe5, 0xc7, 0xcd, 0xde, 0x87, 0x2b, 0xf2, 0x7c },
@@ -1117,7 +1117,7 @@ static struct cipher_testvec des_cbc_enc_tv_template[] = {
1117 .ilen = 8, 1117 .ilen = 8,
1118 .result = { 0x43, 0xe9, 0x34, 0x00, 0x8c, 0x38, 0x9c, 0x0f }, 1118 .result = { 0x43, 0xe9, 0x34, 0x00, 0x8c, 0x38, 0x9c, 0x0f },
1119 .rlen = 8, 1119 .rlen = 8,
1120 }, { 1120 }, {
1121 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, 1121 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1122 .klen = 8, 1122 .klen = 8,
1123 .iv = { 0x43, 0xe9, 0x34, 0x00, 0x8c, 0x38, 0x9c, 0x0f }, 1123 .iv = { 0x43, 0xe9, 0x34, 0x00, 0x8c, 0x38, 0x9c, 0x0f },
@@ -1125,18 +1125,18 @@ static struct cipher_testvec des_cbc_enc_tv_template[] = {
1125 .ilen = 8, 1125 .ilen = 8,
1126 .result = { 0x68, 0x37, 0x88, 0x49, 0x9a, 0x7c, 0x05, 0xf6 }, 1126 .result = { 0x68, 0x37, 0x88, 0x49, 0x9a, 0x7c, 0x05, 0xf6 },
1127 .rlen = 8, 1127 .rlen = 8,
1128 }, { /* Copy of openssl vector for chunk testing */ 1128 }, { /* Copy of openssl vector for chunk testing */
1129 /* From OpenSSL */ 1129 /* From OpenSSL */
1130 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef}, 1130 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef},
1131 .klen = 8, 1131 .klen = 8,
1132 .iv = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10}, 1132 .iv = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10},
1133 .input = { 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x31, 0x20, 1133 .input = { 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x31, 0x20,
1134 0x4e, 0x6f, 0x77, 0x20, 0x69, 0x73, 0x20, 0x74, 1134 0x4e, 0x6f, 0x77, 0x20, 0x69, 0x73, 0x20, 0x74,
1135 0x68, 0x65, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x20 }, 1135 0x68, 0x65, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x20 },
1136 .ilen = 24, 1136 .ilen = 24,
1137 .result = { 0xcc, 0xd1, 0x73, 0xff, 0xab, 0x20, 0x39, 0xf4, 1137 .result = { 0xcc, 0xd1, 0x73, 0xff, 0xab, 0x20, 0x39, 0xf4,
1138 0xac, 0xd8, 0xae, 0xfd, 0xdf, 0xd8, 0xa1, 0xeb, 1138 0xac, 0xd8, 0xae, 0xfd, 0xdf, 0xd8, 0xa1, 0xeb,
1139 0x46, 0x8e, 0x91, 0x15, 0x78, 0x88, 0xba, 0x68 }, 1139 0x46, 0x8e, 0x91, 0x15, 0x78, 0x88, 0xba, 0x68 },
1140 .rlen = 24, 1140 .rlen = 24,
1141 .np = 2, 1141 .np = 2,
1142 .tap = { 13, 11 } 1142 .tap = { 13, 11 }
@@ -1155,24 +1155,24 @@ static struct cipher_testvec des_cbc_dec_tv_template[] = {
1155 }, { 1155 }, {
1156 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, 1156 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1157 .klen = 8, 1157 .klen = 8,
1158 .iv = { 0xe5, 0xc7, 0xcd, 0xde, 0x87, 0x2b, 0xf2, 0x7c }, 1158 .iv = { 0xe5, 0xc7, 0xcd, 0xde, 0x87, 0x2b, 0xf2, 0x7c },
1159 .input = { 0x43, 0xe9, 0x34, 0x00, 0x8c, 0x38, 0x9c, 0x0f }, 1159 .input = { 0x43, 0xe9, 0x34, 0x00, 0x8c, 0x38, 0x9c, 0x0f },
1160 .ilen = 8, 1160 .ilen = 8,
1161 .result = { 0x68, 0x65, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x20 }, 1161 .result = { 0x68, 0x65, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x20 },
1162 .rlen = 8, 1162 .rlen = 8,
1163 }, { 1163 }, {
1164 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, 1164 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1165 .klen = 8, 1165 .klen = 8,
1166 .iv = { 0x43, 0xe9, 0x34, 0x00, 0x8c, 0x38, 0x9c, 0x0f }, 1166 .iv = { 0x43, 0xe9, 0x34, 0x00, 0x8c, 0x38, 0x9c, 0x0f },
1167 .input = { 0x68, 0x37, 0x88, 0x49, 0x9a, 0x7c, 0x05, 0xf6 }, 1167 .input = { 0x68, 0x37, 0x88, 0x49, 0x9a, 0x7c, 0x05, 0xf6 },
1168 .ilen = 8, 1168 .ilen = 8,
1169 .result = { 0x66, 0x6f, 0x72, 0x20, 0x61, 0x6c, 0x6c, 0x20 }, 1169 .result = { 0x66, 0x6f, 0x72, 0x20, 0x61, 0x6c, 0x6c, 0x20 },
1170 .rlen = 8, 1170 .rlen = 8,
1171 }, { /* Copy of above, for chunk testing */ 1171 }, { /* Copy of above, for chunk testing */
1172 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, 1172 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1173 .klen = 8, 1173 .klen = 8,
1174 .iv = { 0x43, 0xe9, 0x34, 0x00, 0x8c, 0x38, 0x9c, 0x0f }, 1174 .iv = { 0x43, 0xe9, 0x34, 0x00, 0x8c, 0x38, 0x9c, 0x0f },
1175 .input = { 0x68, 0x37, 0x88, 0x49, 0x9a, 0x7c, 0x05, 0xf6 }, 1175 .input = { 0x68, 0x37, 0x88, 0x49, 0x9a, 0x7c, 0x05, 0xf6 },
1176 .ilen = 8, 1176 .ilen = 8,
1177 .result = { 0x66, 0x6f, 0x72, 0x20, 0x61, 0x6c, 0x6c, 0x20 }, 1177 .result = { 0x66, 0x6f, 0x72, 0x20, 0x61, 0x6c, 0x6c, 0x20 },
1178 .rlen = 8, 1178 .rlen = 8,
@@ -1276,7 +1276,7 @@ static struct cipher_testvec bf_enc_tv_template[] = {
1276 .ilen = 8, 1276 .ilen = 8,
1277 .result = { 0xe8, 0x7a, 0x24, 0x4e, 0x2c, 0xc8, 0x5e, 0x82 }, 1277 .result = { 0xe8, 0x7a, 0x24, 0x4e, 0x2c, 0xc8, 0x5e, 0x82 },
1278 .rlen = 8, 1278 .rlen = 8,
1279 }, { /* Vary the keylength... */ 1279 }, { /* Vary the keylength... */
1280 .key = { 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87, 1280 .key = { 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87,
1281 0x78, 0x69, 0x5a, 0x4b, 0x3c, 0x2d, 0x1e, 0x0f }, 1281 0x78, 0x69, 0x5a, 0x4b, 0x3c, 0x2d, 0x1e, 0x0f },
1282 .klen = 16, 1282 .klen = 16,
@@ -1297,9 +1297,9 @@ static struct cipher_testvec bf_enc_tv_template[] = {
1297 .key = { 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87, 1297 .key = { 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87,
1298 0x78, 0x69, 0x5a, 0x4b, 0x3c, 0x2d, 0x1e, 0x0f, 1298 0x78, 0x69, 0x5a, 0x4b, 0x3c, 0x2d, 0x1e, 0x0f,
1299 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 1299 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
1300 0x04, 0x68, 0x91, 0x04, 0xc2, 0xfd, 0x3b, 0x2f, 1300 0x04, 0x68, 0x91, 0x04, 0xc2, 0xfd, 0x3b, 0x2f,
1301 0x58, 0x40, 0x23, 0x64, 0x1a, 0xba, 0x61, 0x76, 1301 0x58, 0x40, 0x23, 0x64, 0x1a, 0xba, 0x61, 0x76,
1302 0x1f, 0x1f, 0x1f, 0x1f, 0x0e, 0x0e, 0x0e, 0x0e, 1302 0x1f, 0x1f, 0x1f, 0x1f, 0x0e, 0x0e, 0x0e, 0x0e,
1303 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }, 1303 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff },
1304 .klen = 56, 1304 .klen = 56,
1305 .input = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 }, 1305 .input = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 },
@@ -1331,7 +1331,7 @@ static struct cipher_testvec bf_dec_tv_template[] = {
1331 .ilen = 8, 1331 .ilen = 8,
1332 .result = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 }, 1332 .result = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 },
1333 .rlen = 8, 1333 .rlen = 8,
1334 }, { /* Vary the keylength... */ 1334 }, { /* Vary the keylength... */
1335 .key = { 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87, 1335 .key = { 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87,
1336 0x78, 0x69, 0x5a, 0x4b, 0x3c, 0x2d, 0x1e, 0x0f }, 1336 0x78, 0x69, 0x5a, 0x4b, 0x3c, 0x2d, 0x1e, 0x0f },
1337 .klen = 16, 1337 .klen = 16,
@@ -1352,9 +1352,9 @@ static struct cipher_testvec bf_dec_tv_template[] = {
1352 .key = { 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87, 1352 .key = { 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87,
1353 0x78, 0x69, 0x5a, 0x4b, 0x3c, 0x2d, 0x1e, 0x0f, 1353 0x78, 0x69, 0x5a, 0x4b, 0x3c, 0x2d, 0x1e, 0x0f,
1354 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 1354 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
1355 0x04, 0x68, 0x91, 0x04, 0xc2, 0xfd, 0x3b, 0x2f, 1355 0x04, 0x68, 0x91, 0x04, 0xc2, 0xfd, 0x3b, 0x2f,
1356 0x58, 0x40, 0x23, 0x64, 0x1a, 0xba, 0x61, 0x76, 1356 0x58, 0x40, 0x23, 0x64, 0x1a, 0xba, 0x61, 0x76,
1357 0x1f, 0x1f, 0x1f, 0x1f, 0x0e, 0x0e, 0x0e, 0x0e, 1357 0x1f, 0x1f, 0x1f, 0x1f, 0x0e, 0x0e, 0x0e, 0x0e,
1358 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }, 1358 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff },
1359 .klen = 56, 1359 .klen = 56,
1360 .input = { 0xc0, 0x45, 0x04, 0x01, 0x2e, 0x4e, 0x1f, 0x53 }, 1360 .input = { 0xc0, 0x45, 0x04, 0x01, 0x2e, 0x4e, 0x1f, 0x53 },
@@ -1369,7 +1369,7 @@ static struct cipher_testvec bf_cbc_enc_tv_template[] = {
1369 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 1369 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
1370 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87 }, 1370 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87 },
1371 .klen = 16, 1371 .klen = 16,
1372 .iv = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 }, 1372 .iv = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 },
1373 .input = { 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x31, 0x20, 1373 .input = { 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x31, 0x20,
1374 0x4e, 0x6f, 0x77, 0x20, 0x69, 0x73, 0x20, 0x74, 1374 0x4e, 0x6f, 0x77, 0x20, 0x69, 0x73, 0x20, 0x74,
1375 0x68, 0x65, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x20, 1375 0x68, 0x65, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x20,
@@ -1388,7 +1388,7 @@ static struct cipher_testvec bf_cbc_dec_tv_template[] = {
1388 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 1388 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
1389 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87 }, 1389 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87 },
1390 .klen = 16, 1390 .klen = 16,
1391 .iv = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 }, 1391 .iv = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 },
1392 .input = { 0x6b, 0x77, 0xb4, 0xd6, 0x30, 0x06, 0xde, 0xe6, 1392 .input = { 0x6b, 0x77, 0xb4, 0xd6, 0x30, 0x06, 0xde, 0xe6,
1393 0x05, 0xb1, 0x56, 0xe2, 0x74, 0x03, 0x97, 0x93, 1393 0x05, 0xb1, 0x56, 0xe2, 0x74, 0x03, 0x97, 0x93,
1394 0x58, 0xde, 0xb9, 0xe7, 0x15, 0x46, 0x16, 0xd9, 1394 0x58, 0xde, 0xb9, 0xe7, 0x15, 0x46, 0x16, 0xd9,
@@ -1490,7 +1490,7 @@ static struct cipher_testvec tf_cbc_enc_tv_template[] = {
1490 .key = { [0 ... 15] = 0x00 }, 1490 .key = { [0 ... 15] = 0x00 },
1491 .klen = 16, 1491 .klen = 16,
1492 .iv = { 0x9f, 0x58, 0x9f, 0x5c, 0xf6, 0x12, 0x2c, 0x32, 1492 .iv = { 0x9f, 0x58, 0x9f, 0x5c, 0xf6, 0x12, 0x2c, 0x32,
1493 0xb6, 0xbf, 0xec, 0x2f, 0x2a, 0xe8, 0xc3, 0x5a }, 1493 0xb6, 0xbf, 0xec, 0x2f, 0x2a, 0xe8, 0xc3, 0x5a },
1494 .input = { [0 ... 15] = 0x00 }, 1494 .input = { [0 ... 15] = 0x00 },
1495 .ilen = 16, 1495 .ilen = 16,
1496 .result = { 0xd4, 0x91, 0xdb, 0x16, 0xe7, 0xb1, 0xc3, 0x9e, 1496 .result = { 0xd4, 0x91, 0xdb, 0x16, 0xe7, 0xb1, 0xc3, 0x9e,
@@ -1528,7 +1528,7 @@ static struct cipher_testvec tf_cbc_dec_tv_template[] = {
1528 .klen = 16, 1528 .klen = 16,
1529 .iv = { [0 ... 15] = 0x00 }, 1529 .iv = { [0 ... 15] = 0x00 },
1530 .input = { 0x9f, 0x58, 0x9f, 0x5c, 0xf6, 0x12, 0x2c, 0x32, 1530 .input = { 0x9f, 0x58, 0x9f, 0x5c, 0xf6, 0x12, 0x2c, 0x32,
1531 0xb6, 0xbf, 0xec, 0x2f, 0x2a, 0xe8, 0xc3, 0x5a }, 1531 0xb6, 0xbf, 0xec, 0x2f, 0x2a, 0xe8, 0xc3, 0x5a },
1532 .ilen = 16, 1532 .ilen = 16,
1533 .result = { [0 ... 15] = 0x00 }, 1533 .result = { [0 ... 15] = 0x00 },
1534 .rlen = 16, 1534 .rlen = 16,
@@ -1578,8 +1578,7 @@ static struct cipher_testvec tf_cbc_dec_tv_template[] = {
1578#define TNEPRES_ENC_TEST_VECTORS 4 1578#define TNEPRES_ENC_TEST_VECTORS 4
1579#define TNEPRES_DEC_TEST_VECTORS 4 1579#define TNEPRES_DEC_TEST_VECTORS 4
1580 1580
1581static struct cipher_testvec serpent_enc_tv_template[] = 1581static struct cipher_testvec serpent_enc_tv_template[] = {
1582{
1583 { 1582 {
1584 .input = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 1583 .input = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1585 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }, 1584 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
@@ -1620,8 +1619,7 @@ static struct cipher_testvec serpent_enc_tv_template[] =
1620 }, 1619 },
1621}; 1620};
1622 1621
1623static struct cipher_testvec tnepres_enc_tv_template[] = 1622static struct cipher_testvec tnepres_enc_tv_template[] = {
1624{
1625 { /* KeySize=128, PT=0, I=1 */ 1623 { /* KeySize=128, PT=0, I=1 */
1626 .input = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1624 .input = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1627 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 1625 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
@@ -1629,7 +1627,7 @@ static struct cipher_testvec tnepres_enc_tv_template[] =
1629 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 1627 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
1630 .klen = 16, 1628 .klen = 16,
1631 .ilen = 16, 1629 .ilen = 16,
1632 .result = { 0x49, 0xaf, 0xbf, 0xad, 0x9d, 0x5a, 0x34, 0x05, 1630 .result = { 0x49, 0xaf, 0xbf, 0xad, 0x9d, 0x5a, 0x34, 0x05,
1633 0x2c, 0xd8, 0xff, 0xa5, 0x98, 0x6b, 0xd2, 0xdd }, 1631 0x2c, 0xd8, 0xff, 0xa5, 0x98, 0x6b, 0xd2, 0xdd },
1634 .rlen = 16, 1632 .rlen = 16,
1635 }, { /* KeySize=192, PT=0, I=1 */ 1633 }, { /* KeySize=192, PT=0, I=1 */
@@ -1640,7 +1638,7 @@ static struct cipher_testvec tnepres_enc_tv_template[] =
1640 .input = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1638 .input = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1641 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 1639 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
1642 .ilen = 16, 1640 .ilen = 16,
1643 .result = { 0xe7, 0x8e, 0x54, 0x02, 0xc7, 0x19, 0x55, 0x68, 1641 .result = { 0xe7, 0x8e, 0x54, 0x02, 0xc7, 0x19, 0x55, 0x68,
1644 0xac, 0x36, 0x78, 0xf7, 0xa3, 0xf6, 0x0c, 0x66 }, 1642 0xac, 0x36, 0x78, 0xf7, 0xa3, 0xf6, 0x0c, 0x66 },
1645 .rlen = 16, 1643 .rlen = 16,
1646 }, { /* KeySize=256, PT=0, I=1 */ 1644 }, { /* KeySize=256, PT=0, I=1 */
@@ -1652,7 +1650,7 @@ static struct cipher_testvec tnepres_enc_tv_template[] =
1652 .input = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 1650 .input = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1653 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 1651 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
1654 .ilen = 16, 1652 .ilen = 16,
1655 .result = { 0xab, 0xed, 0x96, 0xe7, 0x66, 0xbf, 0x28, 0xcb, 1653 .result = { 0xab, 0xed, 0x96, 0xe7, 0x66, 0xbf, 0x28, 0xcb,
1656 0xc0, 0xeb, 0xd2, 0x1a, 0x82, 0xef, 0x08, 0x19 }, 1654 0xc0, 0xeb, 0xd2, 0x1a, 0x82, 0xef, 0x08, 0x19 },
1657 .rlen = 16, 1655 .rlen = 16,
1658 }, { /* KeySize=256, I=257 */ 1656 }, { /* KeySize=256, I=257 */
@@ -1664,15 +1662,14 @@ static struct cipher_testvec tnepres_enc_tv_template[] =
1664 .input = { 0x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x08, 1662 .input = { 0x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x08,
1665 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00 }, 1663 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00 },
1666 .ilen = 16, 1664 .ilen = 16,
1667 .result = { 0x5c, 0xe7, 0x1c, 0x70, 0xd2, 0x88, 0x2e, 0x5b, 1665 .result = { 0x5c, 0xe7, 0x1c, 0x70, 0xd2, 0x88, 0x2e, 0x5b,
1668 0xb8, 0x32, 0xe4, 0x33, 0xf8, 0x9f, 0x26, 0xde }, 1666 0xb8, 0x32, 0xe4, 0x33, 0xf8, 0x9f, 0x26, 0xde },
1669 .rlen = 16, 1667 .rlen = 16,
1670 }, 1668 },
1671}; 1669};
1672 1670
1673 1671
1674static struct cipher_testvec serpent_dec_tv_template[] = 1672static struct cipher_testvec serpent_dec_tv_template[] = {
1675{
1676 { 1673 {
1677 .input = { 0x12, 0x07, 0xfc, 0xce, 0x9b, 0xd0, 0xd6, 0x47, 1674 .input = { 0x12, 0x07, 0xfc, 0xce, 0x9b, 0xd0, 0xd6, 0x47,
1678 0x6a, 0xe9, 0x8f, 0xbe, 0xd1, 0x43, 0xa0, 0xe2 }, 1675 0x6a, 0xe9, 0x8f, 0xbe, 0xd1, 0x43, 0xa0, 0xe2 },
@@ -1713,8 +1710,7 @@ static struct cipher_testvec serpent_dec_tv_template[] =
1713 }, 1710 },
1714}; 1711};
1715 1712
1716static struct cipher_testvec tnepres_dec_tv_template[] = 1713static struct cipher_testvec tnepres_dec_tv_template[] = {
1717{
1718 { 1714 {
1719 .input = { 0x41, 0xcc, 0x6b, 0x31, 0x59, 0x31, 0x45, 0x97, 1715 .input = { 0x41, 0xcc, 0x6b, 0x31, 0x59, 0x31, 0x45, 0x97,
1720 0x6d, 0x6f, 0xbb, 0x38, 0x4b, 0x37, 0x21, 0x28 }, 1716 0x6d, 0x6f, 0xbb, 0x38, 0x4b, 0x37, 0x21, 0x28 },
@@ -1726,7 +1722,7 @@ static struct cipher_testvec tnepres_dec_tv_template[] =
1726 .key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 1722 .key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1727 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }, 1723 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
1728 .klen = 16, 1724 .klen = 16,
1729 .input = { 0xea, 0xf4, 0xd7, 0xfc, 0xd8, 0x01, 0x34, 0x47, 1725 .input = { 0xea, 0xf4, 0xd7, 0xfc, 0xd8, 0x01, 0x34, 0x47,
1730 0x81, 0x45, 0x0b, 0xfa, 0x0c, 0xd6, 0xad, 0x6e }, 1726 0x81, 0x45, 0x0b, 0xfa, 0x0c, 0xd6, 0xad, 0x6e },
1731 .ilen = 16, 1727 .ilen = 16,
1732 .result = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 1728 .result = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
@@ -1738,7 +1734,7 @@ static struct cipher_testvec tnepres_dec_tv_template[] =
1738 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 1734 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
1739 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f }, 1735 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f },
1740 .klen = 32, 1736 .klen = 32,
1741 .input = { 0x64, 0xa9, 0x1a, 0x37, 0xed, 0x9f, 0xe7, 0x49, 1737 .input = { 0x64, 0xa9, 0x1a, 0x37, 0xed, 0x9f, 0xe7, 0x49,
1742 0xa8, 0x4e, 0x76, 0xd6, 0xf5, 0x0d, 0x78, 0xee }, 1738 0xa8, 0x4e, 0x76, 0xd6, 0xf5, 0x0d, 0x78, 0xee },
1743 .ilen = 16, 1739 .ilen = 16,
1744 .result = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 1740 .result = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
@@ -1747,7 +1743,7 @@ static struct cipher_testvec tnepres_dec_tv_template[] =
1747 }, { /* KeySize=128, I=121 */ 1743 }, { /* KeySize=128, I=121 */
1748 .key = { [15] = 0x80 }, 1744 .key = { [15] = 0x80 },
1749 .klen = 16, 1745 .klen = 16,
1750 .input = { 0x3d, 0xda, 0xbf, 0xc0, 0x06, 0xda, 0xab, 0x06, 1746 .input = { 0x3d, 0xda, 0xbf, 0xc0, 0x06, 0xda, 0xab, 0x06,
1751 0x46, 0x2a, 0xf4, 0xef, 0x81, 0x54, 0x4e, 0x26 }, 1747 0x46, 0x2a, 0xf4, 0xef, 0x81, 0x54, 0x4e, 0x26 },
1752 .ilen = 16, 1748 .ilen = 16,
1753 .result = { [0 ... 15] = 0x00 }, 1749 .result = { [0 ... 15] = 0x00 },
@@ -1760,58 +1756,56 @@ static struct cipher_testvec tnepres_dec_tv_template[] =
1760#define CAST6_ENC_TEST_VECTORS 3 1756#define CAST6_ENC_TEST_VECTORS 3
1761#define CAST6_DEC_TEST_VECTORS 3 1757#define CAST6_DEC_TEST_VECTORS 3
1762 1758
1763static struct cipher_testvec cast6_enc_tv_template[] = 1759static struct cipher_testvec cast6_enc_tv_template[] = {
1764{
1765 { 1760 {
1766 .key = { 0x23, 0x42, 0xbb, 0x9e, 0xfa, 0x38, 0x54, 0x2c, 1761 .key = { 0x23, 0x42, 0xbb, 0x9e, 0xfa, 0x38, 0x54, 0x2c,
1767 0x0a, 0xf7, 0x56, 0x47, 0xf2, 0x9f, 0x61, 0x5d }, 1762 0x0a, 0xf7, 0x56, 0x47, 0xf2, 0x9f, 0x61, 0x5d },
1768 .klen = 16, 1763 .klen = 16,
1769 .input = { [0 ... 15] = 0x00 }, 1764 .input = { [0 ... 15] = 0x00 },
1770 .ilen = 16, 1765 .ilen = 16,
1771 .result = { 0xc8, 0x42, 0xa0, 0x89, 0x72, 0xb4, 0x3d, 0x20, 1766 .result = { 0xc8, 0x42, 0xa0, 0x89, 0x72, 0xb4, 0x3d, 0x20,
1772 0x83, 0x6c, 0x91, 0xd1, 0xb7, 0x53, 0x0f, 0x6b }, 1767 0x83, 0x6c, 0x91, 0xd1, 0xb7, 0x53, 0x0f, 0x6b },
1773 .rlen = 16, 1768 .rlen = 16,
1774 }, { 1769 }, {
1775 .key = { 0x23, 0x42, 0xbb, 0x9e, 0xfa, 0x38, 0x54, 0x2c, 1770 .key = { 0x23, 0x42, 0xbb, 0x9e, 0xfa, 0x38, 0x54, 0x2c,
1776 0xbe, 0xd0, 0xac, 0x83, 0x94, 0x0a, 0xc2, 0x98, 1771 0xbe, 0xd0, 0xac, 0x83, 0x94, 0x0a, 0xc2, 0x98,
1777 0xba, 0xc7, 0x7a, 0x77, 0x17, 0x94, 0x28, 0x63 }, 1772 0xba, 0xc7, 0x7a, 0x77, 0x17, 0x94, 0x28, 0x63 },
1778 .klen = 24, 1773 .klen = 24,
1779 .input = { [0 ... 15] = 0x00 }, 1774 .input = { [0 ... 15] = 0x00 },
1780 .ilen = 16, 1775 .ilen = 16,
1781 .result = { 0x1b, 0x38, 0x6c, 0x02, 0x10, 0xdc, 0xad, 0xcb, 1776 .result = { 0x1b, 0x38, 0x6c, 0x02, 0x10, 0xdc, 0xad, 0xcb,
1782 0xdd, 0x0e, 0x41, 0xaa, 0x08, 0xa7, 0xa7, 0xe8 }, 1777 0xdd, 0x0e, 0x41, 0xaa, 0x08, 0xa7, 0xa7, 0xe8 },
1783 .rlen = 16, 1778 .rlen = 16,
1784 }, { 1779 }, {
1785 .key = { 0x23, 0x42, 0xbb, 0x9e, 0xfa, 0x38, 0x54, 0x2c, 1780 .key = { 0x23, 0x42, 0xbb, 0x9e, 0xfa, 0x38, 0x54, 0x2c,
1786 0xbe, 0xd0, 0xac, 0x83, 0x94, 0x0a, 0xc2, 0x98, 1781 0xbe, 0xd0, 0xac, 0x83, 0x94, 0x0a, 0xc2, 0x98,
1787 0x8d, 0x7c, 0x47, 0xce, 0x26, 0x49, 0x08, 0x46, 1782 0x8d, 0x7c, 0x47, 0xce, 0x26, 0x49, 0x08, 0x46,
1788 0x1c, 0xc1, 0xb5, 0x13, 0x7a, 0xe6, 0xb6, 0x04 }, 1783 0x1c, 0xc1, 0xb5, 0x13, 0x7a, 0xe6, 0xb6, 0x04 },
1789 .klen = 32, 1784 .klen = 32,
1790 .input = { [0 ... 15] = 0x00 }, 1785 .input = { [0 ... 15] = 0x00 },
1791 .ilen = 16, 1786 .ilen = 16,
1792 .result = { 0x4f, 0x6a, 0x20, 0x38, 0x28, 0x68, 0x97, 0xb9, 1787 .result = { 0x4f, 0x6a, 0x20, 0x38, 0x28, 0x68, 0x97, 0xb9,
1793 0xc9, 0x87, 0x01, 0x36, 0x55, 0x33, 0x17, 0xfa }, 1788 0xc9, 0x87, 0x01, 0x36, 0x55, 0x33, 0x17, 0xfa },
1794 .rlen = 16, 1789 .rlen = 16,
1795 }, 1790 },
1796}; 1791};
1797 1792
1798static struct cipher_testvec cast6_dec_tv_template[] = 1793static struct cipher_testvec cast6_dec_tv_template[] = {
1799{
1800 { 1794 {
1801 .key = { 0x23, 0x42, 0xbb, 0x9e, 0xfa, 0x38, 0x54, 0x2c, 1795 .key = { 0x23, 0x42, 0xbb, 0x9e, 0xfa, 0x38, 0x54, 0x2c,
1802 0x0a, 0xf7, 0x56, 0x47, 0xf2, 0x9f, 0x61, 0x5d }, 1796 0x0a, 0xf7, 0x56, 0x47, 0xf2, 0x9f, 0x61, 0x5d },
1803 .klen = 16, 1797 .klen = 16,
1804 .input = { 0xc8, 0x42, 0xa0, 0x89, 0x72, 0xb4, 0x3d, 0x20, 1798 .input = { 0xc8, 0x42, 0xa0, 0x89, 0x72, 0xb4, 0x3d, 0x20,
1805 0x83, 0x6c, 0x91, 0xd1, 0xb7, 0x53, 0x0f, 0x6b }, 1799 0x83, 0x6c, 0x91, 0xd1, 0xb7, 0x53, 0x0f, 0x6b },
1806 .ilen = 16, 1800 .ilen = 16,
1807 .result = { [0 ... 15] = 0x00 }, 1801 .result = { [0 ... 15] = 0x00 },
1808 .rlen = 16, 1802 .rlen = 16,
1809 }, { 1803 }, {
1810 .key = { 0x23, 0x42, 0xbb, 0x9e, 0xfa, 0x38, 0x54, 0x2c, 1804 .key = { 0x23, 0x42, 0xbb, 0x9e, 0xfa, 0x38, 0x54, 0x2c,
1811 0xbe, 0xd0, 0xac, 0x83, 0x94, 0x0a, 0xc2, 0x98, 1805 0xbe, 0xd0, 0xac, 0x83, 0x94, 0x0a, 0xc2, 0x98,
1812 0xba, 0xc7, 0x7a, 0x77, 0x17, 0x94, 0x28, 0x63 }, 1806 0xba, 0xc7, 0x7a, 0x77, 0x17, 0x94, 0x28, 0x63 },
1813 .klen = 24, 1807 .klen = 24,
1814 .input = { 0x1b, 0x38, 0x6c, 0x02, 0x10, 0xdc, 0xad, 0xcb, 1808 .input = { 0x1b, 0x38, 0x6c, 0x02, 0x10, 0xdc, 0xad, 0xcb,
1815 0xdd, 0x0e, 0x41, 0xaa, 0x08, 0xa7, 0xa7, 0xe8 }, 1809 0xdd, 0x0e, 0x41, 0xaa, 0x08, 0xa7, 0xa7, 0xe8 },
1816 .ilen = 16, 1810 .ilen = 16,
1817 .result = { [0 ... 15] = 0x00 }, 1811 .result = { [0 ... 15] = 0x00 },
@@ -1820,9 +1814,9 @@ static struct cipher_testvec cast6_dec_tv_template[] =
1820 .key = { 0x23, 0x42, 0xbb, 0x9e, 0xfa, 0x38, 0x54, 0x2c, 1814 .key = { 0x23, 0x42, 0xbb, 0x9e, 0xfa, 0x38, 0x54, 0x2c,
1821 0xbe, 0xd0, 0xac, 0x83, 0x94, 0x0a, 0xc2, 0x98, 1815 0xbe, 0xd0, 0xac, 0x83, 0x94, 0x0a, 0xc2, 0x98,
1822 0x8d, 0x7c, 0x47, 0xce, 0x26, 0x49, 0x08, 0x46, 1816 0x8d, 0x7c, 0x47, 0xce, 0x26, 0x49, 0x08, 0x46,
1823 0x1c, 0xc1, 0xb5, 0x13, 0x7a, 0xe6, 0xb6, 0x04 }, 1817 0x1c, 0xc1, 0xb5, 0x13, 0x7a, 0xe6, 0xb6, 0x04 },
1824 .klen = 32, 1818 .klen = 32,
1825 .input = { 0x4f, 0x6a, 0x20, 0x38, 0x28, 0x68, 0x97, 0xb9, 1819 .input = { 0x4f, 0x6a, 0x20, 0x38, 0x28, 0x68, 0x97, 0xb9,
1826 0xc9, 0x87, 0x01, 0x36, 0x55, 0x33, 0x17, 0xfa }, 1820 0xc9, 0x87, 0x01, 0x36, 0x55, 0x33, 0x17, 0xfa },
1827 .ilen = 16, 1821 .ilen = 16,
1828 .result = { [0 ... 15] = 0x00 }, 1822 .result = { [0 ... 15] = 0x00 },
@@ -1837,9 +1831,9 @@ static struct cipher_testvec cast6_dec_tv_template[] =
1837#define AES_ENC_TEST_VECTORS 3 1831#define AES_ENC_TEST_VECTORS 3
1838#define AES_DEC_TEST_VECTORS 3 1832#define AES_DEC_TEST_VECTORS 3
1839 1833
1840static struct cipher_testvec aes_enc_tv_template[] = { 1834static struct cipher_testvec aes_enc_tv_template[] = {
1841 { /* From FIPS-197 */ 1835 { /* From FIPS-197 */
1842 .key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 1836 .key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1843 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }, 1837 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
1844 .klen = 16, 1838 .klen = 16,
1845 .input = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 1839 .input = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
@@ -1853,7 +1847,7 @@ static struct cipher_testvec aes_enc_tv_template[] = {
1853 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 1847 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
1854 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17 }, 1848 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17 },
1855 .klen = 24, 1849 .klen = 24,
1856 .input = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 1850 .input = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
1857 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff }, 1851 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff },
1858 .ilen = 16, 1852 .ilen = 16,
1859 .result = { 0xdd, 0xa9, 0x7c, 0xa4, 0x86, 0x4c, 0xdf, 0xe0, 1853 .result = { 0xdd, 0xa9, 0x7c, 0xa4, 0x86, 0x4c, 0xdf, 0xe0,
@@ -1865,7 +1859,7 @@ static struct cipher_testvec aes_enc_tv_template[] = {
1865 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 1859 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
1866 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f }, 1860 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f },
1867 .klen = 32, 1861 .klen = 32,
1868 .input = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 1862 .input = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
1869 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff }, 1863 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff },
1870 .ilen = 16, 1864 .ilen = 16,
1871 .result = { 0x8e, 0xa2, 0xb7, 0xca, 0x51, 0x67, 0x45, 0xbf, 1865 .result = { 0x8e, 0xa2, 0xb7, 0xca, 0x51, 0x67, 0x45, 0xbf,
@@ -1874,9 +1868,9 @@ static struct cipher_testvec aes_enc_tv_template[] = {
1874 }, 1868 },
1875}; 1869};
1876 1870
1877static struct cipher_testvec aes_dec_tv_template[] = { 1871static struct cipher_testvec aes_dec_tv_template[] = {
1878 { /* From FIPS-197 */ 1872 { /* From FIPS-197 */
1879 .key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 1873 .key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
1880 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }, 1874 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
1881 .klen = 16, 1875 .klen = 16,
1882 .input = { 0x69, 0xc4, 0xe0, 0xd8, 0x6a, 0x7b, 0x04, 0x30, 1876 .input = { 0x69, 0xc4, 0xe0, 0xd8, 0x6a, 0x7b, 0x04, 0x30,
@@ -1893,8 +1887,8 @@ static struct cipher_testvec aes_dec_tv_template[] = {
1893 .input = { 0xdd, 0xa9, 0x7c, 0xa4, 0x86, 0x4c, 0xdf, 0xe0, 1887 .input = { 0xdd, 0xa9, 0x7c, 0xa4, 0x86, 0x4c, 0xdf, 0xe0,
1894 0x6e, 0xaf, 0x70, 0xa0, 0xec, 0x0d, 0x71, 0x91 }, 1888 0x6e, 0xaf, 0x70, 0xa0, 0xec, 0x0d, 0x71, 0x91 },
1895 .ilen = 16, 1889 .ilen = 16,
1896 .result = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 1890 .result = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
1897 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff }, 1891 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff },
1898 .rlen = 16, 1892 .rlen = 16,
1899 }, { 1893 }, {
1900 .key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 1894 .key = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
@@ -1905,7 +1899,7 @@ static struct cipher_testvec aes_dec_tv_template[] = {
1905 .input = { 0x8e, 0xa2, 0xb7, 0xca, 0x51, 0x67, 0x45, 0xbf, 1899 .input = { 0x8e, 0xa2, 0xb7, 0xca, 0x51, 0x67, 0x45, 0xbf,
1906 0xea, 0xfc, 0x49, 0x90, 0x4b, 0x49, 0x60, 0x89 }, 1900 0xea, 0xfc, 0x49, 0x90, 0x4b, 0x49, 0x60, 0x89 },
1907 .ilen = 16, 1901 .ilen = 16,
1908 .result = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 1902 .result = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
1909 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff }, 1903 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff },
1910 .rlen = 16, 1904 .rlen = 16,
1911 }, 1905 },
@@ -1915,8 +1909,7 @@ static struct cipher_testvec aes_dec_tv_template[] = {
1915#define CAST5_ENC_TEST_VECTORS 3 1909#define CAST5_ENC_TEST_VECTORS 3
1916#define CAST5_DEC_TEST_VECTORS 3 1910#define CAST5_DEC_TEST_VECTORS 3
1917 1911
1918static struct cipher_testvec cast5_enc_tv_template[] = 1912static struct cipher_testvec cast5_enc_tv_template[] = {
1919{
1920 { 1913 {
1921 .key = { 0x01, 0x23, 0x45, 0x67, 0x12, 0x34, 0x56, 0x78, 1914 .key = { 0x01, 0x23, 0x45, 0x67, 0x12, 0x34, 0x56, 0x78,
1922 0x23, 0x45, 0x67, 0x89, 0x34, 0x56, 0x78, 0x9a }, 1915 0x23, 0x45, 0x67, 0x89, 0x34, 0x56, 0x78, 0x9a },
@@ -1943,8 +1936,7 @@ static struct cipher_testvec cast5_enc_tv_template[] =
1943 }, 1936 },
1944}; 1937};
1945 1938
1946static struct cipher_testvec cast5_dec_tv_template[] = 1939static struct cipher_testvec cast5_dec_tv_template[] = {
1947{
1948 { 1940 {
1949 .key = { 0x01, 0x23, 0x45, 0x67, 0x12, 0x34, 0x56, 0x78, 1941 .key = { 0x01, 0x23, 0x45, 0x67, 0x12, 0x34, 0x56, 0x78,
1950 0x23, 0x45, 0x67, 0x89, 0x34, 0x56, 0x78, 0x9a }, 1942 0x23, 0x45, 0x67, 0x89, 0x34, 0x56, 0x78, 0x9a },
@@ -1971,14 +1963,13 @@ static struct cipher_testvec cast5_dec_tv_template[] =
1971 }, 1963 },
1972}; 1964};
1973 1965
1974/* 1966/*
1975 * ARC4 test vectors from OpenSSL 1967 * ARC4 test vectors from OpenSSL
1976 */ 1968 */
1977#define ARC4_ENC_TEST_VECTORS 7 1969#define ARC4_ENC_TEST_VECTORS 7
1978#define ARC4_DEC_TEST_VECTORS 7 1970#define ARC4_DEC_TEST_VECTORS 7
1979 1971
1980static struct cipher_testvec arc4_enc_tv_template[] = 1972static struct cipher_testvec arc4_enc_tv_template[] = {
1981{
1982 { 1973 {
1983 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, 1974 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
1984 .klen = 8, 1975 .klen = 8,
@@ -2044,8 +2035,7 @@ static struct cipher_testvec arc4_enc_tv_template[] =
2044 }, 2035 },
2045}; 2036};
2046 2037
2047static struct cipher_testvec arc4_dec_tv_template[] = 2038static struct cipher_testvec arc4_dec_tv_template[] = {
2048{
2049 { 2039 {
2050 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }, 2040 .key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
2051 .klen = 8, 2041 .klen = 8,
@@ -2111,14 +2101,13 @@ static struct cipher_testvec arc4_dec_tv_template[] =
2111 }, 2101 },
2112}; 2102};
2113 2103
2114/* 2104/*
2115 * TEA test vectors 2105 * TEA test vectors
2116 */ 2106 */
2117#define TEA_ENC_TEST_VECTORS 4 2107#define TEA_ENC_TEST_VECTORS 4
2118#define TEA_DEC_TEST_VECTORS 4 2108#define TEA_DEC_TEST_VECTORS 4
2119 2109
2120static struct cipher_testvec tea_enc_tv_template[] = 2110static struct cipher_testvec tea_enc_tv_template[] = {
2121{
2122 { 2111 {
2123 .key = { [0 ... 15] = 0x00 }, 2112 .key = { [0 ... 15] = 0x00 },
2124 .klen = 16, 2113 .klen = 16,
@@ -2138,31 +2127,30 @@ static struct cipher_testvec tea_enc_tv_template[] =
2138 .key = { 0x09, 0x65, 0x43, 0x11, 0x66, 0x44, 0x39, 0x25, 2127 .key = { 0x09, 0x65, 0x43, 0x11, 0x66, 0x44, 0x39, 0x25,
2139 0x51, 0x3a, 0x16, 0x10, 0x0a, 0x08, 0x12, 0x6e }, 2128 0x51, 0x3a, 0x16, 0x10, 0x0a, 0x08, 0x12, 0x6e },
2140 .klen = 16, 2129 .klen = 16,
2141 .input = { 0x6c, 0x6f, 0x6e, 0x67, 0x65, 0x72, 0x5f, 0x74, 2130 .input = { 0x6c, 0x6f, 0x6e, 0x67, 0x65, 0x72, 0x5f, 0x74,
2142 0x65, 0x73, 0x74, 0x5f, 0x76, 0x65, 0x63, 0x74 }, 2131 0x65, 0x73, 0x74, 0x5f, 0x76, 0x65, 0x63, 0x74 },
2143 .ilen = 16, 2132 .ilen = 16,
2144 .result = { 0xbe, 0x7a, 0xbb, 0x81, 0x95, 0x2d, 0x1f, 0x1e, 2133 .result = { 0xbe, 0x7a, 0xbb, 0x81, 0x95, 0x2d, 0x1f, 0x1e,
2145 0xdd, 0x89, 0xa1, 0x25, 0x04, 0x21, 0xdf, 0x95 }, 2134 0xdd, 0x89, 0xa1, 0x25, 0x04, 0x21, 0xdf, 0x95 },
2146 .rlen = 16, 2135 .rlen = 16,
2147 }, { 2136 }, {
2148 .key = { 0x4d, 0x76, 0x32, 0x17, 0x05, 0x3f, 0x75, 0x2c, 2137 .key = { 0x4d, 0x76, 0x32, 0x17, 0x05, 0x3f, 0x75, 0x2c,
2149 0x5d, 0x04, 0x16, 0x36, 0x15, 0x72, 0x63, 0x2f }, 2138 0x5d, 0x04, 0x16, 0x36, 0x15, 0x72, 0x63, 0x2f },
2150 .klen = 16, 2139 .klen = 16,
2151 .input = { 0x54, 0x65, 0x61, 0x20, 0x69, 0x73, 0x20, 0x67, 2140 .input = { 0x54, 0x65, 0x61, 0x20, 0x69, 0x73, 0x20, 0x67,
2152 0x6f, 0x6f, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20, 2141 0x6f, 0x6f, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20,
2153 0x79, 0x6f, 0x75, 0x21, 0x21, 0x21, 0x20, 0x72, 2142 0x79, 0x6f, 0x75, 0x21, 0x21, 0x21, 0x20, 0x72,
2154 0x65, 0x61, 0x6c, 0x6c, 0x79, 0x21, 0x21, 0x21 }, 2143 0x65, 0x61, 0x6c, 0x6c, 0x79, 0x21, 0x21, 0x21 },
2155 .ilen = 32, 2144 .ilen = 32,
2156 .result = { 0xe0, 0x4d, 0x5d, 0x3c, 0xb7, 0x8c, 0x36, 0x47, 2145 .result = { 0xe0, 0x4d, 0x5d, 0x3c, 0xb7, 0x8c, 0x36, 0x47,
2157 0x94, 0x18, 0x95, 0x91, 0xa9, 0xfc, 0x49, 0xf8, 2146 0x94, 0x18, 0x95, 0x91, 0xa9, 0xfc, 0x49, 0xf8,
2158 0x44, 0xd1, 0x2d, 0xc2, 0x99, 0xb8, 0x08, 0x2a, 2147 0x44, 0xd1, 0x2d, 0xc2, 0x99, 0xb8, 0x08, 0x2a,
2159 0x07, 0x89, 0x73, 0xc2, 0x45, 0x92, 0xc6, 0x90 }, 2148 0x07, 0x89, 0x73, 0xc2, 0x45, 0x92, 0xc6, 0x90 },
2160 .rlen = 32, 2149 .rlen = 32,
2161 } 2150 }
2162}; 2151};
2163 2152
2164static struct cipher_testvec tea_dec_tv_template[] = 2153static struct cipher_testvec tea_dec_tv_template[] = {
2165{
2166 { 2154 {
2167 .key = { [0 ... 15] = 0x00 }, 2155 .key = { [0 ... 15] = 0x00 },
2168 .klen = 16, 2156 .klen = 16,
@@ -2183,9 +2171,9 @@ static struct cipher_testvec tea_dec_tv_template[] =
2183 0x51, 0x3a, 0x16, 0x10, 0x0a, 0x08, 0x12, 0x6e }, 2171 0x51, 0x3a, 0x16, 0x10, 0x0a, 0x08, 0x12, 0x6e },
2184 .klen = 16, 2172 .klen = 16,
2185 .input = { 0xbe, 0x7a, 0xbb, 0x81, 0x95, 0x2d, 0x1f, 0x1e, 2173 .input = { 0xbe, 0x7a, 0xbb, 0x81, 0x95, 0x2d, 0x1f, 0x1e,
2186 0xdd, 0x89, 0xa1, 0x25, 0x04, 0x21, 0xdf, 0x95 }, 2174 0xdd, 0x89, 0xa1, 0x25, 0x04, 0x21, 0xdf, 0x95 },
2187 .ilen = 16, 2175 .ilen = 16,
2188 .result = { 0x6c, 0x6f, 0x6e, 0x67, 0x65, 0x72, 0x5f, 0x74, 2176 .result = { 0x6c, 0x6f, 0x6e, 0x67, 0x65, 0x72, 0x5f, 0x74,
2189 0x65, 0x73, 0x74, 0x5f, 0x76, 0x65, 0x63, 0x74 }, 2177 0x65, 0x73, 0x74, 0x5f, 0x76, 0x65, 0x63, 0x74 },
2190 .rlen = 16, 2178 .rlen = 16,
2191 }, { 2179 }, {
@@ -2193,26 +2181,25 @@ static struct cipher_testvec tea_dec_tv_template[] =
2193 0x5d, 0x04, 0x16, 0x36, 0x15, 0x72, 0x63, 0x2f }, 2181 0x5d, 0x04, 0x16, 0x36, 0x15, 0x72, 0x63, 0x2f },
2194 .klen = 16, 2182 .klen = 16,
2195 .input = { 0xe0, 0x4d, 0x5d, 0x3c, 0xb7, 0x8c, 0x36, 0x47, 2183 .input = { 0xe0, 0x4d, 0x5d, 0x3c, 0xb7, 0x8c, 0x36, 0x47,
2196 0x94, 0x18, 0x95, 0x91, 0xa9, 0xfc, 0x49, 0xf8, 2184 0x94, 0x18, 0x95, 0x91, 0xa9, 0xfc, 0x49, 0xf8,
2197 0x44, 0xd1, 0x2d, 0xc2, 0x99, 0xb8, 0x08, 0x2a, 2185 0x44, 0xd1, 0x2d, 0xc2, 0x99, 0xb8, 0x08, 0x2a,
2198 0x07, 0x89, 0x73, 0xc2, 0x45, 0x92, 0xc6, 0x90 }, 2186 0x07, 0x89, 0x73, 0xc2, 0x45, 0x92, 0xc6, 0x90 },
2199 .ilen = 32, 2187 .ilen = 32,
2200 .result = { 0x54, 0x65, 0x61, 0x20, 0x69, 0x73, 0x20, 0x67, 2188 .result = { 0x54, 0x65, 0x61, 0x20, 0x69, 0x73, 0x20, 0x67,
2201 0x6f, 0x6f, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20, 2189 0x6f, 0x6f, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20,
2202 0x79, 0x6f, 0x75, 0x21, 0x21, 0x21, 0x20, 0x72, 2190 0x79, 0x6f, 0x75, 0x21, 0x21, 0x21, 0x20, 0x72,
2203 0x65, 0x61, 0x6c, 0x6c, 0x79, 0x21, 0x21, 0x21 }, 2191 0x65, 0x61, 0x6c, 0x6c, 0x79, 0x21, 0x21, 0x21 },
2204 .rlen = 32, 2192 .rlen = 32,
2205 } 2193 }
2206}; 2194};
2207 2195
2208/* 2196/*
2209 * XTEA test vectors 2197 * XTEA test vectors
2210 */ 2198 */
2211#define XTEA_ENC_TEST_VECTORS 4 2199#define XTEA_ENC_TEST_VECTORS 4
2212#define XTEA_DEC_TEST_VECTORS 4 2200#define XTEA_DEC_TEST_VECTORS 4
2213 2201
2214static struct cipher_testvec xtea_enc_tv_template[] = 2202static struct cipher_testvec xtea_enc_tv_template[] = {
2215{
2216 { 2203 {
2217 .key = { [0 ... 15] = 0x00 }, 2204 .key = { [0 ... 15] = 0x00 },
2218 .klen = 16, 2205 .klen = 16,
@@ -2232,31 +2219,30 @@ static struct cipher_testvec xtea_enc_tv_template[] =
2232 .key = { 0x09, 0x65, 0x43, 0x11, 0x66, 0x44, 0x39, 0x25, 2219 .key = { 0x09, 0x65, 0x43, 0x11, 0x66, 0x44, 0x39, 0x25,
2233 0x51, 0x3a, 0x16, 0x10, 0x0a, 0x08, 0x12, 0x6e }, 2220 0x51, 0x3a, 0x16, 0x10, 0x0a, 0x08, 0x12, 0x6e },
2234 .klen = 16, 2221 .klen = 16,
2235 .input = { 0x6c, 0x6f, 0x6e, 0x67, 0x65, 0x72, 0x5f, 0x74, 2222 .input = { 0x6c, 0x6f, 0x6e, 0x67, 0x65, 0x72, 0x5f, 0x74,
2236 0x65, 0x73, 0x74, 0x5f, 0x76, 0x65, 0x63, 0x74 }, 2223 0x65, 0x73, 0x74, 0x5f, 0x76, 0x65, 0x63, 0x74 },
2237 .ilen = 16, 2224 .ilen = 16,
2238 .result = { 0xe2, 0x04, 0xdb, 0xf2, 0x89, 0x85, 0x9e, 0xea, 2225 .result = { 0xe2, 0x04, 0xdb, 0xf2, 0x89, 0x85, 0x9e, 0xea,
2239 0x61, 0x35, 0xaa, 0xed, 0xb5, 0xcb, 0x71, 0x2c }, 2226 0x61, 0x35, 0xaa, 0xed, 0xb5, 0xcb, 0x71, 0x2c },
2240 .rlen = 16, 2227 .rlen = 16,
2241 }, { 2228 }, {
2242 .key = { 0x4d, 0x76, 0x32, 0x17, 0x05, 0x3f, 0x75, 0x2c, 2229 .key = { 0x4d, 0x76, 0x32, 0x17, 0x05, 0x3f, 0x75, 0x2c,
2243 0x5d, 0x04, 0x16, 0x36, 0x15, 0x72, 0x63, 0x2f }, 2230 0x5d, 0x04, 0x16, 0x36, 0x15, 0x72, 0x63, 0x2f },
2244 .klen = 16, 2231 .klen = 16,
2245 .input = { 0x54, 0x65, 0x61, 0x20, 0x69, 0x73, 0x20, 0x67, 2232 .input = { 0x54, 0x65, 0x61, 0x20, 0x69, 0x73, 0x20, 0x67,
2246 0x6f, 0x6f, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20, 2233 0x6f, 0x6f, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20,
2247 0x79, 0x6f, 0x75, 0x21, 0x21, 0x21, 0x20, 0x72, 2234 0x79, 0x6f, 0x75, 0x21, 0x21, 0x21, 0x20, 0x72,
2248 0x65, 0x61, 0x6c, 0x6c, 0x79, 0x21, 0x21, 0x21 }, 2235 0x65, 0x61, 0x6c, 0x6c, 0x79, 0x21, 0x21, 0x21 },
2249 .ilen = 32, 2236 .ilen = 32,
2250 .result = { 0x0b, 0x03, 0xcd, 0x8a, 0xbe, 0x95, 0xfd, 0xb1, 2237 .result = { 0x0b, 0x03, 0xcd, 0x8a, 0xbe, 0x95, 0xfd, 0xb1,
2251 0xc1, 0x44, 0x91, 0x0b, 0xa5, 0xc9, 0x1b, 0xb4, 2238 0xc1, 0x44, 0x91, 0x0b, 0xa5, 0xc9, 0x1b, 0xb4,
2252 0xa9, 0xda, 0x1e, 0x9e, 0xb1, 0x3e, 0x2a, 0x8f, 2239 0xa9, 0xda, 0x1e, 0x9e, 0xb1, 0x3e, 0x2a, 0x8f,
2253 0xea, 0xa5, 0x6a, 0x85, 0xd1, 0xf4, 0xa8, 0xa5 }, 2240 0xea, 0xa5, 0x6a, 0x85, 0xd1, 0xf4, 0xa8, 0xa5 },
2254 .rlen = 32, 2241 .rlen = 32,
2255 } 2242 }
2256}; 2243};
2257 2244
2258static struct cipher_testvec xtea_dec_tv_template[] = 2245static struct cipher_testvec xtea_dec_tv_template[] = {
2259{
2260 { 2246 {
2261 .key = { [0 ... 15] = 0x00 }, 2247 .key = { [0 ... 15] = 0x00 },
2262 .klen = 16, 2248 .klen = 16,
@@ -2276,24 +2262,24 @@ static struct cipher_testvec xtea_dec_tv_template[] =
2276 .key = { 0x09, 0x65, 0x43, 0x11, 0x66, 0x44, 0x39, 0x25, 2262 .key = { 0x09, 0x65, 0x43, 0x11, 0x66, 0x44, 0x39, 0x25,
2277 0x51, 0x3a, 0x16, 0x10, 0x0a, 0x08, 0x12, 0x6e }, 2263 0x51, 0x3a, 0x16, 0x10, 0x0a, 0x08, 0x12, 0x6e },
2278 .klen = 16, 2264 .klen = 16,
2279 .input = { 0xe2, 0x04, 0xdb, 0xf2, 0x89, 0x85, 0x9e, 0xea, 2265 .input = { 0xe2, 0x04, 0xdb, 0xf2, 0x89, 0x85, 0x9e, 0xea,
2280 0x61, 0x35, 0xaa, 0xed, 0xb5, 0xcb, 0x71, 0x2c }, 2266 0x61, 0x35, 0xaa, 0xed, 0xb5, 0xcb, 0x71, 0x2c },
2281 .ilen = 16, 2267 .ilen = 16,
2282 .result = { 0x6c, 0x6f, 0x6e, 0x67, 0x65, 0x72, 0x5f, 0x74, 2268 .result = { 0x6c, 0x6f, 0x6e, 0x67, 0x65, 0x72, 0x5f, 0x74,
2283 0x65, 0x73, 0x74, 0x5f, 0x76, 0x65, 0x63, 0x74 }, 2269 0x65, 0x73, 0x74, 0x5f, 0x76, 0x65, 0x63, 0x74 },
2284 .rlen = 16, 2270 .rlen = 16,
2285 }, { 2271 }, {
2286 .key = { 0x4d, 0x76, 0x32, 0x17, 0x05, 0x3f, 0x75, 0x2c, 2272 .key = { 0x4d, 0x76, 0x32, 0x17, 0x05, 0x3f, 0x75, 0x2c,
2287 0x5d, 0x04, 0x16, 0x36, 0x15, 0x72, 0x63, 0x2f }, 2273 0x5d, 0x04, 0x16, 0x36, 0x15, 0x72, 0x63, 0x2f },
2288 .klen = 16, 2274 .klen = 16,
2289 .input = { 0x0b, 0x03, 0xcd, 0x8a, 0xbe, 0x95, 0xfd, 0xb1, 2275 .input = { 0x0b, 0x03, 0xcd, 0x8a, 0xbe, 0x95, 0xfd, 0xb1,
2290 0xc1, 0x44, 0x91, 0x0b, 0xa5, 0xc9, 0x1b, 0xb4, 2276 0xc1, 0x44, 0x91, 0x0b, 0xa5, 0xc9, 0x1b, 0xb4,
2291 0xa9, 0xda, 0x1e, 0x9e, 0xb1, 0x3e, 0x2a, 0x8f, 2277 0xa9, 0xda, 0x1e, 0x9e, 0xb1, 0x3e, 0x2a, 0x8f,
2292 0xea, 0xa5, 0x6a, 0x85, 0xd1, 0xf4, 0xa8, 0xa5 }, 2278 0xea, 0xa5, 0x6a, 0x85, 0xd1, 0xf4, 0xa8, 0xa5 },
2293 .ilen = 32, 2279 .ilen = 32,
2294 .result = { 0x54, 0x65, 0x61, 0x20, 0x69, 0x73, 0x20, 0x67, 2280 .result = { 0x54, 0x65, 0x61, 0x20, 0x69, 0x73, 0x20, 0x67,
2295 0x6f, 0x6f, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20, 2281 0x6f, 0x6f, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20,
2296 0x79, 0x6f, 0x75, 0x21, 0x21, 0x21, 0x20, 0x72, 2282 0x79, 0x6f, 0x75, 0x21, 0x21, 0x21, 0x20, 0x72,
2297 0x65, 0x61, 0x6c, 0x6c, 0x79, 0x21, 0x21, 0x21 }, 2283 0x65, 0x61, 0x6c, 0x6c, 0x79, 0x21, 0x21, 0x21 },
2298 .rlen = 32, 2284 .rlen = 32,
2299 } 2285 }
@@ -2305,9 +2291,9 @@ static struct cipher_testvec xtea_dec_tv_template[] =
2305#define KHAZAD_ENC_TEST_VECTORS 5 2291#define KHAZAD_ENC_TEST_VECTORS 5
2306#define KHAZAD_DEC_TEST_VECTORS 5 2292#define KHAZAD_DEC_TEST_VECTORS 5
2307 2293
2308static struct cipher_testvec khazad_enc_tv_template[] = { 2294static struct cipher_testvec khazad_enc_tv_template[] = {
2309 { 2295 {
2310 .key = { 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 2296 .key = { 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2311 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 2297 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
2312 .klen = 16, 2298 .klen = 16,
2313 .input = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 2299 .input = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
@@ -2351,9 +2337,9 @@ static struct cipher_testvec khazad_enc_tv_template[] = {
2351 }, 2337 },
2352}; 2338};
2353 2339
2354static struct cipher_testvec khazad_dec_tv_template[] = { 2340static struct cipher_testvec khazad_dec_tv_template[] = {
2355 { 2341 {
2356 .key = { 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 2342 .key = { 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2357 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 2343 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
2358 .klen = 16, 2344 .klen = 16,
2359 .input = { 0X49, 0Xa4, 0Xce, 0X32, 0Xac, 0X19, 0X0e, 0X3f }, 2345 .input = { 0X49, 0Xa4, 0Xce, 0X32, 0Xac, 0X19, 0X0e, 0X3f },
@@ -2697,8 +2683,7 @@ static struct comp_testvec deflate_decomp_tv_template[] = {
2697 */ 2683 */
2698#define MICHAEL_MIC_TEST_VECTORS 6 2684#define MICHAEL_MIC_TEST_VECTORS 6
2699 2685
2700static struct hash_testvec michael_mic_tv_template[] = 2686static struct hash_testvec michael_mic_tv_template[] = {
2701{
2702 { 2687 {
2703 .key = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 2688 .key = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
2704 .ksize = 8, 2689 .ksize = 8,