[−][src]Struct sgx_tseal::SgxMacAadata
The structure about sealed data, for authenticate and verify.
Methods
impl<'a, T: 'a + Copy + ContiguousMemory> SgxMacAadata<'a, T>
[src]
impl<'a, T: 'a + Copy + ContiguousMemory> SgxMacAadata<'a, T>
pub fn mac_aadata(additional_text: &T) -> SgxResult<Self> | [src] |
This function is used to authenticate the input data with AES-GMAC.
Descryption
The mac_aadata function retrieves a key unique to the enclave and
uses that key to generate the authentication tag based on the input data buffer. This function can be utilized to provide authentication assurance for additional data (of practically unlimited length per invocation) that is not
encrypted. The data origin authentication can be demonstrated on future
instantiations of the enclave using the MAC stored into the data blob.
Use calc_raw_sealed_data_size
to calculate the number of bytes to
allocate for the SgxMacAadata structure. The input sealed data buffer
must be allocated within the enclave
Requirements
Library: libsgx_tservice.a or libsgx_tservice_sim.a (simulation)
Parameters
additional_text
Pointer to the plain text to provide authentication for.
Return value
The sealed data in SgxMacAadata.
Errors
SGX_ERROR_INVALID_PARAMETER
Indicates an error if the parameters do not meet any of the following conditions:
- additional_text buffer can be within or outside the enclave, but cannot cross the enclave boundary.
- encrypt_text must be non-zero.
- encrypt_text buffer must be within the enclave.
SGX_ERROR_OUT_OF_MEMORY
The enclave is out of memory.
SGX_ERROR_UNEXPECTED
Indicates a crypto library failure or the RDRAND instruction fails to generate a random number.
pub fn mac_aadata_ex( | [src] |
This function is used to authenticate the input data with AES-GMAC. This is the expert mode version of the function mac_aadata.
Descryption
The mac_aadata_ex is an extended version of mac_aadata. It provides parameters for you to identify how to derive the sealing key (key policy and attributes_mask). Typical callers of the seal library should be able to use mac_aadata and the default values provided for key_policy (MR_SIGNER) and an attribute mask which includes the RESERVED, INITED and DEBUG bits. Before you use this function, you should have a clear understanding of the impact of using a policy and/or attribute_mask that is different from that in mac_aadata.
Requirements
Library: libsgx_tservice.a or libsgx_tservice_sim.a (simulation)
Parameters
key_policy
Specifies the policy to use in the key derivation. Function sgx_seal_data uses the MRSIGNER policy.
Key policy name | Value | Description |
---|---|---|
KEYPOLICY_MRENCLAVE | 0x0001 | -Derive key using the enclave??s ENCLAVE measurement register |
KEYPOLICY_MRSIGNER | 0x0002 | -Derive key using the enclave??s SIGNER measurement register |
attribute_mask
Identifies which platform/enclave attributes to use in the key derivation. See the definition of sgx_attributes_t to determine which attributes will be checked. Function sgx_seal_data uses flags=0xfffffffffffffff3,?xfrm=0.
misc_mask
The misc mask bits for the enclave. Reserved for future function extension.
additional_text
Pointer to the additional Message Authentication Code (MAC) data. This additional data is optional and no data is necessary.
Return value
The sealed data in SgxSealedData.
Errors
SGX_ERROR_INVALID_PARAMETER
Indicates an error if the parameters do not meet any of the following conditions:
- additional_text buffer can be within or outside the enclave, but cannot cross the enclave boundary.
- encrypt_text must be non-zero.
- encrypt_text buffer must be within the enclave.
SGX_ERROR_OUT_OF_MEMORY
The enclave is out of memory.
SGX_ERROR_UNEXPECTED
Indicates a crypto library failure or the RDRAND instruction fails to generate a random number.
pub fn unmac_aadata(&self) -> SgxResult<Box<T>> | [src] |
This function is used to verify the authenticity of the input sealed data structure using AES-GMAC. This function verifies the MAC generated with sgx_mac_aadata or sgx_mac_aadata_ex.
Descryption
The sgx_unmac_aadata function verifies the tag with AES-GMAC. Use this function to demonstrate the authenticity of data that was preserved by an earlier instantiation of this enclave.
Requirements
Library: libsgx_tservice.a or libsgx_tservice_sim.a (simulation)
Return value
The pointer of the additional data.
Errors
SGX_ERROR_INVALID_PARAMETER
The size of T may be zero.
SGX_ERROR_INVALID_CPUSVN
The CPUSVN in the data blob is beyond the CPUSVN value of the platform.
SGX_ERROR_INVALID_ISVSVN
The ISVSVN in the data blob is greater than the ISVSVN value of the enclave.
SGX_ERROR_MAC_MISMATCH
The tag verification fails. The error may be caused by a platform update, software update, or corruption of the sealed_data_t structure.
SGX_ERROR_OUT_OF_MEMORY
The enclave is out of memory.
SGX_ERROR_UNEXPECTED
Indicates a crypto library failure or the RDRAND instruction fails to generate a random number.
pub unsafe fn from_raw_sealed_data_t( | [src] |
Convert a pointer of sgx_sealed_data_t buffer to SgxMacAadata.
pub unsafe fn to_raw_sealed_data_t( | [src] |
Convert SgxMacAadata to the pointer of sgx_sealed_data_t.
Parameters
p
The pointer of sgx_sealed_data_t to save the data in SgxMacAadata.
len
The size of the pointer of sgx_sealed_data_t.
Error
Some( mut sgx_sealed_data_t)*
Indicates the conversion is successfully. The return value is the pointer of sgx_sealed_data_t.
None
May be the parameter p and len is not avaliable.
impl<'a, T: 'a + Copy + ContiguousMemory> SgxMacAadata<'a, [T]>
[src]
impl<'a, T: 'a + Copy + ContiguousMemory> SgxMacAadata<'a, [T]>
pub fn mac_aadata(additional_text: &[T]) -> SgxResult<Self> | [src] |
This function is used to authenticate the input data with AES-GMAC.
pub fn mac_aadata_ex( | [src] |
This function is used to authenticate the input data with AES-GMAC. This is the expert mode version of the function mac_aadata.
pub fn unmac_aadata(&self) -> SgxResult<Box<[T]>> | [src] |
This function is used to verify the authenticity of the input sealed data structure using AES-GMAC. This function verifies the MAC generated with sgx_mac_aadataorsgx_mac_aadata_ex.
pub unsafe fn from_raw_sealed_data_t( | [src] |
Convert a pointer of sgx_sealed_data_t buffer to SgxMacAadata.
pub unsafe fn to_raw_sealed_data_t( | [src] |
Convert SgxMacAadata to the pointer of sgx_sealed_data_t.
Parameters
p
The pointer of sgx_sealed_data_t to save the data in SgxMacAadata.
len
The size of the pointer of sgx_sealed_data_t.
Error
Some( mut sgx_sealed_data_t)*
Indicates the conversion is successfully. The return value is the pointer of sgx_sealed_data_t.
None
May be the parameter p and len is not avaliable.
impl<'a, T: 'a + ?Sized> SgxMacAadata<'a, T>
[src]
impl<'a, T: 'a + ?Sized> SgxMacAadata<'a, T>
pub fn new() -> Self | [src] |
Create a SgxMacAadata with default values.
pub fn get_payload_size(&self) -> u32 | [src] |
Get the size of payload in SgxMacAadata.
pub fn get_payload_tag(&self) -> &[u8; 16] | [src] |
Get a slice of payload in SgxMacAadata.
pub fn get_key_request(&self) -> &sgx_key_request_t | [src] |
Get the pointer of sgx_key_request_t in SgxMacAadata.
pub fn get_additional_txt(&self) -> &[u8] | [src] |
Get a slice of additional text in SgxMacAadata.
pub fn calc_raw_sealed_data_size( | [src] |
Calculate the size of the sealed data in SgxMacAadata.
pub fn get_add_mac_txt_len(&self) -> u32 | [src] |
Get the size of the additional mactext in SgxMacAadata.
Trait Implementations
impl<'a, T: 'a + Clone + ?Sized> Clone for SgxMacAadata<'a, T>
[src]
impl<'a, T: 'a + Clone + ?Sized> Clone for SgxMacAadata<'a, T>
fn clone(&self) -> SgxMacAadata<'a, T> | [src] |
fn clone_from(&mut self, source: &Self) | 1.0.0 [src] |
Performs copy-assignment from source
. Read more
impl<'a, T: 'a + ?Sized> Default for SgxMacAadata<'a, T>
[src]
impl<'a, T: 'a + ?Sized> Default for SgxMacAadata<'a, T>
fn default() -> SgxMacAadata<'a, T> | [src] |
Auto Trait Implementations
impl<'a, T: ?Sized> Send for SgxMacAadata<'a, T> where
T: Sync,
impl<'a, T: ?Sized> Send for SgxMacAadata<'a, T> where
T: Sync,
impl<'a, T: ?Sized> Sync for SgxMacAadata<'a, T> where
T: Sync,
impl<'a, T: ?Sized> Sync for SgxMacAadata<'a, T> where
T: Sync,
Blanket Implementations
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> | [src] |
impl<T> From for T
[src]
impl<T> From for T
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error> | [src] |
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T | [src] |
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId | [src] |
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,