ed25519 1.2.1 → 1.3.0

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.
Files changed (56) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGES.md +51 -17
  3. data/LICENSE +1 -1
  4. data/README.md +29 -14
  5. data/ed25519.png +0 -0
  6. data/ext/ed25519_jruby/org/{cryptosphere → cryptorb}/Ed25519Provider.java +1 -1
  7. data/ext/ed25519_ref10/extconf.rb +2 -2
  8. data/ext/ed25519_ref10/fe.c +1085 -0
  9. data/ext/ed25519_ref10/ge.c +407 -0
  10. data/lib/ed25519/verify_key.rb +2 -1
  11. data/lib/ed25519/version.rb +1 -1
  12. data/lib/ed25519.rb +8 -8
  13. data/lib/ed25519_jruby.jar +0 -0
  14. metadata +23 -60
  15. data/.gitignore +0 -16
  16. data/.rspec +0 -5
  17. data/.rubocop.yml +0 -35
  18. data/.travis.yml +0 -15
  19. data/CODE_OF_CONDUCT.md +0 -74
  20. data/Gemfile +0 -12
  21. data/Rakefile +0 -27
  22. data/ed25519.gemspec +0 -32
  23. data/ext/ed25519_ref10/fe_0.c +0 -19
  24. data/ext/ed25519_ref10/fe_1.c +0 -19
  25. data/ext/ed25519_ref10/fe_add.c +0 -57
  26. data/ext/ed25519_ref10/fe_cmov.c +0 -63
  27. data/ext/ed25519_ref10/fe_copy.c +0 -29
  28. data/ext/ed25519_ref10/fe_frombytes.c +0 -71
  29. data/ext/ed25519_ref10/fe_invert.c +0 -14
  30. data/ext/ed25519_ref10/fe_isnegative.c +0 -16
  31. data/ext/ed25519_ref10/fe_isnonzero.c +0 -19
  32. data/ext/ed25519_ref10/fe_mul.c +0 -252
  33. data/ext/ed25519_ref10/fe_neg.c +0 -45
  34. data/ext/ed25519_ref10/fe_pow22523.c +0 -13
  35. data/ext/ed25519_ref10/fe_sq.c +0 -148
  36. data/ext/ed25519_ref10/fe_sq2.c +0 -159
  37. data/ext/ed25519_ref10/fe_sub.c +0 -57
  38. data/ext/ed25519_ref10/fe_tobytes.c +0 -119
  39. data/ext/ed25519_ref10/ge_add.c +0 -11
  40. data/ext/ed25519_ref10/ge_double_scalarmult.c +0 -96
  41. data/ext/ed25519_ref10/ge_frombytes.c +0 -50
  42. data/ext/ed25519_ref10/ge_madd.c +0 -11
  43. data/ext/ed25519_ref10/ge_msub.c +0 -11
  44. data/ext/ed25519_ref10/ge_p1p1_to_p2.c +0 -12
  45. data/ext/ed25519_ref10/ge_p1p1_to_p3.c +0 -13
  46. data/ext/ed25519_ref10/ge_p2_0.c +0 -8
  47. data/ext/ed25519_ref10/ge_p2_dbl.c +0 -11
  48. data/ext/ed25519_ref10/ge_p3_0.c +0 -9
  49. data/ext/ed25519_ref10/ge_p3_dbl.c +0 -12
  50. data/ext/ed25519_ref10/ge_p3_to_cached.c +0 -17
  51. data/ext/ed25519_ref10/ge_p3_to_p2.c +0 -12
  52. data/ext/ed25519_ref10/ge_p3_tobytes.c +0 -14
  53. data/ext/ed25519_ref10/ge_precomp_0.c +0 -8
  54. data/ext/ed25519_ref10/ge_scalarmult_base.c +0 -104
  55. data/ext/ed25519_ref10/ge_sub.c +0 -11
  56. data/ext/ed25519_ref10/ge_tobytes.c +0 -14
