Custom sqlcipher build getting crash on endTransaction api. (Android)

HI NIck,

          I have built custom openssl shared library , replaced necessary changes in openssl folder (external/openssl/), i.e . header files , copied my openssl library in android-libs (external/android-libs) and made considerable changes in make file of jni folder sothat it will pic local_shared_Library instead libcrypto.a . Compilation does goes well but application is getting crash in run time.

     It is found crash observed on executing sqlite3_step(statement); on calling sqlitedatabse.endTransaction(); attched sqlcipher_crash.txt for more info.

I have seen certain build steps configuration changes for building sqlite3.c in configure for fips compliant library.

for example i have found these lines sqlite3.c:

Can you please help me where did i went wrong? Really appreciate for your constant team support.

I am printing CRASH LOG HERE ::


D/PowerManagerService( 3147): [api] [s] userActivity : event: 0 flags: 0 (uid: 1000 pid: 3147) eventTime = 120766754

D/PowerManagerService( 3147): [api] release WakeLock flags=0x2000000a tag=WindowManager uid=1000 pid=3147 (0x0)

D/PowerManagerService( 3147): [api] applyWakeLockFlagsOnReleaseLocked : userActivityNoUpdateLocked is called : SCREEN_BRIGHT_WAKE_LOCK ‘WindowManager’ ON_AFTER_RELEASE (uid=1000, pid=3147, ws=WorkSource{10722}) (elapsedTime=194)

D/CommonUtil(27987): Creating an entry in cached doubles for 6

F/libc (27987): Fatal signal 6 (SIGABRT), code -6 in tid 28244 (Thread-6109)

V/AudioPolicyManager( 2574): stopOutput() output 2, stream 1, session 901

V/AudioPolicyManager( 2574): changeRefCount() stream 1, count 0

V/AudioPolicyManager( 2574): getNewOutputDevice() selected device 0

V/AudioPolicyManager( 2574): setOutputDevice() output 2 device 0000 delayMs 160

V/AudioPolicyManager( 2574): setOutputDevice() prevDevice 0002

V/AudioPolicyManager( 2574): setOutputDevice() setting same device 0000 or null device for output 2

I/DEBUG (27664): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***

I/DEBUG (27664): Build fingerprint: ‘samsung/ja3gxx/ja3g:5.0.1/LRX22C/I9500XXUHOK2:user/release-keys’

I/DEBUG (27664): Revision: ‘10’

I/DEBUG (27664): ABI: ‘arm’

I/DEBUG (27664): pid: 27987, tid: 28244, name: Thread-6109 >>> <<<

I/DEBUG (27664): signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------

I/DEBUG (27664): r0 00000000 r1 00006e54 r2 00000006 r3 00000000

I/DEBUG (27664): r4 9a3d8db8 r5 00000006 r6 00000002 r7 0000010c

I/DEBUG (27664): r8 ad11c400 r9 ad14e4c8 sl ad187ed8 fp ad187ee8

I/DEBUG (27664): ip 00006e54 sp 9a3d82f0 lr b6ec4591 pc b6ee7034 cpsr 600f0010

I/DEBUG (27664):

I/DEBUG (27664): backtrace:

I/DEBUG (27664): #00 pc 0003a034 /system/lib/ (tgkill+12)

I/DEBUG (27664): #01 pc 0001758d /system/lib/ (pthread_kill+52)

I/DEBUG (27664): #02 pc 0001819f /system/lib/ (raise+10)

I/DEBUG (27664): #03 pc 00014ae5 /system/lib/ (__libc_android_abort+36)

I/DEBUG (27664): #04 pc 00012aac /system/lib/ (abort+4)

I/DEBUG (27664): #05 pc 0008c074 /data/data/ (OpenSSLDie+32)

Karthik Kondlada.

Hi @karthik.kondlada

Unfortunately we do not provide support for custom builds of SQLCipher for Android, there are too many variables. In the event you are unaware, we sell a FIPS 140-2 version of SQLCipher for Android through our enterprise licensing. Please feel free to reach out to us at if you are interested in discussing licensing.

I am just wondering if any one can just speculate reason for fault address would be great.


@karthik.kondlada - it’s really difficult to even speculate what the problem could be based on the stack / fault address. In terms of troubleshooting, I would suggest putting together a very simple JNI app that calls OpenSSL directly, initializes the library and uses it to encrypt and decrypt some data. By doing this entirely outside of SQLCipher you may be able to isolate exactly what scenarios are causing the crash.

@sjlombardo Thanks for suggesting mate. I figured out and able to build Fips Compliance sqlcipher.