Internet-Draft | ACVP SHA | August 2020 |
Celi | Expires 11 February 2021 | [Page] |
This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.¶
Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at https://datatracker.ietf.org/drafts/current/.¶
Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."¶
This Internet-Draft will expire on 11 February 2021.¶
Copyright (c) 2020 IETF Trust and the persons identified as the document authors. All rights reserved.¶
This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document.¶
There are no acknowledgements.¶
This document defines the JSON schema for testing Secure Hash Algorithm (SHA) implementations with the ACVP specification.¶
The Automated Crypto Validation Protocol (ACVP) defines a mechanism to automatically verify the cryptographic implementation of a software or hardware crypto module. The ACVP specification defines how a crypto module communicates with an ACVP server, including crypto capabilities negotiation, session management, authentication, vector processing and more. The ACVP specification does not define algorithm specific JSON constructs for performing the crypto validation. A series of ACVP sub-specifications define the constructs for testing individual crypto algorithms. Each sub-specification addresses a specific class of crypto algorithms. This sub-specification defines the JSON constructs for testing Secure Hash Algorithm (SHA) implementations using ACVP.¶
No terms and definitions are listed in this document.¶
The following hash algorithms MAY be advertised by the ACVP compliant cryptographic module:¶
This section describes the design of the tests used to validate implementations of SHA-1 and SHA-2.¶
There are two types of tests for SHA-1 and SHA-2: functional tests and Monte Carlo tests. Each has a specific value to be used in the testType field. The testType field definitions are:¶
"AFT" - Algorithm Functional Test. These tests can be processed by the client using a normal 'hash' operation. AFTs cause the implementation under test to exercise nomral operations on a single block, multiple blocks, or partial blocks. In all cases,random data is used. The functional tests are designed to verify that the logical components of the hash function (block chunking, block padding etc.) are operating correctly.¶
"MCT" - Monte Carlo Test. These tests exercise the implementation under test under stenuous circumstances. The implementation under test must process the test vectors according to the correct algorithm and mode in this document. MCTs can help detect potential memory leaks over time, and problems in allocation of resources, addressing variables, error handling, and generally improper behavior in response to random inputs. Each MCT processes 100 pseudorandom tests. Each algorithm and mode SHOULD have at least one MCT group. See Section 6.2 for implementation details.¶
The MCTs start with an initial condition (SEED which is a single message) and perform a series of chained computations.¶
The tests described in this document have the intention of ensuring an implementation is conformant to [FIPS180-4].¶
Sections 3 and 4 in [FIPS180-4] outline the core functions used within the hash algorithms. Normal AFTs test these operations.¶
Section 5 outlines the hash function preprocessing. It is worth noting that not all test cases will cover the message padding process, but through the entire vector set, this operation will be fully tested.¶
Section 1 in [FIPS180-4] outlines the maximum message sizes for each hash function. Due to the large size (either 2^64 or 2^128 bits) of these maximums, they are not tested by this specification.¶
Section 7 outlines digest truncation for applications where a shortened digest is needed. These operations are not tested via this specification.¶
ACVP requires crypto modules to register their capabilities. This allows the crypto module to advertise support for specific algorithms, notifying the ACVP server which algorithms need test vectors generated for the validation process. This section describes the constructs for advertising support of SHA algorithms to the ACVP server.¶
The algorithm capabilities MUST be advertised as JSON objects within the 'algorithms' value of the ACVP registration message. The 'algorithms' value is an array, where each array element is an individual JSON object defined in this section. The 'algorithms' value is part of the 'capability_exchange' element of the ACVP JSON registration message. See the ACVP specification [ACVP] for more details on the registration message.¶
Each algorithm implementation MAY rely on other cryptographic primitives. For example, RSA Signature algorithms depend on an underlying hash function. Each of these underlying algorithm primitives must be validated, either separately or as part of the same submission. ACVP provides a mechanism for specifying the required prerequisites:¶
Prerequisites, if applicable, MUST be submitted in the registration as the prereqVals
JSON property array inside each element of the algorithms
array. Each element in the prereqVals
array MUST contain the following properties¶
JSON Property | Description | JSON Type |
---|---|---|
algorithm | a prerequisite algorithm | string |
valValue | algorithm validation number | string |
A "valValue" of "same" SHALL be used to indicate that the prerequisite is being met by a different algorithm in the capability exchange in the same registration.¶
An example description of prerequisites within a single algorithm capability exchange looks like this¶
This section describes the constructs for advertising support of hash algorithms to the ACVP server.¶
JSON Value | Description | JSON type |
---|---|---|
algorithm | The hash algorithm and mode to be validated. | string |
revision | The algorithm testing revision to use. | string |
messageLength | The message lengths in bits supported by the IUT. Minimum allowed is 0, maximum allowed is 65535. | domain |
The ACVP server provides test vectors to the ACVP client, which are then processed and returned to the ACVP server for validation. A typical ACVP validation test session would require multiple test vector sets to be downloaded and processed by the ACVP client. Each test vector set represents an individual algorithm defined during the capability exchange. This section describes the JSON schema for a test vector set used with Secure Hash Algorithm (SHA) algorithms.¶
The test vector set JSON schema is a multi-level hierarchy that contains meta data for the entire vector set as well as individual test vectors to be processed by the ACVP client. The following table describes the JSON elements at the top level of the hierarchy.¶
JSON Values | Description | JSON Type |
---|---|---|
acvVersion | Protocol version identifier | string |
vsId | Unique numeric vector set identifier | integer |
algorithm | Algorithm defined in the capability exchange | string |
mode | Mode defined in the capability exchange | string |
revision | Protocol test revision selected | string |
testGroups | Array of test groups containing test data, see Section 8.1 | array |
An example of this would look like this¶
Test vector sets MUST contain one or many test groups, each sharing similar properties. For instance, all test vectors that use the same testType would be grouped together. The testGroups element at the top level of the test vector JSON object SHALL be the array of test groups. The Test Group JSON object MUST contain meta-data that applies to all test cases within the group. The following table describes the JSON elements that MAY appear from the server in the Test Group JSON object:¶
JSON Value | Description | JSON type |
---|---|---|
tgId | Numeric identifier for the test group, unique across the entire vector set | integer |
testType | Test category type (AFT or MCT). See Section 6 for more information | string |
tests | Array of individual test case JSON objects, which are defined in Section 8.2 | array of testCase objects |
All properties described in the previous table MUST appear in the prompt file from the server for every testGroup object.¶
Each test group SHALL contain an array of one or more test cases. Each test case is a JSON object that represents a single case to be processed by the ACVP client. The following table describes the JSON elements for each test case.¶
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 MCT seed | integer |
msg | Value of the message or MCT seed in big-endian hex | integer |
All properties described in the previous table MUST appear in the prompt file from the server for every testCase object.¶
After the ACVP client downloads and processes a vector set, it SHALL send the response vectors back to the ACVP server within the alloted timeframe. The following table describes the JSON object that represents a vector set response.¶
JSON Value | Description | JSON type |
---|---|---|
acvVersion | Protocol version identifier | string |
vsId | Unique numeric identifier for the vector set | integer |
testResults | Array of JSON objects that represent each test vector result, which uses the same JSON schema as defined in Section 8.2 | array of testGroup objects |
The testGroup Response section is used to organize the ACVP client response in a similar manner to how it receives vectors. Several algorithms SHALL require the client to send back group level properties in its response. This structure helps accommodate that.¶
JSON Value | Description | JSON type |
---|---|---|
tgId | The test group identifier | integer |
tests | The tests associated to the group specified in tgId | array of testCase objects |
Each test case is a JSON object that represents a single test object to be processed by the ACVP client.¶
The following table describes the JSON elements for each test case object.¶
JSON Value | Description | JSON type |
---|---|---|
tcId | Numeric identifier for the test case, unique across the entire vector set. | integer |
md | The IUT's message digest response to an AFT test | string (hex) |
resultsArray | Array of JSON objects that represent each iteration of an MCT. Each iteration will contain the msg and md | array of objects containing the md |
Note: The tcId MUST be included in every test case object sent between the client and the server.¶
There are no additional security considerations outside of those outlined in the ACVP document.¶
This document does not require any action by IANA.¶
The following is a example JSON object advertising support for SHA-256.¶
The following is an example JSON object for secure hash test vectors sent from the ACVP server to the crypto module. Note the single bit message is represented as "80". This complies with SHA1 and SHA2 being big-endian by nature. All hex strings associated with SHA1 and SHA2 will be big-endian.¶
The following is another example JSON object for secure hash test vectors sent from the ACVP server to the crypto module.¶
The following is an example JSON object for secure hash Monte Carlo test vectors sent from the ACVP server to the crypto module.¶
The following is a example JSON object for secure hash test results sent from the crypto module to the ACVP server.¶
The following is a example JSON object for secure hash Monte Carlo test results sent from the crypto module to the ACVP server. Reduced to 2 iterations for brevity.¶