mirror of
https://github.com/liquidraver/ZephCore.git
synced 2026-09-02 06:33:42 +00:00
Swap the vendored orlp/ed25519 (frozen ~2017 ref10) for Monocypher 4.0.2, an actively maintained, audited, single-file implementation. The persisted private key keeps its 64-byte expanded layout (clamped SHA-512(seed) scalar a || nonce prefix), so identities written by older firmware load, sign, verify and key-exchange unchanged -- no re-key, no storage migration, full wire compatibility with the existing mesh and Arduino MeshCore. Because the stored key carries no seed for Monocypher's high-level EdDSA API, Identity drives signing from the low-level primitives (crypto_sha512 + crypto_eddsa_reduce/scalarbase/mul_add); verify uses crypto_ed25519_check and ECDH uses crypto_eddsa_to_x25519 + crypto_x25519. Nonce material is now wiped after signing. Validated byte-for-byte against the previous orlp output via a known-answer harness (keygen, sign-from-expanded-key, verify accept/reject, X25519-over-Ed25519 shared secret) before the swap. Frees ~42 KB of flash: orlp linked ~55 KB (dominated by its ~30 KB ref10 precomputed tables); the Monocypher Ed25519/X25519/SHA-512 paths link ~14 KB, with --gc-sections dropping all unused algos. wio_tracker_l1 pristine build: FLASH 54.14%, links clean. Monocypher is CC0-1.0 OR BSD-2-Clause.