devcrypto_aead_cipher_op_init

Updated: April 19, 2023

Initialize an AEAD cipher algorithm state

Synopsis:

#include <dev/crypto/devcrypto_plugin.h>
typedef int(* devcrypto_aead_cipher_op_init)(devcrypto_state_ctx_t *sctx,
            const uint8_t *key,
            uint32_t keysize,
            const uint8_t *iv,
            uint32_t ivsize,
            uint8_t *tag,
            uint32_t tagsize,
            uint32_t insize,
            int encrypt);

Arguments:

sctx
The state context.
key
The cipher key.
keysize
The size of the cipher key.
iv
The initialization vector (IV) buffer.
ivsize
The size of the IV buffer.
tag
The tag value (only used for decryption).
tagsize
The size of the tag buffer.
insize
The size of the input data to encrypt or decrypt.
encrypt
Either 1 (encrypt function) or 0 (decrypt function).

Library:

devcr

Description:

Because devcrypto works using ciphers with no padding, plugins need to make sure that cipher padding is turned off. The caller is responsible for providing the cipher with padded and aligned data.

The insize argument is only used for algorithms that require that the plaintext size be known before encryption or decryption can begin (e.g., AES-CCM). This requirement also means the algorithm must encrypt or decrypt all the data in a single operation.

The tag argument is only used for algorithms that require the tag to be input before decryption can begin (e.g., AES-CCM).

Returns:

EOK if successful or errno if an error occurred.