sgx_attest.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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 <stdint.h>
  16. #include "sgx_arch.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 "https://api.trustedservices.intel.com/sgx/dev/attestation/v3/report"
  39. int init_trusted_platform(void);
  40. typedef struct {
  41. sgx_report_t qe_report;
  42. sgx_quote_t* quote;
  43. size_t quote_len;
  44. char* ias_report;
  45. size_t ias_report_len;
  46. uint8_t* ias_sig;
  47. size_t ias_sig_len;
  48. char* ias_certs;
  49. size_t ias_certs_len;
  50. } __attribute__((packed)) sgx_attestation_t;
  51. int sgx_verify_platform(sgx_spid_t* spid, const char* subkey, sgx_quote_nonce_t* nonce,
  52. sgx_report_data_t* report_data, bool linkable,
  53. bool accept_group_out_of_date, bool accept_configuration_needed,
  54. sgx_attestation_t* ret_attestation, char** ret_ias_status,
  55. char** ret_ias_timestamp);
  56. #define HTTPS_REQUEST_MAX_LENGTH 256
  57. #endif /* SGX_ATTEST_H */