1KCAPI_CIPHER_STREAM_(3) Programming Interface KCAPI_CIPHER_STREAM_(3)
2
3
4
6 kcapi_cipher_stream_op - obtain processed data (stream)
7
9 int32_t kcapi_cipher_stream_op(struct kcapi_handle * handle,
10 struct iovec * iov, uint32_t iovlen);
11
13 handle
14 [in] cipher handle
15
16 iov
17 [out] scatter/gather list pointing to buffers to be filled with the
18 resulting data from a cipher operation.
19
20 iovlen
21 [in] number of scatter/gather list elements.
22
24 This call can be called interleaved with kcapi_cipher_stream_update to
25 fetch the processed data.
26
27 This function may cause the caller to sleep if the kernel buffer
28 holding the data is empty. The process will be woken up once more data
29 is sent by calling kcapi_cipher_stream_update.
30
31 Note, when supplying buffers that are not multiple of block size, the
32 buffers will only be filled up to the maximum number of full block
33 sizes that fit into the buffer.
34
35 The kernel supports multithreaded applications where one or more
36 threads send data via the kcapi_cipher_stream_update function and
37 another thread collects the processed data via kcapi_cipher_stream_op.
38 The kernel, however, will return data via kcapi_cipher_stream_op as
39 soon as it has some data available. For example, one thread sends 1000
40 bytes to be encrypted and another thread already waits for the
41 ciphertext. The kernel may send only, say, 500 bytes back to the
42 waiting process during one kcapi_cipher_stream_op call. In a subsequent
43 calls to kcapi_cipher_stream_op more ciphertext is returned. This
44 implies that when the receiving thread shall collect all data there is,
45 kcapi_cipher_stream_op must be called in a loop until all data is
46 received.
47
48 return number of bytes obtained from the kernel upon success; a
49 negative errno-style error code if an error occurred
50
52 Stephan Mueller <smueller@chronox.de>
53 Author.
54
56libkcapi Manual 1.1.1 August 2018 KCAPI_CIPHER_STREAM_(3)