_ed25519_ct_gate.nx
buildroot/runtime/_ed25519_ct_gate.nx
about
_ed25519_ct_gate.nx -- constant-time gate for SEC-CT-002 (ed25519-scalarmul-constant-time).
The FIXED ge_scalar_mul has NO secret-bit branch: each of the 256 bit-iterations runs ge_p3_add
UNCONDITIONALLY and masked-selects with ge_p3_cmov. So the number of point additions executed is a
CONSTANT 256, independent of the scalar's Hamming weight -- whereas the prior `if bit==1 {ge_p3_add}`
ran the add popcount(scalar) times (the variable-time / SPA leak). This gate models BOTH control-flow
structures over the EXACT MSB-first 32-byte bit walk ge_scalar_mul uses, on scalars of very different
Hamming weight, and asserts: NEW add-count is CONSTANT (256, scalar-independent); OLD add-count VARIES
(the NEG control -- proves the gate distinguishes constant-time from variable-time, and that the leak
it removes was real). FUNCTIONAL correctness + byte-identity are proven separately and unfakeably by
nx_ed25519_signature_test (RFC8032 vectors) + nx_ed25519_scalar_test. Sovereign native: exit 0 = GREEN.
dependencies 1 imports · 0 importers
imports: nx_syscalls.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 14 | const ECG_LOG: *u8 = "knowledge/status/speed_gate.log" |
functions
| 16 | func gw(fd: i64, s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(fd, s, n); return 0 } |
| 20 | func ct_addcount_new(scalar_32: *u8) -> i64 called by 1: main |
| 36 | func ct_addcount_old(scalar_32: *u8) -> i64 called by 1: main |
| 52 | func fill32(s: *u8, val: i64) -> i64 { var i: i64 = 0; while i < 32 { s[i] = val as u8; i = i + 1 } return 0 } called by 1: main |
| 54 | func main() -> i64 |