ffi-libsodium 0.1.5 → 0.1.6

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: 0cf480784b408db77107de6674cd7f84d5f38dfe
4
- data.tar.gz: 744e343786578507798094a4d77f9cfb337735b7
3
+ metadata.gz: d610886611da7899a41f214899c8b06695d843df
4
+ data.tar.gz: a0d2633b5ed02ba549df5a380ca73bfd6a7fc1b7
5
5
  SHA512:
6
- metadata.gz: c9a0259a735e18b22c4a4f62b2defeac74e0d4542d5a62a7c65a3f603825bfedc0cd35a7684fa2b5de284927a9894fa417a89f5b433737329248104c13898b7d
7
- data.tar.gz: 8fee93d20db78a7bb60ff5007635af1fcc5fc9f28fe528c46c6a5b3c10a0c38fa776538800d23f860d517766a97f077df1fb02c85fdaf6910503d6b921c4fdfa
6
+ metadata.gz: 1f75c1ffb4e36ef4c27e4925a29dbf8a86ae86a09c26be6897d85f341c877177e3be424b10293f220f33d8b5ae5133ad4df9ecf3854d04e1322f476d2807b1d1
7
+ data.tar.gz: 7ece183ece3d758ccb9bf4888e973fc41a766357594bc971e7a7db400b0b0cd16adefd96dc3dd0ebc5688b7caa4a390664b413508f1be27f705ff9b6811e90f0
@@ -31,8 +31,8 @@ module Crypto
31
31
  NPUBBYTES = npubbytes.freeze
32
32
  ABYTES = abytes.freeze
33
33
 
34
- attach_function :crypto_aead_chacha20poly1305_encrypt, [:buffer_out, :pointer, :buffer_in, :ulong_long, :buffer_in, :ulong_long, :pointer, :buffer_in, :buffer_in], :int, blocking: true
35
- attach_function :crypto_aead_chacha20poly1305_decrypt, [:buffer_out, :pointer, :pointer, :buffer_in, :ulong_long, :buffer_in, :ulong_long, :buffer_in, :buffer_in], :int, blocking: true
34
+ attach_function :crypto_aead_chacha20poly1305_encrypt, [:buffer_out, :pointer, :buffer_in, :ulong_long, :buffer_in, :ulong_long, :pointer, :buffer_in, :buffer_in], :int
35
+ attach_function :crypto_aead_chacha20poly1305_decrypt, [:buffer_out, :pointer, :pointer, :buffer_in, :ulong_long, :buffer_in, :ulong_long, :buffer_in, :buffer_in], :int
36
36
 
37
37
  module_function
38
38
 
data/lib/crypto/auth.rb CHANGED
@@ -18,8 +18,8 @@ module Crypto
18
18
  BYTES = bytes.freeze
19
19
  KEYBYTES = keybytes.freeze
20
20
 
21
- attach_function :crypto_auth, [:buffer_out, :buffer_in, :ulong_long, :buffer_in], :int, blocking: true
22
- attach_function :crypto_auth_verify, [:buffer_in, :buffer_in, :ulong_long, :buffer_in], :int, blocking: true
21
+ attach_function :crypto_auth, [:buffer_out, :buffer_in, :ulong_long, :buffer_in], :int
22
+ attach_function :crypto_auth_verify, [:buffer_in, :buffer_in, :ulong_long, :buffer_in], :int
23
23
 
24
24
  module_function
25
25
 
data/lib/crypto/box.rb CHANGED
@@ -26,16 +26,16 @@ module Crypto
26
26
  NONCEBYTES = noncebytes.freeze
27
27
  MACBYTES = macbytes.freeze
28
28
 
29
- attach_function :crypto_box_keypair, [:buffer_out, :buffer_out], :int, blocking: true
30
- attach_function :crypto_box_seed_keypair, [:buffer_out, :buffer_out, :buffer_in], :int, blocking: true
29
+ attach_function :crypto_box_keypair, [:buffer_out, :buffer_out], :int
30
+ attach_function :crypto_box_seed_keypair, [:buffer_out, :buffer_out, :buffer_in], :int
31
31
 
