[][src]Struct sgx_ucrypto::SgxCmacHandle

pub struct SgxCmacHandle { /* fields omitted */ }

CMAC algorithm context state.

This is a handle to the context state used by the cryptography library to perform an iterative CMAC 128-bit hash. The algorithm stores the intermediate results of performing the hash calculation over data sets.

Methods

impl SgxCmacHandle[src]

pub fn new() -> Self[src]

Constructs a new, empty SgxCmacHandle.

pub fn init(&self, key: &sgx_cmac_128bit_key_t) -> SgxError[src]

init returns an allocated and initialized CMAC algorithm context state.

This should be part of the Init, Update … Update, Final process when the CMAC hash is to be performed over multiple datasets. If a complete dataset is available, the recommended call is rsgx_rijndael128_cmac_msg to perform the hash in a single call.

Description

Calling init is the first set in performing a CMAC 128-bit hash over multiple datasets. The caller does not allocate memory for the CMAC state that this function returns. The state is specific to the implementation of the cryptography library and thus the allocation is performed by the library itself. If the hash over the desired datasets is completed or any error occurs during the hash calculation process, sgx_cmac128_close should be called to free the state allocated by this algorithm.

Parameters

key

A pointer to key to be used in the CMAC hash operation. The size must be 128 bits.

Requirements

Library: libsgx_tcrypto.a

Errors

SGX_ERROR_INVALID_PARAMETER

The pointer is invalid.

SGX_ERROR_OUT_OF_MEMORY

Not enough memory is available to complete this operation.

SGX_ERROR_UNEXPECTED

An internal cryptography library failure occurred.

pub fn update_msg<T>(&self, src: &T) -> SgxError where
    T: Copy + ContiguousMemory
[src]

update_msg performs a CMAC 128-bit hash over the input dataset provided.

This function supports an iterative calculation of the hash over multiple datasets where the cmac_handle contains the intermediate results of the hash calculation over previous datasets.

Description

This function should be used as part of a CMAC 128-bit hash calculation over multiple datasets. If a CMAC hash is needed over a single data set, function rsgx_rijndael128_cmac128_msg should be used instead. Prior to calling this function on the first dataset, the init function must be called first to allocate and initialize the CMAC state structure which will hold intermediate hash results over earlier datasets. The function get_hash should be used to obtain the hash after the final dataset has been processed by this function.

Parameters

src

A pointer to the input data stream to be hashed.

Requirements

Library: libsgx_tcrypto.a

Errors

SGX_ERROR_INVALID_PARAMETER

The pointer is invalid.

SGX_ERROR_INVALID_STATE

The CMAC state is not initialized.

SGX_ERROR_OUT_OF_MEMORY

Not enough memory is available to complete this operation.

SGX_ERROR_UNEXPECTED

An internal cryptography library failure occurred while performing the CMAC hash calculation.

pub fn update_slice<T>(&self, src: &[T]) -> SgxError where
    T: Copy + ContiguousMemory
[src]

update_slice performs a CMAC 128-bit hash over the input dataset provided.

pub fn get_hash(&self) -> SgxResult<sgx_cmac_128bit_tag_t>[src]

get_hash obtains the CMAC 128-bit hash after the final dataset has been processed.

Description

This function returns the hash after performing the CMAC 128-bit hash calculation over one or more datasets using the update function.

Requirements

Library: libsgx_tcrypto.a

Return value

The 128-bit hash that has been CMAC calculated

Errors

SGX_ERROR_INVALID_PARAMETER

The pointer is invalid.

SGX_ERROR_INVALID_STATE

The CMAC state is not initialized.

SGX_ERROR_UNEXPECTED

The CMAC state passed in is likely problematic causing an internal cryptography library failure.

pub fn close(&self) -> SgxError[src]

close cleans up and deallocates the CMAC algorithm context state that was allocated in function init.

Description

Calling close is the last step after performing a CMAC hash over multiple datasets. The caller uses this function to deallocate memory used for storing the CMAC algorithm context state.

Requirements

Library: libsgx_tcrypto.a

Errors

SGX_ERROR_INVALID_PARAMETER

The input handle is invalid.

Trait Implementations

impl Drop for SgxCmacHandle[src]

fn drop(&mut self)[src]

drop cleans up and deallocates the CMAC algorithm context state that was allocated in function init.

impl Default for SgxCmacHandle[src]

Auto Trait Implementations

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]