openssl icon indicating copy to clipboard operation
openssl copied to clipboard

Add EDDSA FIPS self tests.

Open slontis opened this issue 2 years ago • 17 comments

See FIPS 140-3 IG Section 10.3.A Part 11 Indicates ECDSA requires a sign and verify test. Note 11 states that HashEdDSA is not required to be tested if PureEdDSA is tested. Note 12 indicates that both ED25519 and X448 need to be tested.

Since ED uses the oneshot interface, additional API's needed to be exposed to the FIPS provider using #ifdef FIPS_MODULE.

Changed ED25518 and ED448 to use fips=true in the FIPS provider. Updated documentation for provider lists for EDDSA.

Checklist
  • [x] documentation is added or updated
  • [x] tests are added or updated

slontis avatar Sep 15 '23 06:09 slontis

As this is FIPS related it is probably not required for OpenSSL 3.2 (unless 3.2 is going to become FIPS validated).

slontis avatar Sep 15 '23 08:09 slontis

OMC: should we including this in the 3.1.x validation?

paulidale avatar Sep 15 '23 09:09 paulidale

IMO: this is a working group discussion. I'm in favour of 3.1 getting this. I'm unsure about 3.0.

paulidale avatar Sep 27 '23 06:09 paulidale

There is a conflict in this PR.

Also, there is a hold on this PR, but the question seems to be about 3.1. Is this going into master, and should it be there for the beta?

mattcaswell avatar Oct 25 '23 08:10 mattcaswell

I think we could give an post-beta exception if it would be approved to go in 3.1 by OMC.

Otherwise it can as well wait for 3.3.

t8m avatar Oct 25 '23 08:10 t8m

This is a feature addition - this is not in the fips provider and it is being added. It is not a simple addition of a "test".

As such it has to wait for 3.3.

t-j-h avatar Oct 25 '23 09:10 t-j-h

I think this is a question for WG.

The 140-3 submission is long delayed and we've still got a possibility of including EdDSA. We know that EdDSA works, so it's really just changing "no" to "yes" in a few places and adding this test.

The 140-3 submission requires other changes in addition.

paulidale avatar Oct 25 '23 10:10 paulidale

OMC: This can go into master branch. Not in 3.1.

t8m avatar Nov 15 '23 09:11 t8m

@slontis please rebase

t8m avatar Nov 16 '23 17:11 t8m

rebased

slontis avatar Nov 17 '23 09:11 slontis

CI is relevant

t8m avatar Nov 20 '23 09:11 t8m

What about, instead of using the DigestSign API for the self test, adding the EDDSA support to the EVP_PKEY_sign()/verify()?

t8m avatar Nov 20 '23 09:11 t8m

rebased again

slontis avatar Feb 26 '24 04:02 slontis

It looks like the tests fail here - so I will fix it..

slontis avatar Feb 26 '24 05:02 slontis

Had to do a slight change since a failure in the entropy setup was not being reported as a failure by the self test callback (since it was outside the onstart()/onend() callbacks.

slontis avatar Feb 26 '24 07:02 slontis

This PR is in a state where it requires action by @openssl/otc but the last update was 30 days ago

openssl-machine avatar Mar 28 '24 00:03 openssl-machine

This PR is in a state where it requires action by @openssl/otc but the last update was 61 days ago

openssl-machine avatar Apr 28 '24 00:04 openssl-machine

This PR is in a state where it requires action by @openssl/otc but the last update was 30 days ago

openssl-machine avatar Jun 01 '24 00:06 openssl-machine

This PR is in a state where it requires action by @openssl/otc but the last update was 61 days ago

openssl-machine avatar Jul 02 '24 00:07 openssl-machine

I'd wait with this after #23416 is merged and use the newly added signmessage/verifymessage operations instead of using digestsign/verify.

t8m avatar Jul 15 '24 15:07 t8m

I'd wait with this after #23416 is merged and use the newly added signmessage/verifymessage operations instead of using digestsign/verify.

I think ED got taken out of the PR, it will be another PR - but yes we are on the same page.

slontis avatar Jul 15 '24 23:07 slontis

@t8m - Can we merge this rather than waiting for the API / implementations to become present/finalized. i.e. This is an internal detail that we can modify later.

slontis avatar Jul 30 '24 05:07 slontis

I am not really fond of merging this in this form. It requires adding a lot of FIPS_MODULE snippets into m_sigver.c that would have to be reverted. The signing API for EdDSA will be merged soon hopefully.

t8m avatar Jul 31 '24 14:07 t8m

This pull request is ready to merge

openssl-machine avatar Aug 14 '24 10:08 openssl-machine

Merged to the master branch. Thank you for your contribution.

t8m avatar Aug 14 '24 14:08 t8m

Aargh, how is it possible that the KAT for EdDSA fails on master after merging this?

@slontis Can you please look at this?

t8m avatar Aug 14 '24 14:08 t8m

Being investigated.

One of the indicator changes I made causes this failure. In #25032, I put a limit on EdDSA to not allow a digest to be directly verified and instead insist on the entire message being passed through. @slontis and I think that that was a mistake and that restriction applies, instead, to ECDSA but we're not able to locate the paragraph of text in the standard that mandated this to confirm.

If correct, it's another weirdness. Not allowing external digests makes sense for EdDSA where the allowable digest is fixed. It makes a lot less sense for ECDSA where any digest is permitted.

paulidale avatar Aug 14 '24 22:08 paulidale