-
Notifications
You must be signed in to change notification settings - Fork 182
Closed
Description
For the following assertion in FIPS case, I am seeing an interesting difference of the behavior between non-FIPS and FIPS.
openssl/test/openssl/test_pkey_dh.rb
Line 22 in c9b48f9
| assert_nil(OpenSSL::PKey::DH.new(NEW_KEYLEN) { break }) |
My environment
My environment is below. Fedora 38, with relatively latest ruby master branch and OpenSSL master branch.
$ which ruby
~/.local/ruby-3.3.0dev-debug-511571b5ff/bin/ruby
$ ruby -v
ruby 3.3.0dev (2023-10-13T14:21:33Z master 511571b5ff) [x86_64-linux]
$ /home/jaruga/.local/openssl-3.3.0-dev-fips-debug-1aa08644ec/bin/openssl version
OpenSSL 3.3.0-dev (Library: OpenSSL 3.3.0-dev )
I compiled like this.
$ MAKEFLAGS="V=1" \
RUBY_OPENSSL_EXTCFLAGS="-O0 -g3 -ggdb3 -gdwarf-5" \
bundle exec rake compile -- --with-openssl-dir=/home/jaruga/.local/openssl-3.3.0-dev-fips-debug-1aa08644ec
The issue summary
Then here is the difference. The OpenSSL::PKey::DH.new(2048) { break } is expected to return nil. However, in FIPS, it returns a value. The OpenSSL::PKey::DH.new calls OpenSSL::PKey.generate_parameters in it. I am still debugging. But I appreciate if you can let me know this is an expected behavior or a kind of bug.
In Non-FIPS
$ ruby -I./lib -ropenssl -e 'p OpenSSL::PKey::DH.new(2048) { break }'
nil
$ ruby -I./lib -ropenssl <<EOF
p OpenSSL::PKey.generate_parameters("DH", {"dh_paramgen_prime_len" => 2048, "dh_paramgen_generator" => 2}) { break }
EOF
nil
In FIPS
$ OPENSSL_CONF=/home/jaruga/.local/openssl-3.3.0-dev-fips-debug-1aa08644ec/ssl/openssl_fips.cnf \
ruby -I./lib -ropenssl -e 'p OpenSSL::PKey::DH.new(2048) { break }'
#<OpenSSL::PKey::DH:0x00007fed7aa0e118 oid=dhKeyAgreement>
$ OPENSSL_CONF=/home/jaruga/.local/openssl-3.3.0-dev-fips-debug-1aa08644ec/ssl/openssl_fips.cnf \
ruby -I./lib -ropenssl <<EOF
p OpenSSL::PKey.generate_parameters("DH", {"dh_paramgen_prime_len" => 2048, "dh_paramgen_generator" => 2}) { break }
EOF
#<OpenSSL::PKey::DH:0x00007fb97cfae190 oid=dhKeyAgreement>
Metadata
Metadata
Assignees
Labels
No labels