main.h 993 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Copyright(c) 2016-20 Intel Corporation.
  4. */
  5. #ifndef MAIN_H
  6. #define MAIN_H
  7. #define ENCL_HEAP_SIZE_DEFAULT 4096
  8. struct encl_segment {
  9. void *src;
  10. off_t offset;
  11. size_t size;
  12. unsigned int prot;
  13. unsigned int flags;
  14. bool measure;
  15. };
  16. struct encl {
  17. int fd;
  18. void *bin;
  19. off_t bin_size;
  20. void *src;
  21. size_t src_size;
  22. size_t encl_size;
  23. off_t encl_base;
  24. unsigned int nr_segments;
  25. struct encl_segment *segment_tbl;
  26. struct sgx_secs secs;
  27. struct sgx_sigstruct sigstruct;
  28. };
  29. extern unsigned char sign_key[];
  30. extern unsigned char sign_key_end[];
  31. void encl_delete(struct encl *ctx);
  32. bool encl_load(const char *path, struct encl *encl, unsigned long heap_size);
  33. bool encl_measure(struct encl *encl);
  34. bool encl_build(struct encl *encl);
  35. uint64_t encl_get_entry(struct encl *encl, const char *symbol);
  36. int sgx_enter_enclave(void *rdi, void *rsi, long rdx, u32 function, void *r8, void *r9,
  37. struct sgx_enclave_run *run);
  38. #endif /* MAIN_H */