Adding test vectors for VMAC.
The main purpose is to test / explore the robustness of the VMAC implementation such as the one in security/util (e.g. CL 254384251) as well as finding potential weaknesses if VMAC is used in an unconventional way. VMAC is widely used in Google, but so far there is no list of test vector that check corner cases, such as carry propagation. VMAC has a number of odd features, which are tested with these vectors: - The nonce is at most 127-bit long. This is necessary, because VMAC uses an AES-block cipher. Inputs with the most significant bit set are used for the key derivation. The same inputs must not be used for encrypting the nonce. - VMAC requires 128-bit integer arithmetic for some of its temporary results. This leaves a lot of opportunities for overflow and carry errors. The test vectors contain a fairly large number of edge cases to check for such problems. - VMAC lacks "plaintext awareness". A valid VMAC does not prove that the sender knows the plaintext. An example is this: if the VMAC is computed over eg. tag = VMAC(msg || password) then it would be possible for the sender to choose msg, such that is valid for any password. NOKEYCHECK=True PiperOrigin-RevId: 255599337 GitOrigin-RevId: 22d336b66c370dae251f1fa119cf952035f9c8d5
This commit is contained in:
@@ -0,0 +1,118 @@
|
||||
{
|
||||
"type": "object",
|
||||
"definitions": {
|
||||
"MacWithIvTestGroup": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"type": {
|
||||
"enum": [
|
||||
"MacWithIvTest"
|
||||
]
|
||||
},
|
||||
"ivSize": {
|
||||
"type": "integer",
|
||||
"description": "the IV size in bits"
|
||||
},
|
||||
"keySize": {
|
||||
"type": "integer",
|
||||
"description": "the key size in bits"
|
||||
},
|
||||
"tagSize": {
|
||||
"type": "integer",
|
||||
"description": "the expected size of the tag in bits"
|
||||
},
|
||||
"tests": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/MacWithIvTestVector"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"MacWithIvTestVector": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"tcId": {
|
||||
"type": "integer",
|
||||
"description": "Identifier of the test case"
|
||||
},
|
||||
"comment": {
|
||||
"type": "string",
|
||||
"description": "A brief description of the test case"
|
||||
},
|
||||
"key": {
|
||||
"type": "string",
|
||||
"format": "HexBytes",
|
||||
"description": "the key"
|
||||
},
|
||||
"iv": {
|
||||
"type": "string",
|
||||
"format": "HexBytes",
|
||||
"description": "the initailisation vector"
|
||||
},
|
||||
"msg": {
|
||||
"type": "string",
|
||||
"format": "HexBytes",
|
||||
"description": "the plaintext"
|
||||
},
|
||||
"tag": {
|
||||
"type": "string",
|
||||
"format": "HexBytes",
|
||||
"description": "the authentication tag"
|
||||
},
|
||||
"result": {
|
||||
"type": "string",
|
||||
"description": "Test result",
|
||||
"enum": [
|
||||
"valid",
|
||||
"invalid",
|
||||
"acceptable"
|
||||
]
|
||||
},
|
||||
"flags": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": "A list of flags"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
"algorithm": {
|
||||
"type": "string",
|
||||
"description": "the primitive tested in the test file"
|
||||
},
|
||||
"generatorVersion": {
|
||||
"type": "string",
|
||||
"description": "the version of the test vectors."
|
||||
},
|
||||
"header": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": "additional documentation"
|
||||
},
|
||||
"notes": {
|
||||
"type": "object",
|
||||
"description": "a description of the labels used in the test vectors"
|
||||
},
|
||||
"numberOfTests": {
|
||||
"type": "integer",
|
||||
"description": "the number of test vectors in this test"
|
||||
},
|
||||
"schema": {
|
||||
"enum": [
|
||||
"mac_with_iv_test_schema.json"
|
||||
]
|
||||
},
|
||||
"testGroups": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/MacWithIvTestGroup"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user