table of contents
KCAPI_CIPHER_STREAM_(3) | Programming Interface | KCAPI_CIPHER_STREAM_(3) |
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
iov
iovlen
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>
COPYRIGHT¶
March 2023 | libkcapi Manual 1.4.0 |