mbedtls_ccm_finish() function
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.
Arguments
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().
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.
tag_len
The length of the tag. Must match the tag length passed to mbedtls_ccm_set_lengths() function.
Return value
\c 0 on success. #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().
Notes
This function is not implemented in Mbed TLS yet.
mbedtls_ccm_finish() is called by 2 functions and calls 2 functions:
![]()
mbedtls_ccm_finish()
mbedtls_ccm_finish() reads 7 variables:
![]()
mbedtls_ccm_finish()