1KCAPI_HANDLE_REINIT(3) Programming Interface KCAPI_HANDLE_REINIT(3)
2
3
4
6 kcapi_handle_reinit - re-initialize a new kernel interface
7
9 int kcapi_handle_reinit(struct kcapi_handle ** newhandle,
10 struct kcapi_handle * existing,
11 uint32_t flags);
12
14 newhandle
15 [out] cipher handle filled during the call
16
17 existing
18 [in] existing cipher handle from which a new handle shall be
19 re-initialized
20
21 flags
22 [in] flags specifying the type of cipher handle
23
25 The kernel crypto API interface operates with two types of file
26 descriptors, the TFM file descriptor and the OP file descriptor.
27
28 The TFM file descriptor receives the cipher-operation static
29 information: the key, and the AEAD tag size.
30
31 The OP file descriptor receives the volatile data, such as the
32 plaintext / ciphertext, the IV, or the AEAD AD size.
33
34 The kernel crypto API AF_ALG interface supports the concept that one
35 TFM file descriptor can operate with multiple OP file descriptors. The
36 different OP file descriptors can perform completely separate cipher
37 operations using the same key which can execute in parallel. The
38 parallel execution can be performed in the same or different process
39 threads.
40
41 kcapi_handle_reinit function allows the allocation of a new cipher
42 handle with a new OP file descriptor but using the same TFM file
43 descriptor. To obtain a reference to the TFM file descriptor, an
44 existing cipher handle is used as source. kcapi_handle_reinit can be
45 invoked multiple times. Each resulting cipher handle must be
46 deallocated with kcapi_cipher_destroy. The deallocation ensures that
47 the TFM resource is only released if the last handle using this TFM
48 resource is released.
49
50 return 0 upon success; -EINVAL - accept syscall failed -ENOMEM - cipher
51 handle cannot be allocated
52
54 Stephan Mueller <smueller@chronox.de>
55 Author.
56
58libkcapi Manual 1.2.0 August 2020 KCAPI_HANDLE_REINIT(3)