Function esp_idf_svc::hal::sys::mbedtls_chacha20_starts
source ยท pub unsafe extern "C" fn mbedtls_chacha20_starts(
ctx: *mut mbedtls_chacha20_context,
nonce: *const u8,
counter: u32,
) -> i32
Expand description
\brief This function sets the nonce and initial counter value.
\note A ChaCha20 context can be re-used with the same key by calling this function to change the nonce.
\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.
\param ctx The ChaCha20 context to which the nonce should be bound. It must be initialized and bound to a key. \param nonce The nonce. This must be \c 12 Bytes in size. \param counter The initial counter value. This is usually \c 0.
\return \c 0 on success. \return #MBEDTLS_ERR_CHACHA20_BAD_INPUT_DATA if ctx or nonce is NULL.