Modern Apps git
git clone https://git.maproj.org/Modern-Apps.git
cov/c3 ▾

Modern-Apps.git / library / everysync-core / IOS_PQC_NOTES.md

IOS_PQC_NOTES.md1.4 KiBRenderedCodeRaw
1# iOS PQC notes (Phase 1D shell โ€” Phase 3 wires it)
2
3## Surface (stable, from `c_bridge.rs`)
4
5Bind exactly these 10 fns (Kotlin seal framing stays in `CryptoIos.kt`
6via the `AesGcm` actual when it lands โ€” there are NO AES fns to bind):
7
8- `pqc_kem_keygen`, `pqc_kem_encaps`, `pqc_kem_decaps`
9- `pqc_dsa_keygen`, `pqc_dsa_sign`, `pqc_dsa_verify` (1 valid / 0 invalid / -1 parse error)
10- `pqc_bundle_build`, `pqc_bundle_split`
11- `pqc_free`, `pqc_secure_zero`
12
13Explicitly NOT bound: `pqc_identity_keygen` (identity assembly stays in
14Kotlin), `pqc_link_keygen` / `pqc_link_pub_from_seed` (FindFamily link keys),
15`pqc_security_code` (pure SHA-256).
16
17## cinterop `.def` (Phase 3 creates `src/nativeInterop/cinterop/e2eePqc/e2eePqc.def`)
18
19```
20headers = e2ee_pqc.h
21headerFilter = e2ee_pqc/*
22package = e2ee.pqc.native
23compilerOpts = -Ie2ee_pqc # dir holding the cbindgen-generated header
24linkerOpts = -le2ee_pqc # from the XCFramework slice
25```
26
27`e2ee_pqc.h` is generated from `c_bridge.rs` via `cbindgen` at Rust build time.
28
29## XCFramework build (Phase 3)
30
31```
32cargo build --target aarch64-apple-ios --release
33cargo build --target x86_64-apple-ios --release # simulator
34lipo/xcodebuild -create-xcframework ... # then cinterop against it
35```
36
37Memory discipline matches JNA: every `*mut u8 + len` out-param buffer is
38`Box::into_raw` โ€” copy to Kotlin, then `pqc_free`; zero priv/SS bytes.