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

Implement FIPS functions, adding OpenSSL FIPS mode case on CI. #608

Merged
merged 2 commits into from
May 15, 2023

Commits on Apr 12, 2023

  1. CI: Add OpenSSL FIPS mode case.

    test/openssl/fixtures/ssl/openssl_fips.cnf.tmpl:
    
    I referred to the following document for the openssl config file for FIPS mode.
    <https://www.openssl.org/docs/manmaster/man7/fips_module.html>
    - Making all applications use the FIPS module by default
    
    It seems that the `.include` syntax only requires the absolute path.
    So, the placeholder OPENSSL_DIR in the template file is replaced with the
    actual OpenSSL directory.
    
    .github/workflows/test.yml:
    
    The `TEST_RUBY_OPENSSL_FIPS_ENABLED` environment variable is set
    in the FIPS mode CI case. It can be used in the unit tests.
    junaruga committed Apr 12, 2023
    Configuration menu
    Copy the full SHA
    3142d18 View commit details
    Browse the repository at this point in the history
  2. Implement FIPS functions on OpenSSL 3.

    This commit is to implement the `OpenSSL::OPENSSL_FIPS`, `ossl_fips_mode_get`
    and `ossl_fips_mode_set` to pass the test `test/openssl/test_fips.rb`.
    
    It seems that the `OPENSSL_FIPS` macro is not used on the FIPS mode case any
    more, and some FIPS related APIs also were removed in OpenSSL 3.
    
    See the document <https://github.com/openssl/openssl/blob/master/doc/man7/migration_guide.pod#removed-fips_mode-and-fips_mode_set>
    the section OPENSSL 3.0 > Main Changes from OpenSSL 1.1.1 >
    Other notable deprecations and changes - Removed FIPS_mode() and FIPS_mode_set() .
    
    The `OpenSSL::OPENSSL_FIPS` returns always true in OpenSSL 3 because the used
    functions `EVP_default_properties_enable_fips` and `EVP_default_properties_is_fips_enabled`
    works with the OpenSSL installed without FIPS option.
    
    The `TEST_RUBY_OPENSSL_FIPS_ENABLED` is set on the FIPS mode case on the CI.
    Because I want to test that the `OpenSSL.fips_mode` returns the `true` or
    'false' surely in the CI. You can test the FIPS mode case by setting
    `TEST_RUBY_OPENSSL_FIPS_ENABLED` on local too. Right now I don't find a better
    way to get the status of the FIPS mode enabled or disabled for this purpose. I
    am afraid of the possibility that the FIPS test case is unintentionally skipped.
    
    I also replaced the ambiguous "returns" with "should return" in the tests.
    junaruga committed Apr 12, 2023
    Configuration menu
    Copy the full SHA
    285baec View commit details
    Browse the repository at this point in the history