sgx_attest.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /* Copyright (C) 2017, Texas A&M University.
  2. This file is part of Graphene Library OS.
  3. Graphene Library OS is free software: you can redistribute it and/or
  4. modify it under the terms of the GNU Lesser General Public License
  5. as published by the Free Software Foundation, either version 3 of the
  6. License, or (at your option) any later version.
  7. Graphene Library OS is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU Lesser General Public License for more details.
  11. You should have received a copy of the GNU Lesser General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>. */
  13. #ifndef SGX_ATTEST_H
  14. #define SGX_ATTEST_H
  15. #include "sgx_arch.h"
  16. #include <stdint.h>
  17. typedef struct {
  18. uint16_t version;
  19. uint16_t sigtype;
  20. uint32_t gid;
  21. uint16_t isvsvn_qe;
  22. uint16_t isvsvn_pce;
  23. uint8_t reserved[4];
  24. uint8_t base[32];
  25. } __attribute__((packed)) sgx_quote_body_t;
  26. typedef struct {
  27. sgx_quote_body_t body;
  28. sgx_report_body_t report_body;
  29. uint32_t sig_len;
  30. } __attribute__((packed)) sgx_quote_t;
  31. typedef uint8_t sgx_spid_t[16];
  32. typedef uint8_t sgx_quote_nonce_t[16];
  33. enum {
  34. SGX_UNLINKABLE_SIGNATURE,
  35. SGX_LINKABLE_SIGNATURE
  36. };
  37. #define SGX_QUOTE_MAX_SIZE (2048)
  38. #define IAS_REPORT_URL \
  39. "https://api.trustedservices.intel.com/sgx/dev/attestation/v3/report"
  40. int init_trusted_platform(void);
  41. typedef struct {
  42. sgx_report_t qe_report;
  43. sgx_quote_t* quote;
  44. size_t quote_len;
  45. char* ias_report;
  46. size_t ias_report_len;
  47. uint8_t* ias_sig;
  48. size_t ias_sig_len;
  49. char* ias_certs;
  50. size_t ias_certs_len;
  51. } __attribute__((packed)) sgx_attestation_t;
  52. int sgx_verify_platform(sgx_spid_t* spid, const char* subkey, sgx_quote_nonce_t* nonce,
  53. sgx_report_data_t* report_data, bool linkable,
  54. bool accept_group_out_of_date, bool accept_configuration_needed,
  55. sgx_attestation_t* ret_attestation, char** ret_ias_status,
  56. char** ret_ias_timestamp);
  57. #define HTTPS_REQUEST_MAX_LENGTH (256)
  58. #endif /* SGX_ATTEST_H */