KCAPI_AEAD_ENCRYPT(3)
π KCAPI_AEAD_ENCRYPT π
okay bestie, welcome to kcapi_aead_encrypt(3) β straight outta the libkcapi Programming Interface, and she is the one-shot synchronous AEAD glow-up. no cap. let's get into it π¦
β¨ NAME β¨
kcapi_aead_encrypt β synchronously encrypt AEAD data, one shot, no redo, periodt. π
πΈ SYNOPSIS πΈ
ssize_t kcapi_aead_encrypt(struct kcapi_handle * handle,
const uint8_t * in, size_t inlen,
const uint8_t * iv, uint8_t * out,
size_t outlen, int access);
π ARGUMENTS π
she takes seven whole args, and every single one is doing her job, okay:
handleβ [in] the cipher handle. your main character. πinβ [in] plaintext data buffer, i.e. the tea before it gets sealed.inlenβ [in] length of the plaintext buffer.ivβ [in] the IV to be used for the cipher operation.outβ [out] the data buffer that holds the cipher text and the authentication tag. two-for-one, iconic. β¨outlenβ [in] length of theoutbuffer.accessβ [in] kernel access type. your options are:KCAPI_ACCESS_HEURISTICβ use the internal heuristic to grab the fastest kernel access. the "let her cook" option. π₯KCAPI_ACCESS_VMSPLICEβ usevmspliceaccess.KCAPI_ACCESS_SENDMSGβ usesendmsgaccess.
π DESCRIPTION π
so, the AEAD cipher operation requires you to furnish the associated authentication data. no auth data, no vibe. but β plot twist β if that data genuinely isn't needed, you can set it to NULL and set the length value to zero. yes really. π
it is perfectly legal to use the same buffer for both the plaintext and ciphertext pointers. what that means, bestie, is that after the encryption operation, the plaintext gets overwritten by the ciphertext. it's giving transformation arc. π¦
your memory should be aligned at the page boundary using posix_memalign(sysconf(_SC_PAGESIZE)). if it's not aligned at the page boundary, the vmsplice call may not send all the data to the kernel, and that's just sad. π
the iv buffer must be exactly kcapi_cipher_ivsize bytes in size. exactly. not vibes-approximately. exactly.
after invoking this function, the caller should use kcapi_aead_getdata_output to obtain the resulting ciphertext and authentication tag references. don't forget her, she's part of the story. π«Ά
β οΈ IMPORTANT NOTE β οΈ
bestie. listen. the kernel will only process sysconf(_SC_PAGESIZE) * ALG_MAX_PAGES at one time. longer input data cannot be handled by the kernel. that's it. that's the limit. fr fr.
and what does she give you back? the number of bytes encrypted upon success; a negative errno-style error code if an error occurred. π
π AUTHOR π
Stephan Mueller <smueller@chronox.de>
- Author. (yes, THE author. respect the icon. π)
π COPYRIGHT π
that's the whole page, bestie! π this one comes from the libkcapi Manual 1.5.0, dated July 2025 β go encrypt something slay, and remember: aligned memory, correct IV size, no cap. periodt. π β¨π
π¦ 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