Function esp_idf_svc::sys::mbedtls_ccm_star_auth_decrypt
source ยท pub unsafe extern "C" fn mbedtls_ccm_star_auth_decrypt(
ctx: *mut mbedtls_ccm_context,
length: usize,
iv: *const u8,
iv_len: usize,
ad: *const u8,
ad_len: usize,
input: *const u8,
output: *mut u8,
tag: *const u8,
tag_len: usize,
) -> i32
Expand description
\brief This function performs a CCM* authenticated decryption of a buffer.
\note When using this function in a variable tag length context, the tag length has to be decoded from \p iv and passed to this function as \p tag_len. (\p tag needs to be adjusted accordingly.)
\param ctx The CCM context to use for decryption. This must be initialized and bound to a key. \param length The length of the input data in Bytes. For tag length = 0, input length is ignored. \param iv The initialization vector (nonce). This must be a readable buffer of at least \p iv_len Bytes. \param iv_len The length of the nonce in Bytes: 7, 8, 9, 10, 11, 12, or 13. The length L of the message length field is 15 - \p iv_len. \param ad The additional data field. This must be a readable buffer of at least that \p ad_len Bytes. \param ad_len The length of additional data in Bytes. This must be less than 2^16 - 2^8. \param input The buffer holding the input data. If \p length is greater than zero, \p input must be a readable buffer of at least that length. \param output The buffer holding the output data. If \p length is greater than zero, \p output must be a writable buffer of at least that length. \param tag The buffer holding the authentication field. This must be a readable buffer of at least \p tag_len Bytes. \param tag_len The length of the authentication field in Bytes. 0, 4, 6, 8, 10, 12, 14 or 16.
\warning Passing \c 0 as \p tag_len means that the message is nos longer authenticated.
\return \c 0 on success. \return #MBEDTLS_ERR_CCM_AUTH_FAILED if the tag does not match. \return A cipher-specific error code on calculation failure.