32
- attach_function :crypto_box_easy, [:buffer_out, :buffer_in, :ulong_long, :buffer_in, :buffer_in, :buffer_in], :int, blocking: true
33
- attach_function :crypto_box_open_easy, [:buffer_out, :buffer_in, :ulong_long, :buffer_in, :buffer_in, :buffer_in], :int, blocking: true
32
+ attach_function :crypto_box_easy, [:buffer_out, :buffer_in, :ulong_long, :buffer_in, :buffer_in, :buffer_in], :int
33
+ attach_function :crypto_box_open_easy, [:buffer_out, :buffer_in, :ulong_long, :buffer_in, :buffer_in, :buffer_in], :int
34
34
 
35
- attach_function :crypto_box_beforenm, [:buffer_out, :buffer_in, :buffer_in], :int, blocking: true
35
+ attach_function :crypto_box_beforenm, [:buffer_out, :buffer_in, :buffer_in], :int
36
36
 
37
- attach_function :crypto_box_afternm, [:buffer_out, :buffer_in, :ulong_long, :buffer_in, :buffer_in], :int, blocking: true
38
- attach_function :crypto_box_open_afternm, [:buffer_out, :buffer_in, :ulong_long, :buffer_in, :buffer_in], :int, blocking: true
37
+ attach_function :crypto_box_afternm, [:buffer_out, :buffer_in, :ulong_long, :buffer_in, :buffer_in], :int
38
+ attach_function :crypto_box_open_afternm, [:buffer_out, :buffer_in, :ulong_long, :buffer_in, :buffer_in], :int
39
39
 
40
40
  module_function
41
41
 
@@ -27,7 +27,7 @@ module Crypto
27
27
  KEYBYTES_MAX = keybytes_max.freeze
28
28
  KEYBYTES = keybytes.freeze
29
29
 
30
- attach_function :crypto_generichash, [:buffer_out, :size_t, :buffer_in, :ulong_long, :buffer_in, :size_t], :int, blocking: true
30
+ attach_function :crypto_generichash, [:buffer_out, :size_t, :buffer_in, :ulong_long, :buffer_in, :size_t], :int
31
31
 
32
32
  class State < FFI::Struct
33
33
  pack 64
@@ -39,9 +39,9 @@ module Crypto
39
39
  :last_node, :uint8
40
40
  end
41
41
 
42
- attach_function :crypto_generichash_init, [State.ptr, :buffer_in, :size_t, :size_t], :int, blocking: true
43
- attach_function :crypto_generichash_update, [State.ptr, :buffer_in, :ulong_long], :int, blocking: true
44
- attach_function :crypto_generichash_final, [State.ptr, :buffer_out, :ulong_long], :int, blocking: true
42
+ attach_function :crypto_generichash_init, [State.ptr, :buffer_in, :size_t, :size_t], :int
43
+ attach_function :crypto_generichash_update, [State.ptr, :buffer_in, :ulong_long], :int
44
+ attach_function :crypto_generichash_final, [State.ptr, :buffer_out, :ulong_long], :int
45
45
 
46
46
  module_function
47
47
 
@@ -18,17 +18,17 @@ module Crypto
18
18
  BYTES = bytes.freeze
19
19
  KEYBYTES = keybytes.freeze
20
20
 
21
- attach_function :crypto_onetimeauth, [:buffer_out, :buffer_in, :ulong_long, :buffer_in], :int, blocking: true
22
- attach_function :crypto_onetimeauth_verify, [:buffer_in, :buffer_in, :ulong_long, :buffer_in], :int, blocking: true
21
+ attach_function :crypto_onetimeauth, [:buffer_out, :buffer_in, :ulong_long, :buffer_in], :int
22
+ attach_function :crypto_onetimeauth_verify, [:buffer_in, :buffer_in, :ulong_long, :buffer_in], :int
23
23
 
