Function esp_idf_svc::hal::sys::mbedtls_cipher_reset

source ยท
pub unsafe extern "C" fn mbedtls_cipher_reset(
    ctx: *mut mbedtls_cipher_context_t,
) -> i32
Expand description

\brief This function resets the cipher state.

\note With non-AEAD ciphers, the order of calls for each message is as follows: 1. mbedtls_cipher_set_iv() if the mode uses an IV/nonce. 2. mbedtls_cipher_reset() 3. mbedtls_cipher_update() one or more times 4. mbedtls_cipher_finish() . This sequence can be repeated to encrypt or decrypt multiple messages with the same key.

\note With AEAD ciphers, the order of calls for each message is as follows: 1. mbedtls_cipher_set_iv() if the mode uses an IV/nonce. 2. mbedtls_cipher_reset() 3. mbedtls_cipher_update_ad() 4. mbedtls_cipher_update() one or more times 5. mbedtls_cipher_finish() 6. mbedtls_cipher_check_tag() (for decryption) or mbedtls_cipher_write_tag() (for encryption). . This sequence can be repeated to encrypt or decrypt multiple messages with the same key.

\param ctx The generic cipher context. This must be bound to a key.

\return \c 0 on success. \return #MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA on parameter-verification failure.