Asylo
Enumerations | Functions | Variables
asylo::sgx Namespace Reference

Enumerations

enum  AttributeBit {
  AttributeBit::INIT = 0, AttributeBit::DEBUG = 1, AttributeBit::MODE64BIT = 2, AttributeBit::PROVISIONKEY = 4,
  AttributeBit::INITTOKENKEY = 5, AttributeBit::KSS = 7, AttributeBit::FPU = 64 + 0, AttributeBit::SSE = 64 + 1,
  AttributeBit::AVX = 64 + 2, AttributeBit::BNDREG = 64 + 3, AttributeBit::BNDCSR = 64 + 4, AttributeBit::OPMASK = 64 + 5,
  AttributeBit::ZMM_HI256 = 64 + 6, AttributeBit::HI16_ZMM = 64 + 7, AttributeBit::PKRU = 64 + 9
}
 SGX defines 128 bits of enclave attributes, which are located in the SECS (Secure Enclave Control Structure) of the enclave. More...
 
enum  MiscselectBit { MiscselectBit::EXINFO = 0 }
 The following enum defines the various MISCSELECT bits and assigns them a value that is same as their bit position in the SECS MISCSELECT bit vector. More...
 

Functions

Attributes operator & (const Attributes &lhs, const Attributes &rhs)
 Computes the bitwise AND of two Attributes protos. More...
 
bool operator== (const Attributes &lhs, const Attributes &rhs)
 Checks two Attributes protos for equality. More...
 
bool operator!= (const Attributes &lhs, const Attributes &rhs)
 Checks two Attributes protos for inequality. More...
 
Status SetAttributeBit (AttributeBit bit, Attributes *attributes)
 Sets the given bit of attributes to true, or returns a non-OK Status if the bit was invalid. More...
 
Status ClearAttributeBit (AttributeBit bit, Attributes *attributes)
 Sets the given bit of attributes to false, or returns a non-OK Status if the bit was invalid. More...
 
StatusOr< bool > IsAttributeBitSet (AttributeBit bit, const Attributes &attributes)
 Returns whether the given bit of attributes is set, or a non-OK Status if the bit was invalid. More...
 
std::vector< absl::string_view > GetPrintableAttributeList (const Attributes &attributes)
 Returns a printable list of the bits set in attributes. More...
 
bool operator== (const Miscselect &lhs, const Miscselect &rhs)
 Checks two Miscselect protos for equality. More...
 
bool operator!= (const Miscselect &lhs, const Miscselect &rhs)
 Checks two Miscselect protos for inequality. More...
 
Status SetMiscselectBit (MiscselectBit bit, uint32_t *miscselect)
 Sets the given bit of miscselect to true, or returns a non-OK Status if the bit was invalid. More...
 
Status SetMiscselectBit (MiscselectBit bit, Miscselect *miscselect)
 
Status ClearMiscselectBit (MiscselectBit bit, uint32_t *miscselect)
 Sets the given bit of miscselect to false, or returns a non-OK Status if the bit was invalid. More...
 
Status ClearMiscselectBit (MiscselectBit bit, Miscselect *miscselect)
 
StatusOr< bool > IsMiscselectBitSet (MiscselectBit bit, uint32_t miscselect)
 Returns whether the given bit of miscselect is set, or returns a non-OK Status if the bit was invalid. More...
 
StatusOr< bool > IsMiscselectBitSet (MiscselectBit bit, const Miscselect &miscselect)
 
std::vector< absl::string_view > GetPrintableMiscselectList (uint32_t miscselect)
 Returns a printable list of the bits set in miscselect. More...
 
std::vector< absl::string_view > GetPrintableMiscselectList (const Miscselect &miscselect)
 

Variables

const AttributeBit kAllAttributeBits [15]
 All valid bit positions in the ATTRIBUTES bit vector. More...
 
const size_t kNumAttributeFlagBits
 The number of ATTRIBUTES flag bits. More...
 
const size_t kNumAttributeXfrmBits
 The number of ATTRIBUTES XFRM bits. More...
 
