mbedtls_chacha20_starts() function
This function sets the nonce and initial counter value. \warning You must never use the same nonce twice with the same key. This would void any confidentiality guarantees for the messages encrypted with the same nonce and key.
Arguments
ctx
The ChaCha20 context to which the nonce should be bound. It must be initialized and bound to a key.
nonce
The nonce. This must be \c 12 Bytes in size.
counter
The initial counter value. This is usually \c 0.
Return value
\c 0 on success. #MBEDTLS_ERR_CHACHA20_BAD_INPUT_DATA if ctx or nonce is NULL.
Notes
A ChaCha20 context can be re-used with the same key by calling this function to change the nonce.