mbedtls_chachapoly_update_aad() function
This function feeds additional data to be authenticated into an ongoing ChaCha20-Poly1305 operation. The Additional Authenticated Data (AAD), also called Associated Data (AD) is only authenticated but not encrypted nor included in the encrypted output. It is usually transmitted separately from the ciphertext or computed locally by each party. You may call this function multiple times to process an arbitrary amount of AAD. It is permitted to call this function 0 times, if no AAD is used. This function cannot be called any more if data has been processed by \c mbedtls_chachapoly_update(), or if the context has been finished. \warning Decryption with the piecewise API is discouraged, see the warning on \c mbedtls_chachapoly_init().
Arguments
ctx
The ChaCha20-Poly1305 context. This must be initialized and bound to a key.
aad
Buffer containing the AAD. This pointer can be \c NULL if `aad_len == 0`.
aad_len
The length in Bytes of the AAD. The length has no restrictions.
Return value
\c 0 on success. #MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA if \p ctx or \p aad are NULL. #MBEDTLS_ERR_CHACHAPOLY_BAD_STATE if the operations has not been started or has been finished, or if the AAD has been finished.
Notes
This function is called before data is encrypted/decrypted. I.e. call this function to process the AAD before calling \c mbedtls_chachapoly_update().