zephyr::raw

Function bt_ccm_decrypt

source
pub unsafe extern "C" fn bt_ccm_decrypt(
    key: *const u8,
    nonce: *mut u8,
    enc_data: *const u8,
    len: usize,
    aad: *const u8,
    aad_len: usize,
    plaintext: *mut u8,
    mic_size: usize,
) -> i32
Expand description

@brief Decrypt big-endian data with AES-CCM.

Decrypts and authorizes @c enc_data with AES-CCM, as described in https://tools.ietf.org/html/rfc3610.

Assumes that the MIC follows directly after the encrypted data.

@param key 128 bit MS byte first key @param nonce 13 byte MS byte first nonce @param enc_data Encrypted data @param len Length of the encrypted data @param aad Additional authenticated data @param aad_len Additional authenticated data length @param plaintext Plaintext buffer to place result in @param mic_size Size of the trailing MIC (in bytes)

@retval 0 Successfully decrypted the data. @retval -EINVAL Invalid parameters. @retval -EBADMSG Authentication failed.