code wiki / (root) / nx_ed25519_sign_bisect_test.nx

nx_ed25519_sign_bisect_test.nx

buildroot/runtime/nx_ed25519_sign_bisect_test.nx

19268 B482 linesdepth 9pulls 14 transitivereach 0 importersview sourcekind gate/prooftopic ed25519
docsdependenciesstructsconstsfunctions

about

nx_ed25519_sign_bisect_test.nx -- bisection diagnostic for the known Ed25519 sign byte-1 mismatch reported by nx_ed25519_signature_smoke (FAIL at assertion #1). Walks the RFC 8032 ยง7.1 test vector 1 (empty message) step by step and returns a non-zero exit code at the FIRST step whose output diverges from the published reference. This identifies which Ed25519 sub-primitive is broken so the fix can target the actual root cause instead of the symptom. Step-by-step check sequence (each step returns its own assertion code so the failure surface is unambiguous): Step 1 (assertion 1..32): H = SHA-512(priv) byte-by-byte vs the RFC 8032 reference H_priv (precomputed offline -- the SHA-512 of the known priv is itself a known value) Step 2 (assertion 100): s_scalar = H[0..32] clamped == expected s_scalar (precomputed offline) Step 3 (assertion 200+i): A = s_scalar * G; compress(A) == known pub byte-by-byte (this catches scalar_mul OR compress bugs) Step 4 (assertion 300): if A_enc matches pub then scalar_mul works for this scalar -- so any R_enc mismatch is sc_reduce's fault. Continue. Step 5 (assertion 400): r_h = SHA-512(prefix || empty) == expected (precomputed offline) Step 6 (assertion 500+i): r_scalar = sc_reduce(r_h) bytes match expected r_scalar (precomputed offline) Step 7 (assertion 600+i): R = r_scalar * G; compress(R) matches expected R_enc (= first 32 bytes of expected sig) expect_exit: 0 license_tier: ORIGINAL

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_ed25519.nx nx_ed25519_signature.nx nx_ed25519_sign_bisect_test.nx

imports: nx_syscalls.nxnx_ed25519.nxnx_ed25519_signature.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main sys_mmap ge_p3_alloc sys_mmap ↻ fe_alloc nx_scratch nx_scratch_init sys_mmap ↻ nx_scratch_oom sys_write sys_exit sys_mmap ↻ fe_zero ed25519_basepoint_p3 sys_mmap ↻ ge_p3_decompress sys_mmap ↻ fe_from_bytes fe_alloc ↻ fe_sq fe_mul fe_one fe_zero ↻ fe_sub ed25519_d_fe sys_mmap ↻ ed25519_d_bytes fe_from_bytes ↻ fe_mul ↻ fe_add fe_pow22523 fe_alloc ↻ fe_sq ↻ fe_mul ↻ fe_neg fe_alloc ↻ fe_zero ↻ fe_sub ↻ fe_canonical_equal sys_mmap ↻

structs

none

consts

none

functions

40func _load_priv(priv: *u8) -> i64
called by 1: main
53func _load_pub(pub: *u8) -> i64
called by 1: main
78func _bytes_eq(a: *u8, b: *u8, n: i64) -> i64
called by 1: main
88func _load_expected_sig_first32(out: *u8) -> i64
called by 1: main
105func _load_basepoint_compressed(out: *u8) -> i64
called by 1: main
113func _hexdump_label(label0: i64, label1: i64, buf: *u8, n: i64) -> i64
called by 1: main calls 2: sys_mmapsys_write
131func main() -> i64