Lines Matching +full:data +full:- +full:size
5 ------------
9 crypto API high level discussion for the in-kernel use cases applies
21 Some details of the in-kernel kernel crypto API aspects do not apply to
29 ------------------------------
34 - Message digest including keyed message digest (HMAC, CMAC)
36 - Symmetric ciphers
38 - AEAD ciphers
40 - Random Number Generators
56 A cipher is accessed with the same name as done for the in-kernel API
80 system calls to send data to the kernel or obtain data from the
83 In-place Cipher operation
84 -------------------------
86 Just like the in-kernel operation of the kernel crypto API, the user
87 space interface allows the cipher operation in-place. That means that
91 copying of the output data to its final destination can be avoided.
99 ------------------
103 filled struct sockaddr data structure. This data structure must be
120 Using the send() system call, the application provides the data that
124 - MSG_MORE: If this flag is set, the send system call acts like a
139 --------------------
142 initialization, the struct sockaddr data structure must be filled as
154 Before data can be sent to the kernel using the write/send system call
158 Using the sendmsg() system call, the application provides the data that
160 specified with the data structure provided by the sendmsg() system call.
163 struct cmsghdr data structure. See recv(2) and cmsg(3) for more
164 information on how the cmsghdr data structure is used together with the
165 send/recv system call family. That cmsghdr data structure holds the
168 - specification of the cipher operation type with one of these flags:
170 - ALG_OP_ENCRYPT - encryption of data
172 - ALG_OP_DECRYPT - decryption of data
174 - specification of the IV information marked with the flag ALG_SET_IV
178 - MSG_MORE: If this flag is set, the send system call acts like a
179 cipher update function where more input data is expected with a
182 Note: The kernel reports -EINVAL for any unexpected data. The caller
183 must make sure that all data matches the constraints given in
189 data. If the output data size is smaller, only as many blocks are
190 returned that fit into that output buffer size.
193 ---------------
196 initialization, the struct sockaddr data structure must be filled as
208 Before data can be sent to the kernel using the write/send system call
212 In addition, before data can be sent to the kernel using the write/send
213 system call family, the consumer must set the authentication tag size.
214 To set the authentication tag size, the caller must use the setsockopt
217 Using the sendmsg() system call, the application provides the data that
219 specified with the data structure provided by the sendmsg() system call.
222 struct cmsghdr data structure. See recv(2) and cmsg(3) for more
223 information on how the cmsghdr data structure is used together with the
224 send/recv system call family. That cmsghdr data structure holds the
227 - specification of the cipher operation type with one of these flags:
229 - ALG_OP_ENCRYPT - encryption of data
231 - ALG_OP_DECRYPT - decryption of data
233 - specification of the IV information marked with the flag ALG_SET_IV
235 - specification of the associated authentication data (AAD) with the
241 - MSG_MORE: If this flag is set, the send system call acts like a
242 cipher update function where more input data is expected with a
245 Note: The kernel reports -EINVAL for any unexpected data. The caller
246 must make sure that all data matches the constraints given in
252 output data size is smaller, the cipher operation is not performed.
255 Such breach in integrity is marked with the -EBADMSG error code.
261 communicated between user and kernel space as one data stream:
263 - plaintext or ciphertext
265 - associated authentication data (AAD)
267 - authentication tag
270 sendmsg and setsockopt calls (see there). As the kernel knows the size
271 of the entire data stream, the kernel is now able to calculate the right
272 offsets of the data components in the data stream.
277 - AEAD encryption input: AAD \|\| plaintext
279 - AEAD decryption input: AAD \|\| ciphertext \|\| authentication tag
282 large to hold the following data:
284 - AEAD encryption output: ciphertext \|\| authentication tag
286 - AEAD decryption output: plaintext
289 ---------------------------
292 initialization, the struct sockaddr data structure must be filled as
307 seeded. The seed is also known as a *Personalization String* in NIST SP 800-90A
312 requires more data, multiple calls to read()/recvmsg() must be made.
321 - the concatenation of *Entropy* and *Nonce* can be provided to the RNG via
325 - *Additional Data* can be provided using the send()/sendmsg() system calls,
328 Zero-Copy Interface
329 -------------------
332 interface can be accessed with the zero-copy interface of
336 The zero-copy operation requires data to be aligned at the page
337 boundary. Non-aligned data can be used as well, but may require more
339 from the zero-copy interface.
341 The system-inherent limit for the size of one zero-copy operation is 16
342 pages. If more data is to be sent to AF_ALG, user space must slice the
343 input into segments with a maximum size of 16 pages.
345 Zero-copy can be used with the following code example (a complete
353 /* input data in iov */
361 --------------------
364 and retrieve data subject to the cipher operation, a consumer also needs
372 The setsockopt interface allows setting the following data using the
375 - ALG_SET_KEY -- Setting the key. Key setting is applicable to:
377 - the skcipher cipher type (symmetric ciphers)
379 - the hash cipher type (keyed message digests)
381 - the AEAD cipher type
383 - the RNG cipher type to provide the seed
385 - ALG_SET_KEY_BY_KEY_SERIAL -- Setting the key via keyring key_serial_t.
387 data is copied from a keyring key, and uses that data as the
391 permission set, otherwise -EPERM is returned. Supports key types: user,
394 - ALG_SET_AEAD_AUTHSIZE -- Setting the authentication tag size for
396 the given size will be generated. For a decryption operation, the
398 the given size (see section about AEAD memory layout below).
400 - ALG_SET_DRBG_ENTROPY -- Setting the entropy of the random number generator.
404 ----------------------
406 Please see [1] for libkcapi which provides an easy-to-use wrapper around