mbedtls_chachapoly_update() function
Thus function feeds data to be encrypted or decrypted into an on-going ChaCha20-Poly1305 operation. The direction (encryption or decryption) depends on the mode that was given when calling \c mbedtls_chachapoly_starts(). You may call this function multiple times to process an arbitrary amount of data. It is permitted to call this function 0 times, if no data is to be encrypted or decrypted. \warning Decryption with the piecewise API is discouraged, see the warning on \c mbedtls_chachapoly_init().
Arguments
ctx
The ChaCha20-Poly1305 context to use. This must be initialized.
len
The length (in bytes) of the data to encrypt or decrypt.
input
The buffer containing the data to encrypt or decrypt. This pointer can be \c NULL if `len == 0`.
output
The buffer to where the encrypted or decrypted data is written. This must be able to hold \p len bytes. This pointer can be \c NULL if `len == 0`.
Return value
\c 0 on success. #MBEDTLS_ERR_CHACHAPOLY_BAD_STATE if the operation has not been started or has been finished. Another negative error code on other kinds of failure.