Modern Apps git

← Modern-Apps.git

e2ee-p2p: simplify map_or to is_some_and in mldsa verify

Commit
6a140b7feb64ca473f5b457a31137002e4d458d7
Author
Vayun Mathur <[email protected]>
When
2026-12-01 21:55 UTC (4 days ago)
Parents
5ae2690
Workspace clippy flagged bytes_in3(...).map_or(false, |..| ..)
in the ML-DSA verify JNI entry. is_some_and states the same
short-circuit directly: parse the three byte arrays, and only
then run mldsa_verify_der. No behaviour change.

Verified: cargo clippy -p e2ee_pqc --all-targets clean,
cargo test -p e2ee_pqc (28 passed), cargo fmt --check clean.

Diff

library/e2ee-p2p/src/main/rust/src/jni_bridge.rs
diff --git a/library/e2ee-p2p/src/main/rust/src/jni_bridge.rs b/library/e2ee-p2p/src/main/rust/src/jni_bridge.rsindex f38280c1b4..4c8c38bb9d 100644--- a/library/e2ee-p2p/src/main/rust/src/jni_bridge.rs+++ b/library/e2ee-p2p/src/main/rust/src/jni_bridge.rs@@ -145,6 +145,6 @@ pub extern "system" fn Java_com_vayunmathur_e2ee_PqcNative_nativeMldsaVerify<'l>     sig: JByteArray<'l>, ) -> jboolean {     run_bool(env, |e| {-        bytes_in3(e, &pub_der, &msg, &sig).map_or(false, |(d, m, s)| mldsa_verify_der(&d, &m, &s))+        bytes_in3(e, &pub_der, &msg, &sig).is_some_and(|(d, m, s)| mldsa_verify_der(&d, &m, &s))     }) }