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

Improve build and fix X509 test failures for Ruby #1887

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

Conversation

samuel40791765
Copy link
Contributor

Issues:

Resolves CryptoAlg-2701

Description of changes:

  1. bignum_to_string is called when trying to print out the X509 Extension value. Initially I thought the value wasn't being set correctly, but it turns out that we were printing the value in hex form, rather than decimal (which OpenSSL does and Ruby expects). AWS-LC prints the hex value if the value is more than 32 bits, while OpenSSL has a much more lax restriction at 128 bits. Tweaking this to align with OpenSSL gets past the test for test_x509crl.rb. Tweaking the value to align with OpenSSL gets past the test.

  2. Great news is I don't think we need to do anything for the test failure in test_x509req. This was a testing mistake on Ruby's end, documented in this commit: ruby/ruby@6b12013
    Only version 1 is available for CSRs and Ruby attempts to set an invalid version in its tests. OpenSSL 3.3 disallows this behavior now and Ruby has removed the test in it's mainline branch. We can brush up the patch to account for this and skip the test with AWS-LC.

  3. I also took the chance to add back some of the defines Ruby depends on as no-ops. The X509 defines aren't actually used in neither OpenSSL or AWS-LC as found by this commit: 496838a

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.

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.46%. Comparing base (36e0307) to head (3e9f334).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1887      +/-   ##
==========================================
- Coverage   78.50%   78.46%   -0.04%     
==========================================
  Files         585      585              
  Lines       99516    99516              
  Branches    14244    14243       -1     
==========================================
- Hits        78122    78090      -32     
- Misses      20759    20790      +31     
- Partials      635      636       +1     

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

Comment on lines 3196 to 3197
"0x0123456789012345678901234567890123456789",
"-0x0123456789012345678901234567890123456789",
Copy link
Contributor

Choose a reason for hiding this comment

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

minor nit: you should only need 32 hex digits to hit your threshold of 2^128

Copy link
Contributor Author

Choose a reason for hiding this comment

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

True, I just wanted the numbers to align. Will change

Comment on lines +65 to +66
// OCSP_NOSIGS does nothing. In OpenSSL, this skips signature verification in
// |OCSP_basic_verify| and |OCSP_request_verify|.
Copy link
Contributor

Choose a reason for hiding this comment

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

so we'll always check the signatures, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, the intention was to not do this until it's specifically asked for. There's not really a scenario where the signature shouldn't be verified.

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.

3 participants