KCAPI_AKCIPHER_DECRY(3)

πŸ’– KCAPI_AKCIPHER_DECRY(3) πŸ’–

okay bestie, so this is a page from the libkcapi programming interface crew, and it's lowkey one of the most fun ones because we're doing decryption ✨ asynchronous style. grab a snack, we're going in πŸ“


✨ NAME ✨

kcapi_akcipher_decrypt_aio β€” decrypt data (asynchronous one shot) πŸ’…

like. the name literally tells you everything. it decrypts. it's async. it's one shot. iconic behaviour fr fr πŸ‘‘


🌸 SYNOPSIS 🌸

ssize_t kcapi_akcipher_decrypt_aio(struct kcapi_handle * handle,
                                   struct iovec * iniov,
                                   struct iovec * outiov, size_t iovlen,
                                   int access);

look at her. five arguments. not one of them is optional. the way that she returns an ssize_t… main character energy tbh πŸŽ€


πŸ¦‹ ARGUMENTS πŸ¦‹

  • handle β€” [in] your cipher handle. the lil bestie you've been carrying around this whole time 🫢
  • iniov β€” [in] the head of the scatter-gather list array that's holding the plaintext. yes, the plaintext. it's coming in, it's about to get turned into ciphertext on the way out, keep up πŸ’œ
  • outiov β€” [out] the head of the scatter-gather list of destination buffers, and these get filled with ciphertext. she's the output girlie, she receives ✨
  • iovlen β€” [in] how many scatter-gather list entries there are. just a count. a lil number. no cap πŸ”’
  • access β€” [in] the kernel access type, and you've got three flavours to pick from:
    • KCAPI_ACCESS_HEURISTIC β€” use the internal heuristic for the fastest kernel access 🏎️
    • KCAPI_ACCESS_VMSPLICE β€” use vmsplice access 🌊
    • KCAPI_ACCESS_SENDMSG β€” sendmsg access πŸ“¨

🌈 DESCRIPTION 🌈

so here's the tea β˜• β€” the individual scatter-gather list entries get processed with separate invocations of the given cipher. not one big gulp, but a bunch of lil sips. that's just how she operates and we respect it πŸ’…

🚨 okay this next part is IMPORTANT, do not scroll past it bestie. your memory should be aligned at the page boundary using posix_memalign(sysconf(_SC_PAGESIZE)). If it is not aligned at the page boundary, the vmsplice call may not send all data to the kernel. like, data just… doesn't make it. we don't want that. align your memory, periodt 😭

and what does she give back to you?

  • the number of bytes decrypted upon success ✨
  • a negative errno-style error code if an error occurred πŸ’€

that's the vibe check. success = bytes, failure = negative errno. iykyk 🧚


πŸ‘‘ AUTHOR πŸ‘‘

  • Stephan Mueller <smueller@chronox.de> β€” Author.

the literal author. the one who wrote her. we stan 🌟


that's the legal bit, keep it cute, keep it real πŸ’–


and that's the whole page bestie!! libkcapi Manual 1.5.0, dated July 2025 β€” from the libkcapi programming interface girlies with love 🫢✨

πŸ“¦ where this page comes from