Function esp_idf_sys::mbedtls_ccm_set_lengths
source ยท pub unsafe extern "C" fn mbedtls_ccm_set_lengths(
ctx: *mut mbedtls_ccm_context,
total_ad_len: usize,
plaintext_len: usize,
tag_len: usize,
) -> c_int
Expand description
\brief 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().
\note This function is not implemented in Mbed TLS yet.
\param ctx The CCM context. This must be initialized.
\param total_ad_len The total length of additional data in bytes.
This must be less than 2^16 - 2^8
.
\param 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).
\param 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 \c 0 on success. \return #MBEDTLS_ERR_CCM_BAD_INPUT on failure: \p ctx is in an invalid state, \p total_ad_len is greater than \c 0xFF00.