x25519 1.0.5 → 1.0.9
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/.github/workflows/ci.yml +42 -0
- data/.rubocop.yml +1 -1
- data/CHANGELOG.md +90 -0
- data/Gemfile +2 -2
- data/LICENSE +32 -165
- data/README.md +35 -18
- data/ext/x25519_precomputed/extconf.rb +1 -1
- data/ext/x25519_precomputed/fp25519_x64.c +865 -746
- data/ext/x25519_precomputed/fp25519_x64.h +89 -54
- data/ext/x25519_precomputed/table_ladder_x25519.h +534 -267
- data/ext/x25519_precomputed/x25519_precomputed.h +33 -12
- data/ext/x25519_precomputed/x25519_x64.c +237 -217
- data/lib/x25519.rb +3 -2
- data/lib/x25519/montgomery_u.rb +1 -1
- data/lib/x25519/scalar.rb +1 -0
- data/lib/x25519/version.rb +1 -1
- data/x25519.gemspec +5 -5
- metadata +15 -16
- data/.travis.yml +0 -21
- data/CHANGES.md +0 -61
- data/appveyor.yml +0 -20
data/lib/x25519.rb
CHANGED
@@ -72,6 +72,7 @@ module X25519
|
|
72
72
|
def validate_key_bytes(key_bytes)
|
73
73
|
raise TypeError, "expected String, got #{key_bytes.class}" unless key_bytes.is_a?(String)
|
74
74
|
return true if key_bytes.bytesize == KEY_SIZE
|
75
|
+
|
75
76
|
raise ArgumentError, "expected #{KEY_SIZE}-byte String, got #{key_bytes.bytesize}"
|
76
77
|
end
|
77
78
|
|
@@ -79,12 +80,12 @@ module X25519
|
|
79
80
|
def self_test
|
80
81
|
X25519::TestVectors::VARIABLE_BASE.each do |v|
|
81
82
|
shared_secret = provider.scalarmult([v.scalar].pack("H*"), [v.input_coord].pack("H*"))
|
82
|
-
raise SelfTestFailure, "self test failed!" unless shared_secret.
|
83
|
+
raise SelfTestFailure, "self test failed!" unless shared_secret.unpack1("H*") == v.output_coord
|
83
84
|
end
|
84
85
|
|
85
86
|
X25519::TestVectors::FIXED_BASE.each do |v|
|
86
87
|
public_key = provider.scalarmult_base([v.scalar].pack("H*"))
|
87
|
-
raise SelfTestFailure, "self test failed!" unless public_key.
|
88
|
+
raise SelfTestFailure, "self test failed!" unless public_key.unpack1("H*") == v.output_coord
|
88
89
|
end
|
89
90
|
|
90
91
|
true
|
data/lib/x25519/montgomery_u.rb
CHANGED
data/lib/x25519/scalar.rb
CHANGED
@@ -28,6 +28,7 @@ module X25519
|
|
28
28
|
# @return [X25519::MontgomeryU] resulting point (i.e. D-H shared secret)
|
29
29
|
def diffie_hellman(montgomery_u)
|
30
30
|
raise TypeError, "expected X25519::MontgomeryU, got #{montgomery_u}" unless montgomery_u.is_a?(MontgomeryU)
|
31
|
+
|
31
32
|
MontgomeryU.new(X25519.diffie_hellman(@scalar_bytes, montgomery_u.to_bytes))
|
32
33
|
end
|
33
34
|
alias multiply diffie_hellman
|
data/lib/x25519/version.rb
CHANGED
data/x25519.gemspec
CHANGED
@@ -7,14 +7,14 @@ Gem::Specification.new do |spec|
|
|
7
7
|
spec.version = X25519::VERSION
|
8
8
|
spec.authors = ["Tony Arcieri"]
|
9
9
|
spec.email = ["bascule@gmail.com"]
|
10
|
-
spec.summary = "Public key cryptography library providing the X25519
|
10
|
+
spec.summary = "Public key cryptography library providing the X25519 Elliptic Curve Diffie-Hellman function"
|
11
11
|
spec.description = <<-DESCRIPTION.strip.gsub(/\s+/, " ")
|
12
12
|
An efficient public key cryptography library for Ruby providing key
|
13
13
|
exchange/agreement via the X25519 (a.k.a. Curve25519) Elliptic Curve
|
14
14
|
Diffie-Hellman function as described in RFC 7748.
|
15
15
|
DESCRIPTION
|
16
|
-
spec.homepage = "https://github.com/
|
17
|
-
spec.license = "
|
16
|
+
spec.homepage = "https://github.com/RubyCrypto/x25519"
|
17
|
+
spec.license = "BSD-3-Clause" # https://spdx.org/licenses/BSD-3-Clause.html
|
18
18
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
19
19
|
spec.bindir = "exe"
|
20
20
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
@@ -22,6 +22,6 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.platform = Gem::Platform::RUBY
|
23
23
|
spec.extensions = ["ext/x25519_precomputed/extconf.rb", "ext/x25519_ref10/extconf.rb"]
|
24
24
|
|
25
|
-
spec.required_ruby_version = ">= 2.
|
26
|
-
spec.add_development_dependency "bundler", "~> 1
|
25
|
+
spec.required_ruby_version = ">= 2.5"
|
26
|
+
spec.add_development_dependency "bundler", "~> 2.1"
|
27
27
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: x25519
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tony Arcieri
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-08-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1
|
19
|
+
version: '2.1'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1
|
26
|
+
version: '2.1'
|
27
27
|
description: An efficient public key cryptography library for Ruby providing key exchange/agreement
|
28
28
|
via the X25519 (a.k.a. Curve25519) Elliptic Curve Diffie-Hellman function as described
|
29
29
|
in RFC 7748.
|
@@ -35,17 +35,16 @@ extensions:
|
|
35
35
|
- ext/x25519_ref10/extconf.rb
|
36
36
|
extra_rdoc_files: []
|
37
37
|
files:
|
38
|
+
- ".github/workflows/ci.yml"
|
38
39
|
- ".gitignore"
|
39
40
|
- ".rspec"
|
40
41
|
- ".rubocop.yml"
|
41
|
-
-
|
42
|
-
- CHANGES.md
|
42
|
+
- CHANGELOG.md
|
43
43
|
- CODE_OF_CONDUCT.md
|
44
44
|
- Gemfile
|
45
45
|
- LICENSE
|
46
46
|
- README.md
|
47
47
|
- Rakefile
|
48
|
-
- appveyor.yml
|
49
48
|
- ext/x25519_precomputed/cputest.c
|
50
49
|
- ext/x25519_precomputed/extconf.rb
|
51
50
|
- ext/x25519_precomputed/fp25519_x64.c
|
@@ -70,11 +69,11 @@ files:
|
|
70
69
|
- lib/x25519/test_vectors.rb
|
71
70
|
- lib/x25519/version.rb
|
72
71
|
- x25519.gemspec
|
73
|
-
homepage: https://github.com/
|
72
|
+
homepage: https://github.com/RubyCrypto/x25519
|
74
73
|
licenses:
|
75
|
-
-
|
74
|
+
- BSD-3-Clause
|
76
75
|
metadata: {}
|
77
|
-
post_install_message:
|
76
|
+
post_install_message:
|
78
77
|
rdoc_options: []
|
79
78
|
require_paths:
|
80
79
|
- lib
|
@@ -82,16 +81,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
82
81
|
requirements:
|
83
82
|
- - ">="
|
84
83
|
- !ruby/object:Gem::Version
|
85
|
-
version: 2.
|
84
|
+
version: '2.5'
|
86
85
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
86
|
requirements:
|
88
87
|
- - ">="
|
89
88
|
- !ruby/object:Gem::Version
|
90
89
|
version: '0'
|
91
90
|
requirements: []
|
92
|
-
|
93
|
-
|
94
|
-
signing_key:
|
91
|
+
rubygems_version: 3.0.3
|
92
|
+
signing_key:
|
95
93
|
specification_version: 4
|
96
|
-
summary: Public key cryptography library providing the X25519
|
94
|
+
summary: Public key cryptography library providing the X25519 Elliptic Curve Diffie-Hellman
|
95
|
+
function
|
97
96
|
test_files: []
|
data/.travis.yml
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
cache: bundler
|
3
|
-
|
4
|
-
before_install:
|
5
|
-
- gem update --system
|
6
|
-
- gem --version
|
7
|
-
- gem install bundler -v 1.16.1
|
8
|
-
- bundle --version
|
9
|
-
|
10
|
-
rvm:
|
11
|
-
- 2.2
|
12
|
-
- 2.3
|
13
|
-
- 2.4.3
|
14
|
-
- 2.5.0
|
15
|
-
|
16
|
-
matrix:
|
17
|
-
fast_finish: true
|
18
|
-
|
19
|
-
branches:
|
20
|
-
only:
|
21
|
-
- master
|
data/CHANGES.md
DELETED
@@ -1,61 +0,0 @@
|
|
1
|
-
# [1.0.5] (2017-12-31)
|
2
|
-
|
3
|
-
[1.0.5]: https://github.com/crypto-rb/x25519/compare/v1.0.4...v1.0.5
|
4
|
-
|
5
|
-
* [#15](https://github.com/crypto-rb/x25519/pull/15)
|
6
|
-
RuboCop 0.52.1
|
7
|
-
|
8
|
-
* [#14](https://github.com/crypto-rb/x25519/pull/14)
|
9
|
-
`ext/x25519_ref10`: Consolidate all field element code into fe.c
|
10
|
-
|
11
|
-
# [1.0.4] (2017-12-31)
|
12
|
-
|
13
|
-
[1.0.4]: https://github.com/crypto-rb/x25519/compare/v1.0.3...v1.0.4
|
14
|
-
|
15
|
-
* [#13](https://github.com/crypto-rb/x25519/pull/13)
|
16
|
-
Test against Ruby 2.5.0
|
17
|
-
|
18
|
-
* [#12](https://github.com/crypto-rb/x25519/pull/12)
|
19
|
-
Move project to the crypto-rb GitHub organization
|
20
|
-
|
21
|
-
# [1.0.3] (2017-12-13)
|
22
|
-
|
23
|
-
[1.0.3]: https://github.com/crypto-rb/x25519/compare/v1.0.2...v1.0.3
|
24
|
-
|
25
|
-
* [#10](https://github.com/crypto-rb/x25519/pull/10)
|
26
|
-
Detect degenerate (i.e. all-zero) public keys (fixes #6)
|
27
|
-
|
28
|
-
# [1.0.2] (2017-12-13)
|
29
|
-
|
30
|
-
[1.0.2]: https://github.com/crypto-rb/x25519/compare/v1.0.1...v1.0.2
|
31
|
-
|
32
|
-
* [#9](https://github.com/crypto-rb/x25519/pull/9)
|
33
|
-
Make `X25519.provider` an `attr_accessor`
|
34
|
-
* Raise `X25519::SelfTestFailure` when self-test fails
|
35
|
-
|
36
|
-
# [1.0.1] (2017-12-12)
|
37
|
-
|
38
|
-
[1.0.1]: https://github.com/crypto-rb/x25519/compare/v1.0.0...v1.0.1
|
39
|
-
|
40
|
-
* Have `X25519.self_test` return true on success
|
41
|
-
|
42
|
-
# [1.0.0] (2017-12-12)
|
43
|
-
|
44
|
-
[1.0.0]: https://github.com/crypto-rb/x25519/compare/v0.2.0...v1.0.0
|
45
|
-
|
46
|
-
* [#8](https://github.com/crypto-rb/x25519/pull/8)
|
47
|
-
Add self-test
|
48
|
-
|
49
|
-
* [#7](https://github.com/crypto-rb/x25519/pull/7)
|
50
|
-
Factor providers into the `X25519::Provider` namespace
|
51
|
-
|
52
|
-
# [0.2.0] (2017-12-12)
|
53
|
-
|
54
|
-
[0.2.0]: https://github.com/crypto-rb/x25519/compare/v0.1.0...v0.2.0
|
55
|
-
|
56
|
-
* [#5](https://github.com/crypto-rb/x25519/pull/5)
|
57
|
-
Rewrite gem in Ruby with minimal native extensions
|
58
|
-
|
59
|
-
# 0.1.0 (2017-12-11)
|
60
|
-
|
61
|
-
* Initial release
|
data/appveyor.yml
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
branches:
|
2
|
-
only:
|
3
|
-
- master
|
4
|
-
|
5
|
-
environment:
|
6
|
-
PATH: C:\Ruby%RUBY_VERSION%\DevKit\mingw\bin;C:\Ruby%RUBY_VERSION%\bin;C:\Ruby%RUBY_VERSION%\DevKit\bin;%PATH%
|
7
|
-
matrix:
|
8
|
-
- RUBY_VERSION: "22-x64"
|
9
|
-
- RUBY_VERSION: "23-x64"
|
10
|
-
- RUBY_VERSION: "24-x64"
|
11
|
-
|
12
|
-
build: off
|
13
|
-
|
14
|
-
test_script:
|
15
|
-
- SET RAKEOPT=-rdevkit
|
16
|
-
- ruby -v
|
17
|
-
- gem -v
|
18
|
-
- bundle -v
|
19
|
-
- bundle
|
20
|
-
- bundle exec rake compile spec
|