24
24
  class State < FFI::Struct
25
25
  layout :aligner, :ulong_long,
26
26
  :opaque, [:uchar, 136]
27
27
  end
28
28
 
29
- attach_function :crypto_onetimeauth_init, [State.ptr, :buffer_in], :int, blocking: true
30
- attach_function :crypto_onetimeauth_update, [State.ptr, :buffer_in, :ulong_long], :int, blocking: true
31
- attach_function :crypto_onetimeauth_final, [State.ptr, :buffer_out], :int, blocking: true
29
+ attach_function :crypto_onetimeauth_init, [State.ptr, :buffer_in], :int
30
+ attach_function :crypto_onetimeauth_update, [State.ptr, :buffer_in, :ulong_long], :int
31
+ attach_function :crypto_onetimeauth_final, [State.ptr, :buffer_out], :int
32
32
 
33
33
  module_function
34
34
 
@@ -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, blocking: true
42
- attach_function :crypto_pwhash_scryptsalsa208sha256_str, [:buffer_out, :buffer_in, :ulong_long, :ulong_long, :size_t], :int, blocking: true
43
- attach_function :crypto_pwhash_scryptsalsa208sha256_str_verify, [:string, :buffer_in, :ulong_long], :int, blocking: true
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
44
44
 
45
45
  module_function
46
46
 
@@ -18,8 +18,8 @@ module Crypto
18
18
  BYTES = bytes.freeze
19
19
  SCALARBYTES = scalarbytes.freeze
20
20
 
21
- attach_function :crypto_scalarmult_base, [:buffer_out, :buffer_in], :int, blocking: true
22
- attach_function :crypto_scalarmult, [:buffer_out, :buffer_in, :buffer_in], :int, blocking: true
21
+ attach_function :crypto_scalarmult_base, [:buffer_out, :buffer_in], :int
22
+ attach_function :crypto_scalarmult, [:buffer_out, :buffer_in, :buffer_in], :int
23
23
 
24
24
  module_function
25
25
 
@@ -22,8 +22,8 @@ module Crypto
22
22
  NONCEBYTES = noncebytes.freeze
23
23
  MACBYTES = macbytes.freeze
24
24
 
25
- attach_function :crypto_secretbox_easy, [:buffer_out, :buffer_in, :ulong_long, :buffer_in, :buffer_in], :int, blocking: true
26
- attach_function :crypto_secretbox_open_easy, [:buffer_out, :buffer_in, :ulong_long, :buffer_in, :buffer_in], :int, blocking: true
25
+ attach_function :crypto_secretbox_easy, [:buffer_out, :buffer_in, :ulong_long, :buffer_in, :buffer_in], :int
26
+ attach_function :crypto_secretbox_open_easy, [:buffer_out, :buffer_in, :ulong_long, :buffer_in, :buffer_in], :int
27
27
 
28
28
  module_function
29
29
 
@@ -18,7 +18,7 @@ module Crypto
18
18
  BYTES = bytes.freeze
19
19
  KEYBYTES = keybytes.freeze
20
20
 
21
- attach_function :crypto_shorthash, [:buffer_out, :buffer_in, :ulong_long, :buffer_in], :int, blocking: true
21
+ attach_function :crypto_shorthash, [:buffer_out, :buffer_in, :ulong_long, :buffer_in], :int
22
22
 
23
23
  module_function
24
24
 
data/lib/crypto/sign.rb CHANGED
@@ -23,11 +23,11 @@ module Crypto
23
23
  PUBLICKEYBYTES = publickeybytes.freeze
24
24
  SECRETKEYBYTES = secretkeybytes.freeze
25
25
 
26
- attach_function :crypto_sign_keypair, [:buffer_out, :buffer_out], :int, blocking: true
27
- attach_function :crypto_sign_seed_keypair, [:buffer_out, :buffer_out, :buffer_in], :int, blocking: true
26
+ attach_function :crypto_sign_keypair, [:buffer_out, :buffer_out], :int
27
+ attach_function :crypto_sign_seed_keypair, [:buffer_out, :buffer_out, :buffer_in], :int
28
28
 
