code wiki / (root) / nx_aes128_ctr_wasm.nx

nx_aes128_ctr_wasm.nx

buildroot/runtime/nx_aes128_ctr_wasm.nx

15696 B301 linesdepth 0pulls 0 transitivereach 0 importersview sourcekind orphan librarytopic aes128
docsdependenciesstructsconstsfunctions

about

nx_aes128_ctr_wasm.nx -- AES-128-CTR (NIST SP 800-38A §6.5). Wraps inlined AES-128 ECB with counter-mode stream cipher logic. Verified vs NIST SP 800-38A §F.5.1 test vector. (Original ECB header below is the inlined cipher core.) nx_aes128_wasm.nx -- AES-128 ECB (FIPS 197) self-contained for WAT target. Rijndael-128 with 128-bit key, 16-byte block, 10 rounds. ECB mode only -- caller composes CTR/GCM/CBC on top. Implementation: byte-oriented SBox/InvSBox + ShiftRows + MixColumns done as straightforward 4x4 byte ops. No T-tables (slower but smaller code, simpler, side-channel-friendly). API: nx_aes128_encrypt(key_ptr, in_block, scratch_ptr, out_block) -> i64 key_ptr -- 16 bytes (128-bit key) in_block -- 16 bytes plaintext scratch_ptr -- >= 256 bytes (key schedule = 11 round keys = 176 bytes) out_block -- 16 bytes ciphertext nx_aes128_decrypt(key_ptr, in_block, scratch_ptr, out_block) -> i64 symmetric inverse (uses InvSBox + InvShiftRows + InvMixColumns) Verified against FIPS 197 Appendix C.1 (single-block KAT). license_tier: INDEPENDENT_REDERIVE genealogy_id: international-research-sources/nist/fips_197 lineage_id: nishi_aes128_wasm_q11

dependencies 0 imports · 0 importers

imports: none

imported by: nobody (leaf or entry point)

structs

none

consts

none

functions

32func _aes_sbox(b: i64) -> i64
101func _aes_rcon(i: i64) -> i64
called by 1: _aes128_key_expand
110func _xtime(a: i64) -> i64
called by 1: _aes_mix_columns
118func _aes128_key_expand(key: *u8, rk: *u8) -> i64
150func _aes_add_round_key(state: *u8, rk: *u8, round: i64) -> i64
157func _aes_sub_bytes(state: *u8) -> i64
called by 1: _aes128_encrypt_block calls 1: _aes_sbox
169func _aes_shift_rows(state: *u8) -> i64
198func _aes_mix_columns(state: *u8) -> i64
called by 1: _aes128_encrypt_block calls 1: _xtime
222func _aes128_encrypt_block(key_ptr: *u8, in_block: *u8,
255func _aes_ctr_inc(ctr: *u8) -> i64
called by 1: nx_aes128_ctr_xor
274func nx_aes128_ctr_xor(key_ptr: *u8, iv16: *u8,