'\" t .\" Title: kcapi_aead_stream_init_enc .\" Author: .\" Generator: DocBook XSL Stylesheets vsnapshot .\" Date: April 2024 .\" Manual: Programming Interface .\" Source: libkcapi Manual 1.4.0 .\" Language: English .\" .TH "KCAPI_AEAD_STREAM_IN" "3" "April 2024" "libkcapi Manual 1\&.4\&.0" "Programming Interface" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" kcapi_aead_stream_init_enc \- start an encryption operation (stream) .SH "SYNOPSIS" .HP \w'ssize_t\ kcapi_aead_stream_init_enc('u .BI "ssize_t kcapi_aead_stream_init_enc(struct\ kcapi_handle\ *\ " "handle" ", const\ uint8_t\ *\ " "iv" ", struct\ iovec\ *\ " "iov" ", size_t\ " "iovlen" ");" .SH "ARGUMENTS" .PP \fIhandle\fR .RS 4 [in] cipher handle .RE .PP \fIiv\fR .RS 4 [in] IV to be used for cipher operation .RE .PP \fIiov\fR .RS 4 [in] scatter/gather list with data to be encrypted\&. This is the pointer to the first iov entry if an array of iov entries is supplied\&. See sendmsg(2) for details on how iov is to be used\&. This pointer may be NULL if no data to be encrypted is available at the point of the call\&. .RE .PP \fIiovlen\fR .RS 4 [in] number of scatter/gather list elements\&. If iov is NULL, this value must be zero\&. .RE .SH "DESCRIPTION" .PP A stream encryption operation is started with this call\&. Multiple successive \fBkcapi_aead_stream_update\fR function calls can be invoked to send more plaintext data to be encrypted\&. The kernel buffers the input until \fBkcapi_aead_stream_op\fR picks up the encrypted data\&. Once plaintext is encrypted during the \fBkcapi_aead_stream_op\fR it is removed from the kernel buffer\&. .PP Note, unlike the corresponding symmetric cipher API, the function calls of \fBkcapi_aead_stream_update\fR and \fBkcapi_aead_stream_op\fR cannot be mixed! This due to the nature of AEAD where the cipher operation ensures the integrity of the entire data (decryption) or calculates a message digest over the entire data (encryption)\&. .PP When using the stream API, the caller must ensure that data is sent in the correct order (regardless whether data is sent in multiple chunks using \fBkcapi_aead_stream_init_enc\fR or \fBkcapi_cipher_stream_update\fR): (i) the complete associated data must be provided, followed by (ii) the plaintext\&. .PP The IV buffer must be exactly \fBkcapi_cipher_ivsize\fR bytes in size\&. .PP \fIreturn\fR number of bytes sent to the kernel upon success; a negative errno\-style error code if an error occurred .SH "AUTHOR" .PP \fBStephan Mueller\fR <\&smueller@chronox.de\&> .RS 4 Author. .RE .SH "COPYRIGHT" .br