Modern-Apps.git
Publicgit clone https://git.maproj.org/Modern-Apps.gitModern-Apps.git / library / everysync-core / IOS_PQC_NOTES.md
| 1 | # iOS PQC notes (Phase 1D shell โ Phase 3 wires it) |
| 2 | |
| 3 | ## Surface (stable, from `c_bridge.rs`) |
| 4 | |
| 5 | Bind exactly these 10 fns (Kotlin seal framing stays in `CryptoIos.kt` |
| 6 | via 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 | |
| 13 | Explicitly NOT bound: `pqc_identity_keygen` (identity assembly stays in |
| 14 | Kotlin), `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 | ``` |
| 20 | headers = e2ee_pqc.h |
| 21 | headerFilter = e2ee_pqc/* |
| 22 | package = e2ee.pqc.native |
| 23 | compilerOpts = -Ie2ee_pqc # dir holding the cbindgen-generated header |
| 24 | linkerOpts = -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 | ``` |
| 32 | cargo build --target aarch64-apple-ios --release |
| 33 | cargo build --target x86_64-apple-ios --release # simulator |
| 34 | lipo/xcodebuild -create-xcframework ... # then cinterop against it |
| 35 | ``` |
| 36 | |
| 37 | Memory 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. |