1KCAPI_CIPHER_ENC_AES(3) Programming Interface KCAPI_CIPHER_ENC_AES(3)
2
3
4
6 kcapi_cipher_enc_aes_cbc - Convenience function for AES CBC encryption
7
9 int32_t kcapi_cipher_enc_aes_cbc(const uint8_t * key, uint32_t keylen,
10 const uint8_t * in, uint32_t inlen,
11 const uint8_t * iv, uint8_t * out,
12 uint32_t outlen);
13
15 key
16 [in] key buffer
17
18 keylen
19 [in] length of key buffer
20
21 in
22 [in] plaintext data buffer
23
24 inlen
25 [in] length of in buffer
26
27 iv
28 [in] IV to be used for cipher operation
29
30 out
31 [out] ciphertext data buffer
32
33 outlen
34 [in] length of out buffer
35
37 The convenience function performs an AES CBC encryption operation using
38 the provided key, the given input buffer and the given IV. The output
39 is stored in the out buffer.
40
41 Note, AES CBC requires an input data that is a multiple of 16 bytes. If
42 you have data that is not guaranteed to be multiples of 16 bytes,
43 either add zero bytes at the end of the buffer to pad it up to a
44 multiple of 16 bytes. Otherwise, the CTR mode encryption operation may
45 be usable.
46
47 The output buffer must be at least as large as the input buffer.
48
49 The IV must be exactly 16 bytes in size.
50
51 The AES type (AES-128, AES-192 or AES-256) is determined by the size of
52 the given key. If the key is 16 bytes long, AES-128 is used. A 24 byte
53 key implies AES-192 and a 32 byte key implies AES-256.
54
55 return number of bytes generated upon success; a negative errno-style
56 error code if an error occurred
57
59 Stephan Mueller <smueller@chronox.de>
60 Author.
61
63libkcapi Manual 1.2.1 March 2021 KCAPI_CIPHER_ENC_AES(3)