-
Notifications
You must be signed in to change notification settings - Fork 792
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[cryptotest] JSON schema for hash functions
Signed-off-by: Ryan Torok <[email protected]>
- Loading branch information
Showing
2 changed files
with
53 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
sw/host/cryptotest/testvectors/data/schemas/hash_schema.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
} | ||
} | ||
} | ||
} |