diff --git a/sw/host/cryptotest/testvectors/data/schemas/BUILD b/sw/host/cryptotest/testvectors/data/schemas/BUILD index 32dce7e3f1c47f..1b3f525c26d33b 100644 --- a/sw/host/cryptotest/testvectors/data/schemas/BUILD +++ b/sw/host/cryptotest/testvectors/data/schemas/BUILD @@ -14,4 +14,7 @@ filegroup( srcs = ["ecdsa_sig_ver_schema.json"], ) -exports_files(["hmac_schema.json"]) +exports_files([ + "hash_schema.json", + "hmac_schema.json", +]) diff --git a/sw/host/cryptotest/testvectors/data/schemas/hash_schema.json b/sw/host/cryptotest/testvectors/data/schemas/hash_schema.json new file mode 100644 index 00000000000000..babd2621e893e8 --- /dev/null +++ b/sw/host/cryptotest/testvectors/data/schemas/hash_schema.json @@ -0,0 +1,49 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://raw.githubusercontent.com/lowRISC/opentitan/master/sw/host/cryptotest/testvectors/data/schemas/hash_schema.json", + "title": "Cryptotest Hash Function Test Vector", + "description": "A list of testvectors for SHA-2, SHA-3, SHAKE, and cSHAKE testing", + "$defs": { + "byte_array": { + "type": "array", + "items": { + "type": "integer", + "minimum": 0, + "maximum": 255 + } + } + }, + "type": "array", + "minItems": 1, + "items": { + "type": "object", + "additionalProperties": false, + "properties": { + "vendor": { + "description": "Test vector vendor name", + "type": "string" + }, + "test_case_id": { + "description": "Test_case_id", + "type": "integer" + }, + "algorithm": { + "description": "The hash algorithm being tested", + "type": "string", + "enum": ["sha-224", "sha-256", "sha-384", "sha-512", "sha3-256", "sha3-384", "sha3-512", "shake-128", "shake-256"] + }, + "message": { + "description": "Message to be hashed", + "$ref": "#/$defs/byte_array" + }, + "digest": { + "description": "Digest output by the hash function", + "$ref": "#/$defs/byte_array" + }, + "result": { + "description": "Whether the hash of `message` should be equal to `digest`", + "type": "boolean" + } + } + } +}