Investigate crypto crash on Android w/o libjbigi.so #46

Open
opened 2025-04-21 14:45:16 -04:00 by idk · 2 comments
Owner

Opened 7 years ago

Last modified 2 years ago

#1343assigneddefect

Investigate crypto crash on Android w/o libjbigi.so

Reported by:str4dOwned by:Meeh
Priority:
minor
Milestone:

Component:
apps/android
Version:
0.9.14
Keywords:

Cc:

Parent Tickets:

Sensitive:
no

Description

zzz, _sponge, I'm thinking now that we don't need to include jbigi in Android

​https://developer.android.com/reference/java/math/BigInteger.html

"This implementation is efficient for operations traditionally used in cryptography, such as the generation of large prime numbers and computation of the modular inverse."

tl;dr GMP is doing nothing, Android devs have already optimized (at least on Android 4.1.2)

str4d, native was slower 3 years ago too…. the trouble was that Android BigInteger? crashed the jvm. Until I added jbigi, nothing worked.

I spent maybe 6 months trying to track down why. unsuccessfully.

and yes this was on an OG Droid Froyo.

never found a bug report or fix about it

also, testing on numerous 32-bit platforms showed that 5.0.2 was no faster than 4.3.2, and twice the .so size.

To this day we still ship 4.3.2 for 32 bit and 5.0.2 for 64 bit, as set up in May/June? 2011. We haven't touched jbigi since.

see notes in installer/lib/jbigi/README.txt

re: dropping jbigi, sure, if we can figure out when it got fixed.

All I know is I spent 6 months or a year getting the router to work on android, and a big part of that was realizing that it was dying in ssu, i.e. DH, i.e. bigInt.

now, i could try it w/o jbigi on my OG droid, maybe it got fixed somewhere along the way, but there hasn't been an OTA update in years

What sort of crash? OOM or something else?

and of course now I can't run the upcoming release on Froyo anyway, we've moved to API 9.

Yah, that's another point

it was a crash in native code

k

for months i worked around it by disabling SSU

That at least implies that Android API 8 was using NativeBN internally.

but RI signatures also failed about half the time too.

so it would create its own RI, sign it, then it would fail a double=check, and the router would die there.

once I added jbigi it all just magically worked

maybe we could go back through 5 years of AOSP checkins and find a fix point… but more likely we'd just have to throw it out there w/o jbigi and see if anybody bitches

is either one of those worth 89 KB or a 6% speedup? dunno.

btw, the speed test never crashed. only the router.

Right, meaning it's some obscure corner case that is being triggered.

zzz, did the crash happen in the emulator ever?

i think I couldn't ever get the emulator crypto to work, don't remember if exactly the same crash or not

Subtickets

Opened [7 years ago](/timeline?from=2014-08-06T22%3A14%3A22Z&precision=second "See timeline at Aug 6, 2014 10:14:22 PM") Last modified [2 years ago](/timeline?from=2019-04-18T14%3A35%3A29Z&precision=second "See timeline at Apr 18, 2019 2:35:29 PM") ## [\#1343](/ticket/1343)[assigned](/query?status=assigned)[defect](/query?status=!closed&type=defect) # Investigate crypto crash on Android w/o libjbigi.so Reported by:[str4d](/query?status=!closed&reporter=str4d)Owned by:[Meeh](/query?status=!closed&owner=meeh) Priority: [minor](/query?status=!closed&priority=minor) Milestone: Component: [apps/android](/query?status=!closed&component=apps%2Fandroid) Version: [0.9.14](/query?status=!closed&version=0.9.14) Keywords: Cc: Parent Tickets: Sensitive: [no](/query?status=!closed&sensitive=0) ### Description <str4d> zzz, \_sponge, I'm thinking now that we don't need to include jbigi in Android <str4d> [​https://developer.android.com/reference/java/math/BigInteger.html](https://developer.android.com/reference/java/math/BigInteger.html) <str4d> "This implementation is efficient for operations traditionally used in cryptography, such as the generation of large prime numbers and computation of the modular inverse." <str4d> tl;dr GMP is doing nothing, Android devs have already optimized (at least on Android 4.1.2) <zzz> str4d, native was slower 3 years ago too…. the trouble was that Android BigInteger? crashed the jvm. Until I added jbigi, nothing worked. <zzz> I spent maybe 6 months trying to track down why. unsuccessfully. <zzz> and yes this was on an OG Droid Froyo. <zzz> never found a bug report or fix about it <zzz> also, testing on numerous 32-bit platforms showed that 5.0.2 was no faster than 4.3.2, and twice the .so size. <zzz> To this day we still ship 4.3.2 for 32 bit and 5.0.2 for 64 bit, as set up in May/June? 2011\. We haven't touched jbigi since. <zzz> see notes in installer/lib/jbigi/README.txt <zzz> re: dropping jbigi, sure, if we can figure out when it got fixed. <zzz> All I know is I spent 6 months or a year getting the router to work on android, and a big part of that was realizing that it was dying in ssu, i.e. DH, i.e. bigInt. <zzz> now, i could try it w/o jbigi on my OG droid, maybe it got fixed somewhere along the way, but there hasn't been an OTA update in years <str4d> What sort of crash? OOM or something else? <zzz> and of course now I can't run the upcoming release on Froyo anyway, we've moved to API 9. <str4d> Yah, that's another point <zzz> it was a crash in native code <str4d> k <zzz> for months i worked around it by disabling SSU <str4d> That at least implies that Android API 8 was using NativeBN internally. <zzz> but RI signatures also failed about half the time too. <zzz> so it would create its own RI, sign it, then it would fail a double=check, and the router would die there. <zzz> once I added jbigi it all just magically worked <zzz> maybe we could go back through 5 years of AOSP checkins and find a fix point… but more likely we'd just have to throw it out there w/o jbigi and see if anybody bitches <zzz> is either one of those worth 89 KB or a 6% speedup? dunno. <zzz> btw, the speed test never crashed. only the router. <str4d> Right, meaning it's some obscure corner case that is being triggered. <str4d> zzz, did the crash happen in the emulator ever? <zzz> i think I couldn't ever get the emulator crypto to work, don't remember if exactly the same crash or not ### Subtickets
idk added this to the undecided milestone 2025-04-21 14:45:16 -04:00
idk added the
#1343
apps.android
labels 2025-04-21 14:45:16 -04:00
Author
Owner

comment:2 Changed 2 years ago by zzz

Owner:
changed from str4d to _Meeh_Status:open →
assigned

[comment:2](https://trac.i2p2.de/\#comment:2) Changed [2 years ago](https://trac.i2p2.de//timeline?from=2019-04-18T14%3A35%3A29Z&precision=second "See timeline at Apr 18, 2019 2:35:29 PM") by zzz Owner: changed from _str4d_ to _Meeh_Status:open → assigned
Author
Owner

comment:1 Changed 5 years ago by str4d

Status:new →
open

[comment:1](https://trac.i2p2.de/\#comment:1) Changed [5 years ago](https://trac.i2p2.de//timeline?from=2016-02-18T04%3A24%3A46Z&precision=second "See timeline at Feb 18, 2016 4:24:46 AM") by str4d Status:new → open
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: I2P_Developers/i2p.android.base#46
No description provided.