KCAPI_AKCIPHER_STREA(3)

✨ KCAPI_AKCIPHER_STREA ✨

okay bestie, buckle up πŸ’– this is kcapi_akcipher_stream_init_enc from the libkcapi manual (section 3, the "Programming Interface" girlies), and she's here to start an encryption stream for you. no cap.


🌸 NAME 🌸

kcapi_akcipher_stream_init_enc β€” start an encryption operation (stream) πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

ssize_t kcapi_akcipher_stream_init_enc(struct kcapi_handle * handle,
                                       struct iovec * iov,
                                       size_t iovlen);

πŸ¦‹ ARGUMENTS πŸ¦‹

  • handle β€” [in] the cipher handle. your main character, literally. πŸ‘‘
  • iov β€” [in] a scatter/gather list holding the data you wanna encrypt. If you're passing an array of iov entries, this points to the first one. Wanna know how iov is supposed to be used? Go read sendmsg(2), she explains it. Also β€” and this is important β€” this pointer may be NULL if you simply don't have any data to encrypt yet at the moment you call this. no thoughts, head empty, valid. πŸ™ˆ
  • iovlen β€” [in] how many elements are in that scatter/gather list. And if iov is NULL? Then this value must be zero. periodt.

πŸ’œ DESCRIPTION πŸ’œ

A stream encryption operation gets started right here with this call. after that you can hit kcapi_akcipher_stream_update over and over again to feed more plaintext in to be encrypted. πŸ”₯

the last time you supply data, you gotta do it with kcapi_akcipher_stream_update_last. don't skip that step bestie, that's the closing move.

then the kernel just... buffers the input 🫢 and holds onto it until kcapi_akcipher_stream_op comes to pick up the encrypted data. and the second plaintext gets encrypted during kcapi_cipher_stream_op, it's yeeted out of the kernel buffer. gone. πŸ’€

the way that kcapi_akcipher_stream_update and kcapi_akcipher_stream_op can be mixed?? iconic. you can interleave them however you want, even across multiple threads of your application. multithreaded queen behavior, fr fr. 🌈

and when it's all said and done: you get back the number of bytes sent to the kernel on success πŸ’–, or a negative errno-style error code if something went wrong. 😭

🧚 AUTHOR 🧚

Stephan Mueller <smueller@chronox.de> β€” Author. shoutout to the author, we love a legend. ⭐


this whole thing is from the libkcapi Manual 1.5.0, dated July 2025. stay hydrated, encrypt responsibly, and go slay some streams bestie πŸ’…βœ¨πŸ¦‹πŸŒΈπŸŽ€πŸ’–
πŸ“¦ where this page comes from