consttime_memequal 1 → 2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +4 -1
- data/consttime_memequal.gemspec +1 -2
- data/lib/consttime_memequal.rb +6 -5
- metadata +1 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 21438eb0c877ed5159fea334addbc864654eca7a
|
4
|
+
data.tar.gz: dc1bc232c52fa5cdc89a3e47a8b87d85296d96fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c57c1357ddcd0fd13cb2f722b099a3239d41d63556de0e1fc24e7d166b8604f41183d1e752fa3b24cf0ac009f3fcf4a6e49c11ed83d7ac3b40d423d18b7fcae
|
7
|
+
data.tar.gz: f47543711df5e413e6790fb215a1bd1999984df556e0f207f19b2e962467aa0e85ebc3e9221d028ba744b94fceece5bddd2e346f29a66d0dcd63b2ad917bc92f
|
data/Gemfile
CHANGED
data/consttime_memequal.gemspec
CHANGED
@@ -25,7 +25,7 @@
|
|
25
25
|
|
26
26
|
Gem::Specification.new do |spec|
|
27
27
|
spec.name = 'consttime_memequal'
|
28
|
-
spec.version =
|
28
|
+
spec.version = 2
|
29
29
|
spec.author = 'Urabe, Shyouhei'
|
30
30
|
spec.email = 'shyouhei@ruby-lang.org'
|
31
31
|
spec.summary = 'provides consttime_memequal?'
|
@@ -41,5 +41,4 @@ Gem::Specification.new do |spec|
|
|
41
41
|
spec.add_development_dependency 'rake'
|
42
42
|
spec.add_development_dependency 'pry' # used in bin/console
|
43
43
|
spec.required_ruby_version = '>= 2.0.0'
|
44
|
-
spec.add_runtime_dependency 'fiddle'
|
45
44
|
end
|
data/lib/consttime_memequal.rb
CHANGED
@@ -25,7 +25,8 @@
|
|
25
25
|
|
26
26
|
dlsym = lambda do |symbol, lib = 'fiddle'|
|
27
27
|
begin
|
28
|
-
gem lib
|
28
|
+
gem lib if RUBY_VERSION >= '2.3.0'
|
29
|
+
require lib
|
29
30
|
libc = Fiddle.dlopen nil
|
30
31
|
ptr = libc.sym symbol
|
31
32
|
func = Fiddle::Function.new ptr, \
|
@@ -43,7 +44,7 @@ end
|
|
43
44
|
|
44
45
|
case
|
45
46
|
when func = dlsym.call('consttime_memequal') then
|
46
|
-
define_method :consttime_memequal do |this, that, len = this.bytesize|
|
47
|
+
define_method :consttime_memequal? do |this, that, len = this.bytesize|
|
47
48
|
src = Fiddle::Pointer.to_ptr this
|
48
49
|
dst = Fiddle::Pointer.to_ptr that
|
49
50
|
ret = func.call src, dst, len
|
@@ -56,7 +57,7 @@ when func = dlsym.call('consttime_memequal') then
|
|
56
57
|
end
|
57
58
|
|
58
59
|
when func = dlsym.call('timingsafe_memcmp') then
|
59
|
-
define_method :consttime_memequal do |this, that, len = this.bytesize|
|
60
|
+
define_method :consttime_memequal? do |this, that, len = this.bytesize|
|
60
61
|
src = Fiddle::Pointer.to_ptr this
|
61
62
|
dst = Fiddle::Pointer.to_ptr that
|
62
63
|
ret = func.call src, dst, len
|
@@ -64,7 +65,7 @@ when func = dlsym.call('timingsafe_memcmp') then
|
|
64
65
|
end
|
65
66
|
|
66
67
|
when func = dlsym.call('timingsafe_bcmp') then
|
67
|
-
define_method :consttime_memequal do |this, that, len = this.bytesize|
|
68
|
+
define_method :consttime_memequal? do |this, that, len = this.bytesize|
|
68
69
|
src = Fiddle::Pointer.to_ptr this
|
69
70
|
dst = Fiddle::Pointer.to_ptr that
|
70
71
|
ret = func.call src, dst, len
|
@@ -72,7 +73,7 @@ when func = dlsym.call('timingsafe_bcmp') then
|
|
72
73
|
end
|
73
74
|
|
74
75
|
when func = dlsym.call('CRYPTO_memcmp', 'openssl') then
|
75
|
-
define_method :consttime_memequal do |this, that, len = this.bytesize|
|
76
|
+
define_method :consttime_memequal? do |this, that, len = this.bytesize|
|
76
77
|
src = Fiddle::Pointer.to_ptr this
|
77
78
|
dst = Fiddle::Pointer.to_ptr that
|
78
79
|
ret = func.call src, dst, len
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: consttime_memequal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '
|
4
|
+
version: '2'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Urabe, Shyouhei
|
@@ -52,20 +52,6 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: fiddle
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :runtime
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
55
|
description: Wrapper to OS-provided timing-safe memory comparison.
|
70
56
|
email: shyouhei@ruby-lang.org
|
71
57
|
executables: []
|