KCAPI_AKCIPHER_ENCRY(3)
β¨ KCAPI_AKCIPHER_ENCRY β¨
okay bestie, welcome to kcapi_akcipher_encrypt(3) from the libkcapi Manual π this one is giving crypto main character energy and honestly? we're obsessed.
πΈ NAME πΈ
kcapi_akcipher_encrypt β encrypt data πβ¨
π SYNOPSIS π
ssize_t kcapi_akcipher_encrypt(struct kcapi_handle * handle,
const uint8_t * in, size_t inlen,
uint8_t * out, size_t outlen,
int access);
π ARGUMENTS π
handleβ [in] the cipher handle, aka ur little crypto bestie π«Άinβ [in] the plaintext data buffer, the tea before it gets scrambled βinlenβ [in] how long theinbuffer is πoutβ [out] the ciphertext data buffer, where the scrambled tea goes πoutlenβ [in] how long theoutbuffer is πaccessβ [in] the kernel access type. and bestie, u have options π:KCAPI_ACCESS_HEURISTICβ uses the internal heuristic to snag the fastest kernel access, lowkey iconicKCAPI_ACCESS_VMSPLICEβ uses vmsplice accessKCAPI_ACCESS_SENDMSGβ uses sendmsg access
π¦ DESCRIPTION π¦
not me about to tell u the coolest part first: it is perfectly legal to pass the same buffer as both the plaintext and the ciphertext pointers πβ¨ like literally the same pointer. and if u do that? after the encryption operation, ur plaintext gets overwritten with the ciphertext. gone. replaced. slay but also be aware π
now, the memory. it should be aligned at the page boundary using posix_memalign(sysconf(_SC_PAGESIZE)). and if it is not aligned at the page boundary, the vmsplice call may not send all data to the kernel π so like, align it, bestie, it's not that deep.
if the output size is insufficiently large, -EINVAL is returned π« the output buffer must be at least as large as the modululs of the uses key. periodt.
and the return situation, since i know u were wondering: on success u get the number of bytes returned by the encryption operation π and if something went wrong, u get a negative errno-style error code instead π
π AUTHOR π
Stephan Mueller <smueller@chronox.de> β Author. we stan π«Ά
π COPYRIGHT π
that's the whole vibe, bestie β this was libkcapi Manual version 1.5.0, dated July 2025, and yes the manual page itself is literally named KCAPI_AKCIPHER_ENCRY(3) ππ go encrypt something iconic, ily, bye β¨
π¦ 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