Function esp_idf_hal::sys::mbedtls_cipher_set_iv
source ยท pub unsafe extern "C" fn mbedtls_cipher_set_iv(
ctx: *mut mbedtls_cipher_context_t,
iv: *const u8,
iv_len: usize,
) -> i32
Expand description
\brief This function sets the initialization vector (IV) or nonce.
\note Some ciphers do not use IVs nor nonce. For these ciphers, this function has no effect.
\note For #MBEDTLS_CIPHER_CHACHA20, the nonce length must be 12, and the initial counter value is 0.
\note For #MBEDTLS_CIPHER_CHACHA20_POLY1305, the nonce length must be 12.
\param ctx The generic cipher context. This must be initialized and bound to a cipher information structure. \param iv The IV to use, or NONCE_COUNTER for CTR-mode ciphers. This must be a readable buffer of at least \p iv_len Bytes. \param iv_len The IV length for ciphers with variable-size IV. This parameter is discarded by ciphers with fixed-size IV.
\return \c 0 on success. \return #MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA on parameter-verification failure.