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

Skip PKCS7 with indefinite length test in AWS-LC #871

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

samuel40791765
Copy link
Contributor

Extension from this original thread regarding the PKCS7 test we skipped in AWS-LC: #855 (comment)

We've been doing more investigations against the PKCS7 issue like we promised. It turns out @rhenium was right in that this was an issue with "decoding" indefinite BER rather than "encoding". ASN1_TFLG_NDEF is in charge of encoding indefinite BER for PKCS7 in OpenSSL, but that's only used in the "PKCS7 streaming APIs" and is not used by default. The PKCS7 test file has indefinite BER within it, which AWS-LC was not properly decoding.

AWS-LC had been decoding the indefinite BER to an unusable output. Instead of allowing an invalid state to be parsed, we've decided to revert aws/aws-lc@2a72226 (with aws/aws-lc@1a1eb18) until we've actually fixed our parsing for indefinite BER. The Ruby PKCS7 test will bail earlier with the new changes, so we thought it'd be best for us to help you update to minimize churn.

Changes:

  1. We'll be looking to fix our parsing for indefinite BER constructed strings in AWS-LC soon, so I've marked the test as pend for now and removed the AWS-LC specific logic at the end.
  2. I've added an assertion to verify that OpenSSL::PKCS7.verify behaves correctly before doing content comparisons. I noticed this was failing in AWS-LC and will be fixed with Add support for verifying PKCS7 signed attributes aws/aws-lc#2264. This shouldn't effect OpenSSL/LibreSSL builds and should improve the test.

@@ -376,14 +378,9 @@ def test_split_content
END
pki_msg = OpenSSL::PKCS7.new(pki_message_pem)
store = OpenSSL::X509::Store.new
pki_msg.verify(nil, store, nil, OpenSSL::PKCS7::NOVERIFY)
assert_equal(pki_msg.verify(nil, store, nil, OpenSSL::PKCS7::NOVERIFY), true)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
assert_equal(pki_msg.verify(nil, store, nil, OpenSSL::PKCS7::NOVERIFY), true)
assert_equal(true, pki_msg.verify(nil, store, nil, OpenSSL::PKCS7::NOVERIFY))

test-unit's assert_equal takes the expected value as the first argument.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed!

AWS-LC had been decoding the indefinite BER to an unusable output. We
should skip the test until indefinite BER decoding in AWS-LC is
properly fixed.

Changes:
1. AWS-LC will be looking to fix the parsing for indefinite BER
constructed strings in AWS-LC soon, so I've marked the test as `pend`
for now and removed the AWS-LC specific logic at the end.
2. I've added an assertion to verify that `OpenSSL::PKCS7.verify`
behaves correctly before doing content comparisons. I noticed this was
failing initially in AWS-LC, but that will be fixed soon as well. This
shouldn't effect OpenSSL/LibreSSL builds and should improve the test.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants