aes_xts_encrypt(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… aes_xts_encrypt(9) β€” like, the Kernel API Manual, bestie ✨

okay so real talk: this one lives in the Kernel API Manual and it's called aes_xts_encrypt. Obsessed already. It does exactly one thing and does it gorgeously: it encrypts your data with AES-XTS. That's the whole vibe. πŸŽ€


✨ SYNOPSIS ✨

void aes_xts_encrypt (u8 *dst , const u8 *src , size_t len , u8 tweak[static AES_BLOCK_SIZE] , const struct aes_xts_key *key , bool cont );

Like… look at her. Six params, zero drama. πŸ’…


🌸 ARGUMENTS 🌸

  • dst β€” the destination buffer, aka where the encrypted goodness goes. She's flexible: in-place or out-of-place, both iconic, both valid. Any other kind of overlap? behavior is unspecified β€” no cap, don't do it. πŸ™ˆ
  • src β€” the source data, your raw lil plaintext (or whatever you're feeding her). πŸ“
  • len β€” how many bytes to encrypt. Important rules here, bestie, write these down: on non-final calls it must be a nonzero multiple of AES_BLOCK_SIZE. On the final call it can be any value >= AES_BLOCK_SIZE β€” which literally means ciphertext stealing is supported. she ate. πŸ”₯
  • tweak β€” the tweak, duh. She gets updated with the next value… unless len isn't a multiple of AES_BLOCK_SIZE, in which case the value is unspecified. so like, don't go reading her after that, mwah. πŸ’€
  • key β€” the key πŸ’œ β€” and NOT just any key, it's gotta be one already prepared with aes_xts_preparekey. Do the prep first. main character energy requires setup.
  • cont β€” the continuation flag, the plot device of this whole function:
    • false β†’ begin encrypting a new message (this is when she does the tweak encryption) 🫢
    • true β†’ continue encrypting a message (and she skips the tweak encryption) ⭐

πŸ¦‹ DESCRIPTION πŸ¦‹

So she supports both one-shot and incremental encryption, which is genuinely so versatile of her.

The recipe, step by step:

  1. On the first call, pass cont = false. πŸŽ€
  2. On any later calls, pass cont = true and the updated tweak. ✨
And like, small but crucial detail: all earlier len must have been multiples of AES_BLOCK_SIZE. That's the rule, iykyk. πŸ’…

🌈 CONTEXT 🌈

Any context. Literally any. She doesn't care where you call her from, she's chill like that. 😌


πŸ’– SEE ALSO πŸ’–

  • Kernel file ./include/crypto/aes-xts.h β€” the struct aes_xts_key(9) lives there, go say hi πŸ‘‘
  • aes_xts_preparekey(9) β€” do this BEFORE you call her, remember? πŸ”‘
  • aes_xts_decrypt(9) β€” the other direction, her sister fr fr 🧚

okay that's the whole page, and honestly?? flawless. this came from the <pink>./include/crypto</pink> corner of the kernel, dated October 2026, and it's page aes_xts_encrypt(9) β€” so go forth, encrypt responsibly, and don't overlap your buffers weirdly. πŸ’œπŸ¦‹βœ¨

πŸ“¦ where this page comes from