fn ccm_cbc_mac(t: &mut [u8; 16], data: &[u8], flag: bool, cipher: &Aes128) {
    let mut dlen = data.len();

    let mut i = if flag {
        t[0] ^= (dlen >> 8) as u8;
        t[1] ^= dlen as u8;
        dlen += 2;
        2
    } else {
        0
    };

    let mut data = data.iter();
    while i < dlen {
        t[i % AES_BLOCK_SIZE] ^= data.next().unwrap();
        i += 1;
        if i % AES_BLOCK_SIZE == 0 || dlen == i {
            cipher.encrypt_block(GenericArray::from_mut_slice(t));
        }
    }
}
/// Variation of CBC-MAC mode used in CCM.
Variation of CBC-MAC mode used in CCM.
Variation of CBC - MAC mode used in CCM .
fn ccm_cbc_mac(t: &mut [u8; 16], data: &[u8], flag: bool, cipher: &Aes128) {
    let mut dlen = data.len();
    let mut i = if flag {
        t[0] ^= (dlen >> 8) as u8;
        t[1] ^= dlen as u8;
        dlen += 2;
        2
    } else {
        0
    };
    let mut data = data.iter();
    while i < dlen {
        t[i % AES_BLOCK_SIZE] ^= data.next().unwrap();
        i += 1;
        if i % AES_BLOCK_SIZE == 0 || dlen == i {
            cipher.encrypt_block(GenericArray::from_mut_slice(t));
        }
    }
}
fn ccm_cbc_mac ( t : & mut [ u8 ; 16 ] , data : & [ u8 ] , flag : bool , cipher : & Aes128 ) { let mut dlen = data . len ( ) ; let mut i = if flag { t [ 0 ] ^= ( dlen >> 8 ) as u8 ; t [ 1 ] ^= dlen as u8 ; dlen += 2 ; 2 } else { 0 } ; let mut data = data . iter ( ) ; while i < dlen { t [ i % AES_BLOCK_SIZE ] ^= data . next ( ) . unwrap ( ) ; i += 1 ; if i % AES_BLOCK_SIZE == 0 || dlen == i { cipher . encrypt_block ( GenericArray :: from_mut_slice ( t ) ) ; } } }
Variation of CBC-MAC mode used in CCM.
Variation of CBC - MAC mode used in CCM .
t
&mut [u8; 16]
data
&[u8]
flag
bool
cipher
&Aes128
t
&mut [u8; 16]
data
&[u8]
flag
bool
cipher
&Aes128