const size_t kNumAttributeBits
 The total number of ATTRIBUTES bits. More...
 
const uint64_t kValidAttributeFlagsBitmask
 A bitmask over all valid ATTRIBUTES flag bits. More...
 
const uint64_t kValidAttributeXfrmBitmask
 A bitmask over all valid ATTRIBUTES XFRM bits. More...
 
const MiscselectBit kAllMiscselectBits [1]
 All valid bit positions in the MISCSELECT bit vector. More...
 
const size_t kNumMiscselectBits
 The total number of MISCSELECT bits. More...
 
const uint32_t kValidMiscselectBitmask
 A bitmask over all valid MISCSELECT bits. More...
 

Enumeration Type Documentation

◆ AttributeBit

SGX defines 128 bits of enclave attributes, which are located in the SECS (Secure Enclave Control Structure) of the enclave.

The lower 64 bits of these attributes are treated as individual flags, whereas the upper 64 bits are collectively called XFRM (XSAVE Feature Request Mask). This enum defines the various attribute bits and assigns them a value that is same as their bit position in the SECS attributes bit vector. The names of these bits are taken verbatim from the Intel SDM (Software Developer's Manual), volume 3D (see https://software.intel.com/en-us/articles/intel-sdm).

Enumerator
INIT 

Indicates whether the enclave has been initialized via EINIT instruction.

DEBUG 

Indicates whether the enclave is a debug (1) or production (0) enclave.

MODE64BIT 

Indicates whether the enclave is a 64-bit (1) or a 32-bit (0) enclave.

PROVISIONKEY 

Indicates whether the enclave has access to the SGX provisioning key (1) or not (0).

INITTOKENKEY 

Indicates whether the enclave has access to the INIT-token key (1) or not (0).

KSS 

Indicates whether the enclave has support for Key Separation and Sharing (KSS) (1) or not (0).

Enabling KSS sets the ISVEXTPRODID, ISVFAMILYID, CONFIGID and CONFIGSVN values in an enclave's identity.

FPU 

Determines the behavior of the FPU/MMX capabilities.

SSE 

Determines the behavior of the SSE capabilities.

AVX 

Determines the behavior of certain AVX capabilities.

BNDREG 

Determines the behavior of the MPX capabilities.

BNDCSR 

Determines the behavior of the MPX capabilities.

OPMASK 

Determines the behavior of certain AVX capabilities.

ZMM_HI256 

Determines the behavior of certain AVX capabilities.

HI16_ZMM 

Determines the behavior of certain AVX capabilities.

PKRU 

Determines the behavior of the Page Protection Keys.

◆ MiscselectBit

The following enum defines the various MISCSELECT bits and assigns them a value that is same as their bit position in the SECS MISCSELECT bit vector.

The names of these bits are taken verbatim from the Intel SDM (Software Developer's Manual).

Enumerator
EXINFO 

Indicates that information about page faults and GP exceptions that occurred inside an enclave will be saved upon an asynchronous exit.

Function Documentation

◆ ClearAttributeBit()

Status asylo::sgx::ClearAttributeBit ( AttributeBit  bit,
Attributes *  attributes 
)

Sets the given bit of attributes to false, or returns a non-OK Status if the bit was invalid.

◆ ClearMiscselectBit() [1/2]

Status asylo::sgx::ClearMiscselectBit ( MiscselectBit  bit,
uint32_t *  miscselect 
)

Sets the given bit of miscselect to false, or returns a non-OK Status if the bit was invalid.

◆ ClearMiscselectBit() [2/2]

Status asylo::sgx::ClearMiscselectBit ( MiscselectBit  bit,
Miscselect *  miscselect 
)

◆ GetPrintableAttributeList()

std::vector<absl::string_view> asylo::sgx::GetPrintableAttributeList ( const Attributes &  attributes)

Returns a printable list of the bits set in attributes.

◆ GetPrintableMiscselectList() [1/2]

std::vector<absl::string_view> asylo::sgx::GetPrintableMiscselectList ( uint32_t  miscselect)

Returns a printable list of the bits set in miscselect.

◆ GetPrintableMiscselectList() [2/2]

std::vector<absl::string_view> asylo::sgx::GetPrintableMiscselectList ( const Miscselect &  miscselect)

◆ IsAttributeBitSet()

StatusOr<bool> asylo::sgx::IsAttributeBitSet ( AttributeBit  bit,
const Attributes &  attributes 
)

Returns whether the given bit of attributes is set, or a non-OK Status if the bit was invalid.

◆ IsMiscselectBitSet() [1/2]

StatusOr<bool> asylo::sgx::IsMiscselectBitSet ( MiscselectBit  bit,
uint32_t  miscselect 
)

Returns whether the given bit of miscselect is set, or returns a non-OK Status if the bit was invalid.

◆ IsMiscselectBitSet() [2/2]

StatusOr<bool> asylo::sgx::IsMiscselectBitSet ( MiscselectBit  bit,
const Miscselect &  miscselect 
)

◆ operator &()

Attributes asylo::sgx::operator& ( const Attributes &  lhs,
const Attributes &  rhs 
)

Computes the bitwise AND of two Attributes protos.

◆ operator!=() [1/2]

bool asylo::sgx::operator!= ( const Miscselect &  lhs,
const Miscselect &  rhs 
)

Checks two Miscselect protos for inequality.

◆ operator!=() [2/2]

bool asylo::sgx::operator!= ( const Attributes &  lhs,
const Attributes &  rhs 
)

Checks two Attributes protos for inequality.

◆ operator==() [1/2]

bool asylo::sgx::operator== ( const Miscselect &  lhs,
const Miscselect &  rhs 
)

Checks two Miscselect protos for equality.

◆ operator==() [2/2]

bool asylo::sgx::operator== ( const Attributes &  lhs,
const Attributes &  rhs 
)

Checks two Attributes protos for equality.

◆ SetAttributeBit()

Status asylo::sgx::SetAttributeBit ( AttributeBit  bit,
Attributes *  attributes 
)

Sets the given bit of attributes to true, or returns a non-OK Status if the bit was invalid.

◆ SetMiscselectBit() [1/2]

Status asylo::sgx::SetMiscselectBit ( MiscselectBit  bit,
uint32_t *  miscselect 
)

Sets the given bit of miscselect to true, or returns a non-OK Status if the bit was invalid.

◆ SetMiscselectBit() [2/2]

Status asylo::sgx::SetMiscselectBit ( MiscselectBit  bit,
Miscselect *  miscselect 
)

Variable Documentation

◆ kAllAttributeBits

const AttributeBit asylo::sgx::kAllAttributeBits[15]

All valid bit positions in the ATTRIBUTES bit vector.

◆ kAllMiscselectBits

const MiscselectBit asylo::sgx::kAllMiscselectBits[1]

All valid bit positions in the MISCSELECT bit vector.

◆ kNumAttributeBits

const size_t asylo::sgx::kNumAttributeBits

The total number of ATTRIBUTES bits.

◆ kNumAttributeFlagBits

const size_t asylo::sgx::kNumAttributeFlagBits

The number of ATTRIBUTES flag bits.

◆ kNumAttributeXfrmBits

const size_t asylo::sgx::kNumAttributeXfrmBits

The number of ATTRIBUTES XFRM bits.

◆ kNumMiscselectBits

const size_t asylo::sgx::kNumMiscselectBits

The total number of MISCSELECT bits.

◆ kValidAttributeFlagsBitmask

const uint64_t asylo::sgx::kValidAttributeFlagsBitmask

A bitmask over all valid ATTRIBUTES flag bits.

◆ kValidAttributeXfrmBitmask

const uint64_t asylo::sgx::kValidAttributeXfrmBitmask

A bitmask over all valid ATTRIBUTES XFRM bits.

◆ kValidMiscselectBitmask

const uint32_t asylo::sgx::kValidMiscselectBitmask

A bitmask over all valid MISCSELECT bits.