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

Loading this gem breaks OpenSSL HMAC #4

Closed
paz-zz opened this issue Apr 15, 2015 · 4 comments
Closed

Loading this gem breaks OpenSSL HMAC #4

paz-zz opened this issue Apr 15, 2015 · 4 comments
Assignees
Labels

Comments

@paz-zz
Copy link

paz-zz commented Apr 15, 2015

$ irb -f
irb(main):001:0> require 'openssl'
=> true
irb(main):002:0> OpenSSL::HMAC.digest OpenSSL::Digest::SHA512.new, '', ''
=> "\xB96\xCE\xE8l\x9F\x87\xAA]<o.\x84\xCBZB9\xA5\xFEPH\nn\xC6kp\xAB[\x1FJ\xC6s\flQT!\xB3'\xEC\x1Di@.S\xDF\xB4\x9A\xD78\x1E\xB0g\xB38\xFD{\f\xB2\"G\"]G"
irb(main):003:0> require 'sha3'
=> true
irb(main):004:0> OpenSSL::HMAC.digest OpenSSL::Digest::SHA512.new, '', ''
TypeError: wrong argument (OpenSSL::Digest::SHA512)! (Expected kind of SHA3::Digest)
    from (irb):4:in `digest'
    from (irb):4
    from /usr/bin/irb:11:in `<main>'
@mmoghadas
Copy link
Collaborator

ruby version maybe?

$ ruby --version                                                                                                                          [6:00:54]
ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin14.0]
$ gem list|grep sha3                                                                                                                      [6:01:06]
sha3 (0.2.5)

irb -f [5:59:44]
irb(main):001:0> require 'openssl'
=> true
irb(main):002:0> OpenSSL::HMAC.digest OpenSSL::Digest::SHA512.new, '', ''
=> "\xB96\xCE\xE8l\x9F\x87\xAA]<o.\x84\xCBZB9\xA5\xFEPH\nn\xC6kp\xAB[\x1FJ\xC6s\flQT!\xB3'\xEC\x1Di@.S\xDF\xB4\x9A\xD78\x1E\xB0g\xB38\xFD{\f\xB2"G"]G"
irb(main):003:0> require 'sha3'
=> true
irb(main):004:0> OpenSSL::HMAC.digest OpenSSL::Digest::SHA512.new, '', ''
=> "\xB96\xCE\xE8l\x9F\x87\xAA]<o.\x84\xCBZB9\xA5\xFEPH\nn\xC6kp\xAB[\x1FJ\xC6s\flQT!\xB3'\xEC\x1Di@.S\xDF\xB4\x9A\xD78\x1E\xB0g\xB38\xFD{\f\xB2"G"]G"

@johanns johanns self-assigned this Apr 15, 2015
@paz-zz
Copy link
Author

paz-zz commented Apr 15, 2015

$ ruby --version
ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-linux-gnu]

$ gem list | grep sha3
sha3 (0.2.5)

I get a different error in Rubinius

TypeError: wrong argument (�)! (Expected kind of )

$ rbx -v
rubinius 2.5.2.c136 (2.1.0 c776a009 2015-03-19 3.4 JI) [x86_64-linux-gnu]

$ uname -vr
3.13.0-49-generic #83-Ubuntu SMP Fri Apr 10 20:11:33 UTC 2015

@johanns johanns added the bug label Apr 15, 2015
@johanns
Copy link
Owner

johanns commented Apr 15, 2015

Thanks for reporting the issue. I was able to reproduce it on Linux with (MRI 2.2.1), but interestingly, not on my development machine, OS X (with MRI or Rubinius).

Working on a fix!

johanns added a commit that referenced this issue Jun 2, 2015
…inux causing OpenSSL's GetDigestPtr to return SHA3::Digest.* instead of OpenSSL::Digest, if SHA3 loaded after OpenSSL -- renamed internal SHA3 object to cSHA3Digest & eSHA3DigestError
johanns added a commit that referenced this issue Jun 2, 2015
@johanns
Copy link
Owner

johanns commented Jun 2, 2015

@paz Apologies for the delay. I've published a fix for this issue. Please install the latest release v0.2.6: gem install sha3 -v0.2.6. Alternatively, you an download the gem directly from Github: https://github.com/johanns/sha3/releases/download/v0.2.6/sha3-0.2.6.gem

J

@johanns johanns closed this as completed Jun 18, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants