Skip to content

Commit ec33edb

Browse files
committed
Adds HMAC revision 2.0
1 parent 102ced7 commit ec33edb

File tree

5 files changed

+142
-29
lines changed

5 files changed

+142
-29
lines changed

src/mac/sections/03-supported.adoc

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,30 @@
22
[#supported]
33
== Supported HMAC, CMAC, and GMAC Algorithms
44

5-
The following Message Authentication Code Algorithms *MAY* be advertised by the ACVP compliant cryptographic module:
5+
The following Message Authentication Code Algorithms *MAY* be advertised by the ACVP compliant cryptographic module as "algorithm" / "mode" / "revision":
66

7-
* HMAC-SHA-1
8-
* HMAC-SHA2-224
9-
* HMAC-SHA2-256
10-
* HMAC-SHA2-384
11-
* HMAC-SHA2-512
12-
* HMAC-SHA2-512/224
13-
* HMAC-SHA2-512/256
14-
* HMAC-SHA3-224
15-
* HMAC-SHA3-256
16-
* HMAC-SHA3-384
17-
* HMAC-SHA3-512
18-
* CMAC-AES
19-
* CMAC-TDES
20-
* ACVP-AES-GMAC
7+
* HMAC-SHA-1 / / 1.0
8+
* HMAC-SHA2-224 / / 1.0
9+
* HMAC-SHA2-256 / / 1.0
10+
* HMAC-SHA2-384 / / 1.0
11+
* HMAC-SHA2-512 / / 1.0
12+
* HMAC-SHA2-512/224 / / 1.0
13+
* HMAC-SHA2-512/256 / / 1.0
14+
* HMAC-SHA3-224 / / 1.0
15+
* HMAC-SHA3-256 / / 1.0
16+
* HMAC-SHA3-384 / / 1.0
17+
* HMAC-SHA3-512 / / 1.0
18+
* HMAC-SHA-1 / / 2.0
19+
* HMAC-SHA2-224 / / 2.0
20+
* HMAC-SHA2-256 / / 2.0
21+
* HMAC-SHA2-384 / / 2.0
22+
* HMAC-SHA2-512 / / 2.0
23+
* HMAC-SHA2-512/224 / / 2.0
24+
* HMAC-SHA2-512/256 / / 2.0
25+
* HMAC-SHA3-224 / / 2.0
26+
* HMAC-SHA3-256 / / 2.0
27+
* HMAC-SHA3-384 / / 2.0
28+
* HMAC-SHA3-512 / / 2.0
29+
* CMAC-AES / / 1.0
30+
* CMAC-TDES / / 1.0
31+
* ACVP-AES-GMAC / / 1.0

src/mac/sections/04-testtypes.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ The ACVP server performs a set of tests on the MAC algorithms in order to assess
99

1010
There is a single test type for MACs (broken into subsections for CMACs). the single test type, algorithm functional test (AFT) can be described as follows:
1111

12-
* "AFT" - Algorithm Function Test. The IUT processes all of HMAC, GMAC and the "gen" direction of CMAC by running the randomly chosen key and message data (with constraints as per the IUT's capabilities registration) through the MAC algorithm. CMAC has an additional "ver" direction present in its testing to ensure the IUT can successfully determine when a MAC does not match its originating message/key combination.
12+
* "AFT" - Algorithm Function Test. The IUT processes all of HMAC, GMAC and the "gen" direction of CMAC by running the randomly chosen key and message data (with constraints as per the IUT's capabilities registration) through the MAC algorithm. CMAC has an additional "ver" direction present in its testing to ensure the IUT can successfully determine when a MAC does not match its originating message/key combination. All property lengths used are randomly selected from the domains provided but *SHALL* include the minimum and maximum in every test group.
1313

1414
[[test_coverage]]
1515
=== Test Coverage

src/mac/sections/05-hmac-capabilities.adoc

Lines changed: 52 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
Each algorithm capability advertised is a self-contained JSON object using the following values.
88

99
[[hmac_caps_table2]]
10-
.HMAC Algorithm Capabilities JSON Values
10+
.HMAC Revision 1.0 Algorithm Capabilities JSON Values
1111
|===
1212
| JSON Value | Description | JSON type | Valid Values
1313

@@ -18,17 +18,30 @@ Each algorithm capability advertised is a self-contained JSON object using the f
1818
| macLen | The supported mac sizes, maximum is dependent on algorithm, see <<hmac_supported_algs>> | domain | Min: 32
1919
|===
2020

21+
[[hmac_caps_table3]]
22+
.HMAC Revision 2.0 Algorithm Capabilities JSON Values
23+
|===
24+
| JSON Value | Description | JSON type | Valid Values
25+
26+
| algorithm | The MAC algorithm and mode to be validated | string | See <<hmac_supported_algs>>
27+
| revision | The algorithm testing revision to use | string | "2.0"
28+
| prereqVals | prerequisite algorithm validations | array of prereqAlgVal objects | See <<prereq_algs>>
29+
| keyLen | The keyLen Domain supported by the IUT in bits | domain | Min: 8, Max: 524288, Increment: 8
30+
| macLen | The supported mac sizes, maximum is dependent on algorithm, see <<hmac_supported_algs>> | domain | Min: 32
31+
| messageLen | The supported message sizes | domain | Min: 8, Max: 4096, Increment: 8
32+
|===
33+
2134
'keyLen' for HMAC contains a Domain of values, the server *MAY* choose values defined by these rules:
2235

23-
* 2 values below the Hash's block length. See <<hmac_supported_algs>>
36+
* Values below the Hash's block length. See <<hmac_supported_algs>>
2437
* The Hash's block length.
25-
* 2 values above the Hash's block length.
38+
* Values above the Hash's block length.
2639

27-
'macLen' for HMAC contains a Domain of values, the server *MAY* choose values defined by these rules:
40+
'macLen' and 'messageLen' for HMAC contains a Domain of values, the server *MAY* choose values defined by these rules:
2841

29-
* The smallest HMAC length supported
30-
* A second HMAC length supported
31-
* The largest HMAC length supported
42+
* The smallest length supported
43+
* The largest length supported
44+
* Other random lengths
3245

3346
[[hmac_supported_algs]]
3447
=== Supported HMAC Algorithms
@@ -56,7 +69,7 @@ The following HMAC algorithms contain specific individual properties:
5669
[[hmac_app-reg-ex]]
5770
==== Example HMAC Capabilities JSON Object
5871

59-
The following is an example JSON object advertising support for HMAC.
72+
The following is an example JSON object advertising support for HMAC revision 1.0.
6073

6174
[source, json]
6275
----
@@ -79,3 +92,34 @@ The following is an example JSON object advertising support for HMAC.
7992
]
8093
}
8194
----
95+
96+
The following is an example JSON object advertising support for HMAC revision 2.0.
97+
98+
[source, json]
99+
----
100+
{
101+
"algorithm": "HMAC-SHA-1",
102+
"revision": "2.0",
103+
"keyLen": [
104+
{
105+
"min": 8,
106+
"max": 2048,
107+
"increment": 8
108+
}
109+
],
110+
"macLen": [
111+
{
112+
"min": 80,
113+
"max": 160,
114+
"increment": 8
115+
}
116+
],
117+
"messageLen": [
118+
{
119+
"min": 8,
120+
"max": 4096,
121+
"increment": 8
122+
}
123+
]
124+
}
125+
----

src/mac/sections/06-hmac-test-vectors.adoc

Lines changed: 62 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@
44
[[hmac_tgjs]]
55
==== HMAC Test Groups JSON Schema
66

7-
The testGroups element at the top level in the test vector JSON object is an array of test groups. Test vectors are grouped into similar test cases to reduce the amount of data transmitted in the vector set. For instance, all test vectors that use the same key size would be grouped together. The Test Group JSON object contains meta data that applies to all test vectors within the group. The following table describes the secure HMAC JSON elements of the Test Group JSON object.
7+
In HMAC revision 1.0, the testGroups element at the top level in the test vector JSON object is an array of test groups. Test vectors are grouped into similar test cases to reduce the amount of data transmitted in the vector set. For instance, all test vectors that use the same key size would be grouped together. The Test Group JSON object contains meta data that applies to all test vectors within the group. The following table describes the secure HMAC JSON elements of the Test Group JSON object.
8+
9+
In HMAC revision 2.0, there *SHALL* be one single test group that contains all of the test cases for the test vector object.
810

911
[[hmac_vs_tg_table]]
1012
[cols="<,<,<"]
11-
.HMAC Test Group JSON Object
13+
.HMAC revision 1.0 Test Group JSON Object
1214
|===
1315
| JSON Value | Description | JSON type
1416

@@ -20,27 +22,49 @@ The testGroups element at the top level in the test vector JSON object is an arr
2022
| tests | Array of individual test vector JSON objects, which are defined in <<hmac_tvjs>> | array
2123
|===
2224

25+
[[hmac_vs_tg_table2]]
26+
[cols="<,<,<"]
27+
.HMAC revision 2.0 Test Group JSON Object
28+
|===
29+
| JSON Value | Description | JSON type
30+
31+
| tgId | Numeric identifier for the test group, unique across the entire vector set | integer
32+
| testType | Test category type | string
33+
| tests | Array of individual test vector JSON objects, which are defined in <<hmac_tvjs>> | array
34+
|===
35+
2336
[[hmac_tvjs]]
2437
==== HMAC Test Case JSON Schema
2538

2639
Each test group contains an array of one or more test cases. Each test case is a JSON object that represents a single test vector to be processed by the ACVP client. The following table describes the JSON elements for each secure MAC test vector.
2740

2841
[[hmac_vs_tc_table2]]
42+
[cols="<,<,<"]
43+
.HMAC Revision 1.0 Test Case JSON Object
44+
|===
45+
| JSON Value | Description | JSON type
46+
47+
| tcId | Numeric identifier for the test case, unique across the entire vector set | integer
48+
| key | The value of the key | hex
49+
| msg | Value of the message | hex
50+
|===
2951

52+
[[hmac_vs_tc_table3]]
3053
[cols="<,<,<"]
31-
.HMAC Test Case JSON Object
54+
.HMAC Revision 2.0 Test Case JSON Object
3255
|===
3356
| JSON Value | Description | JSON type
3457

3558
| tcId | Numeric identifier for the test case, unique across the entire vector set | integer
3659
| key | The value of the key | hex
3760
| msg | Value of the message | hex
61+
| macLen | Length of MAC in bits to generate | integer
3862
|===
3963

4064
[[hmac_test_vector_json]]
4165
==== Example HMAC Test Vector JSON Object
4266

43-
The following is an example JSON test vector object for HMAC, truncated for brevity.
67+
The following is an example JSON test vector object for HMAC revision 1.0, truncated for brevity.
4468

4569
[source, json]
4670
----
@@ -73,3 +97,37 @@ The following is an example JSON test vector object for HMAC, truncated for brev
7397
}]
7498
}
7599
----
100+
101+
The following is an example JSON test vector object for HMAC revision 2.0, truncated for brevity.
102+
103+
[source, json]
104+
----
105+
{
106+
"vsId": 1,
107+
"algorithm": "HMAC-SHA-1",
108+
"revision": "2.0",
109+
"testGroups": [{
110+
"tgId": 1,
111+
"testType": "AFT",
112+
"tests": [{
113+
"tcId": 1,
114+
"key": "0CBB3AA866",
115+
"msg": "28CD4091D45F28CD",
116+
"macLen": 128
117+
},
118+
{
119+
"tcId": 2,
120+
"key": "7FB3F60ACB9FB7",
121+
"msg": "9F224BF653F9BE143FF8D12761F7",
122+
"macLen": 80
123+
},
124+
{
125+
"tcId": 3,
126+
"key": "3834463234DA",
127+
"msg": "F0FA740D261D5916B06F09AFBB04C94E",
128+
"macLen": 160
129+
}
130+
]
131+
}]
132+
}
133+
----

src/mac/sections/07-hmac-responses.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Each test group contains an array of one or more test cases. Each test case is a
1818
[[hmac_test_vector_response_json]]
1919
==== Example HMAC Test Vector Response JSON Object
2020

21-
The following is an example JSON test vector response object for HMAC.
21+
The following is an example JSON test vector response object for HMAC. The responses are the same for HMAC revision 1.0 and HMAC revision 2.0.
2222

2323
[source, json]
2424
----

0 commit comments

Comments
 (0)