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

Expose BN_set_flags as a no-op #2021

Merged
merged 2 commits into from
Dec 2, 2024
Merged

Conversation

samuel40791765
Copy link
Contributor

Issues:

Addresses CryptoAlg-1477

Description of changes:

We're currently leaning towards continuing to not support BN_FLG_CONSTTIME. It's a problematic flag that's poorly documented and could lead to constant time violations if we aren't careful.
We can expose BN_set_flags as a no-op however. Ruby has logic to get around the BN_FLG_CONSTTIME flag, but not around BN_set/get_flags. Exposing the set symbol would allow for a cleaner patch/build.

Call-outs:

N/A

Testing:

N/A

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.

@samuel40791765 samuel40791765 requested a review from a team as a code owner November 29, 2024 00:35
@codecov-commenter
Copy link

codecov-commenter commented Nov 29, 2024

Codecov Report

Attention: Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Project coverage is 78.68%. Comparing base (5982853) to head (dba9552).

Files with missing lines Patch % Lines
crypto/fipsmodule/bn/bn.c 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2021      +/-   ##
==========================================
- Coverage   78.69%   78.68%   -0.01%     
==========================================
  Files         598      598              
  Lines      103326   103327       +1     
  Branches    14687    14687              
==========================================
- Hits        81310    81307       -3     
- Misses      21366    21369       +3     
- Partials      650      651       +1     

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

@@ -1066,7 +1071,6 @@ OPENSSL_EXPORT unsigned BN_num_bits_word(BN_ULONG l);
#define BN_FLG_STATIC_DATA 0x02

#ifdef AWS_LC_INTERNAL_IGNORE_BN_SET_FLAGS
Copy link
Contributor

Choose a reason for hiding this comment

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

We should also delete this #ifdef as we can just add a -DBN_FLG_CONSTTIME=0x04 at build time OR properly #ifdef the upstream packages (OpenSSH comes to mind).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agree 100%

@samuel40791765 samuel40791765 merged commit b3f452d into aws:main Dec 2, 2024
116 of 119 checks passed
@samuel40791765 samuel40791765 deleted the bn-set-flags branch December 2, 2024 20:01
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.

5 participants