RubyCrypto / rbnacl

Ruby FFI binding to the Networking and Cryptography (NaCl) library (a.k.a. libsodium)
MIT License
983 stars 85 forks source link

Resolve FFI deprecation warning #206

Closed orien closed 4 years ago

orien commented 4 years ago

When running with ffi-1.2 the following warning is produced.

[DEPRECATION] Struct layout is already defined for class RbNaCl::HMAC::State. Redefinition as in /bundle/ruby/2.5.0/gems/rbnacl-7.1.0/lib/rbnacl/hmac/sha512256.rb:103:in `<class:State>' will be disallowed in ffi-2.0.

It seems these three files each define a RbNaCl::HMAC::State class.

The proposal presented here, nests the classes inside the main class of the file. Hence, three separate classes RbNaCl::HMAC::SHA256::State, RbNaCl::HMAC::SHA512::State, and RbNaCl::HMAC::SHA512256::State are defined instead.

Fixes #205

tarcieri commented 4 years ago

Looks like this was possibly just a nesting oversight. Anyway, thank you!

paul commented 4 years ago

@tarcieri Any chance of a patch release so I can update the gem in my app and the warnings will shut up? :grinning:

tarcieri commented 4 years ago

@paul done