Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove ENABLE_DILITHIUM flag #2082

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open

Remove ENABLE_DILITHIUM flag #2082

wants to merge 11 commits into from

Conversation

jakemas
Copy link
Contributor

@jakemas jakemas commented Dec 26, 2024

Need to merge #2072 first

Issues:

It's time. (also we need to do this to add ML-DSA to the FIPS module)

Description of changes:

  • Removed the enable_dilithium flag
  • Added a description to APIs to indicate the external APIs may still be subject to change as the standards space develops. (We don't envision them changing, but they are extremely new).

Call-outs:

Removing the flag has little consequence -- other than it makes the APIs we expose in include/openssl/evp.h that much more "final". We should consider how much we like them before we commit to them. We made a point to refer to asymmetric keypairs as public and private keys, rather than public and secret keys. However, we haven't always been consistant with this, so there is a mix of both in the library. Users will find the consistency between EVP_PKEY_pqdsa_new_raw_secret_key and EVP_PKEY_kem_new_raw_secret_key more satisfying.

However, after internal discussions, we'd also like to change the name of EVP_PKEY_kem_new_raw_public_key and EVP_PKEY_kem_new_raw_secret_key to EVP_PKEY_kem_new_raw_encapsulation_key and EVP_PKEY_kem_new_raw_decapsulation_key to match the names within FIPS 203. Thus, we should stick with secret.

We did consider the use of an experimental flag (by using the OPENSSL_DEPRECATED alias), but, this seems a little over the top. If there are any discrepancy with the API down the line, we will make a change as we are proposing with the kem APIs above. Alternatively, we could place the EVP APIs in include/openssl/experimental/. The arguments of EVP_PKEY_pqdsa_new_raw_secret_key, EVP_PKEY_pqdsa_new_raw_public_key, and EVP_PKEY_CTX_pqdsa_set_params are stable and consistant with KEM and EC variants (see EVP_PKEY_CTX_kem_set_params, EVP_PKEY_CTX_set_dh_paramgen_prime_len, and EVP_PKEY_CTX_set_ec_param_enc, EVP_PKEY_new_raw_private_key, EVP_PKEY_new_raw_public_key, EVP_PKEY_kem_new_raw_public_key).

Testing:

To celebrate the removal of this flag, enjoy this haiku:

feature flag removed,
post-quantum strength stands alone,
simpler code prevails.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license.

@jakemas jakemas requested a review from a team as a code owner December 26, 2024 20:15
@codecov-commenter
Copy link

codecov-commenter commented Dec 26, 2024

Codecov Report

Attention: Patch coverage is 97.58713% with 9 lines in your changes missing coverage. Please review.

Project coverage is 78.95%. Comparing base (2329adb) to head (03dcaf5).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...o/dilithium/pqcrystals_dilithium_ref_common/sign.c 95.91% 4 Missing ⚠️
...dilithium/pqcrystals_dilithium_ref_common/reduce.c 70.00% 3 Missing ⚠️
...o/dilithium/pqcrystals_dilithium_ref_common/poly.c 97.91% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2082      +/-   ##
==========================================
+ Coverage   78.75%   78.95%   +0.20%     
==========================================
  Files         598      610      +12     
  Lines      103650   105189    +1539     
  Branches    14719    14905     +186     
==========================================
+ Hits        81625    83050    +1425     
- Misses      21371    21486     +115     
+ Partials      654      653       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

}

/*************************************************
* Name: crypto_sign_open
* Name: ml_dsa_verify_message
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sign_message and verify_message variants are never used (we use sign/verify without the appended message on the end, so that signature sizes are constant)-- should we just remove them from the library?

@@ -300,7 +300,7 @@ int crypto_sign_signature(ml_dsa_params *params,
}

/*************************************************
* Name: crypto_sign
* Name: ml_dsa_sign_message
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sign_message and verify_message variants are never used (we use sign/verify without the appended message on the end, so that signature sizes are constant)-- should we just remove them from the library?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants