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 +4 -4
- data/lib/crypto/aead/chacha20_poly1305.rb +2 -2
- data/lib/crypto/auth.rb +2 -2
- data/lib/crypto/box.rb +7 -7
- data/lib/crypto/generic_hash.rb +4 -4
- data/lib/crypto/one_time_auth.rb +5 -5
- data/lib/crypto/pw_hash/scrypt_salsa208_sha256.rb +3 -3
- data/lib/crypto/scalar_mult.rb +2 -2
- data/lib/crypto/secret_box.rb +2 -2
- data/lib/crypto/short_hash.rb +1 -1
- data/lib/crypto/sign.rb +4 -4
- data/lib/random_bytes.rb +2 -2
- data/lib/sodium.rb +12 -10
- data/lib/sodium/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d610886611da7899a41f214899c8b06695d843df
|
4
|
+
data.tar.gz: a0d2633b5ed02ba549df5a380ca73bfd6a7fc1b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
35
|
-
attach_function :crypto_aead_chacha20poly1305_decrypt, [:buffer_out, :pointer, :pointer, :buffer_in, :ulong_long, :buffer_in, :ulong_long, :buffer_in, :buffer_in], :int
|
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
|
22
|
-
attach_function :crypto_auth_verify, [:buffer_in, :buffer_in, :ulong_long, :buffer_in], :int
|
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
|
30
|
-
attach_function :crypto_box_seed_keypair, [:buffer_out, :buffer_out, :buffer_in], :int
|
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
|
33
|
-
attach_function :crypto_box_open_easy, [:buffer_out, :buffer_in, :ulong_long, :buffer_in, :buffer_in, :buffer_in], :int
|
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
|
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
|
38
|
-
attach_function :crypto_box_open_afternm, [:buffer_out, :buffer_in, :ulong_long, :buffer_in, :buffer_in], :int
|
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
|
|
data/lib/crypto/generic_hash.rb
CHANGED
@@ -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
|
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
|
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
|
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
|
|
data/lib/crypto/one_time_auth.rb
CHANGED
@@ -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
|
22
|
-
attach_function :crypto_onetimeauth_verify, [:buffer_in, :buffer_in, :ulong_long, :buffer_in], :int
|
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
|
30
|
-
attach_function :crypto_onetimeauth_update, [State.ptr, :buffer_in, :ulong_long], :int
|
31
|
-
attach_function :crypto_onetimeauth_final, [State.ptr, :buffer_out], :int
|
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
|
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],
|
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
|
|
data/lib/crypto/scalar_mult.rb
CHANGED
@@ -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
|
22
|
-
attach_function :crypto_scalarmult, [:buffer_out, :buffer_in, :buffer_in], :int
|
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
|
|
data/lib/crypto/secret_box.rb
CHANGED
@@ -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
|
26
|
-
attach_function :crypto_secretbox_open_easy, [:buffer_out, :buffer_in, :ulong_long, :buffer_in, :buffer_in], :int
|
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
|
|
data/lib/crypto/short_hash.rb
CHANGED
@@ -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
|
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
|
27
|
-
attach_function :crypto_sign_seed_keypair, [:buffer_out, :buffer_out, :buffer_in], :int
|
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
|
30
|
-
attach_function :crypto_sign_open, [:buffer_out, :pointer, :buffer_in, :ulong_long, :buffer_in], :int
|
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
|
13
|
-
attach_function :stir, :randombytes_stir, [], :void
|
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
|
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
|
12
|
-
attach_function :free, :sodium_free, [:pointer], :void
|
13
|
-
attach_function :sodium_mlock, [:pointer, :size_t], :int
|
14
|
-
attach_function :sodium_munlock, [:pointer, :size_t], :int
|
15
|
-
attach_function :sodium_malloc, [:size_t], :pointer
|
16
|
-
attach_function :sodium_allocarray, [:size_t, :size_t], :pointer
|
17
|
-
attach_function :sodium_mprotect_noaccess, [:pointer], :int
|
18
|
-
attach_function :sodium_mprotect_readonly, [:pointer], :int
|
19
|
-
attach_function :sodium_mprotect_readwrite, [:pointer], :int
|
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
|
|
data/lib/sodium/version.rb
CHANGED