aes_xctr(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– aes_xctr(9) πŸ’–

okay bestie, so this is a page from the Kernel API Manual and it's literally all about aes_xctr β€” AES-XCTR en/decryption ✨ buckle up, it's giving cryptography but make it cute.


🌸 NAME 🌸

aes_xctr β€” AES-XCTR en/decryption πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

void aes_xctr (u8 *dst , const u8 *src , size_t len , u64 *ctr , const
u8 iv[static AES_BLOCK_SIZE] , aes_encrypt_arg key );

like, that's the whole signature, no cap πŸ’…


πŸ“ ARGUMENTS πŸ“

  • dst β€” the destination buffer, bestie. it can be in-place or out-of-place, both are fine. for any other overlaps tho? the behavior is unspecified 😭 so like… don't.
  • src β€” the source data, the actual bytes we're working with 🌈
  • len β€” number of bytes to en/decrypt 🧚
  • ctr β€” the block counter, and it's in host endianness (iykyk). for the first call, set it to:
1

and heads up β€” it gets incremented by ceil(len / AES_BLOCK_SIZE) πŸ“ˆ

  • iv β€” the initialization vector πŸŽ€
  • key β€” the key, but not just any key β€” it's already prepared using aes_preparekey or aes_prepareenckey πŸ‘‘

πŸ‘‘ DESCRIPTION πŸ‘‘

so this implements AES in XOR Counter mode, as specified in the paper "Length-preserving encryption with HCTR2" over at https://eprint.iacr.org/2021/1441.pdf πŸ’–

lowkey important: this exists only for use by the implementation of modes built on top of XCTR. callers are expected to know how to use XCTR mode appropriately β€” including choosing (key, IV) pairs appropriately to avoid keystream reuse. like, that part is not optional, fr fr πŸ™ˆ

it also supports incremental en/decryption ✨ the length of each non-final chunk must be a multiple of AES_BLOCK_SIZE, and the updated ctr must be passed in each time. no skipping, bestie πŸ’…


πŸ”₯ CONTEXT πŸ”₯

Any context. literally any. slay 🫢


⭐ SEE ALSO ⭐

  • Kernel file ./include/crypto/aes-ctr.h
  • aes_ctr(9) πŸ¦‹

and that's the whole page, bestie β€” brought to you by the fine folks over at ./include/crypto, dated October 2026. periodt πŸ’œβœ¨πŸŽ€

πŸ“¦ where this page comes from