bitcoin-secp256k1 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 83ea0fb6a6d1a3b0be7ebcd1c83bd2f516691b1e
4
- data.tar.gz: e0dbeb775196343121cc837c82dcfb97045ffdcf
3
+ metadata.gz: 6035dfb23c9b97f481f98bf2bdee8aa281776cb0
4
+ data.tar.gz: 31d82871124f52d7f3e8cbbd21ff35756ffca425
5
5
  SHA512:
6
- metadata.gz: b1520387c37f380e43ab7a6221d94d05ee5a7c45c39ecf0a76dccbc58e3f9b1da74fa4c459fe092b1d5367b29807ed236ae7f9459121fe8bc7fba29a44642a5e
7
- data.tar.gz: fa38a92756ef3f55051072ee737a0d31bb71540a281a501f6b16e9c35e36ce17da3ef8c380cf185c8d03ce70cdb06c3fb1aa4660a609186ac1acc7a9e5ad1dc7
6
+ metadata.gz: bab2b773ca043cfb475f83f46b7e81496ec6c9c582408ea598a4da3ef9a14d090758680f3e78ea048a5d25250fd866f25424279e94052cb081cbd45f1e784280
7
+ data.tar.gz: 3ac36d282caf5d578121f209fdfd2937483bdbc7126c74bdedea1cd955610724ef1554231378aef4f7ec9a5e43c92dcd3e46f0d930f1c4725bae67773fbe1990
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bitcoin-secp256k1 (0.3.1)
4
+ bitcoin-secp256k1 (0.4.0)
5
5
  ffi (>= 1.9.10)
6
6
 
7
7
  GEM
@@ -34,6 +34,9 @@ module Secp256k1
34
34
  # secp256k1_context* secp256k1_context_create(unsigned int flags)
35
35
  attach_function :secp256k1_context_create, [:uint], :pointer
36
36
 
37
+ # void secp256k1_context_destroy(secp256k1_context* ctx)
38
+ attach_function :secp256k1_context_destroy, [:pointer], :void
39
+
37
40
  # int secp256k1_ec_pubkey_parse(const secp256k1_context* ctx, secp256k1_pubkey* pubkey, const unsigned char *input, size_t inputlen)
38
41
  attach_function :secp256k1_ec_pubkey_parse, [:pointer, :pointer, :pointer, :size_t], :int
39
42
 
@@ -81,5 +84,6 @@ module Secp256k1
81
84
 
82
85
  # int secp256k1_ecdsa_recoverable_signature_convert(const secp256k1_context *ctx, secp256k1_ecdsa_signature *sig, const secp256k1_ecdsa_recoverable_signature *sigin)
83
86
  attach_function :secp256k1_ecdsa_recoverable_signature_convert, [:pointer, :pointer, :pointer], :int
87
+
84
88
  end
85
89
  end
@@ -10,16 +10,12 @@ module Secp256k1
10
10
 
11
11
  unless ctx
12
12
  raise ArgumentError, "invalid flags" unless [NO_FLAGS, FLAG_SIGN, FLAG_VERIFY, ALL_FLAGS].include?(flags)
13
- ctx = C.secp256k1_context_create flags
13
+ ctx = FFI::AutoPointer.new C.secp256k1_context_create(flags), C.method(:secp256k1_context_destroy)
14
14
  @destroy = true
15
15
  end
16
16
 
17
17
  @flags = flags
18
18
  @ctx = ctx
19
-
20
- ObjectSpace.define_finalizer(self) do |id|
21
- C.secp256k1_context_destroy @ctx if @destroy
22
- end
23
19
  end
24
20
  end
25
21
 
@@ -1,4 +1,4 @@
1
1
  # -*- encoding : ascii-8bit -*-
2
2
  module Secp256k1
3
- VERSION = '0.3.1'
3
+ VERSION = '0.4.0'
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bitcoin-secp256k1
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Xie
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-19 00:00:00.000000000 Z
11
+ date: 2016-05-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi