mbedtls_cipher_auth_encrypt() function
The generic autenticated encryption (AEAD) function.
int mbedtls_cipher_auth_encrypt( mbedtls_cipher_context_t *ctx,
const unsigned char *iv,
size_t iv_len,
const unsigned char *ad,
size_t ad_len,
const unsigned char *input,
size_t ilen,
unsigned char *output,
size_t *olen,
unsigned char *tag,
size_t tag_len );
Arguments
ctx
The generic cipher context. This must be initialized and bound to a key.
iv
The IV to use, or NONCE_COUNTER for CTR-mode ciphers. This must be a readable buffer of at least \p iv_len Bytes.
iv_len
The IV length for ciphers with variable-size IV. This parameter is discarded by ciphers with fixed-size IV.
ad
The additional data to authenticate. This must be a readable buffer of at least \p ad_len Bytes.
ad_len
The length of \p ad.
The buffer holding the input data. This must be a readable buffer of at least \p ilen Bytes.
ilen
The length of the input data.
output
The buffer for the output data. This must be able to hold at least \p ilen Bytes.
olen
The length of the output data, to be updated with the actual number of Bytes written. This must not be \c NULL.
tag
The buffer for the authentication tag. This must be a writable buffer of at least \p tag_len Bytes.
tag_len
The desired length of the authentication tag.
Return value
\c 0 on success. #MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA on parameter-verification failure. A cipher-specific error code on failure.
Functions calling mbedtls_cipher_auth_encrypt()
Functions called by mbedtls_cipher_auth_encrypt()
mbedtls_cipher_auth_encrypt()
Data read by mbedtls_cipher_auth_encrypt()
mbedtls_cipher_auth_encrypt()