mbedtls_ccm_set_lengths() function
This function declares the lengths of the message and additional data for a CCM encryption or decryption operation. This function and mbedtls_ccm_starts() must be called before calling mbedtls_ccm_update_ad() or mbedtls_ccm_update(). This function can be called before or after mbedtls_ccm_starts().
Arguments
ctx
The CCM context. This must be initialized.
total_ad_len
The total length of additional data in bytes. This must be less than `2^16 - 2^8`.
plaintext_len
The length in bytes of the plaintext to encrypt or result of the decryption (thus not encompassing the additional data that are not encrypted).
tag_len
The length of the tag to generate in Bytes: 4, 6, 8, 10, 12, 14 or 16. For CCM*, zero is also valid.
Return value
\c 0 on success. #MBEDTLS_ERR_CCM_BAD_INPUT on failure: \p ctx is in an invalid state, \p total_ad_len is greater than \c 0xFF00.
Notes
This function is not implemented in Mbed TLS yet.
![]()
set_lengths_result = mbedtls_ccm_set_lengths(
mbedtls_ccm_set_lengths() is called by 3 functions and calls 1 function:
![]()
mbedtls_ccm_set_lengths()
mbedtls_ccm_set_lengths() reads 1 variable and writes 5 variables:
![]()
mbedtls_ccm_set_lengths()