Function esp_idf_sys::mbedtls_cipher_setup

source ยท
pub unsafe extern "C" fn mbedtls_cipher_setup(
    ctx: *mut mbedtls_cipher_context_t,
    cipher_info: *const mbedtls_cipher_info_t,
) -> c_int
Expand description

\brief This function prepares a cipher context for use with the given cipher primitive.

\note After calling this function, you should call mbedtls_cipher_setkey() and, if the mode uses padding, mbedtls_cipher_set_padding_mode(), then for each message to encrypt or decrypt with this key, either: - mbedtls_cipher_crypt() for one-shot processing with non-AEAD modes; - mbedtls_cipher_auth_encrypt_ext() or mbedtls_cipher_auth_decrypt_ext() for one-shot processing with AEAD modes or NIST_KW; - for multi-part processing, see the documentation of mbedtls_cipher_reset().

\param ctx The context to prepare. This must be initialized by a call to mbedtls_cipher_init() first. \param cipher_info The cipher to use.

\return \c 0 on success. \return #MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA on parameter-verification failure. \return #MBEDTLS_ERR_CIPHER_ALLOC_FAILED if allocation of the cipher-specific context fails.