Function esp_idf_sys::mbedtls_cipher_cmac_starts

source ยท
pub unsafe extern "C" fn mbedtls_cipher_cmac_starts(
    ctx: *mut mbedtls_cipher_context_t,
    key: *const c_uchar,
    keybits: usize,
) -> c_int
Expand description

\brief This function starts a new CMAC computation by setting the CMAC key, and preparing to authenticate the input data. It must be called with an initialized cipher context.

                 Once this function has completed, data can be supplied
                 to the CMAC computation by calling
                 mbedtls_cipher_cmac_update().

                 To start a CMAC computation using the same key as a previous
                 CMAC computation, use mbedtls_cipher_cmac_finish().

\note When the CMAC implementation is supplied by an alternate implementation (through #MBEDTLS_CMAC_ALT), some ciphers may not be supported by that implementation, and thus return an error. Alternate implementations must support AES-128 and AES-256, and may support AES-192 and 3DES.

\param ctx The cipher context used for the CMAC operation, initialized as one of the following types: MBEDTLS_CIPHER_AES_128_ECB, MBEDTLS_CIPHER_AES_192_ECB, MBEDTLS_CIPHER_AES_256_ECB, or MBEDTLS_CIPHER_DES_EDE3_ECB. \param key The CMAC key. \param keybits The length of the CMAC key in bits. Must be supported by the cipher.

\return \c 0 on success. \return A cipher-specific error code on failure.