Function esp_idf_sys::mbedtls_ccm_encrypt_and_tag
source ยท pub unsafe extern "C" fn mbedtls_ccm_encrypt_and_tag(
ctx: *mut mbedtls_ccm_context,
length: usize,
iv: *const c_uchar,
iv_len: usize,
ad: *const c_uchar,
ad_len: usize,
input: *const c_uchar,
output: *mut c_uchar,
tag: *mut c_uchar,
tag_len: usize,
) -> c_int
Expand description
\brief This function encrypts a buffer using CCM.
\note The tag is written to a separate buffer. To concatenate the \p tag with the \p output, as done in RFC-3610: Counter with CBC-MAC (CCM), use \p tag = \p output + \p length, and make sure that the output buffer is at least \p length + \p tag_len wide.
\param ctx The CCM context to use for encryption. This must be
initialized and bound to a key.
\param length The length of the input data in Bytes.
\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. If \p ad_len is greater than
zero, \p ad must be a readable buffer of at least that
length.
\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
writable buffer of at least \p tag_len Bytes.
\param tag_len The length of the authentication field to generate in Bytes:
4, 6, 8, 10, 12, 14 or 16.
\return \c 0 on success. \return A CCM or cipher-specific error code on failure.