tink icon indicating copy to clipboard operation
tink copied to clipboard

java.lang.IllegalStateException: Arithmetic error in curve multiplication with the public key

Open dmpatel151282 opened this issue 4 years ago • 9 comments

We are using Tink-Android 1.4 version of library in Android project.

Here are the device details.

Android version: 7.0 cpu: MediaTek MT6737 gpu: ARM Mali-T720 Tink-Android Version: 1.4.0

We are facing above issue in this Android device only.

Stack trace: W/System.err: java.lang.IllegalStateException: Arithmetic error in curve multiplication with the public key: e9613cc69b61dc962fd0ab7ef185fd94e7e278d0775a2ac5df93dba804474c0d W/System.err: at com.google.crypto.tink.subtle.Curve25519.curveMult(Curve25519.java:332) W/System.err: at com.google.crypto.tink.subtle.X25519.computeSharedSecret(X25519.java:103)

Please help us to solve it.

dmpatel151282 avatar Jul 31 '20 12:07 dmpatel151282

Thanks for the report. Is it possible to share the private key? We need both parameters of com.google.crypto.tink.subtle.X25519.computeSharedSecret.

thaidn avatar Jul 31 '20 16:07 thaidn

Sorry for late reply.

Here are both parameters.

privateKey byte[]: [-41, 31, -70, 113, 57, -124, 109, 102, 91, 50, 64, 33, 43, -82, 124, -48, -74, -92, -92, 45, -16, -2, 43, -77, -116, -16, -18, 86, 18, 20, 41, -124] privateKey Hex: D71FBA7139846D665B3240212BAE7CD0B6A4A42DF0FE2BB38CF0EE5612142984

publicKey byte[]: [-40, -16, 59, -76, -92, 23, -22, -84, -108, -122, 57, -80, 66, 26, 52, -86, -83, -33, 9, 5, 115, -47, 33, 30, 27, 126, 39, 27, 67, -51, -96, 92] publicKey Hex: D8F03BB4A417EAAC948639B0421A34AAADDF090573D1211E1B7E271B43CDA05C

dmpatel151282 avatar Aug 04 '20 03:08 dmpatel151282

Any update???

dmpatel151282 avatar Aug 08 '20 03:08 dmpatel151282

We've been trying to reproduce it, but without any luck so far.

sophieschmieg avatar Aug 08 '20 23:08 sophieschmieg

@dmpatel151282 did you encounter this failure on an ASUS ZenFone 3 MAX (ZC520TL) running Android 7.0 Nougat? Another user reported the same failure on this phone, which has the same CPU and GPU as your phone. They wrote:

I've narrowed down the issue to the execution of the following function, on line 294, when i == 3 && j == 7: monty(nqx2, nqz2, nqpqx2, nqpqz2, nqx, nqz, nqpqx, nqpqz, q);

Can you confirm that on your phone it also happens on line 294 when i == 3 and j == 7?

thaidn avatar Sep 13 '20 21:09 thaidn

I've bought an ASUS phone running MediaTek and will have it in a week. Will update once I've got more information.

thaidn avatar Sep 14 '20 18:09 thaidn

Thanks for support. I will also try above from my side and will let you know result.

dmpatel151282 avatar Sep 15 '20 04:09 dmpatel151282

Here's more devices having this issue Android OS: 7.0, 7.1.1 Tink: 1.5.0 (tink / tink-android)


Device:

Oppo: CPH1723, CPH1729, CPH1717 Sony: Xperia L1 CMDC: M760 Infinix HOT 4 Pro Meizu: M6


setF(byte[] f)

clientPrivate: 872c537cad16b802261c81d34f32eceebbecd14d2789ca38701031bc415f0787
serverPublic: 3b7baf9c70df06b0a8b4aadbb96b08e8c1455b16fbd44cb7656d2a183369ff64

xDragonZ avatar Oct 31 '20 09:10 xDragonZ

i'm getting a similar issue as well: java.lang.IllegalStateException: Arithmetic error in curve multiplication with the public key: 0900000000000000000000000000000000000000000000000000000000000000 the device was: OS Version: Android SDK: 25 (7.1.1) Phone model: OPPO CPH1725

np16474 avatar Feb 03 '22 16:02 np16474

Same here, all Android SDK versions are 25(7.1.1)

Tougee avatar May 08 '23 07:05 Tougee

same here with oppo cph1723 (android 7.1.1 + mediatek cpu)

ToddChang avatar Aug 09 '23 03:08 ToddChang

I will close this.

From our understanding this could be a hardware issue on very few devices. If this is the case, I would expect it only to happen very infrequently and only in some devices.

If this is not the case, and someone can observe this frequently or can reproduce it, please open an issue on github.com/tink-crypto/tink-java/ where Tink Java now lives.

tholenst avatar Jan 10 '24 16:01 tholenst