ffi-libsodium 0.0.6 → 0.0.7

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: 193aa2e92e5fc462d8d7f3c68a2ab71c9fb855a0
4
- data.tar.gz: abc95a71587cea89a4d119ed6a1625b4337532cd
3
+ metadata.gz: 809b5a363af975be25d1bece0bf14d70fffacd36
4
+ data.tar.gz: 52789ce07fa6173a7eb8f7602ededd02dc74f720
5
5
  SHA512:
6
- metadata.gz: 19ab15b9ced7dbbc0da8b58bfbe2717c55dad11731ecd09c0c7c774a42a3b58260467ee6116fd17a65b01d8d020679fba5bb9a770d1c972007d2b20a20d2bbb7
7
- data.tar.gz: e757e619ae02c46e91c336aebc1b632c0a652eec8e71453bf9efc3870e2be4448fd0fc22bef42e456889865fdb7c63a04242a99ad7cf138db6c278245491f5c0
6
+ metadata.gz: 33ac72f615ac5b7eda4407b28588321aa74d2274a1dcac5455986cb68511c8d786451ad01fdbe5160a8ad06a8762d95043646ec87b45a4b809f16efc0e11c6a4
7
+ data.tar.gz: bdd464b328937b41f9f2f5f9300fd734758462f96310ae4fa84c906343a277e54ecc76c0835519d8cedecc08184c490182434d93abf4660c9bb1cf746582b3fa
@@ -44,7 +44,7 @@ module Crypto
44
44
  check_length(nonce, NPUBBYTES, :Nonce)
45
45
  check_length(key, KEYBYTES, :SecretKey)
46
46
 
47
- ciphertext = FFI::MemoryPointer.new(:uchar, message_len + ABYTES)
47
+ ciphertext = Sodium::Buffer.new(:uchar, message_len + ABYTES)
48
48
  key.readonly if key.is_a?(Sodium::SecretBuffer)
49
49
  crypto_aead_chacha20poly1305_encrypt(ciphertext, nil, message, message_len, additional_data, additional_data_len, nil, nonce, key)
50
50
  key.noaccess if key.is_a?(Sodium::SecretBuffer)
@@ -60,7 +60,7 @@ module Crypto
60
60
  check_length(nonce, NPUBBYTES, :Nonce)
61
61
  check_length(key, KEYBYTES, :SecretKey)
62
62
 
63
- decrypted = FFI::MemoryPointer.new(:uchar, ciphertext_len - ABYTES)
63
+ decrypted = Sodium::Buffer.new(:uchar, ciphertext_len - ABYTES)
64
64
  key.readonly if key.is_a?(Sodium::SecretBuffer)
65
65
  rc = crypto_aead_chacha20poly1305_decrypt(decrypted, nil, nil, ciphertext, ciphertext_len, additional_data, additional_data_len, nonce, key)
66
66
  key.noaccess if key.is_a?(Sodium::SecretBuffer)
data/lib/crypto/sign.rb CHANGED
@@ -34,7 +34,6 @@ module Crypto
34
34
  def keypair
35
35
  public_key = Sodium::Buffer.new(:uchar, PUBLICKEYBYTES)
36
36
  secret_key = Sodium::Buffer.new(:uchar, SECRETKEYBYTES)
37
-
38
37
  crypto_sign_keypair(public_key, secret_key)
39
38
 
40
39
  [public_key, secret_key]
@@ -45,8 +44,9 @@ module Crypto
45
44
 
46
45
  public_key = Sodium::Buffer.new(:uchar, PUBLICKEYBYTES)
47
46
  secret_key = Sodium::Buffer.new(:uchar, SECRETKEYBYTES)
48
-
47
+ seed.readonly if seed.is_a?(Sodium::SecretBuffer)
49
48
  crypto_sign_seed_keypair(public_key, secret_key, seed)
49
+ seed.noaccess if seed.is_a?(Sodium::SecretBuffer)
50
50
 
51
51
  [public_key, secret_key]
52
52
  end
@@ -65,7 +65,9 @@ module Crypto
65
65
 
66
66
  public_key = Sodium::Buffer.new(:uchar, PUBLICKEYBYTES)
67
67
  secret_key = Sodium::SecretBuffer.new(:uchar, SECRETKEYBYTES)
68
+ seed.readonly if seed.is_a?(Sodium::SecretBuffer)
68
69
  crypto_sign_seed_keypair(public_key, secret_key, seed)
70
+ seed.noaccess if seed.is_a?(Sodium::SecretBuffer)
69
71
  secret_key.noaccess
70
72
 
71
73
  [public_key, secret_key]
@@ -1,3 +1,3 @@
1
1
  module Sodium
2
- VERSION = '0.0.6'.freeze
2
+ VERSION = '0.0.7'.freeze
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.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hendrik Beskow