Bug #6939

Uninformative exception in FIPS mode

Added by Vit Ondruch almost 3 years ago. Updated over 2 years ago.

Status:Third Party's Issue
Assignee:Martin Bosslet
ruby -v:trunk Backport:


cat /proc/sys/crypto/fips_enabled

]# irb
irb(main):001:0> require 'openssl'
=> true
irb(main):002:0> OpenSSL::PKey::DH.new(1024)

irb(main):003:0> OpenSSL::PKey::DH.new(128)
OpenSSL::PKey::DHError: BN lib
from (irb):3:in initialize'
from (irb):3:in
from (irb):3
from /bin/irb:12:in `'

Could you please provide better exception message? While it is fine that DH.new fails with short key, it is not obvious from the message what is the reason. Thank you.


#1 Updated by Vit Ondruch almost 3 years ago

  • Assignee changed from Martin Dürst to Martin Bosslet

#2 Updated by Martin Bosslet almost 3 years ago

I'm not sure whether this is possible at all - the message being generated is what OpenSSL itself generates at this point. I'd have to check if there is a reliable way to detect whether we are in FIPS mode or not. Still, I'd prefer if OpenSSL itself provided a better exception message.

#3 Updated by Martin Bosslet almost 3 years ago

  • Status changed from Open to Assigned

#4 Updated by Martin Bosslet over 2 years ago

  • Status changed from Assigned to Third Party's Issue

This is indeed a third party issue. The exception message (or better, the lack thereof) is generated by OpenSSL. They're fine for RSA, DSA and EC ("key too short"), but miserable for DH, agreed.

I really wouldn't want to start to improve OpenSSL error messages in the Ruby extension, that's not where this belongs IMHO. We could try to open an issue on the OpenSSL tracker, though.

Closing as TPI for now, please feel free to reopen if your opinions differ from mine.

#5 Updated by Vit Ondruch over 2 years ago

MartinBosslet (Martin Bosslet) wrote:

We could try to open an issue on the OpenSSL tracker, though.

Would be cool if you can do this.

Also available in: Atom PDF