- 
                Notifications
    You must be signed in to change notification settings 
- Fork 182
Fix test_ssl.rb in FIPS. #937
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
Conversation
| 
 I debugged more with the openssl/openssl@0b091c8. The error is happening at the following FIPS-specific logic, when the  crypto/dh/dh_key.c The GDB stacktrace is below. The value of the  The  The change was added by the commit openssl/openssl@f11f86f (this part). Do you think this is an expected behavior? Is it better to improve an error handling for this error? | 
| I'm not familiar with the requirements by FIPS 140, but the DH instance would not have the "q" value since  OpenSSL has a special workaround to recover the missing "q" value for known named parameters, which is why other tests that use our defaults in  After all, DH is mostly only kept around for compatibility. I think the failing tests should simply be skipped. | 
| 
 Thank you for your reply. So, in the case with not-known named parameters (not-known ciphers) such as  | 
36eeb49    to
    41d37c2      
    Compare
  
    | @rhenium I rebased this PR. I added the reasons why we skip the tests in FIPS in the commit message. Could you review the PR including the content of the commit message? Thank you! Note that I confirmed the the failures came from the following FIPS specific logic checking the  | 
test_post_connect_check_with_anon_ciphers: test_tmp_dh_callback: test_tmp_dh: DH missing the q value on unknown named parameters (ciphers) is not FIPS-approved, according to the FIPS-186-4 APPENDIX B: Key Pair Generation - B.1.1 Key Pair Generation Using Extra Random Bits, the inputs p, q, and g are required. However, TLS doesn't send q. https://csrc.nist.gov/pubs/fips/186-4/final OpenSSL has a special workaround to recover the missing "q" value for known named parameters, which is the reason why other tests that use the default parameters in `lib/openssl/ssl.rb` are working. Note that the test_post_connect_check_with_anon_ciphers test got the following error on `OpenSSL.debug = true` in FIPS. ``` /home/jaruga/var/git/ruby/openssl/lib/openssl/ssl.rb:551: warning: error on stack: error:0A0C0103:SSL routines:tls_construct_server_key_exchange:internal error ``` test_get_ephemeral_key: kRSA (PKCS1-v1_5 padding) is not allowed in FIPS according to the NIST SP 800-131A Rev. 2 - 6 Key Agreement and Key Transport Using RSA - Table 5: Approval Status for the RSA-based Key Agreement and Key Transport Schemes - PKCS1-v1_5 padding - Disallowed after 2023 https://csrc.nist.gov/pubs/sp/800/131/a/r2/final Note that the test_get_ephemeral_key test got the following error on `OpenSSL.debug = true` in FIPS. ``` test/openssl/test_ssl.rb:2326: warning: error on stack: error:1C8000A8:Provider routines:rsa_encrypt:invalid padding mode ```
41d37c2    to
    ac3559e      
    Compare
  
    There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, thanks!
| Thank you for review! | 
This PR is working in progress. Right now there are 4 test failures below on the OpenSSL FIPS cases.
https://github.com/junaruga/ruby-openssl/actions/runs/17331123966/job/49207153277#step:11:419
I am debugging ruby openssl's latest master branch on the OpenSSL relatively latest commit openssl/openssl@0b091c8.
The cause of the 4 test failures looks similar. For example, the failure of the
test_post_connect_check_with_anon_ciphershappened at theopenssl/test/openssl/test_ssl.rb
Line 2321 in d377a34
SSLSocket#connect).I debugged the issue on gdb like this.
Then I found the following line is a part of the happening error.
https://github.com/openssl/openssl/blob/0b091c88d7d50c542ee393ed31ef5a1b92eea476/ssl/statem/statem.c#L489
This is the backtrace.
I need to debug more. But I assume the error in the connection process just is happening in the FIPS specific part, of course. What do you think about how to fix this failure?