0001
0002
0003
0004
0005
0006 #ifndef MAIN_H
0007 #define MAIN_H
0008
0009 #define ENCL_HEAP_SIZE_DEFAULT 4096
0010
0011 struct encl_segment {
0012 void *src;
0013 off_t offset;
0014 size_t size;
0015 unsigned int prot;
0016 unsigned int flags;
0017 bool measure;
0018 };
0019
0020 struct encl {
0021 int fd;
0022 void *bin;
0023 off_t bin_size;
0024 void *src;
0025 size_t src_size;
0026 size_t encl_size;
0027 off_t encl_base;
0028 unsigned int nr_segments;
0029 struct encl_segment *segment_tbl;
0030 struct sgx_secs secs;
0031 struct sgx_sigstruct sigstruct;
0032 };
0033
0034 extern unsigned char sign_key[];
0035 extern unsigned char sign_key_end[];
0036
0037 void encl_delete(struct encl *ctx);
0038 bool encl_load(const char *path, struct encl *encl, unsigned long heap_size);
0039 bool encl_measure(struct encl *encl);
0040 bool encl_build(struct encl *encl);
0041 uint64_t encl_get_entry(struct encl *encl, const char *symbol);
0042
0043 int sgx_enter_enclave(void *rdi, void *rsi, long rdx, u32 function, void *r8, void *r9,
0044 struct sgx_enclave_run *run);
0045
0046 #endif