Function esp_idf_sys::mbedtls_cipher_crypt
source ยท pub unsafe extern "C" fn mbedtls_cipher_crypt(
ctx: *mut mbedtls_cipher_context_t,
iv: *const c_uchar,
iv_len: usize,
input: *const c_uchar,
ilen: usize,
output: *mut c_uchar,
olen: *mut usize,
) -> c_int
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.