Skip to content

Commit

Permalink
Merge pull request #1556 from usnistgov/livebe01-patch-1-1
Browse files Browse the repository at this point in the history
misc. updates to shake and sha3 test vector definitions and examples
  • Loading branch information
livebe01 authored Jan 23, 2025
2 parents 388251c + 03f639c commit 79d6764
Showing 1 changed file with 11 additions and 60 deletions.
71 changes: 11 additions & 60 deletions src/sha3/sections/06-test-vectors.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ Test vector sets *MUST* contain one or many test groups, each sharing similar pr
| tgId| Numeric identifier for the test group, unique across the entire vector set.| integer
| testType| Test category type. AFT, MCT or VOT as defined in <<testtypes>>| value
| mctVersion | When testType is MCT, the type of MCT being run, i.e., "standard" or "alternate" | string
| maxOutLen | When testType is MCT and the algorithm is SHAKE, the largest supported output length as provided via the outputLen property in the registration. | integer
| minOutLen | When testType is MCT and the algorithm is SHAKE, the smallest supported output length as provided via the outputLen property in the registration. | integer
| tests| Array of individual test case JSON objects, which are defined in <<tcjs>>| array of testCase objects
|===

Expand All @@ -30,70 +32,18 @@ Each test group *SHALL* contain an array of one or more test cases. Each test c
| JSON Value| Description| JSON type

| tcId| Numeric identifier for the test case, unique across the entire vector set.| integer
| len| Length of the message or seed| integer
| outLen| Length of the digest| integer
| msg| Value of the message or seed. Messages are represented as little-endian hex for all SHA3 variations.| string (hex)
| len| Length of the message or seed. Applicable to AFT, VOT, and MCT test types. | integer
| outLen| Length of the digest. Only applicable when the algorithm is SHAKE-128 or SHAKE-256 and the test type is AFT or VOT. | integer
| msg| Value of the message or seed. Messages are represented as little-endian hex for all SHA3 variations. Applicable to AFT, VOT, and MCT test types. | string (hex)
| largeMsg | Object describing the message for an LDT group | large data object, see <<LD_test>> for more information
|===

NOTE: All properties listed in the above table are *REQUIRED* except for outLen which is only *REQUIRED* when the algorithm is SHAKE-128 or SHAKE-256.

NOTE: The maximum value for SHAKE-128 for 'len' is 65,904 bits when the inBit parameter is set to true in the capabilities registration and 66,240 bits when it is set to false. The maximum value for SHAKE-256 for 'len' is 66,428 bits when the inBit parameter is set to true in the capabilities registration and 65,752 bits when it is set to false.

The following are example JSON objects for secure hash test vectors sent from the ACVP server to the crypto module. Notice that the single bit message is represented as "01". This complies with the little-endian nature of SHA3. All hex displayed is little-endian bit order when associated with SHA3 or any of its variations.

[source, json]
----
[
{ "acvVersion": <acvp-version> },
{
"vsId": 1564,
"algorithm": "SHA3-512",
"revision": "1.0",
"testGroups": [
{
"tgId": 1,
"testType": "AFT",
"tests": [
{
"tcId": 1,
"len": 0,
"msg": "00"
},
{
"tcId": 2,
"len": 1,
"msg": "01"
}]
},
{
"tgId": 2,
"testType": "MCT",
"mctVersion": "standard",
"tests": [
{
"tcId": 3,
"len": 512,
"msg": "30850bd984b14ff5aff18993329...",
}]
},
{
"tgId": 3,
"testType": "LDT",
"tests": [
{
"tcId": 4,
"largeMsg": {
"content": "DE26",
"contentLength": 16,
"fullLength": 42949672960,
"expansionTechnique": "repeating"
}
}
]
}]
}
]
[
{ "acvVersion": <acvp-version> },
Expand All @@ -120,6 +70,7 @@ The following are example JSON objects for secure hash test vectors sent from th
{
"tgId": 2,
"testType": "MCT",
"mctVersion": "standard",
"tests": [
{
"tcId": 3,
Expand Down Expand Up @@ -164,20 +115,20 @@ The following is an example JSON object for SHAKE.
{
"tcId": 1,
"len": 0,
"msg": "00"
"msg": "00",
"outLen": 128
},
{
"tcId": 2,
"len": 1,
"msg": "01"
"msg": "01",
"outLen": 128
}]
},
{
"tgId": 2,
"testType": "MCT",
"inBit": true,
"outBit": true,
"inEmpty": false,
"mctVersion": "standard",
"maxOutLen": 4096,
"minOutLen": 128,
"tests": [
Expand Down

0 comments on commit 79d6764

Please sign in to comment.