Function esp_idf_hal::sys::mbedtls_ccm_finish
source ยท pub unsafe extern "C" fn mbedtls_ccm_finish(
ctx: *mut mbedtls_ccm_context,
tag: *mut u8,
tag_len: usize,
) -> i32
Expand description
\brief This function finishes the CCM operation and generates the authentication tag.
It wraps up the CCM stream, and generates the
tag. The tag can have a maximum length of 16 Bytes.
\note This function is not implemented in Mbed TLS yet.
\param ctx The CCM context. This must have been started with mbedtls_ccm_starts() and the lengths of the message and additional data must have been declared with mbedtls_ccm_set_lengths(). \param tag The buffer for holding the tag. If \p tag_len is greater than zero, this must be a writable buffer of at least \p tag_len Bytes. \param tag_len The length of the tag. Must match the tag length passed to mbedtls_ccm_set_lengths() function.
\return \c 0 on success. \return #MBEDTLS_ERR_CCM_BAD_INPUT on failure: \p ctx is in an invalid state, invalid value of \p tag_len, the total amount of additional data passed to mbedtls_ccm_update_ad() was lower than the total length of additional data \c total_ad_len passed to mbedtls_ccm_set_lengths(), the total amount of input data passed to mbedtls_ccm_update() was lower than the plaintext length \c plaintext_len passed to mbedtls_ccm_set_lengths().