You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the decision to switch to SHA256 was over FIPS then the other caveat that often gets overlooked is the use of ruby's Digest class.
When ruby is built against openssl the Digest class no longer uses the internal implementation, but rather openssl's old API. When using the old openssl API with FIPS enabled OpenSSL.fips_mode -> true then openssl will panic/abort with... sha256.c(34): OpenSSL internal error, assertion failed: Low level API call to digest SHA256 forbidden in FIPS mode! even though you are using a FIPS supported algorithm. This is due to the fact that the piece of code that has been validated by NIST doesn't leverage the old API.
Using OpenSSL::Digest class however uses the new API (EVP interface) which allows crypto in a FIPS environment.
Note, rhemium has since pulled the openssl bindings from digest in ruby 3 due to the inconvenience it causes ruby/ruby@2e601c2
Potential Solution
# some place in digest_utils
if Module.defined?(:OpenSSL) && OpenSSL.fips_mode
digest_mod = ::OpenSSL::Digest
else
digest_mod = ::Digest
end
# rewrite explicit references to ::Digest
Summary
If the decision to switch to SHA256 was over FIPS then the other caveat that often gets overlooked is the use of ruby's
Digest
class.When ruby is built against openssl the Digest class no longer uses the internal implementation, but rather openssl's old API. When using the old openssl API with FIPS enabled
OpenSSL.fips_mode -> true
then openssl will panic/abort with...sha256.c(34): OpenSSL internal error, assertion failed: Low level API call to digest SHA256 forbidden in FIPS mode!
even though you are using a FIPS supported algorithm. This is due to the fact that the piece of code that has been validated by NIST doesn't leverage the old API.Using
OpenSSL::Digest
class however uses the new API (EVP interface) which allows crypto in a FIPS environment.Note, rhemium has since pulled the openssl bindings from digest in ruby 3 due to the inconvenience it causes
ruby/ruby@2e601c2
Potential Solution
Last related issue
#725
The text was updated successfully, but these errors were encountered: