mbedtls_chacha20_setkey() function
This function sets the encryption/decryption key.
Arguments
ctx
The ChaCha20 context to which the key should be bound. It must be initialized.
key
The encryption/decryption key. This must be \c 32 Bytes in length.
Return value
\c 0 on success. #MBEDTLS_ERR_CHACHA20_BAD_INPUT_DATA if ctx or key is NULL.
Notes
After using this function, you must also call \c mbedtls_chacha20_starts() to set a nonce before you start encrypting/decrypting data with \c mbedtls_chacha_update().