sgx_report.h 4.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /*
  2. * Copyright (C) 2011-2018 Intel Corporation. All rights reserved.
  3. *
  4. * Redistribution and use in source and binary forms, with or without
  5. * modification, are permitted provided that the following conditions
  6. * are met:
  7. *
  8. * * Redistributions of source code must retain the above copyright
  9. * notice, this list of conditions and the following disclaimer.
  10. * * Redistributions in binary form must reproduce the above copyright
  11. * notice, this list of conditions and the following disclaimer in
  12. * the documentation and/or other materials provided with the
  13. * distribution.
  14. * * Neither the name of Intel Corporation nor the names of its
  15. * contributors may be used to endorse or promote products derived
  16. * from this software without specific prior written permission.
  17. *
  18. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  19. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  20. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  21. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  22. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  23. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  24. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  25. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  26. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  27. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  28. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  29. *
  30. */
  31. /*
  32. * This file is to define Enclave's Report
  33. */
  34. #ifndef _SGX_REPORT_H_
  35. #define _SGX_REPORT_H_
  36. #include "sgx_attributes.h"
  37. #include "sgx_key.h"
  38. #define SGX_HASH_SIZE 32 /* SHA256 */
  39. #define SGX_MAC_SIZE 16 /* Message Authentication Code - 16 bytes */
  40. #define SGX_REPORT_DATA_SIZE 64
  41. typedef struct _sgx_measurement_t
  42. {
  43. uint8_t m[SGX_HASH_SIZE];
  44. } sgx_measurement_t;
  45. typedef uint8_t sgx_mac_t[SGX_MAC_SIZE];
  46. typedef struct _sgx_report_data_t
  47. {
  48. uint8_t d[SGX_REPORT_DATA_SIZE];
  49. } sgx_report_data_t;
  50. typedef uint16_t sgx_prod_id_t;
  51. #define SGX_TARGET_INFO_RESERVED1_BYTES 4
  52. #define SGX_TARGET_INFO_RESERVED2_BYTES 456
  53. typedef struct _target_info_t
  54. {
  55. sgx_measurement_t mr_enclave; /* ( 0) The MRENCLAVE of the target enclave */
  56. sgx_attributes_t attributes; /* ( 32) The ATTRIBUTES field of the target enclave */
  57. uint8_t reserved1[SGX_TARGET_INFO_RESERVED1_BYTES]; /* ( 48) Reserved */
  58. sgx_misc_select_t misc_select; /* ( 52) The MISCSELECT of the target enclave */
  59. uint8_t reserved2[SGX_TARGET_INFO_RESERVED2_BYTES]; /* ( 56) Struct size is 512 bytes */
  60. } sgx_target_info_t;
  61. typedef struct _report_body_t
  62. {
  63. sgx_cpu_svn_t cpu_svn; /* ( 0) Security Version of the CPU */
  64. sgx_misc_select_t misc_select; /* ( 16) Which fields defined in SSA.MISC */
  65. uint8_t reserved1[28]; /* ( 20) */
  66. sgx_attributes_t attributes; /* ( 48) Any special Capabilities the Enclave possess */
  67. sgx_measurement_t mr_enclave; /* ( 64) The value of the enclave's ENCLAVE measurement */
  68. uint8_t reserved2[32]; /* ( 96) */
  69. sgx_measurement_t mr_signer; /* (128) The value of the enclave's SIGNER measurement */
  70. uint8_t reserved3[96]; /* (160) */
  71. sgx_prod_id_t isv_prod_id; /* (256) Product ID of the Enclave */
  72. sgx_isv_svn_t isv_svn; /* (258) Security Version of the Enclave */
  73. uint8_t reserved4[60]; /* (260) */
  74. sgx_report_data_t report_data; /* (320) Data provided by the user */
  75. } sgx_report_body_t;
  76. typedef struct _report_t /* 432 bytes */
  77. {
  78. sgx_report_body_t body;
  79. sgx_key_id_t key_id; /* (384) KeyID used for diversifying the key tree */
  80. sgx_mac_t mac; /* (416) The Message Authentication Code over this structure. */
  81. } sgx_report_t;
  82. #endif