Function esp_idf_svc::sys::mbedtls_chachapoly_starts
source ยท pub unsafe extern "C" fn mbedtls_chachapoly_starts(
ctx: *mut mbedtls_chachapoly_context,
nonce: *const u8,
mode: u32,
) -> i32
Expand description
\brief This function starts a ChaCha20-Poly1305 encryption or decryption operation.
\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.
\note If the context is being used for AAD only (no data to encrypt or decrypt) then \p mode can be set to any value.
\warning Decryption with the piecewise API is discouraged, see the warning on \c mbedtls_chachapoly_init().
\param ctx The ChaCha20-Poly1305 context. This must be initialized and bound to a key. \param nonce The nonce/IV to use for the message. This must be a readable buffer of length \c 12 Bytes. \param mode The operation to perform: #MBEDTLS_CHACHAPOLY_ENCRYPT or #MBEDTLS_CHACHAPOLY_DECRYPT (discouraged, see warning).
\return \c 0 on success. \return A negative error code on failure.