aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/testmgr.h
diff options
context:
space:
mode:
authorJussi Kivilinna <jussi.kivilinna@iki.fi>2014-04-12 08:35:29 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2014-04-16 08:40:17 -0400
commit950e4e1c1b334c4975b91106f23fd343be3eb7a0 (patch)
treed87b9b7c428b862bf4088bfb25427cd1167b0e1c /crypto/testmgr.h
parent52d77eb177a034c6ddc6f33ad16458b7df0c5190 (diff)
crypto: testmgr - add empty and large test vectors for SHA-1, SHA-224, SHA-256, SHA-384 and SHA-512
Patch adds large test-vectors for SHA algorithms for better code coverage in optimized assembly implementations. Empty test-vectors are also added, as some crypto drivers appear to have special case handling for empty input. Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/testmgr.h')
-rw-r--r--crypto/testmgr.h728
1 files changed, 721 insertions, 7 deletions
diff --git a/crypto/testmgr.h b/crypto/testmgr.h
index c5d911dd8039..3c95bda11d51 100644
--- a/crypto/testmgr.h
+++ b/crypto/testmgr.h
@@ -487,10 +487,15 @@ static struct hash_testvec crct10dif_tv_template[] = {
487 * SHA1 test vectors from from FIPS PUB 180-1 487 * SHA1 test vectors from from FIPS PUB 180-1
488 * Long vector from CAVS 5.0 488 * Long vector from CAVS 5.0
489 */ 489 */
490#define SHA1_TEST_VECTORS 4 490#define SHA1_TEST_VECTORS 6
491 491
492static struct hash_testvec sha1_tv_template[] = { 492static struct hash_testvec sha1_tv_template[] = {
493 { 493 {
494 .plaintext = "",
495 .psize = 0,
496 .digest = "\xda\x39\xa3\xee\x5e\x6b\x4b\x0d\x32\x55"
497 "\xbf\xef\x95\x60\x18\x90\xaf\xd8\x07\x09",
498 }, {
494 .plaintext = "abc", 499 .plaintext = "abc",
495 .psize = 3, 500 .psize = 3,
496 .digest = "\xa9\x99\x3e\x36\x47\x06\x81\x6a\xba\x3e" 501 .digest = "\xa9\x99\x3e\x36\x47\x06\x81\x6a\xba\x3e"
@@ -534,6 +539,139 @@ static struct hash_testvec sha1_tv_template[] = {
534 .psize = 64, 539 .psize = 64,
535 .digest = "\xc8\x71\xf6\x9a\x63\xcc\xa9\x84\x84\x82" 540 .digest = "\xc8\x71\xf6\x9a\x63\xcc\xa9\x84\x84\x82"
536 "\x64\xe7\x79\x95\x5d\xd7\x19\x41\x7c\x91", 541 "\x64\xe7\x79\x95\x5d\xd7\x19\x41\x7c\x91",
542 }, {
543 .plaintext = "\x08\x9f\x13\xaa\x41\xd8\x4c\xe3"
544 "\x7a\x11\x85\x1c\xb3\x27\xbe\x55"
545 "\xec\x60\xf7\x8e\x02\x99\x30\xc7"
546 "\x3b\xd2\x69\x00\x74\x0b\xa2\x16"
547 "\xad\x44\xdb\x4f\xe6\x7d\x14\x88"
548 "\x1f\xb6\x2a\xc1\x58\xef\x63\xfa"
549 "\x91\x05\x9c\x33\xca\x3e\xd5\x6c"
550 "\x03\x77\x0e\xa5\x19\xb0\x47\xde"
551 "\x52\xe9\x80\x17\x8b\x22\xb9\x2d"
552 "\xc4\x5b\xf2\x66\xfd\x94\x08\x9f"
553 "\x36\xcd\x41\xd8\x6f\x06\x7a\x11"
554 "\xa8\x1c\xb3\x4a\xe1\x55\xec\x83"
555 "\x1a\x8e\x25\xbc\x30\xc7\x5e\xf5"
556 "\x69\x00\x97\x0b\xa2\x39\xd0\x44"
557 "\xdb\x72\x09\x7d\x14\xab\x1f\xb6"
558 "\x4d\xe4\x58\xef\x86\x1d\x91\x28"
559 "\xbf\x33\xca\x61\xf8\x6c\x03\x9a"
560 "\x0e\xa5\x3c\xd3\x47\xde\x75\x0c"
561 "\x80\x17\xae\x22\xb9\x50\xe7\x5b"
562 "\xf2\x89\x20\x94\x2b\xc2\x36\xcd"
563 "\x64\xfb\x6f\x06\x9d\x11\xa8\x3f"
564 "\xd6\x4a\xe1\x78\x0f\x83\x1a\xb1"
565 "\x25\xbc\x53\xea\x5e\xf5\x8c\x00"
566 "\x97\x2e\xc5\x39\xd0\x67\xfe\x72"
567 "\x09\xa0\x14\xab\x42\xd9\x4d\xe4"
568 "\x7b\x12\x86\x1d\xb4\x28\xbf\x56"
569 "\xed\x61\xf8\x8f\x03\x9a\x31\xc8"
570 "\x3c\xd3\x6a\x01\x75\x0c\xa3\x17"
571 "\xae\x45\xdc\x50\xe7\x7e\x15\x89"
572 "\x20\xb7\x2b\xc2\x59\xf0\x64\xfb"
573 "\x92\x06\x9d\x34\xcb\x3f\xd6\x6d"
574 "\x04\x78\x0f\xa6\x1a\xb1\x48\xdf"
575 "\x53\xea\x81\x18\x8c\x23\xba\x2e"
576 "\xc5\x5c\xf3\x67\xfe\x95\x09\xa0"
577 "\x37\xce\x42\xd9\x70\x07\x7b\x12"
578 "\xa9\x1d\xb4\x4b\xe2\x56\xed\x84"
579 "\x1b\x8f\x26\xbd\x31\xc8\x5f\xf6"
580 "\x6a\x01\x98\x0c\xa3\x3a\xd1\x45"
581 "\xdc\x73\x0a\x7e\x15\xac\x20\xb7"
582 "\x4e\xe5\x59\xf0\x87\x1e\x92\x29"
583 "\xc0\x34\xcb\x62\xf9\x6d\x04\x9b"
584 "\x0f\xa6\x3d\xd4\x48\xdf\x76\x0d"
585 "\x81\x18\xaf\x23\xba\x51\xe8\x5c"
586 "\xf3\x8a\x21\x95\x2c\xc3\x37\xce"
587 "\x65\xfc\x70\x07\x9e\x12\xa9\x40"
588 "\xd7\x4b\xe2\x79\x10\x84\x1b\xb2"
589 "\x26\xbd\x54\xeb\x5f\xf6\x8d\x01"
590 "\x98\x2f\xc6\x3a\xd1\x68\xff\x73"
591 "\x0a\xa1\x15\xac\x43\xda\x4e\xe5"
592 "\x7c\x13\x87\x1e\xb5\x29\xc0\x57"
593 "\xee\x62\xf9\x90\x04\x9b\x32\xc9"
594 "\x3d\xd4\x6b\x02\x76\x0d\xa4\x18"
595 "\xaf\x46\xdd\x51\xe8\x7f\x16\x8a"
596 "\x21\xb8\x2c\xc3\x5a\xf1\x65\xfc"
597 "\x93\x07\x9e\x35\xcc\x40\xd7\x6e"
598 "\x05\x79\x10\xa7\x1b\xb2\x49\xe0"
599 "\x54\xeb\x82\x19\x8d\x24\xbb\x2f"
600 "\xc6\x5d\xf4\x68\xff\x96\x0a\xa1"
601 "\x38\xcf\x43\xda\x71\x08\x7c\x13"
602 "\xaa\x1e\xb5\x4c\xe3\x57\xee\x85"
603 "\x1c\x90\x27\xbe\x32\xc9\x60\xf7"
604 "\x6b\x02\x99\x0d\xa4\x3b\xd2\x46"
605 "\xdd\x74\x0b\x7f\x16\xad\x21\xb8"
606 "\x4f\xe6\x5a\xf1\x88\x1f\x93\x2a"
607 "\xc1\x35\xcc\x63\xfa\x6e\x05\x9c"
608 "\x10\xa7\x3e\xd5\x49\xe0\x77\x0e"
609 "\x82\x19\xb0\x24\xbb\x52\xe9\x5d"
610 "\xf4\x8b\x22\x96\x2d\xc4\x38\xcf"
611 "\x66\xfd\x71\x08\x9f\x13\xaa\x41"
612 "\xd8\x4c\xe3\x7a\x11\x85\x1c\xb3"
613 "\x27\xbe\x55\xec\x60\xf7\x8e\x02"
614 "\x99\x30\xc7\x3b\xd2\x69\x00\x74"
615 "\x0b\xa2\x16\xad\x44\xdb\x4f\xe6"
616 "\x7d\x14\x88\x1f\xb6\x2a\xc1\x58"
617 "\xef\x63\xfa\x91\x05\x9c\x33\xca"
618 "\x3e\xd5\x6c\x03\x77\x0e\xa5\x19"
619 "\xb0\x47\xde\x52\xe9\x80\x17\x8b"
620 "\x22\xb9\x2d\xc4\x5b\xf2\x66\xfd"
621 "\x94\x08\x9f\x36\xcd\x41\xd8\x6f"
622 "\x06\x7a\x11\xa8\x1c\xb3\x4a\xe1"
623 "\x55\xec\x83\x1a\x8e\x25\xbc\x30"
624 "\xc7\x5e\xf5\x69\x00\x97\x0b\xa2"
625 "\x39\xd0\x44\xdb\x72\x09\x7d\x14"
626 "\xab\x1f\xb6\x4d\xe4\x58\xef\x86"
627 "\x1d\x91\x28\xbf\x33\xca\x61\xf8"
628 "\x6c\x03\x9a\x0e\xa5\x3c\xd3\x47"
629 "\xde\x75\x0c\x80\x17\xae\x22\xb9"
630 "\x50\xe7\x5b\xf2\x89\x20\x94\x2b"
631 "\xc2\x36\xcd\x64\xfb\x6f\x06\x9d"
632 "\x11\xa8\x3f\xd6\x4a\xe1\x78\x0f"
633 "\x83\x1a\xb1\x25\xbc\x53\xea\x5e"
634 "\xf5\x8c\x00\x97\x2e\xc5\x39\xd0"
635 "\x67\xfe\x72\x09\xa0\x14\xab\x42"
636 "\xd9\x4d\xe4\x7b\x12\x86\x1d\xb4"
637 "\x28\xbf\x56\xed\x61\xf8\x8f\x03"
638 "\x9a\x31\xc8\x3c\xd3\x6a\x01\x75"
639 "\x0c\xa3\x17\xae\x45\xdc\x50\xe7"
640 "\x7e\x15\x89\x20\xb7\x2b\xc2\x59"
641 "\xf0\x64\xfb\x92\x06\x9d\x34\xcb"
642 "\x3f\xd6\x6d\x04\x78\x0f\xa6\x1a"
643 "\xb1\x48\xdf\x53\xea\x81\x18\x8c"
644 "\x23\xba\x2e\xc5\x5c\xf3\x67\xfe"
645 "\x95\x09\xa0\x37\xce\x42\xd9\x70"
646 "\x07\x7b\x12\xa9\x1d\xb4\x4b\xe2"
647 "\x56\xed\x84\x1b\x8f\x26\xbd\x31"
648 "\xc8\x5f\xf6\x6a\x01\x98\x0c\xa3"
649 "\x3a\xd1\x45\xdc\x73\x0a\x7e\x15"
650 "\xac\x20\xb7\x4e\xe5\x59\xf0\x87"
651 "\x1e\x92\x29\xc0\x34\xcb\x62\xf9"
652 "\x6d\x04\x9b\x0f\xa6\x3d\xd4\x48"
653 "\xdf\x76\x0d\x81\x18\xaf\x23\xba"
654 "\x51\xe8\x5c\xf3\x8a\x21\x95\x2c"
655 "\xc3\x37\xce\x65\xfc\x70\x07\x9e"
656 "\x12\xa9\x40\xd7\x4b\xe2\x79\x10"
657 "\x84\x1b\xb2\x26\xbd\x54\xeb\x5f"
658 "\xf6\x8d\x01\x98\x2f\xc6\x3a\xd1"
659 "\x68\xff\x73\x0a\xa1\x15\xac\x43"
660 "\xda\x4e\xe5\x7c\x13\x87\x1e\xb5"
661 "\x29\xc0\x57\xee\x62\xf9\x90\x04"
662 "\x9b\x32\xc9\x3d\xd4\x6b\x02\x76"
663 "\x0d\xa4\x18\xaf\x46\xdd\x51\xe8"
664 "\x7f\x16\x8a\x21\xb8\x2c\xc3\x5a"
665 "\xf1\x65\xfc\x93\x07\x9e\x35\xcc"
666 "\x40\xd7\x6e\x05\x79\x10\xa7\x1b"
667 "\xb2\x49\xe0\x54\xeb\x82\x19\x8d"
668 "\x24\xbb\x2f\xc6\x5d\xf4\x68\xff"
669 "\x96\x0a\xa1\x38\xcf\x43\xda\x71"
670 "\x08\x7c\x13\xaa\x1e\xb5\x4c",
671 .psize = 1023,
672 .digest = "\xb8\xe3\x54\xed\xc5\xfc\xef\xa4"
673 "\x55\x73\x4a\x81\x99\xe4\x47\x2a"
674 "\x30\xd6\xc9\x85",
537 } 675 }
538}; 676};
539 677
@@ -541,10 +679,17 @@ static struct hash_testvec sha1_tv_template[] = {
541/* 679/*
542 * SHA224 test vectors from from FIPS PUB 180-2 680 * SHA224 test vectors from from FIPS PUB 180-2
543 */ 681 */
544#define SHA224_TEST_VECTORS 3 682#define SHA224_TEST_VECTORS 5
545 683
546static struct hash_testvec sha224_tv_template[] = { 684static struct hash_testvec sha224_tv_template[] = {
547 { 685 {
686 .plaintext = "",
687 .psize = 0,
688 .digest = "\xd1\x4a\x02\x8c\x2a\x3a\x2b\xc9"
689 "\x47\x61\x02\xbb\x28\x82\x34\xc4"
690 "\x15\xa2\xb0\x1f\x82\x8e\xa6\x2a"
691 "\xc5\xb3\xe4\x2f",
692 }, {
548 .plaintext = "abc", 693 .plaintext = "abc",
549 .psize = 3, 694 .psize = 3,
550 .digest = "\x23\x09\x7D\x22\x34\x05\xD8\x22" 695 .digest = "\x23\x09\x7D\x22\x34\x05\xD8\x22"
@@ -568,16 +713,157 @@ static struct hash_testvec sha224_tv_template[] = {
568 "\x42\xfd\x10\x92\xaa\x4e\x04\x08" 713 "\x42\xfd\x10\x92\xaa\x4e\x04\x08"
569 "\x58\xbb\xbb\xe8\xf8\x14\xa7\x0c" 714 "\x58\xbb\xbb\xe8\xf8\x14\xa7\x0c"
570 "\xef\x3b\xcb\x0e", 715 "\xef\x3b\xcb\x0e",
716 }, {
717 .plaintext = "\x08\x9f\x13\xaa\x41\xd8\x4c\xe3"
718 "\x7a\x11\x85\x1c\xb3\x27\xbe\x55"
719 "\xec\x60\xf7\x8e\x02\x99\x30\xc7"
720 "\x3b\xd2\x69\x00\x74\x0b\xa2\x16"
721 "\xad\x44\xdb\x4f\xe6\x7d\x14\x88"
722 "\x1f\xb6\x2a\xc1\x58\xef\x63\xfa"
723 "\x91\x05\x9c\x33\xca\x3e\xd5\x6c"
724 "\x03\x77\x0e\xa5\x19\xb0\x47\xde"
725 "\x52\xe9\x80\x17\x8b\x22\xb9\x2d"
726 "\xc4\x5b\xf2\x66\xfd\x94\x08\x9f"
727 "\x36\xcd\x41\xd8\x6f\x06\x7a\x11"
728 "\xa8\x1c\xb3\x4a\xe1\x55\xec\x83"
729 "\x1a\x8e\x25\xbc\x30\xc7\x5e\xf5"
730 "\x69\x00\x97\x0b\xa2\x39\xd0\x44"
731 "\xdb\x72\x09\x7d\x14\xab\x1f\xb6"
732 "\x4d\xe4\x58\xef\x86\x1d\x91\x28"
733 "\xbf\x33\xca\x61\xf8\x6c\x03\x9a"
734 "\x0e\xa5\x3c\xd3\x47\xde\x75\x0c"
735 "\x80\x17\xae\x22\xb9\x50\xe7\x5b"
736 "\xf2\x89\x20\x94\x2b\xc2\x36\xcd"
737 "\x64\xfb\x6f\x06\x9d\x11\xa8\x3f"
738 "\xd6\x4a\xe1\x78\x0f\x83\x1a\xb1"
739 "\x25\xbc\x53\xea\x5e\xf5\x8c\x00"
740 "\x97\x2e\xc5\x39\xd0\x67\xfe\x72"
741 "\x09\xa0\x14\xab\x42\xd9\x4d\xe4"
742 "\x7b\x12\x86\x1d\xb4\x28\xbf\x56"
743 "\xed\x61\xf8\x8f\x03\x9a\x31\xc8"
744 "\x3c\xd3\x6a\x01\x75\x0c\xa3\x17"
745 "\xae\x45\xdc\x50\xe7\x7e\x15\x89"
746 "\x20\xb7\x2b\xc2\x59\xf0\x64\xfb"
747 "\x92\x06\x9d\x34\xcb\x3f\xd6\x6d"
748 "\x04\x78\x0f\xa6\x1a\xb1\x48\xdf"
749 "\x53\xea\x81\x18\x8c\x23\xba\x2e"
750 "\xc5\x5c\xf3\x67\xfe\x95\x09\xa0"
751 "\x37\xce\x42\xd9\x70\x07\x7b\x12"
752 "\xa9\x1d\xb4\x4b\xe2\x56\xed\x84"
753 "\x1b\x8f\x26\xbd\x31\xc8\x5f\xf6"
754 "\x6a\x01\x98\x0c\xa3\x3a\xd1\x45"
755 "\xdc\x73\x0a\x7e\x15\xac\x20\xb7"
756 "\x4e\xe5\x59\xf0\x87\x1e\x92\x29"
757 "\xc0\x34\xcb\x62\xf9\x6d\x04\x9b"
758 "\x0f\xa6\x3d\xd4\x48\xdf\x76\x0d"
759 "\x81\x18\xaf\x23\xba\x51\xe8\x5c"
760 "\xf3\x8a\x21\x95\x2c\xc3\x37\xce"
761 "\x65\xfc\x70\x07\x9e\x12\xa9\x40"
762 "\xd7\x4b\xe2\x79\x10\x84\x1b\xb2"
763 "\x26\xbd\x54\xeb\x5f\xf6\x8d\x01"
764 "\x98\x2f\xc6\x3a\xd1\x68\xff\x73"
765 "\x0a\xa1\x15\xac\x43\xda\x4e\xe5"
766 "\x7c\x13\x87\x1e\xb5\x29\xc0\x57"
767 "\xee\x62\xf9\x90\x04\x9b\x32\xc9"
768 "\x3d\xd4\x6b\x02\x76\x0d\xa4\x18"
769 "\xaf\x46\xdd\x51\xe8\x7f\x16\x8a"
770 "\x21\xb8\x2c\xc3\x5a\xf1\x65\xfc"
771 "\x93\x07\x9e\x35\xcc\x40\xd7\x6e"
772 "\x05\x79\x10\xa7\x1b\xb2\x49\xe0"
773 "\x54\xeb\x82\x19\x8d\x24\xbb\x2f"
774 "\xc6\x5d\xf4\x68\xff\x96\x0a\xa1"
775 "\x38\xcf\x43\xda\x71\x08\x7c\x13"
776 "\xaa\x1e\xb5\x4c\xe3\x57\xee\x85"
777 "\x1c\x90\x27\xbe\x32\xc9\x60\xf7"
778 "\x6b\x02\x99\x0d\xa4\x3b\xd2\x46"
779 "\xdd\x74\x0b\x7f\x16\xad\x21\xb8"
780 "\x4f\xe6\x5a\xf1\x88\x1f\x93\x2a"
781 "\xc1\x35\xcc\x63\xfa\x6e\x05\x9c"
782 "\x10\xa7\x3e\xd5\x49\xe0\x77\x0e"
783 "\x82\x19\xb0\x24\xbb\x52\xe9\x5d"
784 "\xf4\x8b\x22\x96\x2d\xc4\x38\xcf"
785 "\x66\xfd\x71\x08\x9f\x13\xaa\x41"
786 "\xd8\x4c\xe3\x7a\x11\x85\x1c\xb3"
787 "\x27\xbe\x55\xec\x60\xf7\x8e\x02"
788 "\x99\x30\xc7\x3b\xd2\x69\x00\x74"
789 "\x0b\xa2\x16\xad\x44\xdb\x4f\xe6"
790 "\x7d\x14\x88\x1f\xb6\x2a\xc1\x58"
791 "\xef\x63\xfa\x91\x05\x9c\x33\xca"
792 "\x3e\xd5\x6c\x03\x77\x0e\xa5\x19"
793 "\xb0\x47\xde\x52\xe9\x80\x17\x8b"
794 "\x22\xb9\x2d\xc4\x5b\xf2\x66\xfd"
795 "\x94\x08\x9f\x36\xcd\x41\xd8\x6f"
796 "\x06\x7a\x11\xa8\x1c\xb3\x4a\xe1"
797 "\x55\xec\x83\x1a\x8e\x25\xbc\x30"
798 "\xc7\x5e\xf5\x69\x00\x97\x0b\xa2"
799 "\x39\xd0\x44\xdb\x72\x09\x7d\x14"
800 "\xab\x1f\xb6\x4d\xe4\x58\xef\x86"
801 "\x1d\x91\x28\xbf\x33\xca\x61\xf8"
802 "\x6c\x03\x9a\x0e\xa5\x3c\xd3\x47"
803 "\xde\x75\x0c\x80\x17\xae\x22\xb9"
804 "\x50\xe7\x5b\xf2\x89\x20\x94\x2b"
805 "\xc2\x36\xcd\x64\xfb\x6f\x06\x9d"
806 "\x11\xa8\x3f\xd6\x4a\xe1\x78\x0f"
807 "\x83\x1a\xb1\x25\xbc\x53\xea\x5e"
808 "\xf5\x8c\x00\x97\x2e\xc5\x39\xd0"
809 "\x67\xfe\x72\x09\xa0\x14\xab\x42"
810 "\xd9\x4d\xe4\x7b\x12\x86\x1d\xb4"
811 "\x28\xbf\x56\xed\x61\xf8\x8f\x03"
812 "\x9a\x31\xc8\x3c\xd3\x6a\x01\x75"
813 "\x0c\xa3\x17\xae\x45\xdc\x50\xe7"
814 "\x7e\x15\x89\x20\xb7\x2b\xc2\x59"
815 "\xf0\x64\xfb\x92\x06\x9d\x34\xcb"
816 "\x3f\xd6\x6d\x04\x78\x0f\xa6\x1a"
817 "\xb1\x48\xdf\x53\xea\x81\x18\x8c"
818 "\x23\xba\x2e\xc5\x5c\xf3\x67\xfe"
819 "\x95\x09\xa0\x37\xce\x42\xd9\x70"
820 "\x07\x7b\x12\xa9\x1d\xb4\x4b\xe2"
821 "\x56\xed\x84\x1b\x8f\x26\xbd\x31"
822 "\xc8\x5f\xf6\x6a\x01\x98\x0c\xa3"
823 "\x3a\xd1\x45\xdc\x73\x0a\x7e\x15"
824 "\xac\x20\xb7\x4e\xe5\x59\xf0\x87"
825 "\x1e\x92\x29\xc0\x34\xcb\x62\xf9"
826 "\x6d\x04\x9b\x0f\xa6\x3d\xd4\x48"
827 "\xdf\x76\x0d\x81\x18\xaf\x23\xba"
828 "\x51\xe8\x5c\xf3\x8a\x21\x95\x2c"
829 "\xc3\x37\xce\x65\xfc\x70\x07\x9e"
830 "\x12\xa9\x40\xd7\x4b\xe2\x79\x10"
831 "\x84\x1b\xb2\x26\xbd\x54\xeb\x5f"
832 "\xf6\x8d\x01\x98\x2f\xc6\x3a\xd1"
833 "\x68\xff\x73\x0a\xa1\x15\xac\x43"
834 "\xda\x4e\xe5\x7c\x13\x87\x1e\xb5"
835 "\x29\xc0\x57\xee\x62\xf9\x90\x04"
836 "\x9b\x32\xc9\x3d\xd4\x6b\x02\x76"
837 "\x0d\xa4\x18\xaf\x46\xdd\x51\xe8"
838 "\x7f\x16\x8a\x21\xb8\x2c\xc3\x5a"
839 "\xf1\x65\xfc\x93\x07\x9e\x35\xcc"
840 "\x40\xd7\x6e\x05\x79\x10\xa7\x1b"
841 "\xb2\x49\xe0\x54\xeb\x82\x19\x8d"
842 "\x24\xbb\x2f\xc6\x5d\xf4\x68\xff"
843 "\x96\x0a\xa1\x38\xcf\x43\xda\x71"
844 "\x08\x7c\x13\xaa\x1e\xb5\x4c",
845 .psize = 1023,
846 .digest = "\x98\x43\x07\x63\x75\xe0\xa7\x1c"
847 "\x78\xb1\x8b\xfd\x04\xf5\x2d\x91"
848 "\x20\x48\xa4\x28\xff\x55\xb1\xd3"
849 "\xe6\xf9\x4f\xcc",
571 } 850 }
572}; 851};
573 852
574/* 853/*
575 * SHA256 test vectors from from NIST 854 * SHA256 test vectors from from NIST
576 */ 855 */
577#define SHA256_TEST_VECTORS 3 856#define SHA256_TEST_VECTORS 5
578 857
579static struct hash_testvec sha256_tv_template[] = { 858static struct hash_testvec sha256_tv_template[] = {
580 { 859 {
860 .plaintext = "",
861 .psize = 0,
862 .digest = "\xe3\xb0\xc4\x42\x98\xfc\x1c\x14"
863 "\x9a\xfb\xf4\xc8\x99\x6f\xb9\x24"
864 "\x27\xae\x41\xe4\x64\x9b\x93\x4c"
865 "\xa4\x95\x99\x1b\x78\x52\xb8\x55",
866 }, {
581 .plaintext = "abc", 867 .plaintext = "abc",
582 .psize = 3, 868 .psize = 3,
583 .digest = "\xba\x78\x16\xbf\x8f\x01\xcf\xea" 869 .digest = "\xba\x78\x16\xbf\x8f\x01\xcf\xea"
@@ -600,16 +886,159 @@ static struct hash_testvec sha256_tv_template[] = {
600 "\x2c\x32\x29\x32\x19\xbb\xfb\xfa" 886 "\x2c\x32\x29\x32\x19\xbb\xfb\xfa"
601 "\xd6\xff\x94\xa3\x72\x91\x85\x66" 887 "\xd6\xff\x94\xa3\x72\x91\x85\x66"
602 "\x3b\xa7\x87\x77\x58\xa3\x40\x3a", 888 "\x3b\xa7\x87\x77\x58\xa3\x40\x3a",
889 }, {
890 .plaintext = "\x08\x9f\x13\xaa\x41\xd8\x4c\xe3"
891 "\x7a\x11\x85\x1c\xb3\x27\xbe\x55"
892 "\xec\x60\xf7\x8e\x02\x99\x30\xc7"
893 "\x3b\xd2\x69\x00\x74\x0b\xa2\x16"
894 "\xad\x44\xdb\x4f\xe6\x7d\x14\x88"
895 "\x1f\xb6\x2a\xc1\x58\xef\x63\xfa"
896 "\x91\x05\x9c\x33\xca\x3e\xd5\x6c"
897 "\x03\x77\x0e\xa5\x19\xb0\x47\xde"
898 "\x52\xe9\x80\x17\x8b\x22\xb9\x2d"
899 "\xc4\x5b\xf2\x66\xfd\x94\x08\x9f"
900 "\x36\xcd\x41\xd8\x6f\x06\x7a\x11"
901 "\xa8\x1c\xb3\x4a\xe1\x55\xec\x83"
902 "\x1a\x8e\x25\xbc\x30\xc7\x5e\xf5"
903 "\x69\x00\x97\x0b\xa2\x39\xd0\x44"
904 "\xdb\x72\x09\x7d\x14\xab\x1f\xb6"
905 "\x4d\xe4\x58\xef\x86\x1d\x91\x28"
906 "\xbf\x33\xca\x61\xf8\x6c\x03\x9a"
907 "\x0e\xa5\x3c\xd3\x47\xde\x75\x0c"
908 "\x80\x17\xae\x22\xb9\x50\xe7\x5b"
909 "\xf2\x89\x20\x94\x2b\xc2\x36\xcd"
910 "\x64\xfb\x6f\x06\x9d\x11\xa8\x3f"
911 "\xd6\x4a\xe1\x78\x0f\x83\x1a\xb1"
912 "\x25\xbc\x53\xea\x5e\xf5\x8c\x00"
913 "\x97\x2e\xc5\x39\xd0\x67\xfe\x72"
914 "\x09\xa0\x14\xab\x42\xd9\x4d\xe4"
915 "\x7b\x12\x86\x1d\xb4\x28\xbf\x56"
916 "\xed\x61\xf8\x8f\x03\x9a\x31\xc8"
917 "\x3c\xd3\x6a\x01\x75\x0c\xa3\x17"
918 "\xae\x45\xdc\x50\xe7\x7e\x15\x89"
919 "\x20\xb7\x2b\xc2\x59\xf0\x64\xfb"
920 "\x92\x06\x9d\x34\xcb\x3f\xd6\x6d"
921 "\x04\x78\x0f\xa6\x1a\xb1\x48\xdf"
922 "\x53\xea\x81\x18\x8c\x23\xba\x2e"
923 "\xc5\x5c\xf3\x67\xfe\x95\x09\xa0"
924 "\x37\xce\x42\xd9\x70\x07\x7b\x12"
925 "\xa9\x1d\xb4\x4b\xe2\x56\xed\x84"
926 "\x1b\x8f\x26\xbd\x31\xc8\x5f\xf6"
927 "\x6a\x01\x98\x0c\xa3\x3a\xd1\x45"
928 "\xdc\x73\x0a\x7e\x15\xac\x20\xb7"
929 "\x4e\xe5\x59\xf0\x87\x1e\x92\x29"
930 "\xc0\x34\xcb\x62\xf9\x6d\x04\x9b"
931 "\x0f\xa6\x3d\xd4\x48\xdf\x76\x0d"
932 "\x81\x18\xaf\x23\xba\x51\xe8\x5c"
933 "\xf3\x8a\x21\x95\x2c\xc3\x37\xce"
934 "\x65\xfc\x70\x07\x9e\x12\xa9\x40"
935 "\xd7\x4b\xe2\x79\x10\x84\x1b\xb2"
936 "\x26\xbd\x54\xeb\x5f\xf6\x8d\x01"
937 "\x98\x2f\xc6\x3a\xd1\x68\xff\x73"
938 "\x0a\xa1\x15\xac\x43\xda\x4e\xe5"
939 "\x7c\x13\x87\x1e\xb5\x29\xc0\x57"
940 "\xee\x62\xf9\x90\x04\x9b\x32\xc9"
941 "\x3d\xd4\x6b\x02\x76\x0d\xa4\x18"
942 "\xaf\x46\xdd\x51\xe8\x7f\x16\x8a"
943 "\x21\xb8\x2c\xc3\x5a\xf1\x65\xfc"
944 "\x93\x07\x9e\x35\xcc\x40\xd7\x6e"
945 "\x05\x79\x10\xa7\x1b\xb2\x49\xe0"
946 "\x54\xeb\x82\x19\x8d\x24\xbb\x2f"
947 "\xc6\x5d\xf4\x68\xff\x96\x0a\xa1"
948 "\x38\xcf\x43\xda\x71\x08\x7c\x13"
949 "\xaa\x1e\xb5\x4c\xe3\x57\xee\x85"
950 "\x1c\x90\x27\xbe\x32\xc9\x60\xf7"
951 "\x6b\x02\x99\x0d\xa4\x3b\xd2\x46"
952 "\xdd\x74\x0b\x7f\x16\xad\x21\xb8"
953 "\x4f\xe6\x5a\xf1\x88\x1f\x93\x2a"
954 "\xc1\x35\xcc\x63\xfa\x6e\x05\x9c"
955 "\x10\xa7\x3e\xd5\x49\xe0\x77\x0e"
956 "\x82\x19\xb0\x24\xbb\x52\xe9\x5d"
957 "\xf4\x8b\x22\x96\x2d\xc4\x38\xcf"
958 "\x66\xfd\x71\x08\x9f\x13\xaa\x41"
959 "\xd8\x4c\xe3\x7a\x11\x85\x1c\xb3"
960 "\x27\xbe\x55\xec\x60\xf7\x8e\x02"
961 "\x99\x30\xc7\x3b\xd2\x69\x00\x74"
962 "\x0b\xa2\x16\xad\x44\xdb\x4f\xe6"
963 "\x7d\x14\x88\x1f\xb6\x2a\xc1\x58"
964 "\xef\x63\xfa\x91\x05\x9c\x33\xca"
965 "\x3e\xd5\x6c\x03\x77\x0e\xa5\x19"
966 "\xb0\x47\xde\x52\xe9\x80\x17\x8b"
967 "\x22\xb9\x2d\xc4\x5b\xf2\x66\xfd"
968 "\x94\x08\x9f\x36\xcd\x41\xd8\x6f"
969 "\x06\x7a\x11\xa8\x1c\xb3\x4a\xe1"
970 "\x55\xec\x83\x1a\x8e\x25\xbc\x30"
971 "\xc7\x5e\xf5\x69\x00\x97\x0b\xa2"
972 "\x39\xd0\x44\xdb\x72\x09\x7d\x14"
973 "\xab\x1f\xb6\x4d\xe4\x58\xef\x86"
974 "\x1d\x91\x28\xbf\x33\xca\x61\xf8"
975 "\x6c\x03\x9a\x0e\xa5\x3c\xd3\x47"
976 "\xde\x75\x0c\x80\x17\xae\x22\xb9"
977 "\x50\xe7\x5b\xf2\x89\x20\x94\x2b"
978 "\xc2\x36\xcd\x64\xfb\x6f\x06\x9d"
979 "\x11\xa8\x3f\xd6\x4a\xe1\x78\x0f"
980 "\x83\x1a\xb1\x25\xbc\x53\xea\x5e"
981 "\xf5\x8c\x00\x97\x2e\xc5\x39\xd0"
982 "\x67\xfe\x72\x09\xa0\x14\xab\x42"
983 "\xd9\x4d\xe4\x7b\x12\x86\x1d\xb4"
984 "\x28\xbf\x56\xed\x61\xf8\x8f\x03"
985 "\x9a\x31\xc8\x3c\xd3\x6a\x01\x75"
986 "\x0c\xa3\x17\xae\x45\xdc\x50\xe7"
987 "\x7e\x15\x89\x20\xb7\x2b\xc2\x59"
988 "\xf0\x64\xfb\x92\x06\x9d\x34\xcb"
989 "\x3f\xd6\x6d\x04\x78\x0f\xa6\x1a"
990 "\xb1\x48\xdf\x53\xea\x81\x18\x8c"
991 "\x23\xba\x2e\xc5\x5c\xf3\x67\xfe"
992 "\x95\x09\xa0\x37\xce\x42\xd9\x70"
993 "\x07\x7b\x12\xa9\x1d\xb4\x4b\xe2"
994 "\x56\xed\x84\x1b\x8f\x26\xbd\x31"
995 "\xc8\x5f\xf6\x6a\x01\x98\x0c\xa3"
996 "\x3a\xd1\x45\xdc\x73\x0a\x7e\x15"
997 "\xac\x20\xb7\x4e\xe5\x59\xf0\x87"
998 "\x1e\x92\x29\xc0\x34\xcb\x62\xf9"
999 "\x6d\x04\x9b\x0f\xa6\x3d\xd4\x48"
1000 "\xdf\x76\x0d\x81\x18\xaf\x23\xba"
1001 "\x51\xe8\x5c\xf3\x8a\x21\x95\x2c"
1002 "\xc3\x37\xce\x65\xfc\x70\x07\x9e"
1003 "\x12\xa9\x40\xd7\x4b\xe2\x79\x10"
1004 "\x84\x1b\xb2\x26\xbd\x54\xeb\x5f"
1005 "\xf6\x8d\x01\x98\x2f\xc6\x3a\xd1"
1006 "\x68\xff\x73\x0a\xa1\x15\xac\x43"
1007 "\xda\x4e\xe5\x7c\x13\x87\x1e\xb5"
1008 "\x29\xc0\x57\xee\x62\xf9\x90\x04"
1009 "\x9b\x32\xc9\x3d\xd4\x6b\x02\x76"
1010 "\x0d\xa4\x18\xaf\x46\xdd\x51\xe8"
1011 "\x7f\x16\x8a\x21\xb8\x2c\xc3\x5a"
1012 "\xf1\x65\xfc\x93\x07\x9e\x35\xcc"
1013 "\x40\xd7\x6e\x05\x79\x10\xa7\x1b"
1014 "\xb2\x49\xe0\x54\xeb\x82\x19\x8d"
1015 "\x24\xbb\x2f\xc6\x5d\xf4\x68\xff"
1016 "\x96\x0a\xa1\x38\xcf\x43\xda\x71"
1017 "\x08\x7c\x13\xaa\x1e\xb5\x4c",
1018 .psize = 1023,
1019 .digest = "\xc5\xce\x0c\xca\x01\x4f\x53\x3a"
1020 "\x32\x32\x17\xcc\xd4\x6a\x71\xa9"
1021 "\xf3\xed\x50\x10\x64\x8e\x06\xbe"
1022 "\x9b\x4a\xa6\xbb\x05\x89\x59\x51",
603 } 1023 }
604}; 1024};
605 1025
606/* 1026/*
607 * SHA384 test vectors from from NIST and kerneli 1027 * SHA384 test vectors from from NIST and kerneli
608 */ 1028 */
609#define SHA384_TEST_VECTORS 4 1029#define SHA384_TEST_VECTORS 6
610 1030
611static struct hash_testvec sha384_tv_template[] = { 1031static struct hash_testvec sha384_tv_template[] = {
612 { 1032 {
1033 .plaintext = "",
1034 .psize = 0,
1035 .digest = "\x38\xb0\x60\xa7\x51\xac\x96\x38"
1036 "\x4c\xd9\x32\x7e\xb1\xb1\xe3\x6a"
1037 "\x21\xfd\xb7\x11\x14\xbe\x07\x43"
1038 "\x4c\x0c\xc7\xbf\x63\xf6\xe1\xda"
1039 "\x27\x4e\xde\xbf\xe7\x6f\x65\xfb"
1040 "\xd5\x1a\xd2\xf1\x48\x98\xb9\x5b",
1041 }, {
613 .plaintext= "abc", 1042 .plaintext= "abc",
614 .psize = 3, 1043 .psize = 3,
615 .digest = "\xcb\x00\x75\x3f\x45\xa3\x5e\x8b" 1044 .digest = "\xcb\x00\x75\x3f\x45\xa3\x5e\x8b"
@@ -649,16 +1078,163 @@ static struct hash_testvec sha384_tv_template[] = {
649 "\xc9\x38\xe2\xd1\x99\xe8\xbe\xa4", 1078 "\xc9\x38\xe2\xd1\x99\xe8\xbe\xa4",
650 .np = 4, 1079 .np = 4,
651 .tap = { 26, 26, 26, 26 } 1080 .tap = { 26, 26, 26, 26 }
652 }, 1081 }, {
1082 .plaintext = "\x08\x9f\x13\xaa\x41\xd8\x4c\xe3"
1083 "\x7a\x11\x85\x1c\xb3\x27\xbe\x55"
1084 "\xec\x60\xf7\x8e\x02\x99\x30\xc7"
1085 "\x3b\xd2\x69\x00\x74\x0b\xa2\x16"
1086 "\xad\x44\xdb\x4f\xe6\x7d\x14\x88"
1087 "\x1f\xb6\x2a\xc1\x58\xef\x63\xfa"
1088 "\x91\x05\x9c\x33\xca\x3e\xd5\x6c"
1089 "\x03\x77\x0e\xa5\x19\xb0\x47\xde"
1090 "\x52\xe9\x80\x17\x8b\x22\xb9\x2d"
1091 "\xc4\x5b\xf2\x66\xfd\x94\x08\x9f"
1092 "\x36\xcd\x41\xd8\x6f\x06\x7a\x11"
1093 "\xa8\x1c\xb3\x4a\xe1\x55\xec\x83"
1094 "\x1a\x8e\x25\xbc\x30\xc7\x5e\xf5"
1095 "\x69\x00\x97\x0b\xa2\x39\xd0\x44"
1096 "\xdb\x72\x09\x7d\x14\xab\x1f\xb6"
1097 "\x4d\xe4\x58\xef\x86\x1d\x91\x28"
1098 "\xbf\x33\xca\x61\xf8\x6c\x03\x9a"
1099 "\x0e\xa5\x3c\xd3\x47\xde\x75\x0c"
1100 "\x80\x17\xae\x22\xb9\x50\xe7\x5b"
1101 "\xf2\x89\x20\x94\x2b\xc2\x36\xcd"
1102 "\x64\xfb\x6f\x06\x9d\x11\xa8\x3f"
1103 "\xd6\x4a\xe1\x78\x0f\x83\x1a\xb1"
1104 "\x25\xbc\x53\xea\x5e\xf5\x8c\x00"
1105 "\x97\x2e\xc5\x39\xd0\x67\xfe\x72"
1106 "\x09\xa0\x14\xab\x42\xd9\x4d\xe4"
1107 "\x7b\x12\x86\x1d\xb4\x28\xbf\x56"
1108 "\xed\x61\xf8\x8f\x03\x9a\x31\xc8"
1109 "\x3c\xd3\x6a\x01\x75\x0c\xa3\x17"
1110 "\xae\x45\xdc\x50\xe7\x7e\x15\x89"
1111 "\x20\xb7\x2b\xc2\x59\xf0\x64\xfb"
1112 "\x92\x06\x9d\x34\xcb\x3f\xd6\x6d"
1113 "\x04\x78\x0f\xa6\x1a\xb1\x48\xdf"
1114 "\x53\xea\x81\x18\x8c\x23\xba\x2e"
1115 "\xc5\x5c\xf3\x67\xfe\x95\x09\xa0"
1116 "\x37\xce\x42\xd9\x70\x07\x7b\x12"
1117 "\xa9\x1d\xb4\x4b\xe2\x56\xed\x84"
1118 "\x1b\x8f\x26\xbd\x31\xc8\x5f\xf6"
1119 "\x6a\x01\x98\x0c\xa3\x3a\xd1\x45"
1120 "\xdc\x73\x0a\x7e\x15\xac\x20\xb7"
1121 "\x4e\xe5\x59\xf0\x87\x1e\x92\x29"
1122 "\xc0\x34\xcb\x62\xf9\x6d\x04\x9b"
1123 "\x0f\xa6\x3d\xd4\x48\xdf\x76\x0d"
1124 "\x81\x18\xaf\x23\xba\x51\xe8\x5c"
1125 "\xf3\x8a\x21\x95\x2c\xc3\x37\xce"
1126 "\x65\xfc\x70\x07\x9e\x12\xa9\x40"
1127 "\xd7\x4b\xe2\x79\x10\x84\x1b\xb2"
1128 "\x26\xbd\x54\xeb\x5f\xf6\x8d\x01"
1129 "\x98\x2f\xc6\x3a\xd1\x68\xff\x73"
1130 "\x0a\xa1\x15\xac\x43\xda\x4e\xe5"
1131 "\x7c\x13\x87\x1e\xb5\x29\xc0\x57"
1132 "\xee\x62\xf9\x90\x04\x9b\x32\xc9"
1133 "\x3d\xd4\x6b\x02\x76\x0d\xa4\x18"
1134 "\xaf\x46\xdd\x51\xe8\x7f\x16\x8a"
1135 "\x21\xb8\x2c\xc3\x5a\xf1\x65\xfc"
1136 "\x93\x07\x9e\x35\xcc\x40\xd7\x6e"
1137 "\x05\x79\x10\xa7\x1b\xb2\x49\xe0"
1138 "\x54\xeb\x82\x19\x8d\x24\xbb\x2f"
1139 "\xc6\x5d\xf4\x68\xff\x96\x0a\xa1"
1140 "\x38\xcf\x43\xda\x71\x08\x7c\x13"
1141 "\xaa\x1e\xb5\x4c\xe3\x57\xee\x85"
1142 "\x1c\x90\x27\xbe\x32\xc9\x60\xf7"
1143 "\x6b\x02\x99\x0d\xa4\x3b\xd2\x46"
1144 "\xdd\x74\x0b\x7f\x16\xad\x21\xb8"
1145 "\x4f\xe6\x5a\xf1\x88\x1f\x93\x2a"
1146 "\xc1\x35\xcc\x63\xfa\x6e\x05\x9c"
1147 "\x10\xa7\x3e\xd5\x49\xe0\x77\x0e"
1148 "\x82\x19\xb0\x24\xbb\x52\xe9\x5d"
1149 "\xf4\x8b\x22\x96\x2d\xc4\x38\xcf"
1150 "\x66\xfd\x71\x08\x9f\x13\xaa\x41"
1151 "\xd8\x4c\xe3\x7a\x11\x85\x1c\xb3"
1152 "\x27\xbe\x55\xec\x60\xf7\x8e\x02"
1153 "\x99\x30\xc7\x3b\xd2\x69\x00\x74"
1154 "\x0b\xa2\x16\xad\x44\xdb\x4f\xe6"
1155 "\x7d\x14\x88\x1f\xb6\x2a\xc1\x58"
1156 "\xef\x63\xfa\x91\x05\x9c\x33\xca"
1157 "\x3e\xd5\x6c\x03\x77\x0e\xa5\x19"
1158 "\xb0\x47\xde\x52\xe9\x80\x17\x8b"
1159 "\x22\xb9\x2d\xc4\x5b\xf2\x66\xfd"
1160 "\x94\x08\x9f\x36\xcd\x41\xd8\x6f"
1161 "\x06\x7a\x11\xa8\x1c\xb3\x4a\xe1"
1162 "\x55\xec\x83\x1a\x8e\x25\xbc\x30"
1163 "\xc7\x5e\xf5\x69\x00\x97\x0b\xa2"
1164 "\x39\xd0\x44\xdb\x72\x09\x7d\x14"
1165 "\xab\x1f\xb6\x4d\xe4\x58\xef\x86"
1166 "\x1d\x91\x28\xbf\x33\xca\x61\xf8"
1167 "\x6c\x03\x9a\x0e\xa5\x3c\xd3\x47"
1168 "\xde\x75\x0c\x80\x17\xae\x22\xb9"
1169 "\x50\xe7\x5b\xf2\x89\x20\x94\x2b"
1170 "\xc2\x36\xcd\x64\xfb\x6f\x06\x9d"
1171 "\x11\xa8\x3f\xd6\x4a\xe1\x78\x0f"
1172 "\x83\x1a\xb1\x25\xbc\x53\xea\x5e"
1173 "\xf5\x8c\x00\x97\x2e\xc5\x39\xd0"
1174 "\x67\xfe\x72\x09\xa0\x14\xab\x42"
1175 "\xd9\x4d\xe4\x7b\x12\x86\x1d\xb4"
1176 "\x28\xbf\x56\xed\x61\xf8\x8f\x03"
1177 "\x9a\x31\xc8\x3c\xd3\x6a\x01\x75"
1178 "\x0c\xa3\x17\xae\x45\xdc\x50\xe7"
1179 "\x7e\x15\x89\x20\xb7\x2b\xc2\x59"
1180 "\xf0\x64\xfb\x92\x06\x9d\x34\xcb"
1181 "\x3f\xd6\x6d\x04\x78\x0f\xa6\x1a"
1182 "\xb1\x48\xdf\x53\xea\x81\x18\x8c"
1183 "\x23\xba\x2e\xc5\x5c\xf3\x67\xfe"
1184 "\x95\x09\xa0\x37\xce\x42\xd9\x70"
1185 "\x07\x7b\x12\xa9\x1d\xb4\x4b\xe2"
1186 "\x56\xed\x84\x1b\x8f\x26\xbd\x31"
1187 "\xc8\x5f\xf6\x6a\x01\x98\x0c\xa3"
1188 "\x3a\xd1\x45\xdc\x73\x0a\x7e\x15"
1189 "\xac\x20\xb7\x4e\xe5\x59\xf0\x87"
1190 "\x1e\x92\x29\xc0\x34\xcb\x62\xf9"
1191 "\x6d\x04\x9b\x0f\xa6\x3d\xd4\x48"
1192 "\xdf\x76\x0d\x81\x18\xaf\x23\xba"
1193 "\x51\xe8\x5c\xf3\x8a\x21\x95\x2c"
1194 "\xc3\x37\xce\x65\xfc\x70\x07\x9e"
1195 "\x12\xa9\x40\xd7\x4b\xe2\x79\x10"
1196 "\x84\x1b\xb2\x26\xbd\x54\xeb\x5f"
1197 "\xf6\x8d\x01\x98\x2f\xc6\x3a\xd1"
1198 "\x68\xff\x73\x0a\xa1\x15\xac\x43"
1199 "\xda\x4e\xe5\x7c\x13\x87\x1e\xb5"
1200 "\x29\xc0\x57\xee\x62\xf9\x90\x04"
1201 "\x9b\x32\xc9\x3d\xd4\x6b\x02\x76"
1202 "\x0d\xa4\x18\xaf\x46\xdd\x51\xe8"
1203 "\x7f\x16\x8a\x21\xb8\x2c\xc3\x5a"
1204 "\xf1\x65\xfc\x93\x07\x9e\x35\xcc"
1205 "\x40\xd7\x6e\x05\x79\x10\xa7\x1b"
1206 "\xb2\x49\xe0\x54\xeb\x82\x19\x8d"
1207 "\x24\xbb\x2f\xc6\x5d\xf4\x68\xff"
1208 "\x96\x0a\xa1\x38\xcf\x43\xda\x71"
1209 "\x08\x7c\x13\xaa\x1e\xb5\x4c",
1210 .psize = 1023,
1211 .digest = "\x4d\x97\x23\xc8\xea\x7a\x7c\x15"
1212 "\xb8\xff\x97\x9c\xf5\x13\x4f\x31"
1213 "\xde\x67\xf7\x24\x73\xcd\x70\x1c"
1214 "\x03\x4a\xba\x8a\x87\x49\xfe\xdc"
1215 "\x75\x29\x62\x83\xae\x3f\x17\xab"
1216 "\xfd\x10\x4d\x8e\x17\x1c\x1f\xca",
1217 }
653}; 1218};
654 1219
655/* 1220/*
656 * SHA512 test vectors from from NIST and kerneli 1221 * SHA512 test vectors from from NIST and kerneli
657 */ 1222 */
658#define SHA512_TEST_VECTORS 4 1223#define SHA512_TEST_VECTORS 6
659 1224
660static struct hash_testvec sha512_tv_template[] = { 1225static struct hash_testvec sha512_tv_template[] = {
661 { 1226 {
1227 .plaintext = "",
1228 .psize = 0,
1229 .digest = "\xcf\x83\xe1\x35\x7e\xef\xb8\xbd"
1230 "\xf1\x54\x28\x50\xd6\x6d\x80\x07"
1231 "\xd6\x20\xe4\x05\x0b\x57\x15\xdc"
1232 "\x83\xf4\xa9\x21\xd3\x6c\xe9\xce"
1233 "\x47\xd0\xd1\x3c\x5d\x85\xf2\xb0"
1234 "\xff\x83\x18\xd2\x87\x7e\xec\x2f"
1235 "\x63\xb9\x31\xbd\x47\x41\x7a\x81"
1236 "\xa5\x38\x32\x7a\xf9\x27\xda\x3e",
1237 }, {
662 .plaintext = "abc", 1238 .plaintext = "abc",
663 .psize = 3, 1239 .psize = 3,
664 .digest = "\xdd\xaf\x35\xa1\x93\x61\x7a\xba" 1240 .digest = "\xdd\xaf\x35\xa1\x93\x61\x7a\xba"
@@ -706,7 +1282,145 @@ static struct hash_testvec sha512_tv_template[] = {
706 "\xed\xb4\x19\x87\x23\x28\x50\xc9", 1282 "\xed\xb4\x19\x87\x23\x28\x50\xc9",
707 .np = 4, 1283 .np = 4,
708 .tap = { 26, 26, 26, 26 } 1284 .tap = { 26, 26, 26, 26 }
709 }, 1285 }, {
1286 .plaintext = "\x08\x9f\x13\xaa\x41\xd8\x4c\xe3"
1287 "\x7a\x11\x85\x1c\xb3\x27\xbe\x55"
1288 "\xec\x60\xf7\x8e\x02\x99\x30\xc7"
1289 "\x3b\xd2\x69\x00\x74\x0b\xa2\x16"
1290 "\xad\x44\xdb\x4f\xe6\x7d\x14\x88"
1291 "\x1f\xb6\x2a\xc1\x58\xef\x63\xfa"
1292 "\x91\x05\x9c\x33\xca\x3e\xd5\x6c"
1293 "\x03\x77\x0e\xa5\x19\xb0\x47\xde"
1294 "\x52\xe9\x80\x17\x8b\x22\xb9\x2d"
1295 "\xc4\x5b\xf2\x66\xfd\x94\x08\x9f"
1296 "\x36\xcd\x41\xd8\x6f\x06\x7a\x11"
1297 "\xa8\x1c\xb3\x4a\xe1\x55\xec\x83"
1298 "\x1a\x8e\x25\xbc\x30\xc7\x5e\xf5"
1299 "\x69\x00\x97\x0b\xa2\x39\xd0\x44"
1300 "\xdb\x72\x09\x7d\x14\xab\x1f\xb6"
1301 "\x4d\xe4\x58\xef\x86\x1d\x91\x28"
1302 "\xbf\x33\xca\x61\xf8\x6c\x03\x9a"
1303 "\x0e\xa5\x3c\xd3\x47\xde\x75\x0c"
1304 "\x80\x17\xae\x22\xb9\x50\xe7\x5b"
1305 "\xf2\x89\x20\x94\x2b\xc2\x36\xcd"
1306 "\x64\xfb\x6f\x06\x9d\x11\xa8\x3f"
1307 "\xd6\x4a\xe1\x78\x0f\x83\x1a\xb1"
1308 "\x25\xbc\x53\xea\x5e\xf5\x8c\x00"
1309 "\x97\x2e\xc5\x39\xd0\x67\xfe\x72"
1310 "\x09\xa0\x14\xab\x42\xd9\x4d\xe4"
1311 "\x7b\x12\x86\x1d\xb4\x28\xbf\x56"
1312 "\xed\x61\xf8\x8f\x03\x9a\x31\xc8"
1313 "\x3c\xd3\x6a\x01\x75\x0c\xa3\x17"
1314 "\xae\x45\xdc\x50\xe7\x7e\x15\x89"
1315 "\x20\xb7\x2b\xc2\x59\xf0\x64\xfb"
1316 "\x92\x06\x9d\x34\xcb\x3f\xd6\x6d"
1317 "\x04\x78\x0f\xa6\x1a\xb1\x48\xdf"
1318 "\x53\xea\x81\x18\x8c\x23\xba\x2e"
1319 "\xc5\x5c\xf3\x67\xfe\x95\x09\xa0"
1320 "\x37\xce\x42\xd9\x70\x07\x7b\x12"
1321 "\xa9\x1d\xb4\x4b\xe2\x56\xed\x84"
1322 "\x1b\x8f\x26\xbd\x31\xc8\x5f\xf6"
1323 "\x6a\x01\x98\x0c\xa3\x3a\xd1\x45"
1324 "\xdc\x73\x0a\x7e\x15\xac\x20\xb7"
1325 "\x4e\xe5\x59\xf0\x87\x1e\x92\x29"
1326 "\xc0\x34\xcb\x62\xf9\x6d\x04\x9b"
1327 "\x0f\xa6\x3d\xd4\x48\xdf\x76\x0d"
1328 "\x81\x18\xaf\x23\xba\x51\xe8\x5c"
1329 "\xf3\x8a\x21\x95\x2c\xc3\x37\xce"
1330 "\x65\xfc\x70\x07\x9e\x12\xa9\x40"
1331 "\xd7\x4b\xe2\x79\x10\x84\x1b\xb2"
1332 "\x26\xbd\x54\xeb\x5f\xf6\x8d\x01"
1333 "\x98\x2f\xc6\x3a\xd1\x68\xff\x73"
1334 "\x0a\xa1\x15\xac\x43\xda\x4e\xe5"
1335 "\x7c\x13\x87\x1e\xb5\x29\xc0\x57"
1336 "\xee\x62\xf9\x90\x04\x9b\x32\xc9"
1337 "\x3d\xd4\x6b\x02\x76\x0d\xa4\x18"
1338 "\xaf\x46\xdd\x51\xe8\x7f\x16\x8a"
1339 "\x21\xb8\x2c\xc3\x5a\xf1\x65\xfc"
1340 "\x93\x07\x9e\x35\xcc\x40\xd7\x6e"
1341 "\x05\x79\x10\xa7\x1b\xb2\x49\xe0"
1342 "\x54\xeb\x82\x19\x8d\x24\xbb\x2f"
1343 "\xc6\x5d\xf4\x68\xff\x96\x0a\xa1"
1344 "\x38\xcf\x43\xda\x71\x08\x7c\x13"
1345 "\xaa\x1e\xb5\x4c\xe3\x57\xee\x85"
1346 "\x1c\x90\x27\xbe\x32\xc9\x60\xf7"
1347 "\x6b\x02\x99\x0d\xa4\x3b\xd2\x46"
1348 "\xdd\x74\x0b\x7f\x16\xad\x21\xb8"
1349 "\x4f\xe6\x5a\xf1\x88\x1f\x93\x2a"
1350 "\xc1\x35\xcc\x63\xfa\x6e\x05\x9c"
1351 "\x10\xa7\x3e\xd5\x49\xe0\x77\x0e"
1352 "\x82\x19\xb0\x24\xbb\x52\xe9\x5d"
1353 "\xf4\x8b\x22\x96\x2d\xc4\x38\xcf"
1354 "\x66\xfd\x71\x08\x9f\x13\xaa\x41"
1355 "\xd8\x4c\xe3\x7a\x11\x85\x1c\xb3"
1356 "\x27\xbe\x55\xec\x60\xf7\x8e\x02"
1357 "\x99\x30\xc7\x3b\xd2\x69\x00\x74"
1358 "\x0b\xa2\x16\xad\x44\xdb\x4f\xe6"
1359 "\x7d\x14\x88\x1f\xb6\x2a\xc1\x58"
1360 "\xef\x63\xfa\x91\x05\x9c\x33\xca"
1361 "\x3e\xd5\x6c\x03\x77\x0e\xa5\x19"
1362 "\xb0\x47\xde\x52\xe9\x80\x17\x8b"
1363 "\x22\xb9\x2d\xc4\x5b\xf2\x66\xfd"
1364 "\x94\x08\x9f\x36\xcd\x41\xd8\x6f"
1365 "\x06\x7a\x11\xa8\x1c\xb3\x4a\xe1"
1366 "\x55\xec\x83\x1a\x8e\x25\xbc\x30"
1367 "\xc7\x5e\xf5\x69\x00\x97\x0b\xa2"
1368 "\x39\xd0\x44\xdb\x72\x09\x7d\x14"
1369 "\xab\x1f\xb6\x4d\xe4\x58\xef\x86"
1370 "\x1d\x91\x28\xbf\x33\xca\x61\xf8"
1371 "\x6c\x03\x9a\x0e\xa5\x3c\xd3\x47"
1372 "\xde\x75\x0c\x80\x17\xae\x22\xb9"
1373 "\x50\xe7\x5b\xf2\x89\x20\x94\x2b"
1374 "\xc2\x36\xcd\x64\xfb\x6f\x06\x9d"
1375 "\x11\xa8\x3f\xd6\x4a\xe1\x78\x0f"
1376 "\x83\x1a\xb1\x25\xbc\x53\xea\x5e"
1377 "\xf5\x8c\x00\x97\x2e\xc5\x39\xd0"
1378 "\x67\xfe\x72\x09\xa0\x14\xab\x42"
1379 "\xd9\x4d\xe4\x7b\x12\x86\x1d\xb4"
1380 "\x28\xbf\x56\xed\x61\xf8\x8f\x03"
1381 "\x9a\x31\xc8\x3c\xd3\x6a\x01\x75"
1382 "\x0c\xa3\x17\xae\x45\xdc\x50\xe7"
1383 "\x7e\x15\x89\x20\xb7\x2b\xc2\x59"
1384 "\xf0\x64\xfb\x92\x06\x9d\x34\xcb"
1385 "\x3f\xd6\x6d\x04\x78\x0f\xa6\x1a"
1386 "\xb1\x48\xdf\x53\xea\x81\x18\x8c"
1387 "\x23\xba\x2e\xc5\x5c\xf3\x67\xfe"
1388 "\x95\x09\xa0\x37\xce\x42\xd9\x70"
1389 "\x07\x7b\x12\xa9\x1d\xb4\x4b\xe2"
1390 "\x56\xed\x84\x1b\x8f\x26\xbd\x31"
1391 "\xc8\x5f\xf6\x6a\x01\x98\x0c\xa3"
1392 "\x3a\xd1\x45\xdc\x73\x0a\x7e\x15"
1393 "\xac\x20\xb7\x4e\xe5\x59\xf0\x87"
1394 "\x1e\x92\x29\xc0\x34\xcb\x62\xf9"
1395 "\x6d\x04\x9b\x0f\xa6\x3d\xd4\x48"
1396 "\xdf\x76\x0d\x81\x18\xaf\x23\xba"
1397 "\x51\xe8\x5c\xf3\x8a\x21\x95\x2c"
1398 "\xc3\x37\xce\x65\xfc\x70\x07\x9e"
1399 "\x12\xa9\x40\xd7\x4b\xe2\x79\x10"
1400 "\x84\x1b\xb2\x26\xbd\x54\xeb\x5f"
1401 "\xf6\x8d\x01\x98\x2f\xc6\x3a\xd1"
1402 "\x68\xff\x73\x0a\xa1\x15\xac\x43"
1403 "\xda\x4e\xe5\x7c\x13\x87\x1e\xb5"
1404 "\x29\xc0\x57\xee\x62\xf9\x90\x04"
1405 "\x9b\x32\xc9\x3d\xd4\x6b\x02\x76"
1406 "\x0d\xa4\x18\xaf\x46\xdd\x51\xe8"
1407 "\x7f\x16\x8a\x21\xb8\x2c\xc3\x5a"
1408 "\xf1\x65\xfc\x93\x07\x9e\x35\xcc"
1409 "\x40\xd7\x6e\x05\x79\x10\xa7\x1b"
1410 "\xb2\x49\xe0\x54\xeb\x82\x19\x8d"
1411 "\x24\xbb\x2f\xc6\x5d\xf4\x68\xff"
1412 "\x96\x0a\xa1\x38\xcf\x43\xda\x71"
1413 "\x08\x7c\x13\xaa\x1e\xb5\x4c",
1414 .psize = 1023,
1415 .digest = "\x76\xc9\xd4\x91\x7a\x5f\x0f\xaa"
1416 "\x13\x39\xf3\x01\x7a\xfa\xe5\x41"
1417 "\x5f\x0b\xf8\xeb\x32\xfc\xbf\xb0"
1418 "\xfa\x8c\xcd\x17\x83\xe2\xfa\xeb"
1419 "\x1c\x19\xde\xe2\x75\xdc\x34\x64"
1420 "\x5f\x35\x9c\x61\x2f\x10\xf9\xec"
1421 "\x59\xca\x9d\xcc\x25\x0c\x43\xba"
1422 "\x85\xa8\xf8\xfe\xb5\x24\xb2\xee",
1423 }
710}; 1424};
711 1425
712 1426