KCAPI_CIPHER_STREAM_(3)

✨ NAME ✨

kcapi_cipher_stream_update_last β€” send the last data for processing (stream edition, bestie) πŸŽ€

okay so this whole vibe lives in the KCAPI_CIPHER_STREAM_(3) manual, and yes, that's the family you're in πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

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

🌸 ARGUMENTS 🌸

  • handle β€” [in] the cipher handle. your main character. πŸ”‘
  • iov β€” [in] a scatter/gather list holding the data the cipher operation is gonna chew on. πŸ“
  • iovlen β€” [in] how many elements are in that scatter/gather list. literally just the count, bestie. πŸ”’

πŸ’– DESCRIPTION πŸ’–

so with this function call you can hand more plaintext for encryption or ciphertext for decryption over to the kernel. slay.

this call is identical to the kcapi_cipher_stream_update call, EXCEPT β€” and this is the whole point β€” it marks the last data buffer before the cipher operation gets triggered. 🚨

ngl this call is super important for stream ciphers like CTR or CTS mode when you're providing that final block. it's giving "closing time, everybody out". πŸ‘‘

and yes, it is permissible to hand it a zero buffer if literally all the data β€” including the last block β€” was already provided by kcapi_cipher_stream_update. no cap. πŸ™ˆ


πŸ’€ WARNING πŸ’€

okay bestie, listen up, because this one is the real talk:

if this call is not made for stream ciphers with input data that is not a multiple of the block size of the block cipher, the kernel will not return the last block that contains less data than the block size of the block cipher. 😭

for example: you send 257 bytes of data to be encrypted with ctr(aes), and without this call the kernel will return only 256 bytes. that one lonely byte? gone. not me losing your data. πŸ’€

what you get back: number of bytes sent to the kernel upon success; a negative errno-style error code if an error occurred. ✨


πŸ‘‘ AUTHOR πŸ‘‘

Stephan Mueller <smueller@chronox.de> β€” Author. 🫢


libkcapi Manual 1.5.0 β€” July 2025 🌸

and that's the whole page, bestie!! go forth and send your last block, you absolute icon πŸŽ€βœ¨πŸ’… periodt πŸ¦‹πŸ’–

πŸ“¦ where this page comes from