aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/tcrypt.c
diff options
context:
space:
mode:
authorJonathan Lynch <jonathan.lynch@intel.com>2007-11-10 07:08:25 -0500
committerHerbert Xu <herbert@gondor.apana.org.au>2008-01-10 16:16:12 -0500
commitcd12fb906d2591e80da9edcbd4794b9b916d7489 (patch)
tree312f7ff32b70a1c093fd3d45e6f2a0715008f22b /crypto/tcrypt.c
parentcd7c3bfe54270f41ac52be6b725a7194d99175b4 (diff)
[CRYPTO] sha256-generic: Extend sha256_generic.c to support SHA-224
Resubmitting this patch which extends sha256_generic.c to support SHA-224 as described in FIPS 180-2 and RFC 3874. HMAC-SHA-224 as described in RFC4231 is then supported through the hmac interface. Patch includes test vectors for SHA-224 and HMAC-SHA-224. SHA-224 chould be chosen as a hash algorithm when 112 bits of security strength is required. Patch generated against the 2.6.24-rc1 kernel and tested against 2.6.24-rc1-git14 which includes fix for scatter gather implementation for HMAC. Signed-off-by: Jonathan Lynch <jonathan.lynch@intel.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/tcrypt.c')
-rw-r--r--crypto/tcrypt.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c
index aa84bc4f2313..4d364ccacbb2 100644
--- a/crypto/tcrypt.c
+++ b/crypto/tcrypt.c
@@ -12,6 +12,7 @@
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 * 2007-11-06 Added SHA-224 and SHA-224-HMAC tests
15 * 2006-12-07 Added SHA384 HMAC and SHA512 HMAC tests 16 * 2006-12-07 Added SHA384 HMAC and SHA512 HMAC tests
16 * 2004-08-09 Added cipher speed tests (Reyk Floeter <reyk@vantronix.net>) 17 * 2004-08-09 Added cipher speed tests (Reyk Floeter <reyk@vantronix.net>)
17 * 2003-09-14 Rewritten by Kartikey Mahendra Bhatt 18 * 2003-09-14 Rewritten by Kartikey Mahendra Bhatt
@@ -74,8 +75,9 @@ static char *xbuf;
74static char *tvmem; 75static char *tvmem;
75 76
76static char *check[] = { 77static char *check[] = {
77 "des", "md5", "des3_ede", "rot13", "sha1", "sha256", "blowfish", 78 "des", "md5", "des3_ede", "rot13", "sha1", "sha224", "sha256",
78 "twofish", "serpent", "sha384", "sha512", "md4", "aes", "cast6", 79 "blowfish", "twofish", "serpent", "sha384", "sha512", "md4", "aes",
80 "cast6", "arc4", "michael_mic", "deflate", "crc32c", "tea", "xtea",
79 "arc4", "michael_mic", "deflate", "crc32c", "tea", "xtea", 81 "arc4", "michael_mic", "deflate", "crc32c", "tea", "xtea",
80 "khazad", "wp512", "wp384", "wp256", "tnepres", "xeta", "fcrypt", 82 "khazad", "wp512", "wp384", "wp256", "tnepres", "xeta", "fcrypt",
81 "camellia", "seed", NULL 83 "camellia", "seed", NULL
@@ -918,6 +920,8 @@ static void do_test(void)
918 920
919 test_hash("md4", md4_tv_template, MD4_TEST_VECTORS); 921 test_hash("md4", md4_tv_template, MD4_TEST_VECTORS);
920 922
923 test_hash("sha224", sha224_tv_template, SHA224_TEST_VECTORS);
924
921 test_hash("sha256", sha256_tv_template, SHA256_TEST_VECTORS); 925 test_hash("sha256", sha256_tv_template, SHA256_TEST_VECTORS);
922 926
923 //BLOWFISH 927 //BLOWFISH
@@ -1067,6 +1071,8 @@ static void do_test(void)
1067 HMAC_MD5_TEST_VECTORS); 1071 HMAC_MD5_TEST_VECTORS);
1068 test_hash("hmac(sha1)", hmac_sha1_tv_template, 1072 test_hash("hmac(sha1)", hmac_sha1_tv_template,
1069 HMAC_SHA1_TEST_VECTORS); 1073 HMAC_SHA1_TEST_VECTORS);
1074 test_hash("hmac(sha224)", hmac_sha224_tv_template,
1075 HMAC_SHA224_TEST_VECTORS);
1070 test_hash("hmac(sha256)", hmac_sha256_tv_template, 1076 test_hash("hmac(sha256)", hmac_sha256_tv_template,
1071 HMAC_SHA256_TEST_VECTORS); 1077 HMAC_SHA256_TEST_VECTORS);
1072 test_hash("hmac(sha384)", hmac_sha384_tv_template, 1078 test_hash("hmac(sha384)", hmac_sha384_tv_template,
@@ -1299,6 +1305,9 @@ static void do_test(void)
1299 camellia_cbc_dec_tv_template, 1305 camellia_cbc_dec_tv_template,
1300 CAMELLIA_CBC_DEC_TEST_VECTORS); 1306 CAMELLIA_CBC_DEC_TEST_VECTORS);
1301 break; 1307 break;
1308 case 33:
1309 test_hash("sha224", sha224_tv_template, SHA224_TEST_VECTORS);
1310 break;
1302 1311
1303 case 100: 1312 case 100:
1304 test_hash("hmac(md5)", hmac_md5_tv_template, 1313 test_hash("hmac(md5)", hmac_md5_tv_template,
@@ -1324,7 +1333,10 @@ static void do_test(void)
1324 test_hash("hmac(sha512)", hmac_sha512_tv_template, 1333 test_hash("hmac(sha512)", hmac_sha512_tv_template,
1325 HMAC_SHA512_TEST_VECTORS); 1334 HMAC_SHA512_TEST_VECTORS);
1326 break; 1335 break;
1327 1336 case 105:
1337 test_hash("hmac(sha224)", hmac_sha224_tv_template,
1338 HMAC_SHA224_TEST_VECTORS);
1339 break;
1328 1340
1329 case 200: 1341 case 200:
1330 test_cipher_speed("ecb(aes)", ENCRYPT, sec, NULL, 0, 1342 test_cipher_speed("ecb(aes)", ENCRYPT, sec, NULL, 0,
@@ -1459,6 +1471,10 @@ static void do_test(void)
1459 test_hash_speed("tgr192", sec, generic_hash_speed_template); 1471 test_hash_speed("tgr192", sec, generic_hash_speed_template);
1460 if (mode > 300 && mode < 400) break; 1472 if (mode > 300 && mode < 400) break;
1461 1473
1474 case 313:
1475 test_hash_speed("sha224", sec, generic_hash_speed_template);
1476 if (mode > 300 && mode < 400) break;
1477
1462 case 399: 1478 case 399:
1463 break; 1479 break;
1464 1480