pub unsafe extern "C" fn mbedtls_ccm_star_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.

\note When using this function in a variable tag length context, the tag length has to be encoded into the \p iv passed to this function.

\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. 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 \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 writable buffer of at least \p tag_len Bytes. \param tag_len The length of the authentication field to generate in Bytes: 0, 4, 6, 8, 10, 12, 14 or 16.

\warning Passing \c 0 as \p tag_len means that the message is no longer authenticated.

\return \c 0 on success. \return A CCM or cipher-specific error code on failure.