code wiki / (root) / nx_p256_solinas_timing.nx

nx_p256_solinas_timing.nx

buildroot/runtime/nx_p256_solinas_timing.nx

3412 B122 linesdepth 5pulls 6 transitivereach 0 importersview sourcekind tooltopic p256
docsdependenciesstructsconstsfunctions

about

nx_p256_solinas_timing.nx -- honest FAST(Solinas) vs SLOW(bit-serial) timing for the P-256 field multiply used by TLS ECDSA cert verify. The Solinas fast reduction is ALREADY the production path (p256_field_mul); the bit-serial p256_field_mul_slow is the retained oracle == the "naive reduction" baseline. Timing both on the SAME workload quantifies the reduction speedup that Solinas already delivers. Seeds from a runtime clock and chains a=mul(a,b) (data-dependent) so the optimizer cannot const-fold the field arithmetic away. No correctness claim here -- see nx_p256_solinas_difftest.nx for the bit-identical proof. license_tier: ORIGINAL

dependencies 4 imports · 0 importers

nx_syscalls.nx nx_u256.nx nx_p256_field.nx nx_p256_field_mul.nx nx_p256_solinas_timing.nx

imports: nx_syscalls.nxnx_u256.nxnx_p256_field.nxnx_p256_field_mul.nx

imported by: nobody (leaf or entry point)

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

main nx_scratch_save nx_scratch_init sys_mmap u256_alloc nx_scratch nx_scratch_init ↻ nx_scratch_oom sys_write sys_exit sys_mmap ↻ sys_now_us sys_mmap ↻ sys_clock_gettime_mono _tm_seed p256_field_mul nx_scratch_save ↻ u256_wide_alloc nx_scratch ↻ u256_mul_wide _p256_solinas_reduce u256_alloc ↻ p256_field_load_p nx_scratch ↻ _r_reduce9 _r_cmp8 nx_scratch_restore p256_field_mul_slow nx_scratch_save ↻ u256_wide_alloc ↻ u256_alloc ↻ p256_field_load_p ↻ u256_mul_wide ↻ u256_wide_cmp u256_wide_sub u256_wide_shr_1 u256_wide_copy_low nx_scratch_restore ↻ sys_write ↻ _tm_print_dec

structs

none

consts

18const K_MAGIC_2654435761: i64 = 2654435761
19const K_MAGIC_40503: i64 = 40503
20const K_MAGIC_30000: i64 = 30000

functions

22func _tm_print_dec(n: i64) -> i64
called by 1: main calls 2: sys_mmapsys_write
48func _tm_seed(a: *i64, b: *i64, seed: i64) -> i64
called by 1: main
58func main() -> i64