Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crypto: ED_25519 base x order = infinity? #340

Open
adon-at-work opened this issue Sep 11, 2015 · 3 comments
Open

Crypto: ED_25519 base x order = infinity? #340

adon-at-work opened this issue Sep 11, 2015 · 3 comments

Comments

@adon-at-work
Copy link
Contributor

The following code snippet is copied from https://github.com/google/end-to-end/blob/master/src/javascript/crypto/e2e/ecc/point/curve25519_test.html#L67-L76:

function testCurve25519Order() {
  var params = e2e.ecc.DomainParam.fromCurve(
      e2e.ecc.PrimeCurve.CURVE_25519);
  var base = params.g;
  var order = params.n;
  assertTrue(base.multiply(order).isInfinity());
  assertFalse(base.multiply(order.subtract(e2e.BigNum.ONE)).isInfinity());
}

In short, when I switch to use the e2e.ecc.PrimeCurve.ED_25519 instead of the e2e.ecc.PrimeCurve.CURVE_25519 above, the test case failed.

Expect base.multiply(order).isInfinity() should evaluate to true for both curves.
Any clues? Thanks.

c.c. @andres-erbsen @daniel-ziegler @diracdeltas

@adon-at-work
Copy link
Contributor Author

Realized that such isInfinity() and the infinity point in ED_25519 is different from that of CURVE_25519, and that isIdentity() in ED_25519 fits our need of verifying public key. Some discussions can be found at: YahooArchive/end-to-end#58 (diff)

trying to ping @thaidn, the author of the ecc library. any wisdom/clues?

@thaidn
Copy link

thaidn commented May 1, 2016

Thanks for reporting this bug.

The isInfinity function is wrong. In Ed25519 the Z coordinate is never zero (because the parameter d in the Ed25519 equation is not a square). We're going to remove it. You should use isIdentity instead.

As far as I can tell, this bug doesn't cause any security problems.

@adon-at-work
Copy link
Contributor Author

Thank you. :)

@sirdarckcat sirdarckcat changed the title ED_25519 base x order = infinity? Crypto: ED_25519 base x order = infinity? May 3, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants