diff options
author | Jussi Kivilinna <jussi.kivilinna@mbnet.fi> | 2011-10-10 16:03:03 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2011-10-21 08:28:58 -0400 |
commit | 85b63e342c7ee0b9ac5281a5dfb0f1355bf6d75d (patch) | |
tree | 02b729aaddb380e65cff85da702cb785e1089a76 /crypto | |
parent | 75b766258eb2b8255c628a994663bd5298f216e6 (diff) |
crypto: testmgr - add blowfish test-vectors
Add tests for parallel blowfish-x86_64 code paths.
Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/tcrypt.c | 1 | ||||
-rw-r--r-- | crypto/testmgr.c | 15 | ||||
-rw-r--r-- | crypto/testmgr.h | 172 |
3 files changed, 184 insertions, 4 deletions
diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c index fc35650645e8..91f3ab4e3a90 100644 --- a/crypto/tcrypt.c +++ b/crypto/tcrypt.c | |||
@@ -782,6 +782,7 @@ static int do_test(int m) | |||
782 | case 7: | 782 | case 7: |
783 | ret += tcrypt_test("ecb(blowfish)"); | 783 | ret += tcrypt_test("ecb(blowfish)"); |
784 | ret += tcrypt_test("cbc(blowfish)"); | 784 | ret += tcrypt_test("cbc(blowfish)"); |
785 | ret += tcrypt_test("ctr(blowfish)"); | ||
785 | break; | 786 | break; |
786 | 787 | ||
787 | case 8: | 788 | case 8: |
diff --git a/crypto/testmgr.c b/crypto/testmgr.c index b6b93d416351..466f9c01e480 100644 --- a/crypto/testmgr.c +++ b/crypto/testmgr.c | |||
@@ -1756,6 +1756,21 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
1756 | } | 1756 | } |
1757 | } | 1757 | } |
1758 | }, { | 1758 | }, { |
1759 | .alg = "ctr(blowfish)", | ||
1760 | .test = alg_test_skcipher, | ||
1761 | .suite = { | ||
1762 | .cipher = { | ||
1763 | .enc = { | ||
1764 | .vecs = bf_ctr_enc_tv_template, | ||
1765 | .count = BF_CTR_ENC_TEST_VECTORS | ||
1766 | }, | ||
1767 | .dec = { | ||
1768 | .vecs = bf_ctr_dec_tv_template, | ||
1769 | .count = BF_CTR_DEC_TEST_VECTORS | ||
1770 | } | ||
1771 | } | ||
1772 | } | ||
1773 | }, { | ||
1759 | .alg = "cts(cbc(aes))", | 1774 | .alg = "cts(cbc(aes))", |
1760 | .test = alg_test_skcipher, | 1775 | .test = alg_test_skcipher, |
1761 | .suite = { | 1776 | .suite = { |
diff --git a/crypto/testmgr.h b/crypto/testmgr.h index 27adc92842ba..a51902242261 100644 --- a/crypto/testmgr.h +++ b/crypto/testmgr.h | |||
@@ -2391,10 +2391,12 @@ static struct cipher_testvec des3_ede_cbc_dec_tv_template[] = { | |||
2391 | /* | 2391 | /* |
2392 | * Blowfish test vectors. | 2392 | * Blowfish test vectors. |
2393 | */ | 2393 | */ |
2394 | #define BF_ENC_TEST_VECTORS 6 | 2394 | #define BF_ENC_TEST_VECTORS 7 |
2395 | #define BF_DEC_TEST_VECTORS 6 | 2395 | #define BF_DEC_TEST_VECTORS 7 |
2396 | #define BF_CBC_ENC_TEST_VECTORS 1 | 2396 | #define BF_CBC_ENC_TEST_VECTORS 2 |
2397 | #define BF_CBC_DEC_TEST_VECTORS 1 | 2397 | #define BF_CBC_DEC_TEST_VECTORS 2 |
2398 | #define BF_CTR_ENC_TEST_VECTORS 2 | ||
2399 | #define BF_CTR_DEC_TEST_VECTORS 2 | ||
2398 | 2400 | ||
2399 | static struct cipher_testvec bf_enc_tv_template[] = { | 2401 | static struct cipher_testvec bf_enc_tv_template[] = { |
2400 | { /* DES test vectors from OpenSSL */ | 2402 | { /* DES test vectors from OpenSSL */ |
@@ -2448,6 +2450,24 @@ static struct cipher_testvec bf_enc_tv_template[] = { | |||
2448 | .ilen = 8, | 2450 | .ilen = 8, |
2449 | .result = "\xc0\x45\x04\x01\x2e\x4e\x1f\x53", | 2451 | .result = "\xc0\x45\x04\x01\x2e\x4e\x1f\x53", |
2450 | .rlen = 8, | 2452 | .rlen = 8, |
2453 | }, { /* Generated with Crypto++ */ | ||
2454 | .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" | ||
2455 | "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A" | ||
2456 | "\x27\x04\xE1\x27\x04\xE1\xBE\x9B" | ||
2457 | "\x78\xBE\x9B\x78\x55\x32\x0F\x55", | ||
2458 | .klen = 32, | ||
2459 | .input = "\x56\xED\x84\x1B\x8F\x26\xBD\x31" | ||
2460 | "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3" | ||
2461 | "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15" | ||
2462 | "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87" | ||
2463 | "\x1E\x92\x29\xC0\x34\xCB\x62\xF9", | ||
2464 | .ilen = 40, | ||
2465 | .result = "\x96\x87\x3D\x0C\x7B\xFB\xBD\x1F" | ||
2466 | "\xE3\xC1\x99\x6D\x39\xD4\xC2\x7D" | ||
2467 | "\xD7\x87\xA1\xF2\xDF\x51\x71\x26" | ||
2468 | "\xC2\xF4\x6D\xFF\xF6\xCD\x6B\x40" | ||
2469 | "\xE1\xB3\xBF\xD4\x38\x2B\xC8\x3B", | ||
2470 | .rlen = 40, | ||
2451 | }, | 2471 | }, |
2452 | }; | 2472 | }; |
2453 | 2473 | ||
@@ -2503,6 +2523,24 @@ static struct cipher_testvec bf_dec_tv_template[] = { | |||
2503 | .ilen = 8, | 2523 | .ilen = 8, |
2504 | .result = "\xfe\xdc\xba\x98\x76\x54\x32\x10", | 2524 | .result = "\xfe\xdc\xba\x98\x76\x54\x32\x10", |
2505 | .rlen = 8, | 2525 | .rlen = 8, |
2526 | }, { /* Generated with Crypto++ */ | ||
2527 | .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" | ||
2528 | "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A" | ||
2529 | "\x27\x04\xE1\x27\x04\xE1\xBE\x9B" | ||
2530 | "\x78\xBE\x9B\x78\x55\x32\x0F\x55", | ||
2531 | .klen = 32, | ||
2532 | .input = "\x96\x87\x3D\x0C\x7B\xFB\xBD\x1F" | ||
2533 | "\xE3\xC1\x99\x6D\x39\xD4\xC2\x7D" | ||
2534 | "\xD7\x87\xA1\xF2\xDF\x51\x71\x26" | ||
2535 | "\xC2\xF4\x6D\xFF\xF6\xCD\x6B\x40" | ||
2536 | "\xE1\xB3\xBF\xD4\x38\x2B\xC8\x3B", | ||
2537 | .ilen = 40, | ||
2538 | .result = "\x56\xED\x84\x1B\x8F\x26\xBD\x31" | ||
2539 | "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3" | ||
2540 | "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15" | ||
2541 | "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87" | ||
2542 | "\x1E\x92\x29\xC0\x34\xCB\x62\xF9", | ||
2543 | .rlen = 40, | ||
2506 | }, | 2544 | }, |
2507 | }; | 2545 | }; |
2508 | 2546 | ||
@@ -2522,6 +2560,25 @@ static struct cipher_testvec bf_cbc_enc_tv_template[] = { | |||
2522 | "\x58\xde\xb9\xe7\x15\x46\x16\xd9" | 2560 | "\x58\xde\xb9\xe7\x15\x46\x16\xd9" |
2523 | "\x59\xf1\x65\x2b\xd5\xff\x92\xcc", | 2561 | "\x59\xf1\x65\x2b\xd5\xff\x92\xcc", |
2524 | .rlen = 32, | 2562 | .rlen = 32, |
2563 | }, { /* Generated with Crypto++ */ | ||
2564 | .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" | ||
2565 | "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A" | ||
2566 | "\x27\x04\xE1\x27\x04\xE1\xBE\x9B" | ||
2567 | "\x78\xBE\x9B\x78\x55\x32\x0F\x55", | ||
2568 | .klen = 32, | ||
2569 | .iv = "\xE2\x24\x89\xEE\x53\xB8\x1D\x5F", | ||
2570 | .input = "\x56\xED\x84\x1B\x8F\x26\xBD\x31" | ||
2571 | "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3" | ||
2572 | "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15" | ||
2573 | "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87" | ||
2574 | "\x1E\x92\x29\xC0\x34\xCB\x62\xF9", | ||
2575 | .ilen = 40, | ||
2576 | .result = "\xB4\xFE\xA5\xBB\x3D\x2C\x27\x06" | ||
2577 | "\x06\x2B\x3A\x92\xB2\xF5\x5E\x62" | ||
2578 | "\x84\xCD\xF7\x66\x7E\x41\x6C\x8E" | ||
2579 | "\x1B\xD9\x02\xB6\x48\xB0\x87\x25" | ||
2580 | "\x01\x9C\x93\x63\x51\x60\x82\xD2", | ||
2581 | .rlen = 40, | ||
2525 | }, | 2582 | }, |
2526 | }; | 2583 | }; |
2527 | 2584 | ||
@@ -2541,6 +2598,113 @@ static struct cipher_testvec bf_cbc_dec_tv_template[] = { | |||
2541 | "\x68\x65\x20\x74\x69\x6d\x65\x20" | 2598 | "\x68\x65\x20\x74\x69\x6d\x65\x20" |
2542 | "\x66\x6f\x72\x20\x00\x00\x00\x00", | 2599 | "\x66\x6f\x72\x20\x00\x00\x00\x00", |
2543 | .rlen = 32, | 2600 | .rlen = 32, |
2601 | }, { /* Generated with Crypto++ */ | ||
2602 | .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" | ||
2603 | "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A" | ||
2604 | "\x27\x04\xE1\x27\x04\xE1\xBE\x9B" | ||
2605 | "\x78\xBE\x9B\x78\x55\x32\x0F\x55", | ||
2606 | .klen = 32, | ||
2607 | .iv = "\xE2\x24\x89\xEE\x53\xB8\x1D\x5F", | ||
2608 | .input = "\xB4\xFE\xA5\xBB\x3D\x2C\x27\x06" | ||
2609 | "\x06\x2B\x3A\x92\xB2\xF5\x5E\x62" | ||
2610 | "\x84\xCD\xF7\x66\x7E\x41\x6C\x8E" | ||
2611 | "\x1B\xD9\x02\xB6\x48\xB0\x87\x25" | ||
2612 | "\x01\x9C\x93\x63\x51\x60\x82\xD2", | ||
2613 | .ilen = 40, | ||
2614 | .result = "\x56\xED\x84\x1B\x8F\x26\xBD\x31" | ||
2615 | "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3" | ||
2616 | "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15" | ||
2617 | "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87" | ||
2618 | "\x1E\x92\x29\xC0\x34\xCB\x62\xF9", | ||
2619 | .rlen = 40, | ||
2620 | }, | ||
2621 | }; | ||
2622 | |||
2623 | static struct cipher_testvec bf_ctr_enc_tv_template[] = { | ||
2624 | { /* Generated with Crypto++ */ | ||
2625 | .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" | ||
2626 | "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A" | ||
2627 | "\x27\x04\xE1\x27\x04\xE1\xBE\x9B" | ||
2628 | "\x78\xBE\x9B\x78\x55\x32\x0F\x55", | ||
2629 | .klen = 32, | ||
2630 | .iv = "\xE2\x24\x89\xEE\x53\xB8\x1D\x5F", | ||
2631 | .input = "\x56\xED\x84\x1B\x8F\x26\xBD\x31" | ||
2632 | "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3" | ||
2633 | "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15" | ||
2634 | "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87" | ||
2635 | "\x1E\x92\x29\xC0\x34\xCB\x62\xF9", | ||
2636 | .ilen = 40, | ||
2637 | .result = "\xC7\xA3\xDF\xB9\x05\xF4\x9E\x8D" | ||
2638 | "\x9E\xDF\x38\x18\x83\x07\xEF\xC1" | ||
2639 | "\x93\x3C\xAA\xAA\xFE\x06\x42\xCC" | ||
2640 | "\x0D\x70\x86\x5A\x44\xAD\x85\x17" | ||
2641 | "\xE4\x1F\x5E\xA5\x89\xAC\x32\xBC", | ||
2642 | .rlen = 40, | ||
2643 | }, { /* Generated with Crypto++ */ | ||
2644 | .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" | ||
2645 | "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A" | ||
2646 | "\x27\x04\xE1\x27\x04\xE1\xBE\x9B" | ||
2647 | "\x78\xBE\x9B\x78\x55\x32\x0F\x55", | ||
2648 | .klen = 32, | ||
2649 | .iv = "\xE2\x24\x89\xEE\x53\xB8\x1D\x5F", | ||
2650 | .input = "\x56\xED\x84\x1B\x8F\x26\xBD\x31" | ||
2651 | "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3" | ||
2652 | "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15" | ||
2653 | "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87" | ||
2654 | "\x1E\x92\x29\xC0\x34\xCB\x62\xF9" | ||
2655 | "\x6D\x04\x9B", | ||
2656 | .ilen = 43, | ||
2657 | .result = "\xC7\xA3\xDF\xB9\x05\xF4\x9E\x8D" | ||
2658 | "\x9E\xDF\x38\x18\x83\x07\xEF\xC1" | ||
2659 | "\x93\x3C\xAA\xAA\xFE\x06\x42\xCC" | ||
2660 | "\x0D\x70\x86\x5A\x44\xAD\x85\x17" | ||
2661 | "\xE4\x1F\x5E\xA5\x89\xAC\x32\xBC" | ||
2662 | "\x3D\xA7\xE9", | ||
2663 | .rlen = 43, | ||
2664 | }, | ||
2665 | }; | ||
2666 | |||
2667 | static struct cipher_testvec bf_ctr_dec_tv_template[] = { | ||
2668 | { /* Generated with Crypto++ */ | ||
2669 | .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" | ||
2670 | "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A" | ||
2671 | "\x27\x04\xE1\x27\x04\xE1\xBE\x9B" | ||
2672 | "\x78\xBE\x9B\x78\x55\x32\x0F\x55", | ||
2673 | .klen = 32, | ||
2674 | .iv = "\xE2\x24\x89\xEE\x53\xB8\x1D\x5F", | ||
2675 | .input = "\xC7\xA3\xDF\xB9\x05\xF4\x9E\x8D" | ||
2676 | "\x9E\xDF\x38\x18\x83\x07\xEF\xC1" | ||
2677 | "\x93\x3C\xAA\xAA\xFE\x06\x42\xCC" | ||
2678 | "\x0D\x70\x86\x5A\x44\xAD\x85\x17" | ||
2679 | "\xE4\x1F\x5E\xA5\x89\xAC\x32\xBC", | ||
2680 | .ilen = 40, | ||
2681 | .result = "\x56\xED\x84\x1B\x8F\x26\xBD\x31" | ||
2682 | "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3" | ||
2683 | "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15" | ||
2684 | "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87" | ||
2685 | "\x1E\x92\x29\xC0\x34\xCB\x62\xF9", | ||
2686 | .rlen = 40, | ||
2687 | }, { /* Generated with Crypto++ */ | ||
2688 | .key = "\x85\x62\x3F\x1C\xF9\xD6\x1C\xF9" | ||
2689 | "\xD6\xB3\x90\x6D\x4A\x90\x6D\x4A" | ||
2690 | "\x27\x04\xE1\x27\x04\xE1\xBE\x9B" | ||
2691 | "\x78\xBE\x9B\x78\x55\x32\x0F\x55", | ||
2692 | .klen = 32, | ||
2693 | .iv = "\xE2\x24\x89\xEE\x53\xB8\x1D\x5F", | ||
2694 | .input = "\xC7\xA3\xDF\xB9\x05\xF4\x9E\x8D" | ||
2695 | "\x9E\xDF\x38\x18\x83\x07\xEF\xC1" | ||
2696 | "\x93\x3C\xAA\xAA\xFE\x06\x42\xCC" | ||
2697 | "\x0D\x70\x86\x5A\x44\xAD\x85\x17" | ||
2698 | "\xE4\x1F\x5E\xA5\x89\xAC\x32\xBC" | ||
2699 | "\x3D\xA7\xE9", | ||
2700 | .ilen = 43, | ||
2701 | .result = "\x56\xED\x84\x1B\x8F\x26\xBD\x31" | ||
2702 | "\xC8\x5F\xF6\x6A\x01\x98\x0C\xA3" | ||
2703 | "\x3A\xD1\x45\xDC\x73\x0A\x7E\x15" | ||
2704 | "\xAC\x20\xB7\x4E\xE5\x59\xF0\x87" | ||
2705 | "\x1E\x92\x29\xC0\x34\xCB\x62\xF9" | ||
2706 | "\x6D\x04\x9B", | ||
2707 | .rlen = 43, | ||
2544 | }, | 2708 | }, |
2545 | }; | 2709 | }; |
2546 | 2710 | ||