code wiki / (root) / nx_aes_cbc_enc.nx

nx_aes_cbc_enc.nx

buildroot/runtime/nx_aes_cbc_enc.nx

5059 B91 linesdepth 4pulls 4 transitivereach 3 importersview sourcekind tooltopic aes
docsdependenciesstructsconstsfunctions

about

nx_aes_cbc_enc.nx -- AES-128-CBC ENCRYPT (NIST SP 800-38A ยง6.2) + PKCS#7 pad, over the FIPS-197 block primitive in nx_aes (aes128_encrypt_block + aes128_expand_key). The sovereign sibling of nx_aes_cbc (which ships DECRYPT only). Needed by the PKCS#12 (.p12) provisioning rung R5b to shroud the client identity key under PBES2 (PBKDF2 + AES-CBC). CBC encrypt: C_i = Cipher(P_i XOR C_{i-1}), C_{-1} = IV. GATE (main): the canonical NIST SP 800-38A F.2.1 CBC-AES128.Encrypt 4-block vector (authoritative KAT). license_tier: ORIGINAL expect_exit: 0 module: nishi-core.crypto.aes_cbc_enc

dependencies 2 imports · 1 importers

nx_aes.nx nx_syscalls.nx nx_aes_cbc_enc.nx nx_mtls_pkcs12.nx

imports: nx_aes.nxnx_syscalls.nx

imported by: nx_mtls_pkcs12.nx

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

main ace_puts sys_write sys_mmap ace_hex2bin ace_hexv aes128_expand_key _aes_sbox _aes_rcon aes128_cbc_encrypt sys_mmap ↻ aes128_encrypt_block ace_row ace_puts ↻ aes128_pkcs7_pad sys_exit

structs

none

consts

none

functions

12func aes128_cbc_encrypt(pt: *u8, n: i64, sched: *u8, iv: *u8, out: *u8) -> i64
29func aes128_pkcs7_pad(src: *u8, n: i64, out: *u8) -> i64
39func ace_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 2: ace_rowmain calls 1: sys_write
40func ace_hexv(c: i64) -> i64 { if c>=48 { if c<=57 { return c-48 } } if c>=97 { if c<=102 { return c-97+10 } } return 0 }
called by 1: ace_hex2bin
41func ace_hex2bin(hex: *u8, out: *u8, nbytes: i64) -> i64
called by 1: main calls 1: ace_hexv
46func ace_row(name: *u8, ok: i64) -> i64 { if ok == 1 { ace_puts(" PASS " as *u8) } else { ace_puts(" FAIL " as *u8) } ace_puts(name); ace_puts("\n" as *u8); return ok }
called by 1: main calls 1: ace_puts
48func main() -> i64