Function esp_idf_hal::sys::mbedtls_chacha20_update
source ยท pub unsafe extern "C" fn mbedtls_chacha20_update(
ctx: *mut mbedtls_chacha20_context,
size: usize,
input: *const u8,
output: *mut u8,
) -> i32
Expand description
\brief This function encrypts or decrypts data.
Since ChaCha20 is a stream cipher, the same operation is
used for encrypting and decrypting data.
\note The \p input and \p output pointers must either be equal or point to non-overlapping buffers.
\note \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.
\note This function can be called multiple times in a row in order to encrypt of decrypt data piecewise with the same key and nonce.
\param ctx The ChaCha20 context to use for encryption or decryption.
It must be initialized and bound to a key and nonce.
\param size The length of the input data in Bytes.
\param input The buffer holding the input data.
This pointer can be \c NULL if size == 0
.
\param 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 \c 0 on success. \return A negative error code on failure.