code wiki / (root) / nx_aes256_gcm_gate.nx

nx_aes256_gcm_gate.nx

buildroot/runtime/nx_aes256_gcm_gate.nx

5958 B82 linesdepth 5pulls 8 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

nx_aes256_gcm_gate.nx -- SOVEREIGN KAT referee for AES-256-GCM vs NIST SP 800-38D / McGrew GCM test vectors. TC14: zero key/IV, 16-byte zero PT, no AAD -> CT=cea7403d.. Tag=d0d1c8a7.. TC16: real key/IV + 20-byte AAD + 60-byte PT (ragged, exercises multi-block + tail) -> CT=522dc1f0.. Tag=76fc6ece.. T1 seal(TC14) == CT+Tag ; T2 open(TC14) recovers PT + tag OK ; T3 seal(TC16) == CT+Tag ; T4 open(TC16) recovers PT T5 NEG: open(TC16) with a corrupted tag -> -1 (authentication rejects) ; T6 aes256 KAT block (FIPS-197 C.3) GREEN iff 6/6. license_tier: ORIGINAL expect_exit: 0

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_aes256_gcm.nx nx_gate_verdict.nx nx_aes256_gcm_gate.nx

imports: nx_syscalls.nxnx_aes256_gcm.nxnx_gate_verdict.nx

imported by: nobody (leaf or entry point)

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

main gw sys_write sys_mmap h2b hx nx_aes256_gcm_seal sys_mmap ↻ aes256_expand_key _aes_rcon _aes_sbox aes256_encrypt_block _aes_add_round_key _aes_sub_bytes _aes_sbox ↻ _aes_shift_rows _aes_mix_columns _aes_xtime gcm256_inc32 nx_ghash_update_buf sys_mmap ↻ nx_ghash_update_block gh_upd_temp sys_mmap ↻ nx_ghash_mul nx_ghash_mul_clmul gh_scratch gh_byterev_bits gh_clmul_core nx_ghash_finalize sys_mmap ↻ nx_ghash_be64_put nx_ghash_update_block ↻ beq grow gw ↻ nx_aes256_gcm_open sys_mmap ↻ aes256_expand_key ↻ aes256_encrypt_block ↻

structs

none

consts

none

functions

11func gw(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
called by 3: gngrowmain calls 1: sys_write
12func gn(v: i64) -> i64 { let b: *u8 = sys_mmap(24); var m: i64 = v; if m < 0 { gw("-" as *u8); m = 0 - m }; let t: *u8 = sys_mmap(24); var k: i64 = 0; if m == 0 { t[0] = 48 as u8; k = 1 }; while m > 0 { t[k] = (48 + (m % 10)) as u8; m = m / 10; k = k + 1 }; var i: i64 = 0; while i < k { b[i] = t[k - 1 - i]; i = i + 1 }; sys_write(1, b, k); return 0 }
called by 1: main calls 3: sys_mmapgwsys_write
13func grow(name: *u8, ok: i64) -> i64 { if ok == 1 { gw(" PASS " as *u8) } else { gw(" FAIL " as *u8) } gw(name); gw("\n" as *u8); return ok }
called by 1: main calls 1: gw
15func hx(c: i64) -> i64 { if c>=48 { if c<=57 { return c-48 } } if c>=97 { if c<=102 { return c-87 } } if c>=65 { if c<=70 { return c-55 } } return 0 }
called by 1: h2b
17func h2b(s: *u8, out: *u8) -> i64
called by 1: main calls 1: hx
22func beq(a: *u8, b: *u8, n: i64) -> i64 { var i: i64 = 0; while i < n { if (a[i] as i64) != (b[i] as i64) { return 0 } i = i + 1 } return 1 }
called by 1: main
24func main() -> i64