usnistgov / ACVP-Server

A repository tracking releases of NIST's ACVP server. See www.github.com/usnistgov/ACVP for the protocol.
46 stars 16 forks source link

ECDSA with SHAKE128/SHAKE256 using truncated digests #348

Open dghgit opened 1 month ago

dghgit commented 1 month ago

SHAKE variants of the ECDSA signature algorithms appear to be using truncated digests.

We've found we can pass on demo by truncating SHAKE128 to 16 bytes and SHAKE256 to 32 bytes.

FIPS PUB 186-5 Section 6.4 states "An approved hash function or an XOF shall be used during the generation of digital signatures. Approved XOFs are SHAKE128 and SHAKE256, which are specified in FIPS 202. 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."

livebe01 commented 1 month ago

I'm pasting in info from @LikelyLee below (see https://github.com/usnistgov/ACVP-Server/issues/349#issue-2427642629):

  1. SHAKE length used in ECDSA issue: ECDSA with SHAKE as XOF algorithm, the hash output length does not follow the statement in FIPS 186-5 Section 6.4: "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."

Current situation:

Expected behavior:

  1. ECDSA and SHAKE Combination issue: ECDSA siggen / sigver with P-384 and P-521 shall not paired with SHAKE-128 since the output bits are not match the security strength. But now acvp server could request such combination and validate the results.
livebe01 commented 1 month ago

Thanks for reporting this @dghgit and @LikelyLee. The output lengths for SHAKE and ECDSA was something we addressed in a previous release, but we appear to have reverted those changes. We'll get this fixed and deployed in a release as soon as possible.