DOKK / manpages / debian 12 / libkcapi-dev / kcapi_cipher_dec_aes_ctr.3.en
KCAPI_CIPHER_DEC_AES(3) Programming Interface KCAPI_CIPHER_DEC_AES(3)

kcapi_cipher_dec_aes_ctr - Convenience function for AES CTR decryption

ssize_t kcapi_cipher_dec_aes_ctr(const uint8_t * key, uint32_t keylen, const uint8_t * in, size_t inlen, const uint8_t * ctr, uint8_t * out, size_t outlen);

key

[in] key buffer

keylen

[in] length of key buffer

in

[in] ciphertext data buffer

inlen

[in] length of in buffer

ctr

[in] start counter value to be used for cipher operation

out

[out] plaintext data buffer

outlen

[in] length of out buffer

The convenience function performs an AES counter mode encryption operation using the provided key, the given input buffer and the given IV. The output is stored in the out buffer.

The input buffer can be of arbitrary length.

The output buffer must be at least as large as the input buffer.

The start counter can contain all zeros (not a NULL buffer!) and must be exactly 16 bytes in size.

The AES type (AES-128, AES-192 or AES-256) is determined by the size of the given key. If the key is 16 bytes long, AES-128 is used. A 24 byte key implies AES-192 and a 32 byte key implies AES-256.

return number of bytes generated upon success; a negative errno-style error code if an error occurred

Stephan Mueller <smueller@chronox.de>

Author.

February 2022 libkcapi Manual 1.4.0