eth 0.4.10 → 0.4.11
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 +5 -5
- data/.travis.yml +3 -0
- data/CHANGELOG.md +9 -0
- data/eth.gemspec +1 -2
- data/lib/eth/open_ssl.rb +75 -8
- data/lib/eth/version.rb +1 -1
- metadata +4 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6436ecdbcecdf75d62a47c1aadcca3b8056774a3
|
4
|
+
data.tar.gz: c60fefe544a070c75cd0a60c80ed6d7df7ddca2f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3757924cd14cbe89260b08d88c9aa157a914b8ed7afa6086d8c08335dd77a006ec74f37ba4ab7febc835644f75112a68b5bbf3c91224411753d78211f81ab5e8
|
7
|
+
data.tar.gz: 286f9d8b76042b74f1930855cafd34648d3308156eaab17e4a2a8c3ebe3f12692444284c9b797cc555dbaf61fe96b46a515ec0b882a925d524f67f6193736f4a
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -6,8 +6,17 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|
6
6
|
|
7
7
|
### Unreleased
|
8
8
|
|
9
|
+
## [0.4.11]
|
10
|
+
|
11
|
+
### Added
|
12
|
+
- Support for recovering signatures with a V value below 27 (like from Ledger hardware wallets)
|
13
|
+
|
9
14
|
## [0.4.10]
|
10
15
|
|
16
|
+
### Changed
|
17
|
+
- Use updated sha3 dependency
|
18
|
+
- Improved OpenSSL support
|
19
|
+
|
11
20
|
### Changed
|
12
21
|
- Changed Eth::Configuration.default_chain_id back to .chain_id for dependent libraries.
|
13
22
|
|
data/eth.gemspec
CHANGED
@@ -19,13 +19,12 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
20
|
spec.require_paths = ["lib"]
|
21
21
|
|
22
|
-
spec.add_dependency 'digest-sha3', '~> 1.1'
|
22
|
+
spec.add_dependency 'digest-sha3-patched', '~> 1.1'
|
23
23
|
spec.add_dependency 'ffi', '~> 1.0'
|
24
24
|
spec.add_dependency 'money-tree', '~> 0.10.0'
|
25
25
|
spec.add_dependency 'rlp', '~> 0.7.3'
|
26
26
|
spec.add_dependency 'scrypt', '~> 3.0.6'
|
27
27
|
|
28
|
-
spec.add_development_dependency 'bundler', '~> 1.12'
|
29
28
|
spec.add_development_dependency 'pry', '~> 0.1'
|
30
29
|
spec.add_development_dependency 'rake', '~> 10.0'
|
31
30
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
data/lib/eth/open_ssl.rb
CHANGED
@@ -8,18 +8,69 @@ module Eth
|
|
8
8
|
if FFI::Platform.windows?
|
9
9
|
ffi_lib 'libeay32', 'ssleay32'
|
10
10
|
else
|
11
|
-
ffi_lib [
|
11
|
+
ffi_lib [
|
12
|
+
'libssl.so.1.1.0', 'libssl.so.1.1',
|
13
|
+
'libssl.so.1.0.0', 'libssl.so.10',
|
14
|
+
'ssl'
|
15
|
+
]
|
12
16
|
end
|
13
17
|
|
14
18
|
NID_secp256k1 = 714
|
15
19
|
POINT_CONVERSION_COMPRESSED = 2
|
16
20
|
POINT_CONVERSION_UNCOMPRESSED = 4
|
17
21
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
+
# OpenSSL 1.1.0 version as a numerical version value as defined in:
|
23
|
+
# https://www.openssl.org/docs/man1.1.0/man3/OpenSSL_version.html
|
24
|
+
VERSION_1_1_0_NUM = 0x10100000
|
25
|
+
|
26
|
+
# OpenSSL 1.1.0 engine constants, taken from:
|
27
|
+
# https://github.com/openssl/openssl/blob/2be8c56a39b0ec2ec5af6ceaf729df154d784a43/include/openssl/crypto.h
|
28
|
+
OPENSSL_INIT_ENGINE_RDRAND = 0x00000200
|
29
|
+
OPENSSL_INIT_ENGINE_DYNAMIC = 0x00000400
|
30
|
+
OPENSSL_INIT_ENGINE_CRYPTODEV = 0x00001000
|
31
|
+
OPENSSL_INIT_ENGINE_CAPI = 0x00002000
|
32
|
+
OPENSSL_INIT_ENGINE_PADLOCK = 0x00004000
|
33
|
+
OPENSSL_INIT_ENGINE_ALL_BUILTIN = (
|
34
|
+
OPENSSL_INIT_ENGINE_RDRAND |
|
35
|
+
OPENSSL_INIT_ENGINE_DYNAMIC |
|
36
|
+
OPENSSL_INIT_ENGINE_CRYPTODEV |
|
37
|
+
OPENSSL_INIT_ENGINE_CAPI |
|
38
|
+
OPENSSL_INIT_ENGINE_PADLOCK
|
39
|
+
)
|
40
|
+
|
41
|
+
# OpenSSL 1.1.0 load strings constant, taken from:
|
42
|
+
# https://github.com/openssl/openssl/blob/c162c126be342b8cd97996346598ecf7db56130f/include/openssl/ssl.h
|
43
|
+
OPENSSL_INIT_LOAD_SSL_STRINGS = 0x00200000
|
44
|
+
|
45
|
+
# This is the very first function we need to use to determine what version
|
46
|
+
# of OpenSSL we are interacting with.
|
47
|
+
begin
|
48
|
+
attach_function :OpenSSL_version_num, [], :ulong
|
49
|
+
rescue FFI::NotFoundError
|
50
|
+
attach_function :SSLeay, [], :long
|
51
|
+
end
|
52
|
+
|
53
|
+
# Returns the version of SSL present.
|
54
|
+
#
|
55
|
+
# @return [Integer] version number as an integer.
|
56
|
+
def self.version
|
57
|
+
if self.respond_to?(:OpenSSL_version_num)
|
58
|
+
OpenSSL_version_num()
|
59
|
+
else
|
60
|
+
SSLeay()
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
if version >= VERSION_1_1_0_NUM
|
65
|
+
# Initialization procedure for the library was changed in OpenSSL 1.1.0
|
66
|
+
attach_function :OPENSSL_init_ssl, [:uint64, :pointer], :int
|
67
|
+
else
|
68
|
+
attach_function :SSL_library_init, [], :int
|
69
|
+
attach_function :ERR_load_crypto_strings, [], :void
|
70
|
+
attach_function :SSL_load_error_strings, [], :void
|
71
|
+
end
|
22
72
|
|
73
|
+
attach_function :RAND_poll, [], :int
|
23
74
|
attach_function :BN_CTX_free, [:pointer], :int
|
24
75
|
attach_function :BN_CTX_new, [], :pointer
|
25
76
|
attach_function :BN_add, [:pointer, :pointer, :pointer], :int
|
@@ -157,7 +208,15 @@ module Eth
|
|
157
208
|
return false if signature.bytesize != 65
|
158
209
|
|
159
210
|
version = signature.unpack('C')[0]
|
211
|
+
|
212
|
+
# Version of signature should be 27 or 28, but 0 and 1 are also possible versions
|
213
|
+
# which can show up in Ledger hardwallet signings
|
214
|
+
if version < 27
|
215
|
+
version += 27
|
216
|
+
end
|
217
|
+
|
160
218
|
v_base = Eth.replayable_v?(version) ? Eth.replayable_chain_id : Eth.v_base
|
219
|
+
|
161
220
|
return false if version < v_base
|
162
221
|
|
163
222
|
recover_public_key_from_signature(hash, signature, (version - v_base), false)
|
@@ -165,9 +224,17 @@ module Eth
|
|
165
224
|
|
166
225
|
def init_ffi_ssl
|
167
226
|
return if @ssl_loaded
|
168
|
-
|
169
|
-
|
170
|
-
|
227
|
+
if version >= VERSION_1_1_0_NUM
|
228
|
+
OPENSSL_init_ssl(
|
229
|
+
OPENSSL_INIT_LOAD_SSL_STRINGS | OPENSSL_INIT_ENGINE_ALL_BUILTIN,
|
230
|
+
nil
|
231
|
+
)
|
232
|
+
else
|
233
|
+
SSL_library_init()
|
234
|
+
ERR_load_crypto_strings()
|
235
|
+
SSL_load_error_strings()
|
236
|
+
end
|
237
|
+
|
171
238
|
RAND_poll()
|
172
239
|
@ssl_loaded = true
|
173
240
|
end
|
data/lib/eth/version.rb
CHANGED
metadata
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steve Ellis
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-03-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name: digest-sha3
|
14
|
+
name: digest-sha3-patched
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
@@ -80,20 +80,6 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 3.0.6
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: bundler
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - "~>"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '1.12'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - "~>"
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '1.12'
|
97
83
|
- !ruby/object:Gem::Dependency
|
98
84
|
name: pry
|
99
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -187,7 +173,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
187
173
|
version: '0'
|
188
174
|
requirements: []
|
189
175
|
rubyforge_project:
|
190
|
-
rubygems_version: 2.
|
176
|
+
rubygems_version: 2.6.8
|
191
177
|
signing_key:
|
192
178
|
specification_version: 4
|
193
179
|
summary: Simple API to sign Ethereum transactions.
|