123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 |
-
- #ifndef _PVE_MSG_H_
- #define _PVE_MSG_H_
- #include "epid_pve_type.h"
- #include "sgx_tseal.h"
- #include "sgx_report.h"
- typedef enum _pve_status_t
- {
- PVEC_SUCCESS = 0,
- PVEC_PARAMETER_ERROR,
- PVEC_INSUFFICIENT_MEMORY_ERROR,
- PVEC_READ_RAND_ERROR,
- PVEC_SIGRL_INTEGRITY_CHECK_ERROR,
- PVEC_MALLOC_ERROR,
- PVEC_EPID_BLOB_ERROR,
- PVEC_SE_ERROR,
- PVEC_IPP_ERROR,
- PVEC_MSG_ERROR,
- PVEC_PEK_SIGN_ERROR,
- PVEC_XEGDSK_SIGN_ERROR,
- PVEC_INTEGER_OVERFLOW_ERROR,
- PVEC_SEAL_ERROR,
- PVEC_EPID_ERROR,
- PVEC_REVOKED_ERROR,
- PVEC_UNSUPPORTED_VERSION_ERROR,
- PVEC_INVALID_CPU_ISV_SVN,
- PVEC_INVALID_EPID_KEY,
- PVEC_UNEXPECTED_ERROR
- }pve_status_t;
- typedef enum _prov_stage_t
- {
- PVE_STAGE_IDLE,
- PVE_STAGE_WAIT_FOR_GET_EK2,
- PVE_STAGE_WAIT_FOR_MSG2_OR_MSG4,
- PVE_STAGE_WAIT_FOR_MSG4,
- }prov_stage_t;
- #define PVE_RSAOAEP_ENCRYPT_MAXLEN (RSA_3072_KEY_BYTES - 2*SHA_SIZE_BIT/8 - 2)
- #define SHA_SIZE_BIT 256
- #define pointer_diff_u32(p1, p2) static_cast<uint32_t>(p1-p2)
- #pragma pack(1)
- typedef struct _proc_prov_msg2_blob_input_t{
- signed_epid_group_cert_t group_cert;
- extended_epid_group_blob_t xegb;
- signed_pek_t pek;
- sgx_target_info_t pce_target_info;
- uint8_t challenge_nonce[CHALLENGE_NONCE_SIZE];
- bk_platform_info_t equiv_pi;
- bk_platform_info_t previous_pi;
- GroupId previous_gid;
- uint8_t old_epid_data_blob[SGX_TRUSTED_EPID_BLOB_SIZE_SDK];
- uint8_t is_previous_pi_provided;
- }proc_prov_msg2_blob_input_t;
- #define HARD_CODED_JOIN_PROOF_WITH_ESCROW_TLV_SIZE (4+sizeof(join_proof_with_escrow_t))
- #define HARD_CODED_EPID_MEMBER_WITH_ESCROW_TLV_SIZE (4+sizeof(membership_credential_with_escrow_t))
- typedef struct _gen_prov_msg3_output_t{
- uint8_t field1_iv[IV_SIZE];
- uint8_t field1_data[HARD_CODED_JOIN_PROOF_WITH_ESCROW_TLV_SIZE];
- uint8_t field1_mac[MAC_SIZE];
- uint8_t n2[NONCE_2_SIZE];
- uint8_t epid_sig_iv[IV_SIZE];
- uint8_t epid_sig_mac[MAC_SIZE];
- uint8_t encrypted_pwk2[PEK_MOD_SIZE];
- sgx_report_t pwk2_report;
- uint32_t epid_sig_output_size;
- uint8_t is_join_proof_generated;
- uint8_t is_epid_sig_generated;
-
- }gen_prov_msg3_output_t;
- typedef struct _proc_prov_msg4_input_t{
- extended_epid_group_blob_t xegb;
- uint8_t member_credential_iv[IV_SIZE];
- uint8_t encrypted_member_credential[HARD_CODED_EPID_MEMBER_WITH_ESCROW_TLV_SIZE];
- uint8_t member_credential_mac[MAC_SIZE];
- uint8_t n2[NONCE_2_SIZE];
- psvn_t equivalent_psvn;
- fmsp_t fmsp;
- signed_epid_group_cert_t group_cert;
- }proc_prov_msg4_input_t;
- typedef struct _proc_prov_msg4_output_t{
- uint8_t truested_epid_blob[SGX_TRUSTED_EPID_BLOB_SIZE_SDK];
- }proc_prov_msg4_output_t;
- typedef struct _gen_endpoint_selection_output_t{
- uint8_t xid[XID_SIZE];
- uint8_t selector_id;
- }gen_endpoint_selection_output_t;
- #pragma pack()
- #define PSVN_START_IN_DEVICE_ID sizeof(ppid_t)
- #define PPID_START_IN_DEVICE_ID 0
- #define FMSP_START_IN_DEVICE_ID (sizeof(ppid_t)+sizeof(psvn_t))
- #endif
|