code wiki / (root) / nx_aes_cbc.nx

nx_aes_cbc.nx

buildroot/runtime/nx_aes_cbc.nx

6195 B98 linesdepth 4pulls 5 transitivereach 1 importersview sourcekind tooltopic aes
docsdependenciesstructsconstsfunctions

about

nx_aes_cbc.nx -- AES-128-CBC DECRYPT (NIST SP 800-38A ยง6.2) over the FIPS-197 block primitive in nx_aes (aes128_decrypt_block + aes128_expand_key). The mode HLS uses for #EXT-X-KEY:METHOD=AES-128: each .ts segment is one CBC stream with PKCS7 padding. CBC decrypt: P_i = InvCipher(C_i) XOR C_{i-1} (C_{-1} = IV). In-place safe (the cipher block is saved before the plaintext overwrites it). GATE (main): the canonical NIST SP 800-38A F.2.2 CBC-AES128 4-block vector (authoritative KAT) + a PKCS7 strip check. Crypto is KAT-proven here BEFORE nx_hls_get composes it. license_tier: ORIGINAL module: nishi-core.crypto.aes_cbc

dependencies 3 imports · 1 importers

nx_aes.nx nx_itoa_lib.nx nx_syscalls.nx nx_aes_cbc.nx nx_hls_get.nx

imports: nx_aes.nxnx_itoa_lib.nxnx_syscalls.nx

imported by: nx_hls_get.nx

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

main cbc_puts sys_write sys_mmap cbc_hex2bin cbc_hexv aes128_expand_key _aes_sbox _aes_rcon aes128_cbc_decrypt sys_mmap ↻ aes128_decrypt_block _aes_add_round_key _aes_inv_shift_rows _aes_inv_sub_bytes _aes_inv_sbox _aes_inv_mix_columns _aes_xtime cbc_putn nxi_out nxi_fd sys_mmap ↻ ccz_cat_num sys_write ↻ sys_munmap aes128_pkcs7_strip sys_exit

structs

none

consts

none

functions

14func aes128_cbc_decrypt(ct: *u8, n: i64, sched: *u8, iv: *u8, out: *u8) -> i64
32func aes128_pkcs7_strip(buf: *u8, n: i64) -> i64
called by 2: mainmain
42func cbc_puts(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 1: main calls 1: sys_write
47func cbc_putn(v: i64) -> i64 { nxi_out(v); return 0 }
called by 1: main calls 1: nxi_out
48func cbc_hexv(c: i64) -> i64 { if c>=48 { if c<=57 { return c-48 } } if c>=97 { if c<=102 { return c-97+10 } } if c>=65 { if c<=70 { return c-65+10 } } return 0 }
called by 1: cbc_hex2bin
50func cbc_hex2bin(hex: *u8, out: *u8, nbytes: i64) -> i64
called by 1: main calls 1: cbc_hexv
56func main() -> i64