Skip to content

ECDSA/sigVer/sigGen wrong XOF length used with SHAKE-128/SHAKE-256 #301

@sandor-szendro-i4p

Description

@sandor-szendro-i4p

environment
Demo

testSessionId
462560

vsId
2006870

Algorithm registration
"algorithm":"ECDSA",
"mode":"sigVer",
"revision":"FIPS186-5",
"componentTest":false,
"capabilities":[
{
"curve":[
"P-224",
"P-256",
"P-384",
"P-521"
],
"hashAlg":[
"SHA2-224",
"SHA2-256",
"SHA2-384",
"SHA2-512",
"SHA3-224",
"SHA3-256",
"SHA3-384",
"SHA3-512",
"SHAKE-128",
"SHAKE-256"
]
}

Endpoint in which the error is experienced
https://demo.acvts.nist.gov/acvp/v1/testSessions GET

Expected behavior
For ECDSA/sigVer when hashAlg is SHAKE-128 / SHAKE-256 the expected results returned by ACVP server is calculated with the XOF length of 16 / 32 bytes instead of 32 and 64 bytes.
This also applies to ECDSA/sigGen as well.

For example :
"tgId": 9,
"testType": "AFT",
"componentTest": false,
"curve": "P-224",
"hashAlg": "SHAKE-128",

{
"tcId": 62,
"message": "CF9D6EA7D7B7703552B3B37F3DBD8BAF29CE59F5B2CCFD3ECC41AF14570CFA1DC48252BC823A9C2581253B38CAB2A0C79617F0DC8A668E225AF0E274DCF15A8EEB7E31DE8521C61AAAE35C41EF572FAEB58B06B29BE59BF560D8DE48544608DD672B8FFA6056539CC98CC2265CEFFB383937BBE5CFC2B97A789234D9BE90A66C",
"qx": "6BC5DF751BA4B84F003BE8B5D3040AEE25AC5B7160EE9BA478484627",
"qy": "E99462FA46ABC8BA83CBECDABC9C52BD383DB911D17EE8F28CC4FD2B",
"r": "8D97A315D570CE28C76C65A970E8CAAEB90DD479F31B3AFF7595BBE9",
"s": "F62FB523CDF04994F72869B8284F0579A83259048C8B9F4348891633"
},

The expectation says this signature is valid.
This vector will only be valid with the XOF len = 16 bytes, but XOF len of 32 bytes should be used.

Additional context
According to FIPS 186-6.4 ECDSA Digital Signature Generation and Verification
When SHAKE128 or SHAKE256 is used as an XOF in Sections 6.4.1 and 6.4.2 below, its output
length shall be 256 or 512 bits, respectively.
It seem like on the ACVP Server 16 / 32 bytes are used.
This issue seems similar to #277

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions