Opened 5 years ago

Last modified 4 months ago

#1343 assigned defect

Investigate crypto crash on Android w/o libjbigi.so

Reported by: str4d Owned by: Meeh
Priority: minor Milestone:
Component: apps/android Version: 0.9.14
Keywords: Cc:
Parent Tickets: Sensitive: no

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
<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

Change History (2)

comment:1 Changed 4 years ago by str4d

Status: newopen

comment:2 Changed 4 months ago by zzz

Owner: changed from str4d to Meeh
Status: openassigned
Note: See TracTickets for help on using tickets.