---
name: "kcapi_cipher_stream_op"
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_op"
---

# kcapi\_cipher\_stream\_op(3)

obtain processed data (stream)

## NAME

kcapi\_cipher\_stream\_op - obtain processed data (stream)

## SYNOPSIS

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

## ARGUMENTS

*handle*

\[in\] cipher handle

*iov*

\[out\] scatter/gather list pointing to buffers to be filled with the resulting data from a cipher operation.

*iovlen*

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

## DESCRIPTION

This call can be called interleaved with **kcapi\_cipher\_stream\_update** to fetch the processed data.

This function may cause the caller to sleep if the kernel buffer holding the data is empty. The process will be woken up once more data is sent by calling **kcapi\_cipher\_stream\_update**.

Note, when supplying buffers that are not multiple of block size, the buffers will only be filled up to the maximum number of full block sizes that fit into the buffer.

The kernel supports multithreaded applications where one or more threads send data via the **kcapi\_cipher\_stream\_update** function and another thread collects the processed data via kcapi\_cipher\_stream\_op. The kernel, however, will return data via **kcapi\_cipher\_stream\_op** as soon as it has some data available. For example, one thread sends 1000 bytes to be encrypted and another thread already waits for the ciphertext. The kernel may send only, say, 500 bytes back to the waiting process during one **kcapi\_cipher\_stream\_op** call. In a subsequent calls to **kcapi\_cipher\_stream\_op** more ciphertext is returned. This implies that when the receiving thread shall collect all data there is, **kcapi\_cipher\_stream\_op** must be called in a loop until all data is received.

*return* number of bytes obtained from the kernel upon success; a negative errno-style error code if an error occurred

## AUTHOR

**Stephan Mueller** \<smueller@chronox.de\>

Author.

## COPYRIGHT
