diff options
-rw-r--r-- | crypto/tcrypt.c | 435 |
1 files changed, 259 insertions, 176 deletions
diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c index 56d0d8b3bcf2..5e2278069d22 100644 --- a/crypto/tcrypt.c +++ b/crypto/tcrypt.c | |||
@@ -17,6 +17,7 @@ | |||
17 | * | 17 | * |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <linux/err.h> | ||
20 | #include <linux/init.h> | 21 | #include <linux/init.h> |
21 | #include <linux/module.h> | 22 | #include <linux/module.h> |
22 | #include <linux/mm.h> | 23 | #include <linux/mm.h> |
@@ -54,8 +55,6 @@ | |||
54 | */ | 55 | */ |
55 | #define ENCRYPT 1 | 56 | #define ENCRYPT 1 |
56 | #define DECRYPT 0 | 57 | #define DECRYPT 0 |
57 | #define MODE_ECB 1 | ||
58 | #define MODE_CBC 0 | ||
59 | 58 | ||
60 | static unsigned int IDX[8] = { IDX1, IDX2, IDX3, IDX4, IDX5, IDX6, IDX7, IDX8 }; | 59 | static unsigned int IDX[8] = { IDX1, IDX2, IDX3, IDX4, IDX5, IDX6, IDX7, IDX8 }; |
61 | 60 | ||
@@ -250,28 +249,27 @@ out: | |||
250 | 249 | ||
251 | #endif /* CONFIG_CRYPTO_HMAC */ | 250 | #endif /* CONFIG_CRYPTO_HMAC */ |
252 | 251 | ||
253 | static void test_cipher(char *algo, int mode, int enc, | 252 | static void test_cipher(char *algo, int enc, |
254 | struct cipher_testvec *template, unsigned int tcount) | 253 | struct cipher_testvec *template, unsigned int tcount) |
255 | { | 254 | { |
256 | unsigned int ret, i, j, k, temp; | 255 | unsigned int ret, i, j, k, temp; |
257 | unsigned int tsize; | 256 | unsigned int tsize; |
257 | unsigned int iv_len; | ||
258 | unsigned int len; | ||
258 | char *q; | 259 | char *q; |
259 | struct crypto_tfm *tfm; | 260 | struct crypto_blkcipher *tfm; |
260 | char *key; | 261 | char *key; |
261 | struct cipher_testvec *cipher_tv; | 262 | struct cipher_testvec *cipher_tv; |
263 | struct blkcipher_desc desc; | ||
262 | struct scatterlist sg[8]; | 264 | struct scatterlist sg[8]; |
263 | const char *e, *m; | 265 | const char *e; |
264 | 266 | ||
265 | if (enc == ENCRYPT) | 267 | if (enc == ENCRYPT) |
266 | e = "encryption"; | 268 | e = "encryption"; |
267 | else | 269 | else |
268 | e = "decryption"; | 270 | e = "decryption"; |
269 | if (mode == MODE_ECB) | ||
270 | m = "ECB"; | ||
271 | else | ||
272 | m = "CBC"; | ||
273 | 271 | ||
274 | printk("\ntesting %s %s %s\n", algo, m, e); | 272 | printk("\ntesting %s %s\n", algo, e); |
275 | 273 | ||
276 | tsize = sizeof (struct cipher_testvec); | 274 | tsize = sizeof (struct cipher_testvec); |
277 | tsize *= tcount; | 275 | tsize *= tcount; |
@@ -285,15 +283,15 @@ static void test_cipher(char *algo, int mode, int enc, | |||
285 | memcpy(tvmem, template, tsize); | 283 | memcpy(tvmem, template, tsize); |
286 | cipher_tv = (void *)tvmem; | 284 | cipher_tv = (void *)tvmem; |
287 | 285 | ||
288 | if (mode) | 286 | tfm = crypto_alloc_blkcipher(algo, 0, CRYPTO_ALG_ASYNC); |
289 | tfm = crypto_alloc_tfm(algo, 0); | ||
290 | else | ||
291 | tfm = crypto_alloc_tfm(algo, CRYPTO_TFM_MODE_CBC); | ||
292 | 287 | ||
293 | if (tfm == NULL) { | 288 | if (IS_ERR(tfm)) { |
294 | printk("failed to load transform for %s %s\n", algo, m); | 289 | printk("failed to load transform for %s: %ld\n", algo, |
290 | PTR_ERR(tfm)); | ||
295 | return; | 291 | return; |
296 | } | 292 | } |
293 | desc.tfm = tfm; | ||
294 | desc.flags = 0; | ||
297 | 295 | ||
298 | j = 0; | 296 | j = 0; |
299 | for (i = 0; i < tcount; i++) { | 297 | for (i = 0; i < tcount; i++) { |
@@ -302,14 +300,17 @@ static void test_cipher(char *algo, int mode, int enc, | |||
302 | printk("test %u (%d bit key):\n", | 300 | printk("test %u (%d bit key):\n", |
303 | j, cipher_tv[i].klen * 8); | 301 | j, cipher_tv[i].klen * 8); |
304 | 302 | ||
305 | tfm->crt_flags = 0; | 303 | crypto_blkcipher_clear_flags(tfm, ~0); |
306 | if (cipher_tv[i].wk) | 304 | if (cipher_tv[i].wk) |
307 | tfm->crt_flags |= CRYPTO_TFM_REQ_WEAK_KEY; | 305 | crypto_blkcipher_set_flags( |
306 | tfm, CRYPTO_TFM_REQ_WEAK_KEY); | ||
308 | key = cipher_tv[i].key; | 307 | key = cipher_tv[i].key; |
309 | 308 | ||
310 | ret = crypto_cipher_setkey(tfm, key, cipher_tv[i].klen); | 309 | ret = crypto_blkcipher_setkey(tfm, key, |
310 | cipher_tv[i].klen); | ||
311 | if (ret) { | 311 | if (ret) { |
312 | printk("setkey() failed flags=%x\n", tfm->crt_flags); | 312 | printk("setkey() failed flags=%x\n", |
313 | crypto_blkcipher_get_flags(tfm)); | ||
313 | 314 | ||
314 | if (!cipher_tv[i].fail) | 315 | if (!cipher_tv[i].fail) |
315 | goto out; | 316 | goto out; |
@@ -318,19 +319,19 @@ static void test_cipher(char *algo, int mode, int enc, | |||
318 | sg_set_buf(&sg[0], cipher_tv[i].input, | 319 | sg_set_buf(&sg[0], cipher_tv[i].input, |
319 | cipher_tv[i].ilen); | 320 | cipher_tv[i].ilen); |
320 | 321 | ||
321 | if (!mode) { | 322 | iv_len = crypto_blkcipher_ivsize(tfm); |
322 | crypto_cipher_set_iv(tfm, cipher_tv[i].iv, | 323 | if (iv_len) |
323 | crypto_tfm_alg_ivsize(tfm)); | 324 | crypto_blkcipher_set_iv(tfm, cipher_tv[i].iv, |
324 | } | 325 | iv_len); |
325 | |||
326 | if (enc) | ||
327 | ret = crypto_cipher_encrypt(tfm, sg, sg, cipher_tv[i].ilen); | ||
328 | else | ||
329 | ret = crypto_cipher_decrypt(tfm, sg, sg, cipher_tv[i].ilen); | ||
330 | 326 | ||
327 | len = cipher_tv[i].ilen; | ||
328 | ret = enc ? | ||
329 | crypto_blkcipher_encrypt(&desc, sg, sg, len) : | ||
330 | crypto_blkcipher_decrypt(&desc, sg, sg, len); | ||
331 | 331 | ||
332 | if (ret) { | 332 | if (ret) { |
333 | printk("%s () failed flags=%x\n", e, tfm->crt_flags); | 333 | printk("%s () failed flags=%x\n", e, |
334 | desc.flags); | ||
334 | goto out; | 335 | goto out; |
335 | } | 336 | } |
336 | 337 | ||
@@ -343,7 +344,7 @@ static void test_cipher(char *algo, int mode, int enc, | |||
343 | } | 344 | } |
344 | } | 345 | } |
345 | 346 | ||
346 | printk("\ntesting %s %s %s across pages (chunking)\n", algo, m, e); | 347 | printk("\ntesting %s %s across pages (chunking)\n", algo, e); |
347 | memset(xbuf, 0, XBUFSIZE); | 348 | memset(xbuf, 0, XBUFSIZE); |
348 | 349 | ||
349 | j = 0; | 350 | j = 0; |
@@ -353,14 +354,17 @@ static void test_cipher(char *algo, int mode, int enc, | |||
353 | printk("test %u (%d bit key):\n", | 354 | printk("test %u (%d bit key):\n", |
354 | j, cipher_tv[i].klen * 8); | 355 | j, cipher_tv[i].klen * 8); |
355 | 356 | ||
356 | tfm->crt_flags = 0; | 357 | crypto_blkcipher_clear_flags(tfm, ~0); |
357 | if (cipher_tv[i].wk) | 358 | if (cipher_tv[i].wk) |
358 | tfm->crt_flags |= CRYPTO_TFM_REQ_WEAK_KEY; | 359 | crypto_blkcipher_set_flags( |
360 | tfm, CRYPTO_TFM_REQ_WEAK_KEY); | ||
359 | key = cipher_tv[i].key; | 361 | key = cipher_tv[i].key; |
360 | 362 | ||
361 | ret = crypto_cipher_setkey(tfm, key, cipher_tv[i].klen); | 363 | ret = crypto_blkcipher_setkey(tfm, key, |
364 | cipher_tv[i].klen); | ||
362 | if (ret) { | 365 | if (ret) { |
363 | printk("setkey() failed flags=%x\n", tfm->crt_flags); | 366 | printk("setkey() failed flags=%x\n", |
367 | crypto_blkcipher_get_flags(tfm)); | ||
364 | 368 | ||
365 | if (!cipher_tv[i].fail) | 369 | if (!cipher_tv[i].fail) |
366 | goto out; | 370 | goto out; |
@@ -376,18 +380,19 @@ static void test_cipher(char *algo, int mode, int enc, | |||
376 | cipher_tv[i].tap[k]); | 380 | cipher_tv[i].tap[k]); |
377 | } | 381 | } |
378 | 382 | ||
379 | if (!mode) { | 383 | iv_len = crypto_blkcipher_ivsize(tfm); |
380 | crypto_cipher_set_iv(tfm, cipher_tv[i].iv, | 384 | if (iv_len) |
381 | crypto_tfm_alg_ivsize(tfm)); | 385 | crypto_blkcipher_set_iv(tfm, cipher_tv[i].iv, |
382 | } | 386 | iv_len); |
383 | 387 | ||
384 | if (enc) | 388 | len = cipher_tv[i].ilen; |
385 | ret = crypto_cipher_encrypt(tfm, sg, sg, cipher_tv[i].ilen); | 389 | ret = enc ? |
386 | else | 390 | crypto_blkcipher_encrypt(&desc, sg, sg, len) : |
387 | ret = crypto_cipher_decrypt(tfm, sg, sg, cipher_tv[i].ilen); | 391 | crypto_blkcipher_decrypt(&desc, sg, sg, len); |
388 | 392 | ||
389 | if (ret) { | 393 | if (ret) { |
390 | printk("%s () failed flags=%x\n", e, tfm->crt_flags); | 394 | printk("%s () failed flags=%x\n", e, |
395 | desc.flags); | ||
391 | goto out; | 396 | goto out; |
392 | } | 397 | } |
393 | 398 | ||
@@ -406,10 +411,10 @@ static void test_cipher(char *algo, int mode, int enc, | |||
406 | } | 411 | } |
407 | 412 | ||
408 | out: | 413 | out: |
409 | crypto_free_tfm(tfm); | 414 | crypto_free_blkcipher(tfm); |
410 | } | 415 | } |
411 | 416 | ||
412 | static int test_cipher_jiffies(struct crypto_tfm *tfm, int enc, char *p, | 417 | static int test_cipher_jiffies(struct blkcipher_desc *desc, int enc, char *p, |
413 | int blen, int sec) | 418 | int blen, int sec) |
414 | { | 419 | { |
415 | struct scatterlist sg[1]; | 420 | struct scatterlist sg[1]; |
@@ -422,9 +427,9 @@ static int test_cipher_jiffies(struct crypto_tfm *tfm, int enc, char *p, | |||
422 | for (start = jiffies, end = start + sec * HZ, bcount = 0; | 427 | for (start = jiffies, end = start + sec * HZ, bcount = 0; |
423 | time_before(jiffies, end); bcount++) { | 428 | time_before(jiffies, end); bcount++) { |
424 | if (enc) | 429 | if (enc) |
425 | ret = crypto_cipher_encrypt(tfm, sg, sg, blen); | 430 | ret = crypto_blkcipher_encrypt(desc, sg, sg, blen); |
426 | else | 431 | else |
427 | ret = crypto_cipher_decrypt(tfm, sg, sg, blen); | 432 | ret = crypto_blkcipher_decrypt(desc, sg, sg, blen); |
428 | 433 | ||
429 | if (ret) | 434 | if (ret) |
430 | return ret; | 435 | return ret; |
@@ -435,7 +440,7 @@ static int test_cipher_jiffies(struct crypto_tfm *tfm, int enc, char *p, | |||
435 | return 0; | 440 | return 0; |
436 | } | 441 | } |
437 | 442 | ||
438 | static int test_cipher_cycles(struct crypto_tfm *tfm, int enc, char *p, | 443 | static int test_cipher_cycles(struct blkcipher_desc *desc, int enc, char *p, |
439 | int blen) | 444 | int blen) |
440 | { | 445 | { |
441 | struct scatterlist sg[1]; | 446 | struct scatterlist sg[1]; |
@@ -451,9 +456,9 @@ static int test_cipher_cycles(struct crypto_tfm *tfm, int enc, char *p, | |||
451 | /* Warm-up run. */ | 456 | /* Warm-up run. */ |
452 | for (i = 0; i < 4; i++) { | 457 | for (i = 0; i < 4; i++) { |
453 | if (enc) | 458 | if (enc) |
454 | ret = crypto_cipher_encrypt(tfm, sg, sg, blen); | 459 | ret = crypto_blkcipher_encrypt(desc, sg, sg, blen); |
455 | else | 460 | else |
456 | ret = crypto_cipher_decrypt(tfm, sg, sg, blen); | 461 | ret = crypto_blkcipher_decrypt(desc, sg, sg, blen); |
457 | 462 | ||
458 | if (ret) | 463 | if (ret) |
459 | goto out; | 464 | goto out; |
@@ -465,9 +470,9 @@ static int test_cipher_cycles(struct crypto_tfm *tfm, int enc, char *p, | |||
465 | 470 | ||
466 | start = get_cycles(); | 471 | start = get_cycles(); |
467 | if (enc) | 472 | if (enc) |
468 | ret = crypto_cipher_encrypt(tfm, sg, sg, blen); | 473 | ret = crypto_blkcipher_encrypt(desc, sg, sg, blen); |
469 | else | 474 | else |
470 | ret = crypto_cipher_decrypt(tfm, sg, sg, blen); | 475 | ret = crypto_blkcipher_decrypt(desc, sg, sg, blen); |
471 | end = get_cycles(); | 476 | end = get_cycles(); |
472 | 477 | ||
473 | if (ret) | 478 | if (ret) |
@@ -487,35 +492,32 @@ out: | |||
487 | return ret; | 492 | return ret; |
488 | } | 493 | } |
489 | 494 | ||
490 | static void test_cipher_speed(char *algo, int mode, int enc, unsigned int sec, | 495 | static void test_cipher_speed(char *algo, int enc, unsigned int sec, |
491 | struct cipher_testvec *template, | 496 | struct cipher_testvec *template, |
492 | unsigned int tcount, struct cipher_speed *speed) | 497 | unsigned int tcount, struct cipher_speed *speed) |
493 | { | 498 | { |
494 | unsigned int ret, i, j, iv_len; | 499 | unsigned int ret, i, j, iv_len; |
495 | unsigned char *key, *p, iv[128]; | 500 | unsigned char *key, *p, iv[128]; |
496 | struct crypto_tfm *tfm; | 501 | struct crypto_blkcipher *tfm; |
497 | const char *e, *m; | 502 | struct blkcipher_desc desc; |
503 | const char *e; | ||
498 | 504 | ||
499 | if (enc == ENCRYPT) | 505 | if (enc == ENCRYPT) |
500 | e = "encryption"; | 506 | e = "encryption"; |
501 | else | 507 | else |
502 | e = "decryption"; | 508 | e = "decryption"; |
503 | if (mode == MODE_ECB) | ||
504 | m = "ECB"; | ||
505 | else | ||
506 | m = "CBC"; | ||
507 | 509 | ||
508 | printk("\ntesting speed of %s %s %s\n", algo, m, e); | 510 | printk("\ntesting speed of %s %s\n", algo, e); |
509 | 511 | ||
510 | if (mode) | 512 | tfm = crypto_alloc_blkcipher(algo, 0, CRYPTO_ALG_ASYNC); |
511 | tfm = crypto_alloc_tfm(algo, 0); | ||
512 | else | ||
513 | tfm = crypto_alloc_tfm(algo, CRYPTO_TFM_MODE_CBC); | ||
514 | 513 | ||
515 | if (tfm == NULL) { | 514 | if (IS_ERR(tfm)) { |
516 | printk("failed to load transform for %s %s\n", algo, m); | 515 | printk("failed to load transform for %s: %ld\n", algo, |
516 | PTR_ERR(tfm)); | ||
517 | return; | 517 | return; |
518 | } | 518 | } |
519 | desc.tfm = tfm; | ||
520 | desc.flags = 0; | ||
519 | 521 | ||
520 | for (i = 0; speed[i].klen != 0; i++) { | 522 | for (i = 0; speed[i].klen != 0; i++) { |
521 | if ((speed[i].blen + speed[i].klen) > TVMEMSIZE) { | 523 | if ((speed[i].blen + speed[i].klen) > TVMEMSIZE) { |
@@ -539,32 +541,33 @@ static void test_cipher_speed(char *algo, int mode, int enc, unsigned int sec, | |||
539 | } | 541 | } |
540 | p = (unsigned char *)tvmem + speed[i].klen; | 542 | p = (unsigned char *)tvmem + speed[i].klen; |
541 | 543 | ||
542 | ret = crypto_cipher_setkey(tfm, key, speed[i].klen); | 544 | ret = crypto_blkcipher_setkey(tfm, key, speed[i].klen); |
543 | if (ret) { | 545 | if (ret) { |
544 | printk("setkey() failed flags=%x\n", tfm->crt_flags); | 546 | printk("setkey() failed flags=%x\n", |
547 | crypto_blkcipher_get_flags(tfm)); | ||
545 | goto out; | 548 | goto out; |
546 | } | 549 | } |
547 | 550 | ||
548 | if (!mode) { | 551 | iv_len = crypto_blkcipher_ivsize(tfm); |
549 | iv_len = crypto_tfm_alg_ivsize(tfm); | 552 | if (iv_len) { |
550 | memset(&iv, 0xff, iv_len); | 553 | memset(&iv, 0xff, iv_len); |
551 | crypto_cipher_set_iv(tfm, iv, iv_len); | 554 | crypto_blkcipher_set_iv(tfm, iv, iv_len); |
552 | } | 555 | } |
553 | 556 | ||
554 | if (sec) | 557 | if (sec) |
555 | ret = test_cipher_jiffies(tfm, enc, p, speed[i].blen, | 558 | ret = test_cipher_jiffies(&desc, enc, p, speed[i].blen, |
556 | sec); | 559 | sec); |
557 | else | 560 | else |
558 | ret = test_cipher_cycles(tfm, enc, p, speed[i].blen); | 561 | ret = test_cipher_cycles(&desc, enc, p, speed[i].blen); |
559 | 562 | ||
560 | if (ret) { | 563 | if (ret) { |
561 | printk("%s() failed flags=%x\n", e, tfm->crt_flags); | 564 | printk("%s() failed flags=%x\n", e, desc.flags); |
562 | break; | 565 | break; |
563 | } | 566 | } |
564 | } | 567 | } |
565 | 568 | ||
566 | out: | 569 | out: |
567 | crypto_free_tfm(tfm); | 570 | crypto_free_blkcipher(tfm); |
568 | } | 571 | } |
569 | 572 | ||
570 | static void test_digest_jiffies(struct crypto_tfm *tfm, char *p, int blen, | 573 | static void test_digest_jiffies(struct crypto_tfm *tfm, char *p, int blen, |
@@ -784,79 +787,119 @@ static void do_test(void) | |||
784 | test_hash("sha1", sha1_tv_template, SHA1_TEST_VECTORS); | 787 | test_hash("sha1", sha1_tv_template, SHA1_TEST_VECTORS); |
785 | 788 | ||
786 | //DES | 789 | //DES |
787 | test_cipher ("des", MODE_ECB, ENCRYPT, des_enc_tv_template, DES_ENC_TEST_VECTORS); | 790 | test_cipher("ecb(des)", ENCRYPT, des_enc_tv_template, |
788 | test_cipher ("des", MODE_ECB, DECRYPT, des_dec_tv_template, DES_DEC_TEST_VECTORS); | 791 | DES_ENC_TEST_VECTORS); |
789 | test_cipher ("des", MODE_CBC, ENCRYPT, des_cbc_enc_tv_template, DES_CBC_ENC_TEST_VECTORS); | 792 | test_cipher("ecb(des)", DECRYPT, des_dec_tv_template, |
790 | test_cipher ("des", MODE_CBC, DECRYPT, des_cbc_dec_tv_template, DES_CBC_DEC_TEST_VECTORS); | 793 | DES_DEC_TEST_VECTORS); |
794 | test_cipher("cbc(des)", ENCRYPT, des_cbc_enc_tv_template, | ||
795 | DES_CBC_ENC_TEST_VECTORS); | ||
796 | test_cipher("cbc(des)", DECRYPT, des_cbc_dec_tv_template, | ||
797 | DES_CBC_DEC_TEST_VECTORS); | ||
791 | 798 | ||
792 | //DES3_EDE | 799 | //DES3_EDE |
793 | test_cipher ("des3_ede", MODE_ECB, ENCRYPT, des3_ede_enc_tv_template, DES3_EDE_ENC_TEST_VECTORS); | 800 | test_cipher("ecb(des3_ede)", ENCRYPT, des3_ede_enc_tv_template, |
794 | test_cipher ("des3_ede", MODE_ECB, DECRYPT, des3_ede_dec_tv_template, DES3_EDE_DEC_TEST_VECTORS); | 801 | DES3_EDE_ENC_TEST_VECTORS); |
802 | test_cipher("ecb(des3_ede)", DECRYPT, des3_ede_dec_tv_template, | ||
803 | DES3_EDE_DEC_TEST_VECTORS); | ||
795 | 804 | ||
796 | test_hash("md4", md4_tv_template, MD4_TEST_VECTORS); | 805 | test_hash("md4", md4_tv_template, MD4_TEST_VECTORS); |
797 | 806 | ||
798 | test_hash("sha256", sha256_tv_template, SHA256_TEST_VECTORS); | 807 | test_hash("sha256", sha256_tv_template, SHA256_TEST_VECTORS); |
799 | 808 | ||
800 | //BLOWFISH | 809 | //BLOWFISH |
801 | test_cipher ("blowfish", MODE_ECB, ENCRYPT, bf_enc_tv_template, BF_ENC_TEST_VECTORS); | 810 | test_cipher("ecb(blowfish)", ENCRYPT, bf_enc_tv_template, |
802 | test_cipher ("blowfish", MODE_ECB, DECRYPT, bf_dec_tv_template, BF_DEC_TEST_VECTORS); | 811 | BF_ENC_TEST_VECTORS); |
803 | test_cipher ("blowfish", MODE_CBC, ENCRYPT, bf_cbc_enc_tv_template, BF_CBC_ENC_TEST_VECTORS); | 812 | test_cipher("ecb(blowfish)", DECRYPT, bf_dec_tv_template, |
804 | test_cipher ("blowfish", MODE_CBC, DECRYPT, bf_cbc_dec_tv_template, BF_CBC_DEC_TEST_VECTORS); | 813 | BF_DEC_TEST_VECTORS); |
814 | test_cipher("cbc(blowfish)", ENCRYPT, bf_cbc_enc_tv_template, | ||
815 | BF_CBC_ENC_TEST_VECTORS); | ||
816 | test_cipher("cbc(blowfish)", DECRYPT, bf_cbc_dec_tv_template, | ||
817 | BF_CBC_DEC_TEST_VECTORS); | ||
805 | 818 | ||
806 | //TWOFISH | 819 | //TWOFISH |
807 | test_cipher ("twofish", MODE_ECB, ENCRYPT, tf_enc_tv_template, TF_ENC_TEST_VECTORS); | 820 | test_cipher("ecb(twofish)", ENCRYPT, tf_enc_tv_template, |
808 | test_cipher ("twofish", MODE_ECB, DECRYPT, tf_dec_tv_template, TF_DEC_TEST_VECTORS); | 821 | TF_ENC_TEST_VECTORS); |
809 | test_cipher ("twofish", MODE_CBC, ENCRYPT, tf_cbc_enc_tv_template, TF_CBC_ENC_TEST_VECTORS); | 822 | test_cipher("ecb(twofish)", DECRYPT, tf_dec_tv_template, |
810 | test_cipher ("twofish", MODE_CBC, DECRYPT, tf_cbc_dec_tv_template, TF_CBC_DEC_TEST_VECTORS); | 823 | TF_DEC_TEST_VECTORS); |
824 | test_cipher("cbc(twofish)", ENCRYPT, tf_cbc_enc_tv_template, | ||
825 | TF_CBC_ENC_TEST_VECTORS); | ||
826 | test_cipher("cbc(twofish)", DECRYPT, tf_cbc_dec_tv_template, | ||
827 | TF_CBC_DEC_TEST_VECTORS); | ||
811 | 828 | ||
812 | //SERPENT | 829 | //SERPENT |
813 | test_cipher ("serpent", MODE_ECB, ENCRYPT, serpent_enc_tv_template, SERPENT_ENC_TEST_VECTORS); | 830 | test_cipher("ecb(serpent)", ENCRYPT, serpent_enc_tv_template, |
814 | test_cipher ("serpent", MODE_ECB, DECRYPT, serpent_dec_tv_template, SERPENT_DEC_TEST_VECTORS); | 831 | SERPENT_ENC_TEST_VECTORS); |
832 | test_cipher("ecb(serpent)", DECRYPT, serpent_dec_tv_template, | ||
833 | SERPENT_DEC_TEST_VECTORS); | ||
815 | 834 | ||
816 | //TNEPRES | 835 | //TNEPRES |
817 | test_cipher ("tnepres", MODE_ECB, ENCRYPT, tnepres_enc_tv_template, TNEPRES_ENC_TEST_VECTORS); | 836 | test_cipher("ecb(tnepres)", ENCRYPT, tnepres_enc_tv_template, |
818 | test_cipher ("tnepres", MODE_ECB, DECRYPT, tnepres_dec_tv_template, TNEPRES_DEC_TEST_VECTORS); | 837 | TNEPRES_ENC_TEST_VECTORS); |
838 | test_cipher("ecb(tnepres)", DECRYPT, tnepres_dec_tv_template, | ||
839 | TNEPRES_DEC_TEST_VECTORS); | ||
819 | 840 | ||
820 | //AES | 841 | //AES |
821 | test_cipher ("aes", MODE_ECB, ENCRYPT, aes_enc_tv_template, AES_ENC_TEST_VECTORS); | 842 | test_cipher("ecb(aes)", ENCRYPT, aes_enc_tv_template, |
822 | test_cipher ("aes", MODE_ECB, DECRYPT, aes_dec_tv_template, AES_DEC_TEST_VECTORS); | 843 | AES_ENC_TEST_VECTORS); |
823 | test_cipher ("aes", MODE_CBC, ENCRYPT, aes_cbc_enc_tv_template, AES_CBC_ENC_TEST_VECTORS); | 844 | test_cipher("ecb(aes)", DECRYPT, aes_dec_tv_template, |
824 | test_cipher ("aes", MODE_CBC, DECRYPT, aes_cbc_dec_tv_template, AES_CBC_DEC_TEST_VECTORS); | 845 | AES_DEC_TEST_VECTORS); |
846 | test_cipher("cbc(aes)", ENCRYPT, aes_cbc_enc_tv_template, | ||
847 | AES_CBC_ENC_TEST_VECTORS); | ||
848 | test_cipher("cbc(aes)", DECRYPT, aes_cbc_dec_tv_template, | ||
849 | AES_CBC_DEC_TEST_VECTORS); | ||
825 | 850 | ||
826 | //CAST5 | 851 | //CAST5 |
827 | test_cipher ("cast5", MODE_ECB, ENCRYPT, cast5_enc_tv_template, CAST5_ENC_TEST_VECTORS); | 852 | test_cipher("ecb(cast5)", ENCRYPT, cast5_enc_tv_template, |
828 | test_cipher ("cast5", MODE_ECB, DECRYPT, cast5_dec_tv_template, CAST5_DEC_TEST_VECTORS); | 853 | CAST5_ENC_TEST_VECTORS); |
854 | test_cipher("ecb(cast5)", DECRYPT, cast5_dec_tv_template, | ||
855 | CAST5_DEC_TEST_VECTORS); | ||
829 | 856 | ||
830 | //CAST6 | 857 | //CAST6 |
831 | test_cipher ("cast6", MODE_ECB, ENCRYPT, cast6_enc_tv_template, CAST6_ENC_TEST_VECTORS); | 858 | test_cipher("ecb(cast6)", ENCRYPT, cast6_enc_tv_template, |
832 | test_cipher ("cast6", MODE_ECB, DECRYPT, cast6_dec_tv_template, CAST6_DEC_TEST_VECTORS); | 859 | CAST6_ENC_TEST_VECTORS); |
860 | test_cipher("ecb(cast6)", DECRYPT, cast6_dec_tv_template, | ||
861 | CAST6_DEC_TEST_VECTORS); | ||
833 | 862 | ||
834 | //ARC4 | 863 | //ARC4 |
835 | test_cipher ("arc4", MODE_ECB, ENCRYPT, arc4_enc_tv_template, ARC4_ENC_TEST_VECTORS); | 864 | test_cipher("ecb(arc4)", ENCRYPT, arc4_enc_tv_template, |
836 | test_cipher ("arc4", MODE_ECB, DECRYPT, arc4_dec_tv_template, ARC4_DEC_TEST_VECTORS); | 865 | ARC4_ENC_TEST_VECTORS); |
866 | test_cipher("ecb(arc4)", DECRYPT, arc4_dec_tv_template, | ||
867 | ARC4_DEC_TEST_VECTORS); | ||
837 | 868 | ||
838 | //TEA | 869 | //TEA |
839 | test_cipher ("tea", MODE_ECB, ENCRYPT, tea_enc_tv_template, TEA_ENC_TEST_VECTORS); | 870 | test_cipher("ecb(tea)", ENCRYPT, tea_enc_tv_template, |
840 | test_cipher ("tea", MODE_ECB, DECRYPT, tea_dec_tv_template, TEA_DEC_TEST_VECTORS); | 871 | TEA_ENC_TEST_VECTORS); |
872 | test_cipher("ecb(tea)", DECRYPT, tea_dec_tv_template, | ||
873 | TEA_DEC_TEST_VECTORS); | ||
841 | 874 | ||
842 | 875 | ||
843 | //XTEA | 876 | //XTEA |
844 | test_cipher ("xtea", MODE_ECB, ENCRYPT, xtea_enc_tv_template, XTEA_ENC_TEST_VECTORS); | 877 | test_cipher("ecb(xtea)", ENCRYPT, xtea_enc_tv_template, |
845 | test_cipher ("xtea", MODE_ECB, DECRYPT, xtea_dec_tv_template, XTEA_DEC_TEST_VECTORS); | 878 | XTEA_ENC_TEST_VECTORS); |
879 | test_cipher("ecb(xtea)", DECRYPT, xtea_dec_tv_template, | ||
880 | XTEA_DEC_TEST_VECTORS); | ||
846 | 881 | ||
847 | //KHAZAD | 882 | //KHAZAD |
848 | test_cipher ("khazad", MODE_ECB, ENCRYPT, khazad_enc_tv_template, KHAZAD_ENC_TEST_VECTORS); | 883 | test_cipher("ecb(khazad)", ENCRYPT, khazad_enc_tv_template, |
849 | test_cipher ("khazad", MODE_ECB, DECRYPT, khazad_dec_tv_template, KHAZAD_DEC_TEST_VECTORS); | 884 | KHAZAD_ENC_TEST_VECTORS); |
885 | test_cipher("ecb(khazad)", DECRYPT, khazad_dec_tv_template, | ||
886 | KHAZAD_DEC_TEST_VECTORS); | ||
850 | 887 | ||
851 | //ANUBIS | 888 | //ANUBIS |
852 | test_cipher ("anubis", MODE_ECB, ENCRYPT, anubis_enc_tv_template, ANUBIS_ENC_TEST_VECTORS); | 889 | test_cipher("ecb(anubis)", ENCRYPT, anubis_enc_tv_template, |
853 | test_cipher ("anubis", MODE_ECB, DECRYPT, anubis_dec_tv_template, ANUBIS_DEC_TEST_VECTORS); | 890 | ANUBIS_ENC_TEST_VECTORS); |
854 | test_cipher ("anubis", MODE_CBC, ENCRYPT, anubis_cbc_enc_tv_template, ANUBIS_CBC_ENC_TEST_VECTORS); | 891 | test_cipher("ecb(anubis)", DECRYPT, anubis_dec_tv_template, |
855 | test_cipher ("anubis", MODE_CBC, DECRYPT, anubis_cbc_dec_tv_template, ANUBIS_CBC_ENC_TEST_VECTORS); | 892 | ANUBIS_DEC_TEST_VECTORS); |
893 | test_cipher("cbc(anubis)", ENCRYPT, anubis_cbc_enc_tv_template, | ||
894 | ANUBIS_CBC_ENC_TEST_VECTORS); | ||
895 | test_cipher("cbc(anubis)", DECRYPT, anubis_cbc_dec_tv_template, | ||
896 | ANUBIS_CBC_ENC_TEST_VECTORS); | ||
856 | 897 | ||
857 | //XETA | 898 | //XETA |
858 | test_cipher ("xeta", MODE_ECB, ENCRYPT, xeta_enc_tv_template, XETA_ENC_TEST_VECTORS); | 899 | test_cipher("ecb(xeta)", ENCRYPT, xeta_enc_tv_template, |
859 | test_cipher ("xeta", MODE_ECB, DECRYPT, xeta_dec_tv_template, XETA_DEC_TEST_VECTORS); | 900 | XETA_ENC_TEST_VECTORS); |
901 | test_cipher("ecb(xeta)", DECRYPT, xeta_dec_tv_template, | ||
902 | XETA_DEC_TEST_VECTORS); | ||
860 | 903 | ||
861 | test_hash("sha384", sha384_tv_template, SHA384_TEST_VECTORS); | 904 | test_hash("sha384", sha384_tv_template, SHA384_TEST_VECTORS); |
862 | test_hash("sha512", sha512_tv_template, SHA512_TEST_VECTORS); | 905 | test_hash("sha512", sha512_tv_template, SHA512_TEST_VECTORS); |
@@ -886,15 +929,21 @@ static void do_test(void) | |||
886 | break; | 929 | break; |
887 | 930 | ||
888 | case 3: | 931 | case 3: |
889 | test_cipher ("des", MODE_ECB, ENCRYPT, des_enc_tv_template, DES_ENC_TEST_VECTORS); | 932 | test_cipher("ecb(des)", ENCRYPT, des_enc_tv_template, |
890 | test_cipher ("des", MODE_ECB, DECRYPT, des_dec_tv_template, DES_DEC_TEST_VECTORS); | 933 | DES_ENC_TEST_VECTORS); |
891 | test_cipher ("des", MODE_CBC, ENCRYPT, des_cbc_enc_tv_template, DES_CBC_ENC_TEST_VECTORS); | 934 | test_cipher("ecb(des)", DECRYPT, des_dec_tv_template, |
892 | test_cipher ("des", MODE_CBC, DECRYPT, des_cbc_dec_tv_template, DES_CBC_DEC_TEST_VECTORS); | 935 | DES_DEC_TEST_VECTORS); |
936 | test_cipher("cbc(des)", ENCRYPT, des_cbc_enc_tv_template, | ||
937 | DES_CBC_ENC_TEST_VECTORS); | ||
938 | test_cipher("cbc(des)", DECRYPT, des_cbc_dec_tv_template, | ||
939 | DES_CBC_DEC_TEST_VECTORS); | ||
893 | break; | 940 | break; |
894 | 941 | ||
895 | case 4: | 942 | case 4: |
896 | test_cipher ("des3_ede", MODE_ECB, ENCRYPT, des3_ede_enc_tv_template, DES3_EDE_ENC_TEST_VECTORS); | 943 | test_cipher("ecb(des3_ede)", ENCRYPT, des3_ede_enc_tv_template, |
897 | test_cipher ("des3_ede", MODE_ECB, DECRYPT, des3_ede_dec_tv_template, DES3_EDE_DEC_TEST_VECTORS); | 944 | DES3_EDE_ENC_TEST_VECTORS); |
945 | test_cipher("ecb(des3_ede)", DECRYPT, des3_ede_dec_tv_template, | ||
946 | DES3_EDE_DEC_TEST_VECTORS); | ||
898 | break; | 947 | break; |
899 | 948 | ||
900 | case 5: | 949 | case 5: |
@@ -906,29 +955,43 @@ static void do_test(void) | |||
906 | break; | 955 | break; |
907 | 956 | ||
908 | case 7: | 957 | case 7: |
909 | test_cipher ("blowfish", MODE_ECB, ENCRYPT, bf_enc_tv_template, BF_ENC_TEST_VECTORS); | 958 | test_cipher("ecb(blowfish)", ENCRYPT, bf_enc_tv_template, |
910 | test_cipher ("blowfish", MODE_ECB, DECRYPT, bf_dec_tv_template, BF_DEC_TEST_VECTORS); | 959 | BF_ENC_TEST_VECTORS); |
911 | test_cipher ("blowfish", MODE_CBC, ENCRYPT, bf_cbc_enc_tv_template, BF_CBC_ENC_TEST_VECTORS); | 960 | test_cipher("ecb(blowfish)", DECRYPT, bf_dec_tv_template, |
912 | test_cipher ("blowfish", MODE_CBC, DECRYPT, bf_cbc_dec_tv_template, BF_CBC_DEC_TEST_VECTORS); | 961 | BF_DEC_TEST_VECTORS); |
962 | test_cipher("cbc(blowfish)", ENCRYPT, bf_cbc_enc_tv_template, | ||
963 | BF_CBC_ENC_TEST_VECTORS); | ||
964 | test_cipher("cbc(blowfish)", DECRYPT, bf_cbc_dec_tv_template, | ||
965 | BF_CBC_DEC_TEST_VECTORS); | ||
913 | break; | 966 | break; |
914 | 967 | ||
915 | case 8: | 968 | case 8: |
916 | test_cipher ("twofish", MODE_ECB, ENCRYPT, tf_enc_tv_template, TF_ENC_TEST_VECTORS); | 969 | test_cipher("ecb(twofish)", ENCRYPT, tf_enc_tv_template, |
917 | test_cipher ("twofish", MODE_ECB, DECRYPT, tf_dec_tv_template, TF_DEC_TEST_VECTORS); | 970 | TF_ENC_TEST_VECTORS); |
918 | test_cipher ("twofish", MODE_CBC, ENCRYPT, tf_cbc_enc_tv_template, TF_CBC_ENC_TEST_VECTORS); | 971 | test_cipher("ecb(twofish)", DECRYPT, tf_dec_tv_template, |
919 | test_cipher ("twofish", MODE_CBC, DECRYPT, tf_cbc_dec_tv_template, TF_CBC_DEC_TEST_VECTORS); | 972 | TF_DEC_TEST_VECTORS); |
973 | test_cipher("cbc(twofish)", ENCRYPT, tf_cbc_enc_tv_template, | ||
974 | TF_CBC_ENC_TEST_VECTORS); | ||
975 | test_cipher("cbc(twofish)", DECRYPT, tf_cbc_dec_tv_template, | ||
976 | TF_CBC_DEC_TEST_VECTORS); | ||
920 | break; | 977 | break; |
921 | 978 | ||
922 | case 9: | 979 | case 9: |
923 | test_cipher ("serpent", MODE_ECB, ENCRYPT, serpent_enc_tv_template, SERPENT_ENC_TEST_VECTORS); | 980 | test_cipher("ecb(serpent)", ENCRYPT, serpent_enc_tv_template, |
924 | test_cipher ("serpent", MODE_ECB, DECRYPT, serpent_dec_tv_template, SERPENT_DEC_TEST_VECTORS); | 981 | SERPENT_ENC_TEST_VECTORS); |
982 | test_cipher("ecb(serpent)", DECRYPT, serpent_dec_tv_template, | ||
983 | SERPENT_DEC_TEST_VECTORS); | ||
925 | break; | 984 | break; |
926 | 985 | ||
927 | case 10: | 986 | case 10: |
928 | test_cipher ("aes", MODE_ECB, ENCRYPT, aes_enc_tv_template, AES_ENC_TEST_VECTORS); | 987 | test_cipher("ecb(aes)", ENCRYPT, aes_enc_tv_template, |
929 | test_cipher ("aes", MODE_ECB, DECRYPT, aes_dec_tv_template, AES_DEC_TEST_VECTORS); | 988 | AES_ENC_TEST_VECTORS); |
930 | test_cipher ("aes", MODE_CBC, ENCRYPT, aes_cbc_enc_tv_template, AES_CBC_ENC_TEST_VECTORS); | 989 | test_cipher("ecb(aes)", DECRYPT, aes_dec_tv_template, |
931 | test_cipher ("aes", MODE_CBC, DECRYPT, aes_cbc_dec_tv_template, AES_CBC_DEC_TEST_VECTORS); | 990 | AES_DEC_TEST_VECTORS); |
991 | test_cipher("cbc(aes)", ENCRYPT, aes_cbc_enc_tv_template, | ||
992 | AES_CBC_ENC_TEST_VECTORS); | ||
993 | test_cipher("cbc(aes)", DECRYPT, aes_cbc_dec_tv_template, | ||
994 | AES_CBC_DEC_TEST_VECTORS); | ||
932 | break; | 995 | break; |
933 | 996 | ||
934 | case 11: | 997 | case 11: |
@@ -944,18 +1007,24 @@ static void do_test(void) | |||
944 | break; | 1007 | break; |
945 | 1008 | ||
946 | case 14: | 1009 | case 14: |
947 | test_cipher ("cast5", MODE_ECB, ENCRYPT, cast5_enc_tv_template, CAST5_ENC_TEST_VECTORS); | 1010 | test_cipher("ecb(cast5)", ENCRYPT, cast5_enc_tv_template, |
948 | test_cipher ("cast5", MODE_ECB, DECRYPT, cast5_dec_tv_template, CAST5_DEC_TEST_VECTORS); | 1011 | CAST5_ENC_TEST_VECTORS); |
1012 | test_cipher("ecb(cast5)", DECRYPT, cast5_dec_tv_template, | ||
1013 | CAST5_DEC_TEST_VECTORS); | ||
949 | break; | 1014 | break; |
950 | 1015 | ||
951 | case 15: | 1016 | case 15: |
952 | test_cipher ("cast6", MODE_ECB, ENCRYPT, cast6_enc_tv_template, CAST6_ENC_TEST_VECTORS); | 1017 | test_cipher("ecb(cast6)", ENCRYPT, cast6_enc_tv_template, |
953 | test_cipher ("cast6", MODE_ECB, DECRYPT, cast6_dec_tv_template, CAST6_DEC_TEST_VECTORS); | 1018 | CAST6_ENC_TEST_VECTORS); |
1019 | test_cipher("ecb(cast6)", DECRYPT, cast6_dec_tv_template, | ||
1020 | CAST6_DEC_TEST_VECTORS); | ||
954 | break; | 1021 | break; |
955 | 1022 | ||
956 | case 16: | 1023 | case 16: |
957 | test_cipher ("arc4", MODE_ECB, ENCRYPT, arc4_enc_tv_template, ARC4_ENC_TEST_VECTORS); | 1024 | test_cipher("ecb(arc4)", ENCRYPT, arc4_enc_tv_template, |
958 | test_cipher ("arc4", MODE_ECB, DECRYPT, arc4_dec_tv_template, ARC4_DEC_TEST_VECTORS); | 1025 | ARC4_ENC_TEST_VECTORS); |
1026 | test_cipher("ecb(arc4)", DECRYPT, arc4_dec_tv_template, | ||
1027 | ARC4_DEC_TEST_VECTORS); | ||
959 | break; | 1028 | break; |
960 | 1029 | ||
961 | case 17: | 1030 | case 17: |
@@ -967,18 +1036,24 @@ static void do_test(void) | |||
967 | break; | 1036 | break; |
968 | 1037 | ||
969 | case 19: | 1038 | case 19: |
970 | test_cipher ("tea", MODE_ECB, ENCRYPT, tea_enc_tv_template, TEA_ENC_TEST_VECTORS); | 1039 | test_cipher("ecb(tea)", ENCRYPT, tea_enc_tv_template, |
971 | test_cipher ("tea", MODE_ECB, DECRYPT, tea_dec_tv_template, TEA_DEC_TEST_VECTORS); | 1040 | TEA_ENC_TEST_VECTORS); |
1041 | test_cipher("ecb(tea)", DECRYPT, tea_dec_tv_template, | ||
1042 | TEA_DEC_TEST_VECTORS); | ||
972 | break; | 1043 | break; |
973 | 1044 | ||
974 | case 20: | 1045 | case 20: |
975 | test_cipher ("xtea", MODE_ECB, ENCRYPT, xtea_enc_tv_template, XTEA_ENC_TEST_VECTORS); | 1046 | test_cipher("ecb(xtea)", ENCRYPT, xtea_enc_tv_template, |
976 | test_cipher ("xtea", MODE_ECB, DECRYPT, xtea_dec_tv_template, XTEA_DEC_TEST_VECTORS); | 1047 | XTEA_ENC_TEST_VECTORS); |
1048 | test_cipher("ecb(xtea)", DECRYPT, xtea_dec_tv_template, | ||
1049 | XTEA_DEC_TEST_VECTORS); | ||
977 | break; | 1050 | break; |
978 | 1051 | ||
979 | case 21: | 1052 | case 21: |
980 | test_cipher ("khazad", MODE_ECB, ENCRYPT, khazad_enc_tv_template, KHAZAD_ENC_TEST_VECTORS); | 1053 | test_cipher("ecb(khazad)", ENCRYPT, khazad_enc_tv_template, |
981 | test_cipher ("khazad", MODE_ECB, DECRYPT, khazad_dec_tv_template, KHAZAD_DEC_TEST_VECTORS); | 1054 | KHAZAD_ENC_TEST_VECTORS); |
1055 | test_cipher("ecb(khazad)", DECRYPT, khazad_dec_tv_template, | ||
1056 | KHAZAD_DEC_TEST_VECTORS); | ||
982 | break; | 1057 | break; |
983 | 1058 | ||
984 | case 22: | 1059 | case 22: |
@@ -994,15 +1069,21 @@ static void do_test(void) | |||
994 | break; | 1069 | break; |
995 | 1070 | ||
996 | case 25: | 1071 | case 25: |
997 | test_cipher ("tnepres", MODE_ECB, ENCRYPT, tnepres_enc_tv_template, TNEPRES_ENC_TEST_VECTORS); | 1072 | test_cipher("ecb(tnepres)", ENCRYPT, tnepres_enc_tv_template, |
998 | test_cipher ("tnepres", MODE_ECB, DECRYPT, tnepres_dec_tv_template, TNEPRES_DEC_TEST_VECTORS); | 1073 | TNEPRES_ENC_TEST_VECTORS); |
1074 | test_cipher("ecb(tnepres)", DECRYPT, tnepres_dec_tv_template, | ||
1075 | TNEPRES_DEC_TEST_VECTORS); | ||
999 | break; | 1076 | break; |
1000 | 1077 | ||
1001 | case 26: | 1078 | case 26: |
1002 | test_cipher ("anubis", MODE_ECB, ENCRYPT, anubis_enc_tv_template, ANUBIS_ENC_TEST_VECTORS); | 1079 | test_cipher("ecb(anubis)", ENCRYPT, anubis_enc_tv_template, |
1003 | test_cipher ("anubis", MODE_ECB, DECRYPT, anubis_dec_tv_template, ANUBIS_DEC_TEST_VECTORS); | 1080 | ANUBIS_ENC_TEST_VECTORS); |
1004 | test_cipher ("anubis", MODE_CBC, ENCRYPT, anubis_cbc_enc_tv_template, ANUBIS_CBC_ENC_TEST_VECTORS); | 1081 | test_cipher("ecb(anubis)", DECRYPT, anubis_dec_tv_template, |
1005 | test_cipher ("anubis", MODE_CBC, DECRYPT, anubis_cbc_dec_tv_template, ANUBIS_CBC_ENC_TEST_VECTORS); | 1082 | ANUBIS_DEC_TEST_VECTORS); |
1083 | test_cipher("cbc(anubis)", ENCRYPT, anubis_cbc_enc_tv_template, | ||
1084 | ANUBIS_CBC_ENC_TEST_VECTORS); | ||
1085 | test_cipher("cbc(anubis)", DECRYPT, anubis_cbc_dec_tv_template, | ||
1086 | ANUBIS_CBC_ENC_TEST_VECTORS); | ||
1006 | break; | 1087 | break; |
1007 | 1088 | ||
1008 | case 27: | 1089 | case 27: |
@@ -1019,8 +1100,10 @@ static void do_test(void) | |||
1019 | break; | 1100 | break; |
1020 | 1101 | ||
1021 | case 30: | 1102 | case 30: |
1022 | test_cipher ("xeta", MODE_ECB, ENCRYPT, xeta_enc_tv_template, XETA_ENC_TEST_VECTORS); | 1103 | test_cipher("ecb(xeta)", ENCRYPT, xeta_enc_tv_template, |
1023 | test_cipher ("xeta", MODE_ECB, DECRYPT, xeta_dec_tv_template, XETA_DEC_TEST_VECTORS); | 1104 | XETA_ENC_TEST_VECTORS); |
1105 | test_cipher("ecb(xeta)", DECRYPT, xeta_dec_tv_template, | ||
1106 | XETA_DEC_TEST_VECTORS); | ||
1024 | break; | 1107 | break; |
1025 | 1108 | ||
1026 | #ifdef CONFIG_CRYPTO_HMAC | 1109 | #ifdef CONFIG_CRYPTO_HMAC |
@@ -1039,65 +1122,65 @@ static void do_test(void) | |||
1039 | #endif | 1122 | #endif |
1040 | 1123 | ||
1041 | case 200: | 1124 | case 200: |
1042 | test_cipher_speed("aes", MODE_ECB, ENCRYPT, sec, NULL, 0, | 1125 | test_cipher_speed("ecb(aes)", ENCRYPT, sec, NULL, 0, |
1043 | aes_speed_template); | 1126 | aes_speed_template); |
1044 | test_cipher_speed("aes", MODE_ECB, DECRYPT, sec, NULL, 0, | 1127 | test_cipher_speed("ecb(aes)", DECRYPT, sec, NULL, 0, |
1045 | aes_speed_template); | 1128 | aes_speed_template); |
1046 | test_cipher_speed("aes", MODE_CBC, ENCRYPT, sec, NULL, 0, | 1129 | test_cipher_speed("cbc(aes)", ENCRYPT, sec, NULL, 0, |
1047 | aes_speed_template); | 1130 | aes_speed_template); |
1048 | test_cipher_speed("aes", MODE_CBC, DECRYPT, sec, NULL, 0, | 1131 | test_cipher_speed("cbc(aes)", DECRYPT, sec, NULL, 0, |
1049 | aes_speed_template); | 1132 | aes_speed_template); |
1050 | break; | 1133 | break; |
1051 | 1134 | ||
1052 | case 201: | 1135 | case 201: |
1053 | test_cipher_speed("des3_ede", MODE_ECB, ENCRYPT, sec, | 1136 | test_cipher_speed("ecb(des3_ede)", ENCRYPT, sec, |
1054 | des3_ede_enc_tv_template, | 1137 | des3_ede_enc_tv_template, |
1055 | DES3_EDE_ENC_TEST_VECTORS, | 1138 | DES3_EDE_ENC_TEST_VECTORS, |
1056 | des3_ede_speed_template); | 1139 | des3_ede_speed_template); |
1057 | test_cipher_speed("des3_ede", MODE_ECB, DECRYPT, sec, | 1140 | test_cipher_speed("ecb(des3_ede)", DECRYPT, sec, |
1058 | des3_ede_dec_tv_template, | 1141 | des3_ede_dec_tv_template, |
1059 | DES3_EDE_DEC_TEST_VECTORS, | 1142 | DES3_EDE_DEC_TEST_VECTORS, |
1060 | des3_ede_speed_template); | 1143 | des3_ede_speed_template); |
1061 | test_cipher_speed("des3_ede", MODE_CBC, ENCRYPT, sec, | 1144 | test_cipher_speed("cbc(des3_ede)", ENCRYPT, sec, |
1062 | des3_ede_enc_tv_template, | 1145 | des3_ede_enc_tv_template, |
1063 | DES3_EDE_ENC_TEST_VECTORS, | 1146 | DES3_EDE_ENC_TEST_VECTORS, |
1064 | des3_ede_speed_template); | 1147 | des3_ede_speed_template); |
1065 | test_cipher_speed("des3_ede", MODE_CBC, DECRYPT, sec, | 1148 | test_cipher_speed("cbc(des3_ede)", DECRYPT, sec, |
1066 | des3_ede_dec_tv_template, | 1149 | des3_ede_dec_tv_template, |
1067 | DES3_EDE_DEC_TEST_VECTORS, | 1150 | DES3_EDE_DEC_TEST_VECTORS, |
1068 | des3_ede_speed_template); | 1151 | des3_ede_speed_template); |
1069 | break; | 1152 | break; |
1070 | 1153 | ||
1071 | case 202: | 1154 | case 202: |
1072 | test_cipher_speed("twofish", MODE_ECB, ENCRYPT, sec, NULL, 0, | 1155 | test_cipher_speed("ecb(twofish)", ENCRYPT, sec, NULL, 0, |
1073 | twofish_speed_template); | 1156 | twofish_speed_template); |
1074 | test_cipher_speed("twofish", MODE_ECB, DECRYPT, sec, NULL, 0, | 1157 | test_cipher_speed("ecb(twofish)", DECRYPT, sec, NULL, 0, |
1075 | twofish_speed_template); | 1158 | twofish_speed_template); |
1076 | test_cipher_speed("twofish", MODE_CBC, ENCRYPT, sec, NULL, 0, | 1159 | test_cipher_speed("cbc(twofish)", ENCRYPT, sec, NULL, 0, |
1077 | twofish_speed_template); | 1160 | twofish_speed_template); |
1078 | test_cipher_speed("twofish", MODE_CBC, DECRYPT, sec, NULL, 0, | 1161 | test_cipher_speed("cbc(twofish)", DECRYPT, sec, NULL, 0, |
1079 | twofish_speed_template); | 1162 | twofish_speed_template); |
1080 | break; | 1163 | break; |
1081 | 1164 | ||
1082 | case 203: | 1165 | case 203: |
1083 | test_cipher_speed("blowfish", MODE_ECB, ENCRYPT, sec, NULL, 0, | 1166 | test_cipher_speed("ecb(blowfish)", ENCRYPT, sec, NULL, 0, |
1084 | blowfish_speed_template); | 1167 | blowfish_speed_template); |
1085 | test_cipher_speed("blowfish", MODE_ECB, DECRYPT, sec, NULL, 0, | 1168 | test_cipher_speed("ecb(blowfish)", DECRYPT, sec, NULL, 0, |
1086 | blowfish_speed_template); | 1169 | blowfish_speed_template); |
1087 | test_cipher_speed("blowfish", MODE_CBC, ENCRYPT, sec, NULL, 0, | 1170 | test_cipher_speed("cbc(blowfish)", ENCRYPT, sec, NULL, 0, |
1088 | blowfish_speed_template); | 1171 | blowfish_speed_template); |
1089 | test_cipher_speed("blowfish", MODE_CBC, DECRYPT, sec, NULL, 0, | 1172 | test_cipher_speed("cbc(blowfish)", DECRYPT, sec, NULL, 0, |
1090 | blowfish_speed_template); | 1173 | blowfish_speed_template); |
1091 | break; | 1174 | break; |
1092 | 1175 | ||
1093 | case 204: | 1176 | case 204: |
1094 | test_cipher_speed("des", MODE_ECB, ENCRYPT, sec, NULL, 0, | 1177 | test_cipher_speed("ecb(des)", ENCRYPT, sec, NULL, 0, |
1095 | des_speed_template); | 1178 | des_speed_template); |
1096 | test_cipher_speed("des", MODE_ECB, DECRYPT, sec, NULL, 0, | 1179 | test_cipher_speed("ecb(des)", DECRYPT, sec, NULL, 0, |
1097 | des_speed_template); | 1180 | des_speed_template); |
1098 | test_cipher_speed("des", MODE_CBC, ENCRYPT, sec, NULL, 0, | 1181 | test_cipher_speed("cbc(des)", ENCRYPT, sec, NULL, 0, |
1099 | des_speed_template); | 1182 | des_speed_template); |
1100 | test_cipher_speed("des", MODE_CBC, DECRYPT, sec, NULL, 0, | 1183 | test_cipher_speed("cbc(des)", DECRYPT, sec, NULL, 0, |
1101 | des_speed_template); | 1184 | des_speed_template); |
1102 | break; | 1185 | break; |
1103 | 1186 | ||