mbedtls_chacha20_update() function
This function encrypts or decrypts data. Since ChaCha20 is a stream cipher, the same operation is used for encrypting and decrypting data.
Arguments
ctx
The ChaCha20 context to use for encryption or decryption. It must be initialized and bound to a key and nonce.
size
The length of the input data in Bytes.
input
The buffer holding the input data. This pointer can be \c NULL if `size == 0`.
output
The buffer holding the output data. This must be able to hold \p size Bytes. This pointer can be \c NULL if `size == 0`.
Return value
\c 0 on success. A negative error code on failure.
Notes
The \p input and \p output pointers must either be equal or point to non-overlapping buffers. \c mbedtls_chacha20_setkey() and \c mbedtls_chacha20_starts() must be called at least once to setup the context before this function can be called. This function can be called multiple times in a row in order to encrypt of decrypt data piecewise with the same key and nonce.