Skip to content

Commit

Permalink
crypto: sha3 - Add HMAC-SHA3 test modes and test vectors
Browse files Browse the repository at this point in the history
This patch adds HMAC-SHA3 test modes in tcrypt module
and related test vectors.

Signed-off-by: Raveendra Padasalagi <raveendra.padasalagi@broadcom.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
  • Loading branch information
raveendra padasalagi authored and Herbert Xu committed Jul 1, 2016
1 parent eb35478 commit 98eca72
Show file tree
Hide file tree
Showing 3 changed files with 444 additions and 0 deletions.
16 changes: 16 additions & 0 deletions crypto/tcrypt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1313,6 +1313,22 @@ static int do_test(const char *alg, u32 type, u32 mask, int m)
ret += tcrypt_test("hmac(crc32)");
break;

case 111:
ret += tcrypt_test("hmac(sha3-224)");
break;

case 112:
ret += tcrypt_test("hmac(sha3-256)");
break;

case 113:
ret += tcrypt_test("hmac(sha3-384)");
break;

case 114:
ret += tcrypt_test("hmac(sha3-512)");
break;

case 150:
ret += tcrypt_test("ansi_cprng");
break;
Expand Down
40 changes: 40 additions & 0 deletions crypto/testmgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -3399,6 +3399,46 @@ static const struct alg_test_desc alg_test_descs[] = {
.count = HMAC_SHA256_TEST_VECTORS
}
}
}, {
.alg = "hmac(sha3-224)",
.test = alg_test_hash,
.fips_allowed = 1,
.suite = {
.hash = {
.vecs = hmac_sha3_224_tv_template,
.count = HMAC_SHA3_224_TEST_VECTORS
}
}
}, {
.alg = "hmac(sha3-256)",
.test = alg_test_hash,
.fips_allowed = 1,
.suite = {
.hash = {
.vecs = hmac_sha3_256_tv_template,
.count = HMAC_SHA3_256_TEST_VECTORS
}
}
}, {
.alg = "hmac(sha3-384)",
.test = alg_test_hash,
.fips_allowed = 1,
.suite = {
.hash = {
.vecs = hmac_sha3_384_tv_template,
.count = HMAC_SHA3_384_TEST_VECTORS
}
}
}, {
.alg = "hmac(sha3-512)",
.test = alg_test_hash,
.fips_allowed = 1,
.suite = {
.hash = {
.vecs = hmac_sha3_512_tv_template,
.count = HMAC_SHA3_512_TEST_VECTORS
}
}
}, {
.alg = "hmac(sha384)",
.test = alg_test_hash,
Expand Down
Loading

0 comments on commit 98eca72

Please sign in to comment.