KCAPI_AEAD_STREAM_IN(3)
π KCAPI_AEAD_STREAM_IN π
okay bestie, welcome to the <pink>libkcapi</pink> corner of the manual β this one's kcapi_aead_stream_init_enc(3) and it's literally the moment your encryption era begins. β¨
πΈ NAME πΈ
kcapi_aead_stream_init_enc β start an encryption operation (stream) π«Ά
π SYNOPSIS π
ssize_t kcapi_aead_stream_init_enc(struct kcapi_handle * handle,
const uint8_t * iv,
struct iovec * iov, size_t iovlen);
β¨ ARGUMENTS β¨
handleβ [in] the cipher handle. your main character, your plus-one, your whole vibe. πivβ [in] the IV to be used for the cipher operation. πiovβ [in] the scatter/gather list holding the data you wanna encrypt. if you're passing an array of iov entries, this here is the pointer to the first one. peek atsendmsg(2)for the whole tea on howiovis meant to be used. and lowkey? this pointer can beNULLif you've got no data to encrypt at the moment of the call β no data, no problem, it's giving "showing up empty-handed but cute". πiovlenβ [in] how many scatter/gather list elements there are. and heads up: ifiovisNULL, this value must be zero. not one, not "ehh close enough", zero. π«
π¦ DESCRIPTION π¦
A stream encryption operation gets started right here with this call. no cap. Then you can hit up kcapi_aead_stream_update multiple times in a row to send more plaintext over to be encrypted. π
The kernel holds onto that input and buffers it until kcapi_aead_stream_op comes through and picks up the encrypted data. And the moment plaintext gets encrypted during kcapi_aead_stream_op? bestie, it's gone β removed from the kernel buffer. poof. π
β οΈ NOT me mixing things up β unlike the corresponding symmetric cipher API, the function calls ofkcapi_aead_stream_updateandkcapi_aead_stream_opcannot be mixed! periodt. this is just the nature of AEAD being AEAD: the cipher operation is out here ensuring the integrity of the entire data (that's decryption) or calculating a message digest over the entire data (that's encryption). it's an all-or-nothing situation and honestly? iconic. π
When you're using the stream API, the caller has to make sure data goes in the correct order β doesn't matter whether you're sending data in multiple chunks via kcapi_aead_stream_init_enc or kcapi_cipher_stream_update:
- the complete associated data must be provided first,
- and then the plaintext.
in that order. no skipping ahead, no shuffling. β
The IV buffer must be exactly kcapi_cipher_ivsize bytes in size. exactly exactly. π
And what do you get back? the number of bytes sent to the kernel upon success; or a negative errno-style error code if something went wrong. π
π AUTHOR π
Stephan Mueller <smueller@chronox.de> β Author. π«‘
π COPYRIGHT π
libkcapi Manual 1.5.0 β July 2025 β KCAPI_AEAD_STREAM_IN(3)
and that's the whole page, bestie! π go forth, init that stream, and may all your errno values be non-negative. mwah. πβ¨π¦πΈπ
π¦ 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