KCAPI_AKCIPHER_ENCRY(3)

πŸ’– KCAPI_AKCIPHER_ENCRY πŸ’–

okay bestie, welcome to the libkcapi girlies' corner of section 3 β€” this one lives in the Programming Interface manual and it's literally the moment you've been waiting for 🫢


✨ NAME ✨

kcapi_akcipher_encrypt_aio β€” encrypt data (asynchronous one shot) πŸ”βœ¨


🌸 SYNOPSIS 🌸

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

πŸŽ€ ARGUMENTS πŸŽ€

  • handle β€” [in] your cipher handle, the main character of this whole operation πŸ‘‘
  • iniov β€” [in] head of the scatter-gather list array holding the plaintext (this is the tea you're about to encrypt πŸ“)
  • outiov β€” [out] head of the scatter-gather list of the destination buffers, which get filled with ciphertext πŸ’œ
  • iovlen β€” [in] number of scatter-gather list entries (how many lil chunks we're working with)
  • access β€” [in] kernel access type, and babes you have options:
    • KCAPI_ACCESS_HEURISTIC β€” use internal heuristic for fastest kernel access ⚑
    • KCAPI_ACCESS_VMSPLICE β€” use vmsplice access
    • KCAPI_ACCESS_SENDMSG β€” sendmsg access

πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the vibe: the individual scatter-gather list entries are processed with separate invocations of the the given cipher. like, each one gets its own moment, no sharing ✨

now the memory part, and listen closely because this one matters β€” the 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 😭 no cap, that's just how it is.

⚠️ fr fr, get that alignment right or the kernel might not receive everything. it's giving "missing data" and nobody wants that.

and the return value? number of bytes encrypted upon success πŸŽ‰ β€” or a negative errno-style error code if an error occurred πŸ’€


🌈 AUTHOR 🌈

Stephan Mueller <smueller@chronox.de> Author. πŸ’…


that's the whole page, bestie β€” no more sections, no less. 🧚


and that's a wrap on this one, gorgeous 🌸 the source is the libkcapi Manual, version 1.5.0, dated July 2025 β€” so you know exactly which era of the manual you're reading. go forth and encrypt responsibly, mwah πŸ’–βœ¨

πŸ“¦ where this page comes from