aboutsummaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorSonic Zhang <sonic.zhang@analog.com>2012-05-25 05:54:13 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2012-06-12 04:37:17 -0400
commita482b081a2d4d74d16bc9ea8779f9f6055f95852 (patch)
tree96832483869b977ab7f090c4793ed45bda0afd74 /crypto
parent65df57743924c3d13e1fa1bcf5bf70fe874fcdfd (diff)
crypto: testmgr - Add new test cases for Blackfin CRC crypto driver
Signed-off-by: Sonic Zhang <sonic.zhang@analog.com> Acked-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto')
-rw-r--r--crypto/tcrypt.c3
-rw-r--r--crypto/testmgr.c9
-rw-r--r--crypto/testmgr.h90
3 files changed, 102 insertions, 0 deletions
diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c
index 8f147bff0980..750cce44bad6 100644
--- a/crypto/tcrypt.c
+++ b/crypto/tcrypt.c
@@ -1192,6 +1192,9 @@ static int do_test(int m)
1192 case 109: 1192 case 109:
1193 ret += tcrypt_test("vmac(aes)"); 1193 ret += tcrypt_test("vmac(aes)");
1194 break; 1194 break;
1195 case 110:
1196 ret += tcrypt_test("hmac(crc32)");
1197 break;
1195 1198
1196 case 150: 1199 case 150:
1197 ret += tcrypt_test("ansi_cprng"); 1200 ret += tcrypt_test("ansi_cprng");
diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index 5674878ff6c1..eb6d20f8ec5d 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -2220,6 +2220,15 @@ static const struct alg_test_desc alg_test_descs[] = {
2220 } 2220 }
2221 } 2221 }
2222 }, { 2222 }, {
2223 .alg = "hmac(crc32)",
2224 .test = alg_test_hash,
2225 .suite = {
2226 .hash = {
2227 .vecs = bfin_crc_tv_template,
2228 .count = BFIN_CRC_TEST_VECTORS
2229 }
2230 }
2231 }, {
2223 .alg = "hmac(md5)", 2232 .alg = "hmac(md5)",
2224 .test = alg_test_hash, 2233 .test = alg_test_hash,
2225 .suite = { 2234 .suite = {
diff --git a/crypto/testmgr.h b/crypto/testmgr.h
index 36e5a8ee0e1e..34a9d511deef 100644
--- a/crypto/testmgr.h
+++ b/crypto/testmgr.h
@@ -14858,4 +14858,94 @@ static struct hash_testvec crc32c_tv_template[] = {
14858 }, 14858 },
14859}; 14859};
14860 14860
14861/*
14862 * Blakcifn CRC test vectors
14863 */
14864#define BFIN_CRC_TEST_VECTORS 6
14865
14866static struct hash_testvec bfin_crc_tv_template[] = {
14867 {
14868 .psize = 0,
14869 .digest = "\x00\x00\x00\x00",
14870 },
14871 {
14872 .key = "\x87\xa9\xcb\xed",
14873 .ksize = 4,
14874 .psize = 0,
14875 .digest = "\x87\xa9\xcb\xed",
14876 },
14877 {
14878 .key = "\xff\xff\xff\xff",
14879 .ksize = 4,
14880 .plaintext = "\x01\x02\x03\x04\x05\x06\x07\x08"
14881 "\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10"
14882 "\x11\x12\x13\x14\x15\x16\x17\x18"
14883 "\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20"
14884 "\x21\x22\x23\x24\x25\x26\x27\x28",
14885 .psize = 40,
14886 .digest = "\x84\x0c\x8d\xa2",
14887 },
14888 {
14889 .key = "\xff\xff\xff\xff",
14890 .ksize = 4,
14891 .plaintext = "\x01\x02\x03\x04\x05\x06\x07\x08"
14892 "\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10"
14893 "\x11\x12\x13\x14\x15\x16\x17\x18"
14894 "\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20"
14895 "\x21\x22\x23\x24\x25\x26",
14896 .psize = 38,
14897 .digest = "\x8c\x58\xec\xb7",
14898 },
14899 {
14900 .key = "\xff\xff\xff\xff",
14901 .ksize = 4,
14902 .plaintext = "\x01\x02\x03\x04\x05\x06\x07\x08"
14903 "\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10"
14904 "\x11\x12\x13\x14\x15\x16\x17\x18"
14905 "\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20"
14906 "\x21\x22\x23\x24\x25\x26\x27",
14907 .psize = 39,
14908 .digest = "\xdc\x50\x28\x7b",
14909 },
14910 {
14911 .key = "\xff\xff\xff\xff",
14912 .ksize = 4,
14913 .plaintext = "\x01\x02\x03\x04\x05\x06\x07\x08"
14914 "\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10"
14915 "\x11\x12\x13\x14\x15\x16\x17\x18"
14916 "\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20"
14917 "\x21\x22\x23\x24\x25\x26\x27\x28"
14918 "\x29\x2a\x2b\x2c\x2d\x2e\x2f\x30"
14919 "\x31\x32\x33\x34\x35\x36\x37\x38"
14920 "\x39\x3a\x3b\x3c\x3d\x3e\x3f\x40"
14921 "\x41\x42\x43\x44\x45\x46\x47\x48"
14922 "\x49\x4a\x4b\x4c\x4d\x4e\x4f\x50"
14923 "\x51\x52\x53\x54\x55\x56\x57\x58"
14924 "\x59\x5a\x5b\x5c\x5d\x5e\x5f\x60"
14925 "\x61\x62\x63\x64\x65\x66\x67\x68"
14926 "\x69\x6a\x6b\x6c\x6d\x6e\x6f\x70"
14927 "\x71\x72\x73\x74\x75\x76\x77\x78"
14928 "\x79\x7a\x7b\x7c\x7d\x7e\x7f\x80"
14929 "\x81\x82\x83\x84\x85\x86\x87\x88"
14930 "\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90"
14931 "\x91\x92\x93\x94\x95\x96\x97\x98"
14932 "\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0"
14933 "\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8"
14934 "\xa9\xaa\xab\xac\xad\xae\xaf\xb0"
14935 "\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8"
14936 "\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0"
14937 "\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8"
14938 "\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0"
14939 "\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8"
14940 "\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0"
14941 "\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8"
14942 "\xe9\xea\xeb\xec\xed\xee\xef\xf0",
14943 .psize = 240,
14944 .digest = "\x10\x19\x4a\x5c",
14945 .np = 2,
14946 .tap = { 31, 209 }
14947 },
14948
14949};
14950
14861#endif /* _CRYPTO_TESTMGR_H */ 14951#endif /* _CRYPTO_TESTMGR_H */