code wiki / (root) / nx_poly1305_pure.nx

nx_poly1305_pure.nx

buildroot/runtime/nx_poly1305_pure.nx

11643 B326 linesdepth 1pulls 1 transitivereach 2 importersview sourcekind librarytopic poly1305
docsdependenciesstructsconstsfunctions

about

nx_poly1305_pure.nx -- architecture-neutral Poly1305 (arena-based). Arena-refactor arc piece 2 per docs/NISHI_LANG_FRICTION_CATALOG.md#F5. Parallel to original nx_poly1305.nx (RV64-pinned via `import "nx_syscalls.nx"`). This variant takes `*NxArena` for the two scratch buffers (rbuf, block; ~32 bytes total per mac call) and imports NO syscall layer. API differs from nx_poly1305 by adding `arena: *NxArena` as first parameter and renaming functions with `_pure` suffix: poly1305_mac(key, msg, n, tag) -> poly1305_mac_pure(arena, key, msg, n, tag) poly1305_tag_equal(a, b) -- no allocation; renamed only -> poly1305_tag_equal_pure(a, b) Helpers (p_load_u32_le / p_store_u32_le / poly1305_clamp) duplicated with `pure_` prefix to avoid collision with the original module's helpers. KAT verified: RFC 8439 ยง2.5.2 (the "Cryptographic Forum Research Group" vector with key 85d6...51b -> tag a8061dc1305136c6c22b8baf0c0127a9). Identical to original nx_poly1305_test. Smoke at bench/nx_poly1305_pure_x86_64_smoke.nx. Composes with: - nx_arena_types (NxArena + nx_arena_alloc) - Any architecture's syscall layer at orchestrator boundary - nx_chacha20_poly1305_pure (next arc piece -- the AEAD) nx_capability_claims: needs: [arena_alloc, pointer_arithmetic] provides: [poly1305_mac_pure, poly1305_tag_equal_pure] safety: [no_syscall, no_floating_point, target_agnostic, bit_equal_reproducible, RFC_8439_section_2_5_2_KAT_VERIFIED, constant_time_tag_compare_per_Lucky13_lesson]

dependencies 1 imports · 2 importers

nx_arena_types.nx nx_poly1305_pure.nx nx_chacha20_poly1305_pure.nx nx_poly1305_pure_test.nx

imports: nx_arena_types.nx

imported by: nx_chacha20_poly1305_pure.nxnx_poly1305_pure_test.nx

structs

none

consts

none

functions

53func purep_load_u32_le(buf: *u8, off: i64) -> i64
61func purep_store_u32_le(buf: *u8, off: i64, v: i64) -> i64
called by 1: poly1305_mac_pure
79func poly1305_mix_pure(h: *i64, r: *i64, s: *i64) -> i64
called by 1: poly1305_block_pure
133func poly1305_block_pure(
172func poly1305_clamp_pure(r: *u8) -> i64
called by 1: poly1305_mac_pure
192func poly1305_mac_pure(
316func poly1305_tag_equal_pure(a: *u8, b: *u8) -> i64