-
Notifications
You must be signed in to change notification settings - Fork 168
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
Support OpenSSL 3 FIPS #603
Comments
I'll add what we learned on our side in more detail. Downstream bug report: https://bugzilla.redhat.com/show_bug.cgi?id=2170105 Some words and what they refer to throughout this report: Problem description: Reproducer on RHEL 9:
Actual results:
Expected results: No errors This was observed with OpenSSL versions 3.0.1 through 3.0.7 and with rubygem-openssl 2.2.1, 3.0.0, 3.1.0 up to the more recent commits on the master branch of this repo: 9ea934a . The problem is that I have distilled Ruby's code flow into a simple C example to illustrate better what is happening. See the comment on the downstream ticket: https://bugzilla.redhat.com/show_bug.cgi?id=2170105#c7 I found that initializing
I'll emphasize that it is important that I have also used system's python (python 3.9), where loading pem key simply works:
They seem to initialize OpenSSL similarly to Ruby From inspecting ltraces of both languages I noticed that python uses EVP_MD* function family from openssl unlike rubygem-openssl, where OSSL_DECODER* function family is used. Traces for python and Ruby: To me it seems something isn't being loaded properly in Ruby when system is in FIPS mode as calling |
Note that now the maintainers can try the FIPS mode enabled environment on the RHEL 9.1 server in the Ruby project. For the steps, see #601 (comment) . I was able to reproduce this issue ticket' error on the environment. |
I noted the the mentioned RPM package "python3-cryptography" is not available on Fedora: https://src.fedoraproject.org/rpms/python3-cryptography . So, just installing the PyPI package "cryptography" directly is convenient. The GitHub is here.
|
We can reproduce this issue on GitHub Actions after this PR #608 is merged! |
I am not sure you are right in this. I was able to find this via both the it is actually coming from this repo: https://src.fedoraproject.org/rpms/python-cryptography |
@jackorp You are right. Thanks for the info. I also can see the installed package on my environment. What was I seeing at that time... Sorry.
It seems that the |
I am debugging this issue on Fedora 37. Let me share my current status. I think my small program: fips_mode command is helpful for you to check if you are running the correct FIPS mode on your environment. You can run like this.
I am debugging this issue with GDB on the commits in the #608 on Fedora. There is an issue gdb with
Some of the content might repeat what jarkorp said. openssl/ext/openssl/ossl_pkey.c Lines 215 to 218 in a14055a
Here is the backtrace.
In the process, the When the openssl/ext/openssl/ossl_pkey.c Lines 144 to 145 in a14055a
|
I opened the issue ticket openssl/openssl#20657 on the OpenSSL project to ask a queston. |
In the issue ticket on the openssl/openssl above, the root cause was found. In short summary, the By applying this patch, the unit test result in the FIPS mode changes in a better way from https://github.com/junaruga/openssl/actions/runs/4681990779/jobs/8295272065
to https://github.com/junaruga/openssl/actions/runs/4690199157/jobs/8312977212
. I am still working to fix other issues on the FIPS mode. Seeing the code below in the test, it seems that the FIPS mode case was not tested before. And I would like to remove this logic to run the unit tests in the FIPS mode. Lines 5 to 8 in 6182ac0
|
I changed this issue ticket's title to the "Support OpenSSL 3 FIPS mode" to manage all the issues on this one ticket. I think it's easy for people to track. This ticket's goal is to pass all the unit tests on the OpenSSL 3.0 FIPS mode on GitHub Actions CI. My current focus is to fix the 2 test failures
|
@junaruga you still working on this? Need help? |
@cwjenkins Yes, I am still working on this. And yes! Thank you for your help. For the original issue on this ticket, I plan to rebase the PR #615 as a workaround of this issue and merge it to the master branch. If you want to see it soon, I can work on it as a higher priority. The root cause was found on the OpenSSL side. Here is the issue ticket openssl/openssl#20657 Folks are working on it.
In the other issues, I want to fix the issue that I wrote on the comment above, #603 (comment). The ticket is openssl/openssl#20758. They are working on it. I don't have a time to debug it by myself (yet). Right now my focus is to add checks for the compiler warnings on GitHub Actions. Here is the ticket, #626. Because I made a bug #620 related to compiler warning. I think checking compiler warnings by So, I need your help for any things related to this issue. Please let me know if you take a task. Thanks! |
By the way, I created a document of how to debug Ruby OpenSSL bindings with upstream OpenSSL FIPS mode and, OpenSSL FIPS mode itself (without Ruby). I wish that that I add some of the contents to the |
Note I merged the #615, and updated this ticket's first comment. |
@cwjenkins Yes I like it! Thank you! As a note, now I am rethinking about how to check the compiler warnings on CI. Because in the way with the However, the way with
My email is "jaruga AT ruby-lang.org" in this case. I normally would like open communication as a way to scale. But you can comment on #628 or email me if you have questions. I have to do other work other than ruby/openssl for a few days or 1 week from now. |
since this is supposed to track the FIPS mode related issues, I've added one with issue on creation of RSA key pair: #643 |
@tarnowsc thanks! I updated the first comment on this ticket with your issue link. |
As you may know the compiler warnings checks are added to the master branch. So, my focus is to debug the issue openssl/openssl#20758 to fix. @cwjenkins you can help it for that too when you have spare time.
I finished the other work above, came back slightly.. |
Thanks @junaruga. I'll try finding some time this week. |
@junaruga took a look this weekend and noticed with fips/base providers on 3.1.0 the key is NULL. Looks like the provider lookup has been refactored so can compare on the changes against 3.0.x to see what exactly produced a mangled key. |
@cwjenkins That's a nice finding! Thanks! I plan to check the issue with the openssl/openssl master branch. By the way, I will take a vacation from tomorrow 5th to 12th July. Then I will come back. |
@cwjenkins I executed your Dockerfile with OpenSSL 3.0.8 and 3.1.0 with x86_64 image as my local machine is x86_64. And I was able to see the difference of both results as you reported.
I tested this on OpenSSL latest master branch, and reported it at openssl/openssl#20758 (comment). Note I updated the README for the instructions of my reproducing program by adding the |
@junaruga thanks. The NULL pkey was from The segfault was in I did notice the
|
Right now the The logic is And one person said "OpenSSL 3.0 has banned EdDSA by policy, so a technical fix isn't required." in a openssl ticket. So perhaps this issue in OpenSSL 3.0 FIPS case may be not fixed. And perhaps we may need to implement the error check by ourselves.
What's the value of The following command only works when the library directory of the openssl is "lib" such as "/path/to/openssl_dir/lib"
If your openssl's library directory name is lib64 (default library name), maybe like this.
Then if you are compiling in Linux environment, you can check the link like this.
|
Note I opened another issue ticket openssl/openssl#21493 with x25519 pem file, the case is convenient to debug and fix the issue as we can reproducer the issue on OpenSSL master branch. |
Note after openssl/openssl#21519 will be merged, I think we can work to add the unit tests related to the issues to the FIPS cases in this repository. |
First, I added OpenSSL head non-FIPS and FIPS cases to the CI to run the unit tests on the fixed version of the OpenSSL by the #658. I managed to pass the pending tests in the fixed version of the OpenSSL (openssl-head) cases. Here is my work on my forked repository. The last 4 commits are for this topic. |
I sent the PR #664, to pass the pending tests in FIPS in the fixed versions of the OpenSSL. |
I sent the PR #669 that is to implement a workaround to avoid the issue openssl/openssl#21519, and it's a rework of the #664. I believe the workaround is better than pending the related tests. |
I am debugging the test failures in FIPS in the |
As an experiment, I would share the status update about this ticket here once in around 3 months, or when I achieve something. During the term from July 2023 to September, 2023, we finished the task 4 and 5 written in the first comment.
|
I would share the status update about this ticket. During the term from October 2023 to December 2023, we finished the task 6 below. |
I would share the status update about this ticket. During the term from January 2024 to March 2024, we finished the task 7 below. |
I would share the status update about this ticket. During the term from April 2024 to June 2024, there is no progress for this ticket. I couldn't have time at all for this FIPS task, because I was busy for another task in my company. |
I would share the status update about this ticket. During the term from July 2024 to September 2024, we finished the task 8 and 9 below. |
For FIPS packages for OSs that ship OpenSSL 3+ to work properly, the changes made as part of ruby/openssl#603 is required. This is available in v3.2.0 of the OpenSSL gem. Installing it after installing Ruby will cause Ruby to use it instead of the default OpenSSL gem version. Signed-off-by: Balasankar 'Balu' C <[email protected]>
Note below is a list of failing or error test files in FIPS. The fist column means a number of the failing or error tests in the test file. Feel free to fix the files!
|
I would like to use this ticket to manage all the issues related to OpenSSL 3 FIPS. The goal of this ticket is to pass all the unit tests with the OpenSSL 3.2, 3.1 and 3.0 FIPS cases on the CI.
FIPS related issues/pull-requests
I update the list regularly. The issues are sorted by newest first.
test/openssl/test_pkey_ec.rb
. test_pkey_ec.rb test failures in OpenSSL FIPS #671 fixed by test/openssl/test_pkey_ec.rb: refactor tests for EC.builtin_curves #675, and Fix test_pkey_ec.rb on FIPS. #681.OpenSSL::PKey.read
andtest/openssl/test_pkey.rb
. The issue was fixed by the the workaround ossl_pkey.c: Workaround: Decode with non-zero selections. #669.OpenSSL::PKey.read
. Applied the workaround PR Fix OpenSSL::PKey.read that cannot parse PKey in the FIPS mode. #615 to avoid the OpenSSL issue OSSL_DECODER_CTX_set_selection doesn't apply the selection value properly openssl/openssl#20657.OpenSSL.fips_mode
in OpenSSL 3.0+. The issue: OpenSSL 3: OpenSSL.fips_mode returns false in FIPS enabled environment #605, the PR: Implement FIPS functions, adding OpenSSL FIPS mode case on CI. #608Remaining tasks to the goal
Fix other test files
test/**/test_*.rb
to pass in CI. The fixed test files 18/33.Documents
Original comment
I deleted to simplify this issue ticket. I think we don't need the original comment's information any more.
The text was updated successfully, but these errors were encountered: