Android/arm64 startup regression after OpenSSL → LibTomCrypt switch (4.11.0 vs 4.17.0)
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 32/100
Hướng nghiên cứu
Start by comparing the cited OpenSSL PBKDF2 and LibTomCrypt PBKDF2/HMAC implementations, then review the reported Perfetto and native-disassembly evidence. The report says a standalone reproducer and direct first-open benchmark are not yet available, so first determine how to isolate database-open time and reproduce the ARM64 regression. Done means establishing whether the KDF path causes the slowdown and providing maintainers evidence to assess acceleration or HMAC-state reuse without changing KDF strength or database compatibility.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
Changing only net.zetetic:sqlcipher-android from 4.11.0 to 4.17.0 adds approximately 300 ms to cold activity launch in our Android application. Restoring the original 4.17.0 APK restores the delay.
Perfetto samples and native disassembly identify LibTomCrypt's PBKDF2-HMAC-SHA512 path during first encrypted database open as the bottleneck. The sampled 4.11.0/OpenSSL path uses ARM SHA-512 instructions; the 4.17.0/LibTomCrypt path uses scalar SHA-512 and repeated HMAC setup.
Related: sqlcipher-android #91, sqlcipher #620. This report adds a dependency-only A/B/A comparison and native hot-path evidence.
Environment
- Galaxy S25 Ultra (SM-S938U1), Android 16,
arm64-v8a. - SQLCipher Android Community Edition 4.11.0 versus 4.17.0; resolved versions and packaged native libraries verified.
- SQLDelight
AndroidSqliteDriverwithSupportOpenHelperFactory, opening an encrypted policy database during startup. - Passphrase API, not raw-key format; unchanged key/cipher/KDF configuration. Source defaults are PBKDF2-HMAC-SHA512, 256,000 rounds in both versions; runtime PRAGMAs were not collected.
- Same app source, other dependencies, signing, account and database data; non-debuggable release builds, R8 disabled.
Controlled results
Four untraced force-stop launches per condition, in order. Authentication/setup occurred beforehand. Before each launch, app-specific ART state was reset and status=verify confirmed; process absence and cold-launch classification were checked. One validation launch per install was excluded. Cooldowns were 20 seconds; thermal status remained 0.
| Condition | Android launch samples (ms) | Median |
|---|---|---|
| Original APK, SQLCipher 4.17.0 | 603, 603, 603, 597 | 603 ms |
| SQLCipher-only 4.11.0 control | 307, 301, 301, 311 | 304 ms |
| Exact original 4.17.0 APK restored | 602, 605, 595, 596 | 599 ms |
Measurement: Android am start -W TotalTime. The initial 4.17.0 median is 299 ms slower than the 4.11.0 control, and the delay returns after switching back.
These are activity-launch timings, not isolated database-open or PBKDF2 timings. The small cohorts establish a repeatable local signal, not population confidence intervals. APK resources/manifest were unchanged; aggregate uncompressed Dex size differed by only 116 bytes.
Trace and native-code evidence
Separate Perfetto captures at 100 Hz are excluded from the table. In the restored 4.17.0 trace, the main thread waits approximately 270 ms for SQLDelight's synchronized lazy database initialization while the owning worker runs on CPU in SQLCipher connection initialization/key derivation.
Native mapping build IDs were matched to the packaged ELFs. Because the libraries are stripped, attribution used disassembly, embedded diagnostic/source strings, and SHA-512 constants:
- 4.17.0: 35 startup samples contain
sqlcipher_ltc_kdf→pkcs_5_alg2. Its iteration loop callshmac_memory, repeatedly allocating and initializing HMAC state. Sampled leaf PCs execute scalar SHA-512 compression. This matches LibTomCrypt's PBKDF2 and HMAC implementations. - 4.11.0: sampled leaf PCs execute ARM
sha512h,sha512h2,sha512su0, andsha512su1instructions. Its OpenSSL 3.5.4 PBKDF2 implementation also reuses a keyed HMAC template.
This strongly implicates provider-related KDF execution, but does not separately quantify hardware acceleration versus HMAC setup/allocation costs. The 4.15.0 JNI critical-section fix is already included in the tested 4.17.0 build.
Application-level reproduction
- Build the same application with each SQLCipher version, preserving the encrypted database and key settings.
- Complete setup outside measurement; run four force-stop launches per version under the controls above, recording Android
TotalTime. - Restore the original 4.17.0 APK and repeat; capture separate CPU profiles of first database initialization.
A public standalone reproducer and direct first-open benchmark are not yet available. WAL/connection-pool multiplicity has not been independently isolated. Proprietary APKs/raw traces are not attached.
Questions for maintainers
- Is the loss of ARM SHA-512 acceleration in Android Community's PBKDF2 path expected or tracked?
- Is a supported 4.x fix planned for ARM acceleration and/or HMAC-state reuse, preserving KDF strength and database compatibility?
- Is this addressed in a newer release? If not, what additional measurements would help you investigate?
- Ngôn ngữ chính
- Java
- Star
- 277
- Fork
- 39
- Merge trung bình
- 1 ngày 11 giờ
- Pull request đã merge (30 ngày)
- 1
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của sqlcipher/sqlcipher-android
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
sqlcipher/sqlcipher-android#97 · 1 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 32/100
sqlcipher/sqlcipher-android#95 · 4 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 30/100
sqlcipher/sqlcipher-android#23 · 2 bình luận ·
Tất cả issue của sqlcipher/sqlcipher-android
Issue tương tự
-
enhancement good first issue
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 66/100
apache/fineract-consumer-facing#175 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG] 订单:会员凭订单号即可取消其他会员的待付款订单(取消接口不校验订单归属)Có thể đã có người làm @dadiyang đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
macrozheng/mall#1016 ·
-
[Bug] The producer summary counts an unreported client version as a second version and warns about a version mixCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
apache/rocketmq-dashboard#6110 ·
Maintainer thường phản hồi trong vòng 4 ngày
-
Feature:Resolution
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
intellij-elixir/intellij-elixir#4396 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Python 3.15 supportCó thể đã có người làm @amnesiaof đã nhận hôm nay. Đang mởL: python L: python:uv
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
dependabot/dependabot-core#16524 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày