mbedtls_chachapoly_starts() function
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. \warning Decryption with the piecewise API is discouraged, see the warning on \c mbedtls_chachapoly_init().
Arguments
ctx
The ChaCha20-Poly1305 context. This must be initialized and bound to a key.
nonce
The nonce/IV to use for the message. This must be a readable buffer of length \c 12 Bytes.
mode
The operation to perform: #MBEDTLS_CHACHAPOLY_ENCRYPT or #MBEDTLS_CHACHAPOLY_DECRYPT (discouraged, see warning).
Return value
\c 0 on success. A negative error code on failure.
Notes
If the context is being used for AAD only (no data to encrypt or decrypt) then \p mode can be set to any value.