29
- attach_function :crypto_sign, [:buffer_out, :pointer, :buffer_in, :ulong_long, :buffer_in], :int, blocking: true
30
- attach_function :crypto_sign_open, [:buffer_out, :pointer, :buffer_in, :ulong_long, :buffer_in], :int, blocking: true
29
+ attach_function :crypto_sign, [:buffer_out, :pointer, :buffer_in, :ulong_long, :buffer_in], :int
30
+ attach_function :crypto_sign_open, [:buffer_out, :pointer, :buffer_in, :ulong_long, :buffer_in], :int
31
31
 
32
32
  module_function
33
33
 
data/lib/random_bytes.rb CHANGED
@@ -9,8 +9,8 @@ module RandomBytes
9
9
 
10
10
  attach_function :random, :randombytes_random, [], :uint32, blocking: true
11
11
  attach_function :uniform, :randombytes_uniform, [:uint32], :uint32, blocking: true
12
- attach_function :close, :randombytes_close, [], :int, blocking: true
13
- attach_function :stir, :randombytes_stir, [], :void, blocking: true
12
+ attach_function :close, :randombytes_close, [], :int
13
+ attach_function :stir, :randombytes_stir, [], :void
14
14
 
15
15
  module_function
16
16
 
data/lib/sodium.rb CHANGED
@@ -1,22 +1,24 @@
1
1
  require 'ffi'
2
2
  require_relative 'sodium/errors'
3
+ require_relative 'sodium/utils'
4
+ require_relative 'sodium/buffer'
3
5
 
4
6
  module Sodium
5
7
  extend FFI::Library
6
8
  ffi_lib :libsodium
7
9
 
8
- attach_function :init, :sodium_init, [], :int, blocking: true
10
+ attach_function :init, :sodium_init, [], :int
9
11
 
10
12
  attach_function :memcmp, :sodium_memcmp, [:buffer_in, :buffer_in, :size_t], :int
11
- attach_function :memzero, :sodium_memzero, [:pointer, :size_t], :void, blocking: true
12
- attach_function :free, :sodium_free, [:pointer], :void, blocking: true
13
- attach_function :sodium_mlock, [:pointer, :size_t], :int, blocking: true
14
- attach_function :sodium_munlock, [:pointer, :size_t], :int, blocking: true
15
- attach_function :sodium_malloc, [:size_t], :pointer, blocking: true
16
- attach_function :sodium_allocarray, [:size_t, :size_t], :pointer, blocking: true
17
- attach_function :sodium_mprotect_noaccess, [:pointer], :int, blocking: true
18
- attach_function :sodium_mprotect_readonly, [:pointer], :int, blocking: true
19
- attach_function :sodium_mprotect_readwrite, [:pointer], :int, blocking: true
13
+ attach_function :memzero, :sodium_memzero, [:pointer, :size_t], :void
14
+ attach_function :free, :sodium_free, [:pointer], :void
15
+ attach_function :sodium_mlock, [:pointer, :size_t], :int
16
+ attach_function :sodium_munlock, [:pointer, :size_t], :int
17
+ attach_function :sodium_malloc, [:size_t], :pointer
18
+ attach_function :sodium_allocarray, [:size_t, :size_t], :pointer
19
+ attach_function :sodium_mprotect_noaccess, [:pointer], :int
20
+ attach_function :sodium_mprotect_readonly, [:pointer], :int
21
+ attach_function :sodium_mprotect_readwrite, [:pointer], :int
20
22
 
21
23
  module_function
22
24
 
@@ -1,3 +1,3 @@
1
1
  module Sodium
2
- VERSION = Gem::Version.new('0.1.5')
2
+ VERSION = Gem::Version.new('0.1.6')
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.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hendrik Beskow