Function esp_idf_hal::sys::mbedtls_cipher_crypt
source ยท pub unsafe extern "C" fn mbedtls_cipher_crypt(
ctx: *mut mbedtls_cipher_context_t,
iv: *const u8,
iv_len: usize,
input: *const u8,
ilen: usize,
output: *mut u8,
olen: *mut usize,
) -> i32
Expand description
\brief The generic all-in-one encryption/decryption function, for all ciphers except AEAD constructs.
\param ctx The generic cipher context. This must be initialized.
\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.
\param input The buffer holding the input data. This must be a
readable buffer of at least \p ilen Bytes.
\param ilen The length of the input data in Bytes.
\param output The buffer for the output data. This must be able to
hold at least ilen + block_size
. This must not be the
same buffer as \p input.
\param olen The length of the output data, to be updated with the
actual number of Bytes written. This must not be
\c NULL.
\note Some ciphers do not use IVs nor nonce. For these ciphers, use \p iv = NULL and \p iv_len = 0.
\return \c 0 on success. \return #MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA on parameter-verification failure. \return #MBEDTLS_ERR_CIPHER_FULL_BLOCK_EXPECTED on decryption expecting a full block but not receiving one. \return #MBEDTLS_ERR_CIPHER_INVALID_PADDING on invalid padding while decrypting. \return A cipher-specific error code on failure.