Lines Matching +full:kernel +full:- +full:family
5 ------------
7 The concepts of the kernel crypto API visible to kernel space is fully
8 applicable to the user space interface as well. Therefore, the kernel
9 crypto API high level discussion for the in-kernel use cases applies
16 The following covers the user space interface exported by the kernel
19 applications that require cryptographic services from the kernel.
21 Some details of the in-kernel kernel crypto API aspects do not apply to
29 ------------------------------
31 The kernel crypto API is accessible from user space. Currently, the
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
60 To interact with the kernel crypto API, a socket must be created by the
62 send()/write() system call family. The result of the cipher operation is
63 obtained with the read()/recv() system call family.
66 opened by the user space application and discusses only the kernel
80 system calls to send data to the kernel or obtain data from the
81 kernel, the file descriptor returned by accept must be used.
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
99 ------------------
110 .salg_type = "hash", /* this selects the hash logic in the kernel */
124 - MSG_MORE: If this flag is set, the send system call acts like a
130 from the kernel crypto API. If the buffer is too small for the message
131 digest, the flag MSG_TRUNC is set by the kernel.
139 --------------------
154 Before data can be sent to the kernel using the write/send system call
155 family, the consumer must set the key. The key setting is described with
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
176 The send system call family allows the following flag to be specified:
178 - MSG_MORE: If this flag is set, the send system call acts like a
182 Note: The kernel reports -EINVAL for any unexpected data. The caller
187 cipher operation from the kernel crypto API. The output buffer must be
193 ---------------
208 Before data can be sent to the kernel using the write/send system call
209 family, the consumer must set the key. The key setting is described with
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.
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
236 flag ALG_SET_AEAD_ASSOCLEN. The AAD is sent to the kernel together
239 The send system call family allows the following flag to be specified:
241 - MSG_MORE: If this flag is set, the send system call acts like a
245 Note: The kernel reports -EINVAL for any unexpected data. The caller
250 cipher operation from the kernel crypto API. The output buffer must be
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
277 - AEAD encryption input: AAD \|\| plaintext
279 - AEAD decryption input: AAD \|\| ciphertext \|\| authentication tag
284 - AEAD encryption output: ciphertext \|\| authentication tag
286 - AEAD decryption output: plaintext
289 ---------------------------
307 seeded. The seed is also known as a *Personalization String* in NIST SP 800-90A
311 The kernel generates at most 128 bytes in one call. If user space
318 Following CAVP testing interfaces are enabled when kernel is built with
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 -------------------
331 In addition to the send/write/read/recv system call family, the AF_ALG
332 interface can be accessed with the zero-copy interface of
333 splice/vmsplice. As the name indicates, the kernel tries to avoid a copy
334 operation into kernel space.
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
338 operations of the kernel which would defeat the speed gains obtained
339 from the zero-copy interface.
341 The system-inherent limit for the size of one zero-copy operation is 16
345 Zero-copy can be used with the following code example (a complete
361 --------------------
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.
391 permission set, otherwise -EPERM is returned. Supports key types: user,
394 - ALG_SET_AEAD_AUTHSIZE -- Setting the authentication tag size for
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
407 the aforementioned Netlink kernel interface. [1] also contains a test