KCAPI_CIPHER_STREAM_(3)
π NAME π
kcapi_cipher_stream_init_enc β bestie, this is the one that starts up an encryption operation in stream mode β¨ (and yeah, the page itself lives in section 3 of the manual, KCAPI_CIPHER_STREAM_(3), iykyk π)
π¦ SYNOPSIS π¦
ssize_t kcapi_cipher_stream_init_enc(struct kcapi_handle * handle,
const uint8_t * iv,
struct iovec * iov, size_t iovlen);
πΈ ARGUMENTS πΈ
okay so here's who's coming to the party π every single one of them matters, no skips:
handleβ [in] the cipher handle. your main character, your ride-or-die π«Άivβ [in] the IV that's gonna be used for this cipher operation. yes it has to be the right size, we'll get to that πiovβ [in] a scatter/gather list holding the data you wanna encrypt. if you're passing in an actual array of iov entries, this is the pointer to the first one. wanna know howiovis meant to be used? go readsendmsg(2), it's literally right there π. and lowkey? this pointer is allowed to beNULLif there's just no data to encrypt yet at the moment you make the call πiovlenβ [in] how many scatter/gather list elements there are. and heads up: ifiovisNULL, this value must be zero. not negotiable bestie β οΈ
β¨ DESCRIPTION β¨
so this call is what kicks off a stream encryption operation π once you've done that, you can hit kcapi_cipher_stream_update over and over, one after another, to keep feeding more plaintext in to be encrypted π
the kernel holds onto your input, just chilling in the buffer, until kcapi_cipher_stream_op comes along and picks up the encrypted data. and the moment that plaintext actually gets encrypted during the kcapi_cipher_stream_op, it's removed from the kernel buffer. gone. bye π
the way that you can mix kcapi_cipher_stream_update and kcapi_cipher_stream_op calls together?? iconic. and not just in a single-threaded lil baby program β multiple threads of an application can do it too π§ the multitasking ate fr fr
β οΈ okay important one: the IV buffer must be exactly kcapi_cipher_ivsize bytes in size. not more, not less. get this wrong and it's giving chaos π
and what do you get back?
- on success: the number of bytes sent to the kernel β
- on failure: a negative errno-style error code π
π AUTHOR π
Stephan Mueller <smueller@chronox.de> β the author, the legend, the moment π
π COPYRIGHT π
that's all from me bestie, hope your encryption streams slay π β¨
libkcapi Manual 1.5.0 β July 2025 β and yeah, you'll find it filed under KCAPI_CIPHER_STREAM_(3) π¦ mwah, 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