pub unsafe extern "C" fn mbedtls_chachapoly_encrypt_and_tag(
    ctx: *mut mbedtls_chachapoly_context,
    length: usize,
    nonce: *const c_uchar,
    aad: *const c_uchar,
    aad_len: usize,
    input: *const c_uchar,
    output: *mut c_uchar,
    tag: *mut c_uchar
) -> c_int
Expand description

\brief This function performs a complete ChaCha20-Poly1305 authenticated encryption with the previously-set key.

\note Before using this function, you must set the key with \c mbedtls_chachapoly_setkey().

\warning You must never use the same nonce twice with the same key. This would void any confidentiality and authenticity guarantees for the messages encrypted with the same nonce and key.

\param ctx The ChaCha20-Poly1305 context to use (holds the key). This must be initialized. \param length The length (in bytes) of the data to encrypt or decrypt. \param nonce The 96-bit (12 bytes) nonce/IV to use. \param aad The buffer containing the additional authenticated data (AAD). This pointer can be \c NULL if aad_len == 0. \param aad_len The length (in bytes) of the AAD data to process. \param input The buffer containing the data to encrypt or decrypt. This pointer can be \c NULL if ilen == 0. \param output The buffer to where the encrypted or decrypted data is written. This pointer can be \c NULL if ilen == 0. \param tag The buffer to where the computed 128-bit (16 bytes) MAC is written. This must not be \c NULL.

\return \c 0 on success. \return A negative error code on failure.