Function esp_idf_svc::sys::mbedtls_chachapoly_update_aad
source ยท pub unsafe extern "C" fn mbedtls_chachapoly_update_aad(
ctx: *mut mbedtls_chachapoly_context,
aad: *const u8,
aad_len: usize,
) -> i32
Expand description
\brief 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.
\note This function is called before data is encrypted/decrypted. I.e. call this function to process the AAD before calling \c mbedtls_chachapoly_update().
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().
\param ctx The ChaCha20-Poly1305 context. This must be initialized
and bound to a key.
\param aad_len The length in Bytes of the AAD. The length has no
restrictions.
\param aad Buffer containing the AAD.
This pointer can be \c NULL if aad_len == 0
.
\return \c 0 on success. \return #MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA if \p ctx or \p aad are NULL. \return #MBEDTLS_ERR_CHACHAPOLY_BAD_STATE if the operations has not been started or has been finished, or if the AAD has been finished.