Skip to content

Commit 98eca72

Browse files
raveenpherbertx
authored andcommitted
crypto: sha3 - Add HMAC-SHA3 test modes and test vectors
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>
1 parent eb35478 commit 98eca72

3 files changed

Lines changed: 444 additions & 0 deletions

File tree

‎crypto/tcrypt.c‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1313,6 +1313,22 @@ static int do_test(const char *alg, u32 type, u32 mask, int m)
13131313
ret += tcrypt_test("hmac(crc32)");
13141314
break;
13151315

1316+
case 111:
1317+
ret += tcrypt_test("hmac(sha3-224)");
1318+
break;
1319+
1320+
case 112:
1321+
ret += tcrypt_test("hmac(sha3-256)");
1322+
break;
1323+
1324+
case 113:
1325+
ret += tcrypt_test("hmac(sha3-384)");
1326+
break;
1327+
1328+
case 114:
1329+
ret += tcrypt_test("hmac(sha3-512)");
1330+
break;
1331+
13161332
case 150:
13171333
ret += tcrypt_test("ansi_cprng");
13181334
break;

‎crypto/testmgr.c‎

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3399,6 +3399,46 @@ static const struct alg_test_desc alg_test_descs[] = {
33993399
.count = HMAC_SHA256_TEST_VECTORS
34003400
}
34013401
}
3402+
}, {
3403+
.alg = "hmac(sha3-224)",
3404+
.test = alg_test_hash,
3405+
.fips_allowed = 1,
3406+
.suite = {
3407+
.hash = {
3408+
.vecs = hmac_sha3_224_tv_template,
3409+
.count = HMAC_SHA3_224_TEST_VECTORS
3410+
}
3411+
}
3412+
}, {
3413+
.alg = "hmac(sha3-256)",
3414+
.test = alg_test_hash,
3415+
.fips_allowed = 1,
3416+
.suite = {
3417+
.hash = {
3418+
.vecs = hmac_sha3_256_tv_template,
3419+
.count = HMAC_SHA3_256_TEST_VECTORS
3420+
}
3421+
}
3422+
}, {
3423+
.alg = "hmac(sha3-384)",
3424+
.test = alg_test_hash,
3425+
.fips_allowed = 1,
3426+
.suite = {
3427+
.hash = {
3428+
.vecs = hmac_sha3_384_tv_template,
3429+
.count = HMAC_SHA3_384_TEST_VECTORS
3430+
}
3431+
}
3432+
}, {
3433+
.alg = "hmac(sha3-512)",
3434+
.test = alg_test_hash,
3435+
.fips_allowed = 1,
3436+
.suite = {
3437+
.hash = {
3438+
.vecs = hmac_sha3_512_tv_template,
3439+
.count = HMAC_SHA3_512_TEST_VECTORS
3440+
}
3441+
}
34023442
}, {
34033443
.alg = "hmac(sha384)",
34043444
.test = alg_test_hash,

0 commit comments

Comments
 (0)