Function esp_idf_svc::hal::sys::mbedtls_chachapoly_auth_decrypt

source ยท
pub unsafe extern "C" fn mbedtls_chachapoly_auth_decrypt(
    ctx: *mut mbedtls_chachapoly_context,
    length: usize,
    nonce: *const u8,
    aad: *const u8,
    aad_len: usize,
    tag: *const u8,
    input: *const u8,
    output: *mut u8,
) -> i32
Expand description

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

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

\param ctx The ChaCha20-Poly1305 context to use (holds the key). \param length The length (in Bytes) of the data to decrypt. \param nonce The \c 96 Bit (\c 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 tag The buffer holding the authentication tag. This must be a readable buffer of length \c 16 Bytes. \param input The buffer containing the data to decrypt. This pointer can be \c NULL if ilen == 0. \param output The buffer to where the decrypted data is written. This pointer can be \c NULL if ilen == 0.

\return \c 0 on success. \return #MBEDTLS_ERR_CHACHAPOLY_AUTH_FAILED if the data was not authentic. \return Another negative error code on other kinds of failure.