From 1997663a417bb0a56a8de00c0e6add55d73c2a74 Mon Sep 17 00:00:00 2001 From: Tony Arcieri Date: Mon, 9 Sep 2013 22:08:56 -0700 Subject: [PATCH] libsodium 0.4.3 support It appears there was a minor change in the ABI: crypto_onetimeauth_poly1305_ref(_*) => crypto_onetimeauth_poly1305(_*) --- lib/rbnacl/nacl.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/rbnacl/nacl.rb b/lib/rbnacl/nacl.rb index efad014..7240448 100644 --- a/lib/rbnacl/nacl.rb +++ b/lib/rbnacl/nacl.rb @@ -118,11 +118,19 @@ def self.#{name}(*args) ONETIME_KEYBYTES = 32 ONETIME_BYTES = 16 + if NaCl.supported_version? :libsodium, '0.4.3' + crypto_onetimeauth_poly1305 = :crypto_onetimeauth_poly1305 + crypto_onetimeauth_poly1305_verify = :crypto_onetimeauth_poly1305_verify + else + crypto_onetimeauth_poly1305 = :crypto_onetimeauth_poly1305_ref + crypto_onetimeauth_poly1305_verify = :crypto_onetimeauth_poly1305_verify_ref + end + wrap_nacl_function :crypto_auth_onetime, - :crypto_onetimeauth_poly1305_ref, + crypto_onetimeauth_poly1305, [:pointer, :pointer, :long_long, :pointer] wrap_nacl_function :crypto_auth_onetime_verify, - :crypto_onetimeauth_poly1305_ref_verify, + crypto_onetimeauth_poly1305_verify, [:pointer, :pointer, :long_long, :pointer] wrap_nacl_function :random_bytes,