Struct capsules::aes_ccm::AES128CCM
[−]
[src]
pub struct AES128CCM<'a, A: AES128<'a> + AES128Ctr + AES128CBC + 'a> { aes: &'a A, crypt_buf: TakeCell<'a, [u8]>, crypt_auth_len: Cell<usize>, crypt_enc_len: Cell<usize>, crypt_client: Cell<Option<&'a CCMClient>>, state: Cell<CCMState>, confidential: Cell<bool>, encrypting: Cell<bool>, buf: TakeCell<'static, [u8]>, pos: Cell<(usize, usize, usize, usize)>, key: Cell<[u8; 16]>, nonce: Cell<[u8; 13]>, saved_tag: Cell<[u8; 16]>, }
Fields
aes: &'a A
crypt_buf: TakeCell<'a, [u8]>
crypt_auth_len: Cell<usize>
crypt_enc_len: Cell<usize>
crypt_client: Cell<Option<&'a CCMClient>>
state: Cell<CCMState>
confidential: Cell<bool>
encrypting: Cell<bool>
buf: TakeCell<'static, [u8]>
pos: Cell<(usize, usize, usize, usize)>
key: Cell<[u8; 16]>
nonce: Cell<[u8; 13]>
saved_tag: Cell<[u8; 16]>
Methods
impl<'a, A: AES128<'a> + AES128Ctr + AES128CBC + 'a> AES128CCM<'a, A>
[src]
pub fn new(aes: &'a A, crypt_buf: &'static mut [u8]) -> AES128CCM<'a, A>
[src]
fn prepare_ccm_buffer(
&self,
nonce: &[u8; 13],
mic_len: usize,
a_data: &[u8],
m_data: &[u8]
) -> ReturnCode
[src]
&self,
nonce: &[u8; 13],
mic_len: usize,
a_data: &[u8],
m_data: &[u8]
) -> ReturnCode
Prepares crypt_buf with the input for the CCM* authentication and encryption/decryption transformations. Returns ENOMEM if crypt_buf is not present or if it is not long enough.
fn encode_ccm_buffer(
buf: &mut [u8],
nonce: &[u8; 13],
mic_len: usize,
a_data: &[u8],
m_data: &[u8]
) -> SResult<(usize, usize)>
[src]
buf: &mut [u8],
nonce: &[u8; 13],
mic_len: usize,
a_data: &[u8],
m_data: &[u8]
) -> SResult<(usize, usize)>
This function encudes AuthData (a_data) and PData/CData (m_data) into a
buffer, along with the prerequisite metadata/padding bytes. On success,
auth_len
(the length of the AuthData field) and enc_len
(the
combined length of AuthData and PData/CData) are returned. auth_len
is
guaranteed to be >= AES128_BLOCK_SIZE
fn reversed(&self) -> bool
[src]
fn start_ccm_auth(&self) -> ReturnCode
[src]
fn start_ccm_encrypt(&self) -> ReturnCode
[src]
fn end_ccm(&self)
[src]
fn reverse_end_ccm(&self)
[src]
fn save_tag_block(&self)
[src]
fn swap_tag_block(&self)
[src]
Trait Implementations
impl<'a, A: AES128<'a> + AES128Ctr + AES128CBC + 'a> AES128CCM<'a> for AES128CCM<'a, A>
[src]
fn set_client(&self, client: &'a CCMClient)
[src]
Set the client instance which will receive crypt_done()
callbacks
fn set_key(&self, key: &[u8]) -> ReturnCode
[src]
Set the key to be used for CCM encryption
fn set_nonce(&self, nonce: &[u8]) -> ReturnCode
[src]
Set the nonce (length NONCE_LENGTH) to be used for CCM encryption
fn crypt(
&self,
buf: &'static mut [u8],
a_off: usize,
m_off: usize,
m_len: usize,
mic_len: usize,
confidential: bool,
encrypting: bool
) -> (ReturnCode, Option<&'static mut [u8]>)
[src]
&self,
buf: &'static mut [u8],
a_off: usize,
m_off: usize,
m_len: usize,
mic_len: usize,
confidential: bool,
encrypting: bool
) -> (ReturnCode, Option<&'static mut [u8]>)
Try to begin the encryption/decryption process