tink: [android] [throwable] arithmetic error in scalar multiplication

we use Tink-Android to generate keyPair and sign our information. it work well in common case. but there is a crash in Android device M1 E when we use

Ed25519Sign(private_key)

and we find the throwable is

   // This check is to protect against flaws, i.e. if there is a computation error through a
    // faulty CPU or if the implementation contains a bug.
    XYZ result = new XYZ(ret);
    if (!result.isOnCurve()) {
      throw new IllegalStateException("arithmetic error in scalar multiplication");
    }

https://github.com/google/tink/blob/09fc71c45dc7c4ecc7fb0df3414b0fb3a9ca52c3/java/src/main/java/com/google/crypto/tink/subtle/Ed25519.java#L626

Android version: 7.0 cpu: Helio P10 gpu: ARM Mali-T860 Tink-Android Version: 1.2.2

Is there anyone can help me ? thanks !

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 24 (13 by maintainers)

Commits related to this issue

Most upvoted comments

We spend the afternoon debugging, and found the issue: the isOnCurve check did not reduce the coefficients before comparing.

The good news is that this isn’t a vulnerability, it merely means our test to check that our math was correct was a bit overeager. Fix will be out soon.

Although we have a mitigation in place in our own code for this, we’d really like to upgrade to a release that includes this fix. Can I help with getting a 1.2.3 or 1.3.0 release out?

This should be fixed at HEAD and will be included in 1.3.0 release. We may also backport it to 1.2.3.

1.3.0-RC3 is out. It should work as well as 1.3.0-RC2.

Thanks @chuckx. We updated to 1.3.0-rc2 and have been using it in production for five days now - and we’ve not seen any recurrences of this issue. We’ll update to newer release candidates/releases as they become ready too.