github.com/epfl-dcsl/gotee@v0.0.0-20200909122901-014b35f5e5e9/src/gosec/signature_types.go (about) 1 package gosec 2 3 const ( 4 SGX_HASH_SIZE = 32 5 SGX_MAC_SIZE = 16 6 7 METADATA_MAGIC = uint64(0x86A80294635D0E4C) 8 METADATA_VERSION = uint64(0x200000003) 9 10 SE_KEY_SIZE = 384 /* in bytes */ 11 SE_EXPONENT_SIZE = 4 /* RSA public key exponent size in bytes */ 12 13 TPE_DBG = (1 << 31) 14 ) 15 16 type TokenGob struct { 17 Token []byte 18 Meta metadata_t 19 } 20 21 type sgx_measurement_t struct { 22 M [SGX_HASH_SIZE]uint8 23 } 24 type sgx_attributes_t struct { 25 Flags uint64 26 Xfrm uint64 27 } 28 29 type enclave_css_t struct { /* 1808 bytes */ 30 Header [12]uint8 /* (0) must be (06000000E100000000000100H) */ 31 Tpe uint32 /* (12) bit 31: 0 = prod, 1 = debug; Bit 30-0: Must be zero */ 32 Module_vendor uint32 /* (16) Intel=0x8086, ISV=0x0000 */ 33 Date uint32 /* (20) build date as yyyymmdd */ 34 Header2 [16]uint8 /* (24) must be (01010000600000006000000001000000H) */ 35 Hw_version uint32 /* (40) For Launch Enclaves: HWVERSION != 0. Others, HWVERSION = 0 */ 36 Reserved [84]uint8 /* (44) Must be 0 */ 37 Modulus [SE_KEY_SIZE]uint8 /* (128) Module Public Key (keylength=3072 bits) */ 38 Exponent [SE_EXPONENT_SIZE]uint8 /* (512) RSA Exponent = 3 */ 39 Signature [SE_KEY_SIZE]uint8 /* (516) Signature over Header and Body */ 40 Misc_select miscselect_t /* (900) The MISCSELECT that must be set */ 41 Misc_mask miscselect_t /* (904) Mask of MISCSELECT to enforce */ 42 Reserved2 [20]uint8 /* (908) Reserved. Must be 0. */ 43 Attributes sgx_attributes_t /* (928) Enclave Attributes that must be set */ 44 Attribute_mask sgx_attributes_t /* (944) Mask of Attributes to Enforce */ 45 Enclave_hash sgx_measurement_t /* (960) MRENCLAVE - (32 bytes) */ 46 Reserved3 [32]uint8 /* (992) Must be 0 */ 47 Isv_prod_id uint16 /* (1024) ISV assigned Product ID */ 48 Isv_svn uint16 /* (1026) ISV assigned SVN */ 49 Reserved4 [12]uint8 /* (1028) Must be 0 */ 50 Q1 [SE_KEY_SIZE]uint8 /* (1040) Q1 value for RSA Signature Verification */ 51 Q2 [SE_KEY_SIZE]uint8 /* (1424) Q2 value for RSA Signature Verification */ 52 } 53 54 type metadata_t struct { 55 Magic_num uint64 /* The magic number identifying the file as a signed enclave image */ 56 Version uint64 /* The metadata version */ 57 Size uint32 /* The size of this structure */ 58 Tcs_policy uint32 /* TCS management policy */ 59 Ssa_frame_size uint32 /* The size of SSA frame in page */ 60 Max_save_buffer_size uint32 /* Max buffer size is 2632 */ 61 Desired_misc_select uint32 62 Tcs_min_pool uint32 /* TCS min pool*/ 63 Enclave_size uint64 /* enclave virtual size */ 64 Attributes sgx_attributes_t /*XFeatureMask to be set in SECS. */ 65 Enclave_css enclave_css_t /* The enclave signature */ 66 //dirs [DIR_NUM]data_directory_t 67 Data [18592]uint8 68 } 69 70 type LaunchTokenRequest struct { 71 MrEnclave []byte `protobuf:"bytes,1,req,name=mr_enclave,json=mrEnclave" json:"mr_enclave,omitempty"` 72 MrSigner []byte `protobuf:"bytes,2,req,name=mr_signer,json=mrSigner" json:"mr_signer,omitempty"` 73 SeAttributes []byte `protobuf:"bytes,3,req,name=se_attributes,json=seAttributes" json:"se_attributes,omitempty"` 74 Timeout *uint32 `protobuf:"varint,9,opt,name=timeout" json:"timeout,omitempty"` 75 XXX_unrecognized []byte `json:"-"` 76 } 77 78 type AESM_message struct { 79 size uint32 80 data []byte 81 }