code wiki / (root) / nx_ghash_kat_test.nx

nx_ghash_kat_test.nx

buildroot/runtime/nx_ghash_kat_test.nx

3116 B82 linesdepth 4pulls 4 transitivereach 0 importersview sourcekind gate/prooftopic ghash
docsdependenciesstructsconstsfunctions

about

nx_ghash_kat_test.nx -- canonical KAT for the GHASH primitive using NIST SP 800-38D Appendix B Test Case 2 ("AES-128-GCM with 16-byte plaintext, all-zero IV"). Test Case 2 inputs (NIST published): K = 00000000000000000000000000000000 P = 00000000000000000000000000000000 (16-byte all-zero plaintext) AAD = (empty) IV = 000000000000000000000000 (12-byte all-zero IV) Derived intermediates: H = E_K(0^128) = 66e94bd4ef8a2c3b884cfa59ca342b2e C = ciphertext = 0388dace60b6a392f328c2b971b2fe78 GHASH(H, A=empty, C) = E_K(J0) XOR T where T = AB6E47D42CEC13BDF53A67B21257BDDF (the published tag). E_K(J0) where J0 = IV || 0^31 || 1 = 000000000000000000000000 00000001: E_K(J0) = 58e2fccefa7e3061367f1d57a4e7455a So GHASH = T XOR E_K(J0) = AB6E47D42CEC13BDF53A67B21257BDDF XOR 58e2fccefa7e3061367f1d57a4e7455a = F38CBB1AD692230AC3457AE5B6B0E885 We verify the GHASH output (NOT the tag) against that derived value. Inputs to ghash: A = empty, C = 0388dace60b6a392f328c2b971b2fe78. Length block = 0^64 || 16*8=128 = 00 00 00 00 00 00 00 00 || 00 00 00 00 00 00 00 80 expect_exit: 0. license_tier: ORIGINAL

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_ghash.nx nx_ghash_kat_test.nx

imports: nx_syscalls.nxnx_ghash.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 nx_ghash_update_buf sys_mmap ↻ nx_ghash_update_block gh_upd_temp sys_mmap ↻ nx_ghash_mul nx_ghash_mul_clmul gh_scratch sys_mmap ↻ gh_byterev_bits gh_revtab gh_clmul_core gh_scratch ↻ gh_clmul_mul256_acc gh_clmul_reduce256 nx_ghash_finalize sys_mmap ↻ nx_ghash_be64_put nx_ghash_update_block ↻ sys_write

structs

none

consts

none

functions

32func hex_byte(out: *u8, idx: i64, hi: i64, lo: i64) -> i64
37func main() -> i64