---
name: "kcapi_cipher_stream_update"
section: "3"
platform: "linux"
package: "libkcapi-dev"
version: "1.4.0-1+b2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/kcapi_cipher_stream_update"
---

# kcapi\_cipher\_stream\_update(3)

send more data for processing (stream)

## NAME

kcapi\_cipher\_stream\_update - send more data for processing (stream)

## SYNOPSIS

**ssize\_t kcapi\_cipher\_stream\_update(struct kcapi\_handle \*** *handle***, struct iovec \*** *iov***, size\_t** *iovlen***);**

## ARGUMENTS

*handle*

\[in\] cipher handle

*iov*

\[in\] scatter/gather list with data to be processed by the cipher operation.

*iovlen*

\[in\] number of scatter/gather list elements.

## DESCRIPTION

Using this function call, more plaintext for encryption or ciphertext for decryption can be submitted to the kernel.

This function may cause the caller to sleep if the kernel buffer holding the data is getting full. The process will be woken up once more buffer space becomes available by calling **kcapi\_cipher\_stream\_op**.

## NOTE

with the separate API calls of **kcapi\_cipher\_stream\_update** and **kcapi\_cipher\_stream\_op** a multi-threaded application can be implemented where one thread sends data to be processed and one thread picks up data processed by the cipher operation.

## IMPORTANT NOTE

The kernel will only process sysconf(\_SC\_PAGESIZE) \* ALG\_MAX\_PAGES at one time. If your input data is larger than this threshold, you MUST segment it into chunks of at most sysconf(\_SC\_PAGESIZE) \* ALG\_MAX\_PAGES and invoke the **kcapi\_cipher\_stream\_update** on that segment followed by **kcapi\_cipher\_stream\_op** before the next chunk is processed. If this rule is not obeyed, the thread invoking **kcapi\_cipher\_stream\_update** will be put to sleep until another thread invokes **kcapi\_cipher\_stream\_op**.

## WARNING

The memory referenced by *iov* is not accessed by the kernel during this call. The memory is first accessed when **kcapi\_cipher\_stream\_op** is called. Thus, you MUST make sure that the referenced memory is still present at the time **kcapi\_cipher\_stream\_op** is called.

*return* 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.

## COPYRIGHT
