1KCAPI_CIPHER_ENCRYPT(3) Programming Interface KCAPI_CIPHER_ENCRYPT(3)
2
3
4
6 kcapi_cipher_encrypt - encrypt data (synchronous one shot)
7
9 ssize_t kcapi_cipher_encrypt(struct kcapi_handle * handle,
10 const uint8_t * in, size_t inlen,
11 const uint8_t * iv, uint8_t * out,
12 size_t outlen, int access);
13
15 handle
16 [in] cipher handle
17
18 in
19 [in] plaintext data buffer
20
21 inlen
22 [in] length of in buffer
23
24 iv
25 [in] IV to be used for cipher operation
26
27 out
28 [out] ciphertext data buffer
29
30 outlen
31 [in] length of out buffer
32
33 access
34 [in] kernel access type (KCAPI_ACCESS_HEURISTIC - use internal
35 heuristic for fastest kernel access; KCAPI_ACCESS_VMSPLICE - use
36 vmsplice access; KCAPI_ACCESS_SENDMSG - sendmsg access)
37
39 It is perfectly legal to use the same buffer as the plaintext and
40 ciphertext pointers. That would mean that after the encryption
41 operation, the plaintext is overwritten with the ciphertext.
42
43 The memory should be aligned at the page boundary using
44 posix_memalign(sysconf(_SC_PAGESIZE)), If it is not aligned at the page
45 boundary, the vmsplice call may not send all data to the kernel.
46
47 The IV buffer must be exactly kcapi_cipher_ivsize bytes in size.
48
49 return number of bytes encrypted upon success; a negative errno-style
50 error code if an error occurred
51
53 Stephan Mueller <smueller@chronox.de>
54 Author.
55
57libkcapi Manual 1.4.0 August 2022 KCAPI_CIPHER_ENCRYPT(3)