KCAPI_CIPHER_ENCRYPT(3)
π KCAPI_CIPHER_ENCRYPT(3) π
okay bestie, welcome to the Programming Interface section of the libkcapi manual β this one's all about kcapi_cipher_encrypt_aio, the async one-shot encryption girlie. she's giving "send your plaintext, get your ciphertext, no drama" and honestly? iconic. let's get into it π«Ά
β¨ NAME β¨
kcapi_cipher_encrypt_aio β encrypt data (asynchronous one shot) π₯
πΈ SYNOPSIS πΈ
ssize_t kcapi_cipher_encrypt_aio(struct kcapi_handle * handle,
struct iovec * iniov,
struct iovec * outiov, size_t iovlen,
const uint8_t * iv, 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 (the stuff you wanna hide π)outiovβ [out] head of the scatter-gather list of the destination buffers, which get filled with the ciphertext β¨iovlenβ [in] number of scatter-gather list entries, bestie. count them.ivβ [in] the IV to be used for the cipher operation πaccessβ [in] kernel access type, and you have three flavors to choose from:KCAPI_ACCESS_HEURISTICβ use the internal heuristic for the fastest kernel access πββοΈπ¨KCAPI_ACCESS_VMSPLICEβ use vmsplice accessKCAPI_ACCESS_SENDMSGβ sendmsg access
π¦ DESCRIPTION π¦
So here's the vibe: each individual scatter-gather list entry gets processed with separate invocations of the given cipher. not one big call β separate ones. noted. π
Your memory should be aligned at the page boundary using posix_memalign(sysconf(_SC_PAGESIZE)). and like, if it's not aligned at the page boundary, the vmsplice call may not send all data to the kernel β so yeah, that's a real one, don't skip it. π
Also: the IV buffer must be exactly kcapi_cipher_ivsize bytes in size. not more, not less. periodt.
And what do you get back? the number of bytes encrypted upon success π β or a negative errno-style error code if an error occurred π
π AUTHOR π
Stephan Mueller <smueller@chronox.de> β Author.
π COPYRIGHT π
this one's short and sweet, no cap.
okay that's the whole page, bestie, you ate that ππ§
libkcapi Manual 1.5.0, July 2025 β mwah, take care of her πβ¨
π¦ where this page comes from
- fedora 43: libkcapi-devel 1.5.0-6.fc43 Β· BSD-3-Clause OR GPL-2.0-only
- fedora 43: libkcapi-devel 1.5.0-6.fc43 Β· BSD-3-Clause OR GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms