aes_xts_encrypt(9)
π 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 ofAES_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β¦ unlesslenisn't a multiple ofAES_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 withaes_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:
- On the first call, pass
cont = false. π - On any later calls, pass
cont = trueand the updated tweak. β¨
And like, small but crucial detail: all earlierlenmust have been multiples ofAES_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β thestruct 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
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms