Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[sival,hmac,kmac] Update test plan and add SHA3-224 test vectors #25256

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions hw/top_earlgrey/data/ip/chip_hmac_testplan.hjson
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
name: chip_sw_hmac_sha2_stress
desc: '''Verify SHA2 mode of operation.

- Verify the following digest sizes: 256
- Verify the following digest sizes: 256, 384, 512
- Verify input message size of 0 bytes.
- Verify multiple input message sizes as defined in NIST test vectors.
- Use endianness configuration used in the crypto library.
Expand All @@ -109,14 +109,22 @@
lc_states: ["PROD"]
tests: []
bazel: [
"//sw/device/tests/crypto:hmac_sha256_functest",
"//sw/device/tests/crypto/cryptotest:sha256_kat",
"//sw/device/tests/crypto/cryptotest:sha384_kat",
"//sw/device/tests/crypto/cryptotest:sha512_kat",
"//sw/device/tests/crypto:sha256_functest",
"//sw/device/tests/crypto:sha384_functest",
"//sw/device/tests/crypto:sha512_functest",
]
}
{
name: chip_sw_hmac_stress
desc: '''Verify HMAC mode of operation.

- Verify the following security configurations: HMAC-SHA2-256
- Verify all HMAC modes of operation:
- HMAC-SHA2-256
- HMAC-SHA2-384
- HMAC-SHA2-512
- Verify input message size of 0 bytes.
- Verify multiple input message sizes as defined in NIST test vectors.
- Use endianness configuration used in the crypto library.
Expand All @@ -130,9 +138,10 @@
"//sw/device/tests/crypto/cryptotest:hmac_sha256_kat",
"//sw/device/tests/crypto/cryptotest:hmac_sha384_kat",
"//sw/device/tests/crypto/cryptotest:hmac_sha512_kat",
"//sw/device/tests/crypto:kmac_functest_hardcoded",
"//sw/device/tests/crypto:hmac_functest",
"//sw/device/tests/crypto:hmac_sha256_functest",
"//sw/device/tests/crypto:hmac_sha384_functest",
"//sw/device/tests/crypto:hmac_sha512_functest",
"//sw/device/tests/crypto:hmac_sha384_functest"
]
}
{
Expand Down
4 changes: 2 additions & 2 deletions hw/top_earlgrey/data/ip/chip_kmac_testplan.hjson
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@
tests: []
bazel: [
"//sw/device/tests:kmac_mode_cshake_test",
"//sw/device/tests/crypto/cryptotest:cshake_kat",
]
}
{
Expand All @@ -191,17 +192,16 @@
- Verify input message size of 0 bytes.
- Verify multiple input message sizes as defined in NIST test vectors.
- Use endianess configuration used in the crypto library.
- Verify multiple XOF configurations.
'''
features: [
"KMAC.MODE.KMAC",
"KMAC.MODE.XOF",
]
stage: V3
si_stage: SV3
lc_states: ["PROD"]
tests: []
bazel: [
"//sw/device/tests/crypto:kmac_functest_hardcoded",
"//sw/device/tests/crypto/cryptotest:kmac_kat",
]
}
Expand Down
23 changes: 23 additions & 0 deletions sw/device/tests/crypto/cryptotest/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,28 @@ cryptotest(
test_vectors = SHA512_TESTVECTOR_TARGETS,
)

SHA3_224_TESTVECTOR_TARGETS = [
"//sw/host/cryptotest/testvectors/data:nist_cavp_sha3_fips_202_sha3_224_{}_json".format(
msg_type.lower(),
)
for msg_type in [
"ShortMsg",
"LongMsg",
]
]

SHA3_224_TESTVECTOR_ARGS = " ".join([
"--hash-json=\"$(rootpath {})\"".format(target)
for target in SHA3_224_TESTVECTOR_TARGETS
])

cryptotest(
name = "sha3_224_kat",
test_args = SHA3_224_TESTVECTOR_ARGS,
test_harness = "//sw/host/tests/crypto/hash_kat:harness",
test_vectors = SHA3_224_TESTVECTOR_TARGETS,
)

SHA3_256_TESTVECTOR_TARGETS = [
"//sw/host/cryptotest/testvectors/data:nist_cavp_sha3_fips_202_sha3_256_{}_json".format(
msg_type.lower(),
Expand Down Expand Up @@ -418,6 +440,7 @@ test_suite(
":kmac_kat",
":sha256_kat",
":sha384_kat",
":sha3_224_kat",
":sha3_256_kat",
":sha3_384_kat",
":sha3_512_kat",
Expand Down
5 changes: 5 additions & 0 deletions sw/host/cryptotest/testvectors/data/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,10 @@ ECDSA_RANDOM_COUNT = 128
]
]

################################################################################
# SHA2, SHA3 - NIST CAVP KAT
################################################################################

[
run_binary(
name = "nist_cavp_{}_{}_{}_json".format(
Expand Down Expand Up @@ -214,6 +218,7 @@ ECDSA_RANDOM_COUNT = 128
("SHA256", "sha2_fips_180_4", []),
("SHA384", "sha2_fips_180_4", []),
("SHA512", "sha2_fips_180_4", []),
("SHA3_224", "sha3_fips_202", []),
("SHA3_256", "sha3_fips_202", []),
("SHA3_384", "sha3_fips_202", []),
("SHA3_512", "sha3_fips_202", []),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"SHA256": "sha-256",
"SHA384": "sha-384",
"SHA512": "sha-512",
"SHA3_224": "sha3-224",
"SHA3_256": "sha3-256",
"SHA3_384": "sha3-384",
"SHA3_512": "sha3-512",
Expand Down
Loading