ffi-libsodium 0.3.1 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9b346ccce416e5830577e755185f792cfd63613b
4
- data.tar.gz: 3b9ebf3532114c5dd85dd4f48bddd0c72a26691b
3
+ metadata.gz: 2d30d2756247274875e470ab61e090288114cb2d
4
+ data.tar.gz: 7d7edba752748cac108b93b446a2ce9e8a2ada35
5
5
  SHA512:
6
- metadata.gz: 81359e298eef2fbb734bdccfa8ad24f190d74f2b47d91f9065994c73c4ed1b6e6393cda29279a065791cf5fcb8ced39e6c1b3a805c23b15c28dbb4fbf16f6778
7
- data.tar.gz: 9b006e3addfdb329015b1ab7a1760a777fb170459ca20be0bba84758131968255fc1382641aa3dce5e4f2f6023b77d284ef4d24cfa471d83e47d6ed94c726071
6
+ metadata.gz: abe3e18a46e2bd3a83fe093a56d6529df2ac856e4df9fc1521c46246bfd90ab6b3d6d6f8f3fcd000e6d4b6c1975e46eacd4acae3bd79b0cc46d11970002813c4
7
+ data.tar.gz: f6ebd40cd8971e20625ed634eca8d90129079a7f971d5d0c3c2d87e4c3ee206a546e397ba8934bf51291343970a1052ba1961e7c0026527547435db231c08234
@@ -38,9 +38,9 @@ module Crypto
38
38
  OPSLIMIT_SENSITIVE = opslimit_sensitive.freeze
39
39
  MEMLIMIT_SENSITIVE = memlimit_sensitive.freeze
40
40
 
41
- attach_function :crypto_pwhash_scryptsalsa208sha256, [:buffer_out, :ulong_long, :buffer_in, :ulong_long, :buffer_in, :ulong_long, :size_t], :int
42
- attach_function :crypto_pwhash_scryptsalsa208sha256_str, [:buffer_out, :buffer_in, :ulong_long, :ulong_long, :size_t], :int
43
- attach_function :crypto_pwhash_scryptsalsa208sha256_str_verify, [:string, :buffer_in, :ulong_long], :int
41
+ attach_function :crypto_pwhash_scryptsalsa208sha256, [:buffer_out, :ulong_long, :string, :ulong_long, :buffer_in, :ulong_long, :size_t], :int
42
+ attach_function :crypto_pwhash_scryptsalsa208sha256_str, [:buffer_out, :string, :ulong_long, :ulong_long, :size_t], :int
43
+ attach_function :crypto_pwhash_scryptsalsa208sha256_str_verify, [:string, :string, :ulong_long], :int
44
44
 
45
45
  module_function
46
46
 
@@ -52,7 +52,7 @@ module Crypto
52
52
  check_length(salt, SALTBYTES, :Salt)
53
53
 
54
54
  out = Sodium::SecretBuffer.new(outlen)
55
- if crypto_pwhash_scryptsalsa208sha256(out, outlen, passwd, get_size(passwd), salt, opslimit, memlimit) == 0
55
+ if crypto_pwhash_scryptsalsa208sha256(out, outlen, passwd, passwd.bytesize, salt, opslimit, memlimit) == 0
56
56
  out.noaccess
57
57
  out
58
58
  else
@@ -62,7 +62,7 @@ module Crypto
62
62
 
63
63
  def str(passwd, opslimit = OPSLIMIT_INTERACTIVE, memlimit = MEMLIMIT_INTERACTIVE)
64
64
  hashed_password = FFI::MemoryPointer.new(:char, STRBYTES)
65
- if crypto_pwhash_scryptsalsa208sha256_str(hashed_password, passwd, get_size(passwd), opslimit, memlimit) == 0
65
+ if crypto_pwhash_scryptsalsa208sha256_str(hashed_password, passwd, passwd.bytesize, opslimit, memlimit) == 0
66
66
  hashed_password.get_string(0)
67
67
  else
68
68
  raise NoMemoryError, "Failed to allocate memory max size=#{memlimit} bytes", caller
@@ -71,7 +71,7 @@ module Crypto
71
71
 
72
72
  def str_verify(str, passwd)
73
73
  check_length(str, STRBYTES - 1, :Str)
74
- crypto_pwhash_scryptsalsa208sha256_str_verify(str, passwd, get_size(passwd)) == 0
74
+ crypto_pwhash_scryptsalsa208sha256_str_verify(str, passwd, passwd.bytesize) == 0
75
75
  end
76
76
  end
77
77
 
data/lib/sodium.rb CHANGED
@@ -19,7 +19,7 @@ module Sodium
19
19
  attach_function :sodium_allocarray, [:size_t, :size_t], :pointer
20
20
 
21
21
  attach_function :sodium_bin2hex, [:buffer_out, :size_t, :buffer_in, :size_t], :string
22
- attach_function :sodium_hex2bin, [:buffer_out, :size_t, :buffer_in, :size_t, :string, :pointer, :pointer], :int
22
+ attach_function :sodium_hex2bin, [:buffer_out, :size_t, :string, :size_t, :string, :buffer_out, :pointer], :int
23
23
 
24
24
  module_function
25
25
 
@@ -1,3 +1,3 @@
1
1
  module Sodium
2
- VERSION = Gem::Version.new('0.3.1')
2
+ VERSION = Gem::Version.new('0.3.2')
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ffi-libsodium
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hendrik Beskow