data/.travis.yml DELETED
@@ -1,15 +0,0 @@
1
- language: ruby
2
-
3
- rvm:
4
- - jruby-9.1.15.0
5
- - 2
6
- - 2.1
7
- - 2.2
8
- - 2.3.6
9
- - 2.4.3
10
-
11
- before_install: gem install bundler -v 1.16.0
12
-
13
- branches:
14
- only:
15
- - master
data/CODE_OF_CONDUCT.md DELETED
@@ -1,74 +0,0 @@
1
- # Contributor Covenant Code of Conduct
2
-
3
- ## Our Pledge
4
-
5
- In the interest of fostering an open and welcoming environment, we as
6
- contributors and maintainers pledge to making participation in our project and
7
- our community a harassment-free experience for everyone, regardless of age, body
8
- size, disability, ethnicity, gender identity and expression, level of experience,
9
- nationality, personal appearance, race, religion, or sexual identity and
10
- orientation.
11
-
12
- ## Our Standards
13
-
14
- Examples of behavior that contributes to creating a positive environment
15
- include:
16
-
17
- * Using welcoming and inclusive language
18
- * Being respectful of differing viewpoints and experiences
19
- * Gracefully accepting constructive criticism
20
- * Focusing on what is best for the community
21
- * Showing empathy towards other community members
22
-
23
- Examples of unacceptable behavior by participants include:
24
-
25
- * The use of sexualized language or imagery and unwelcome sexual attention or
26
- advances
27
- * Trolling, insulting/derogatory comments, and personal or political attacks
28
- * Public or private harassment
29
- * Publishing others' private information, such as a physical or electronic
30
- address, without explicit permission
31
- * Other conduct which could reasonably be considered inappropriate in a
32
- professional setting
33
-
34
- ## Our Responsibilities
35
-
36
- Project maintainers are responsible for clarifying the standards of acceptable
37
- behavior and are expected to take appropriate and fair corrective action in
38
- response to any instances of unacceptable behavior.
39
-
40
- Project maintainers have the right and responsibility to remove, edit, or
41
- reject comments, commits, code, wiki edits, issues, and other contributions
42
- that are not aligned to this Code of Conduct, or to ban temporarily or
43
- permanently any contributor for other behaviors that they deem inappropriate,
44
- threatening, offensive, or harmful.
45
-
46
- ## Scope
47
-
48
- This Code of Conduct applies both within project spaces and in public spaces
49
- when an individual is representing the project or its community. Examples of
50
- representing a project or community include using an official project e-mail
51
- address, posting via an official social media account, or acting as an appointed
52
- representative at an online or offline event. Representation of a project may be
53
- further defined and clarified by project maintainers.
54
-
55
- ## Enforcement
56
-
57
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
- reported by contacting the project team at bascule@gmail.com. All
59
- complaints will be reviewed and investigated and will result in a response that
60
- is deemed necessary and appropriate to the circumstances. The project team is
61
- obligated to maintain confidentiality with regard to the reporter of an incident.
62
- Further details of specific enforcement policies may be posted separately.
63
-
64
- Project maintainers who do not follow or enforce the Code of Conduct in good
65
- faith may face temporary or permanent repercussions as determined by other
66
- members of the project's leadership.
67
-
68
- ## Attribution
69
-
70
- This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
- available at [http://contributor-covenant.org/version/1/4][version]
72
-
73
- [homepage]: http://contributor-covenant.org
74
- [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile DELETED
@@ -1,12 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source "https://rubygems.org"
4
-
5
- gemspec
6
-
7
- group :development, :test do
8
- gem "rake", require: false
9
- gem "rake-compiler", "~> 1.0", require: false
10
- gem "rspec", "~> 3.7", require: false
11
- gem "rubocop", "0.50.0", require: false
12
- end
data/Rakefile DELETED
@@ -1,27 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "bundler/gem_tasks"
4
-
5
- require "rake/clean"
6
- CLEAN.include("**/*.o", "**/*.so", "**/*.bundle", "*.jar", "pkg", "tmp")
7
-
8
- if defined? JRUBY_VERSION
9
- require "rake/javaextensiontask"
10
- Rake::JavaExtensionTask.new("ed25519_jruby") do |ext|
11
- ext.ext_dir = "ext/ed25519_jruby"
12
- end
13
- else
14
- require "rake/extensiontask"
15
-
16
- Rake::ExtensionTask.new("ed25519_ref10") do |ext|
17
- ext.ext_dir = "ext/ed25519_ref10"
18
- end
19
- end
20
-
21
- require "rspec/core/rake_task"
22
- RSpec::Core::RakeTask.new
23
-
24
- require "rubocop/rake_task"
25
- RuboCop::RakeTask.new
26
-
27
- task default: %w[compile spec rubocop]
data/ed25519.gemspec DELETED
@@ -1,32 +0,0 @@
1
-
2
- # frozen_string_literal: true
3
-
4
- require File.expand_path("lib/ed25519/version", __dir__)
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = "ed25519"
8
- spec.version = Ed25519::VERSION
9
- spec.authors = ["Tony Arcieri"]
10
- spec.email = ["tony.arcieri@gmail.com"]
11
- spec.summary = "An efficient digital signature library providing the Ed25519 algorithm"
12
- spec.description = <<-DESCRIPTION.strip.gsub(/\s+/, " ")
13
- A Ruby binding to the Ed25519 elliptic curve public-key signature system
14
- described in RFC 8032.
15
- DESCRIPTION
16
- spec.homepage = "https://github.com/cryptosphere/ed25519"
17
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
- spec.bindir = "exe"
19
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
- spec.require_paths = ["lib"]
21
-
22
- if defined? JRUBY_VERSION
23
- spec.platform = "jruby"
24
- spec.files << "lib/ed25519_java.jar"
25
- else
26
- spec.platform = Gem::Platform::RUBY
27
- spec.extensions = ["ext/ed25519_ref10/extconf.rb"]
28
- end
29
-
30
- spec.required_ruby_version = ">= 2.0.0"
31
- spec.add_development_dependency "bundler", "~> 1.16"
32
- end
@@ -1,19 +0,0 @@
1
- #include "fe.h"
2
-
3
- /*
4
- h = 0
5
- */
6
-
7
- void fe_0(fe h)
8
- {
9
- h[0] = 0;
10
- h[1] = 0;
11
- h[2] = 0;
12
- h[3] = 0;
13
- h[4] = 0;
14
- h[5] = 0;
15
- h[6] = 0;
16
- h[7] = 0;
17
- h[8] = 0;
18
- h[9] = 0;
19
- }
@@ -1,19 +0,0 @@
1
- #include "fe.h"
2
-
3
- /*
4
- h = 1
5
- */
6
-
7
- void fe_1(fe h)
8
- {
9
- h[0] = 1;
10
- h[1] = 0;
11
- h[2] = 0;
12
- h[3] = 0;
13
- h[4] = 0;
14
- h[5] = 0;
15
- h[6] = 0;
16
- h[7] = 0;
17
- h[8] = 0;
18
- h[9] = 0;
19
- }
@@ -1,57 +0,0 @@
1
- #include "fe.h"
2
-
3
- /*
4
- h = f + g
5
- Can overlap h with f or g.
6
-
7
- Preconditions:
8
- |f| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc.
9
- |g| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc.
10
-
11
- Postconditions:
12
- |h| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc.
13
- */
14
-
15
- void fe_add(fe h,const fe f,const fe g)
16
- {
17
- int32_t f0 = f[0];
18
- int32_t f1 = f[1];
19
- int32_t f2 = f[2];
20
- int32_t f3 = f[3];
21
- int32_t f4 = f[4];
22
- int32_t f5 = f[5];
23
- int32_t f6 = f[6];
24
- int32_t f7 = f[7];
25
- int32_t f8 = f[8];
26
- int32_t f9 = f[9];
27
- int32_t g0 = g[0];
28
- int32_t g1 = g[1];
29
- int32_t g2 = g[2];
30
- int32_t g3 = g[3];
31
- int32_t g4 = g[4];
32
- int32_t g5 = g[5];
33
- int32_t g6 = g[6];
34
- int32_t g7 = g[7];
35
- int32_t g8 = g[8];
36
- int32_t g9 = g[9];
37
- int32_t h0 = f0 + g0;
38
- int32_t h1 = f1 + g1;
39
- int32_t h2 = f2 + g2;
40
- int32_t h3 = f3 + g3;
41
- int32_t h4 = f4 + g4;
42
- int32_t h5 = f5 + g5;
43
- int32_t h6 = f6 + g6;
44
- int32_t h7 = f7 + g7;
45
- int32_t h8 = f8 + g8;
46
- int32_t h9 = f9 + g9;
47
- h[0] = h0;
48
- h[1] = h1;
49
- h[2] = h2;
50
- h[3] = h3;
51
- h[4] = h4;
52
- h[5] = h5;
53
- h[6] = h6;
54
- h[7] = h7;
55
- h[8] = h8;
56
- h[9] = h9;
57
- }
@@ -1,63 +0,0 @@
1
- #include "fe.h"
2
-
3
- /*
4
- Replace (f,g) with (g,g) if b == 1;
5
- replace (f,g) with (f,g) if b == 0.
6
-
7
- Preconditions: b in {0,1}.
8
- */
9
-
10
- void fe_cmov(fe f,const fe g,unsigned int b)
11
- {
12
- int32_t f0 = f[0];
13
- int32_t f1 = f[1];
14
- int32_t f2 = f[2];
15
- int32_t f3 = f[3];
16
- int32_t f4 = f[4];
17
- int32_t f5 = f[5];
18
- int32_t f6 = f[6];
19
- int32_t f7 = f[7];
20
- int32_t f8 = f[8];
21
- int32_t f9 = f[9];
22
- int32_t g0 = g[0];
23
- int32_t g1 = g[1];
24
- int32_t g2 = g[2];
25
- int32_t g3 = g[3];
26
- int32_t g4 = g[4];
27
- int32_t g5 = g[5];
28
- int32_t g6 = g[6];
29
- int32_t g7 = g[7];
30
- int32_t g8 = g[8];
31
- int32_t g9 = g[9];
32
- int32_t x0 = f0 ^ g0;
33
- int32_t x1 = f1 ^ g1;
34
- int32_t x2 = f2 ^ g2;
35
- int32_t x3 = f3 ^ g3;
36
- int32_t x4 = f4 ^ g4;
37
- int32_t x5 = f5 ^ g5;
38
- int32_t x6 = f6 ^ g6;
39
- int32_t x7 = f7 ^ g7;
40
- int32_t x8 = f8 ^ g8;
41
- int32_t x9 = f9 ^ g9;
42
- b = -b;
43
- x0 &= b;
44
- x1 &= b;
45
- x2 &= b;
46
- x3 &= b;
47
- x4 &= b;
48
- x5 &= b;
49
- x6 &= b;
50
- x7 &= b;
51
- x8 &= b;
52
- x9 &= b;
53
- f[0] = f0 ^ x0;
54
- f[1] = f1 ^ x1;
55
- f[2] = f2 ^ x2;
56
- f[3] = f3 ^ x3;
57
- f[4] = f4 ^ x4;
58
- f[5] = f5 ^ x5;
59
- f[6] = f6 ^ x6;
60
- f[7] = f7 ^ x7;
61
- f[8] = f8 ^ x8;
62
- f[9] = f9 ^ x9;
63
- }
@@ -1,29 +0,0 @@
1
- #include "fe.h"
2
-
3
- /*
4
- h = f
5
- */
6
-
7
- void fe_copy(fe h,const fe f)
8
- {
9
- int32_t f0 = f[0];
10
- int32_t f1 = f[1];
11
- int32_t f2 = f[2];
12
- int32_t f3 = f[3];
13
- int32_t f4 = f[4];
14
- int32_t f5 = f[5];
15
- int32_t f6 = f[6];
16
- int32_t f7 = f[7];
17
- int32_t f8 = f[8];
18
- int32_t f9 = f[9];
19
- h[0] = f0;
20
- h[1] = f1;
21
- h[2] = f2;
22
- h[3] = f3;
23
- h[4] = f4;
24
- h[5] = f5;
25
- h[6] = f6;
26
- h[7] = f7;
27
- h[8] = f8;
28
- h[9] = f9;
29
- }
@@ -1,71 +0,0 @@
1
- #include "fe.h"
2
-
3
- static uint64_t load_3(const unsigned char *in)
4
- {
5
- uint64_t result;
6
- result = (uint64_t) in[0];
7
- result |= ((uint64_t) in[1]) << 8;
8
- result |= ((uint64_t) in[2]) << 16;
9
- return result;
10
- }
11
-
12
- static uint64_t load_4(const unsigned char *in)
13
- {
14
- uint64_t result;
15
- result = (uint64_t) in[0];
16
- result |= ((uint64_t) in[1]) << 8;
17
- result |= ((uint64_t) in[2]) << 16;
18
- result |= ((uint64_t) in[3]) << 24;
19
- return result;
20
- }
21
-
22
- /*
23
- Ignores top bit of h.
24
- */
25
-
26
- void fe_frombytes(fe h,const unsigned char *s)
27
- {
28
- int64_t h0 = load_4(s);
29
- int64_t h1 = load_3(s + 4) << 6;
30
- int64_t h2 = load_3(s + 7) << 5;
31
- int64_t h3 = load_3(s + 10) << 3;
32
- int64_t h4 = load_3(s + 13) << 2;
33
- int64_t h5 = load_4(s + 16);
34
- int64_t h6 = load_3(s + 20) << 7;
35
- int64_t h7 = load_3(s + 23) << 5;
36
- int64_t h8 = load_3(s + 26) << 4;
37
- int64_t h9 = (load_3(s + 29) & 8388607) << 2;
38
- int64_t carry0;
39
- int64_t carry1;
40
- int64_t carry2;
41
- int64_t carry3;
42
- int64_t carry4;
43
- int64_t carry5;
44
- int64_t carry6;
45
- int64_t carry7;
46
- int64_t carry8;
47
- int64_t carry9;
48
-
49
- carry9 = (h9 + (int64_t) (1<<24)) >> 25; h0 += carry9 * 19; h9 -= carry9 << 25;
50
- carry1 = (h1 + (int64_t) (1<<24)) >> 25; h2 += carry1; h1 -= carry1 << 25;
51
- carry3 = (h3 + (int64_t) (1<<24)) >> 25; h4 += carry3; h3 -= carry3 << 25;
52
- carry5 = (h5 + (int64_t) (1<<24)) >> 25; h6 += carry5; h5 -= carry5 << 25;
53
- carry7 = (h7 + (int64_t) (1<<24)) >> 25; h8 += carry7; h7 -= carry7 << 25;
54
-
55
- carry0 = (h0 + (int64_t) (1<<25)) >> 26; h1 += carry0; h0 -= carry0 << 26;
56
- carry2 = (h2 + (int64_t) (1<<25)) >> 26; h3 += carry2; h2 -= carry2 << 26;
57
- carry4 = (h4 + (int64_t) (1<<25)) >> 26; h5 += carry4; h4 -= carry4 << 26;
58
- carry6 = (h6 + (int64_t) (1<<25)) >> 26; h7 += carry6; h6 -= carry6 << 26;
59
- carry8 = (h8 + (int64_t) (1<<25)) >> 26; h9 += carry8; h8 -= carry8 << 26;
60
-
61
- h[0] = (int32_t)h0;
62
- h[1] = (int32_t)h1;
63
- h[2] = (int32_t)h2;
64
- h[3] = (int32_t)h3;
65
- h[4] = (int32_t)h4;
66
- h[5] = (int32_t)h5;
67
- h[6] = (int32_t)h6;
68
- h[7] = (int32_t)h7;
69
- h[8] = (int32_t)h8;
70
- h[9] = (int32_t)h9;
71
- }
@@ -1,14 +0,0 @@
1
- #include "fe.h"
2
-
3
- void fe_invert(fe out,const fe z)
4
- {
5
- fe t0;
6
- fe t1;
7
- fe t2;
8
- fe t3;
9
- int i;
10
-
11
- #include "pow225521.h"
12
-
13
- return;
14
- }
@@ -1,16 +0,0 @@
1
- #include "fe.h"
2
-
3
- /*
4
- return 1 if f is in {1,3,5,...,q-2}
5
- return 0 if f is in {0,2,4,...,q-1}
6
-
7
- Preconditions:
8
- |f| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc.
9
- */
10
-
11
- int fe_isnegative(const fe f)
12
- {
13
- unsigned char s[32];
14
- fe_tobytes(s,f);
15
- return s[0] & 1;
16
- }
@@ -1,19 +0,0 @@
1
- #include "fe.h"
2
- #include "ed25519_ref10.h"
3
-
4
- /*
5
- return 1 if f == 0
6
- return 0 if f != 0
7
-
8
- Preconditions:
9
- |f| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc.
10
- */
11
-
12
- static const unsigned char zero[32];
13
-
14
- int fe_isnonzero(const fe f)
15
- {
16
- unsigned char s[32];
17
- fe_tobytes(s,f);
18
- return crypto_verify_32(s,zero);
19
- }