sgx_uae_service.h 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  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. #ifndef _SGX_UAE_SERVICE_H_
  32. #define _SGX_UAE_SERVICE_H_
  33. #include <stdint.h>
  34. #include "sgx_quote.h"
  35. #include "sgx_error.h"
  36. #include "sgx_urts.h"
  37. #define PS_CAP_TRUSTED_TIME 0x1
  38. #define PS_CAP_MONOTONIC_COUNTER 0x2
  39. /**
  40. * Platform service capabilities
  41. * ps_cap0
  42. * Bit 0 : Trusted Time
  43. * Bit 1 : Monotonic Counter
  44. * Bit 2-31 : Reserved
  45. * ps_cap1
  46. * Bit 0-31 : Reserved
  47. */
  48. typedef struct _sgx_ps_cap_t
  49. {
  50. uint32_t ps_cap0;
  51. uint32_t ps_cap1;
  52. } sgx_ps_cap_t;
  53. #ifdef __cplusplus
  54. extern "C" {
  55. #endif
  56. /*
  57. * Function used to initialize the process of quoting.
  58. *
  59. * @param p_target_info[out] Target info of quoting enclave.
  60. * @param p_gid[out] ID of platform's current EPID group.
  61. * @return If outputs are generated, return SGX_SCCUESS, otherwise return general error code
  62. * or SGX_ERROR_AE_INVALID_EPIDBLOB to indicate special error condition.
  63. */
  64. sgx_status_t SGXAPI sgx_init_quote(
  65. sgx_target_info_t *p_target_info,
  66. sgx_epid_group_id_t *p_gid);
  67. /*
  68. * Function used to calculate quote size.
  69. *
  70. * @param p_sig_rl[in] OPTIONAL Signature Revocation List.
  71. * @param sig_rl_size[in] Signature Revocation List size, in bytes.
  72. * @param p_quote_size[out] Quote size, in bytes.
  73. * @return If quote size is calculated,return SGX_SUCCESS, otherwise return
  74. * SGX_ERROR_INVALID_PARAMETER to indicate special error condition.
  75. */
  76. sgx_status_t SGXAPI sgx_calc_quote_size(
  77. const uint8_t *p_sig_rl,
  78. uint32_t sig_rl_size,
  79. uint32_t* p_quote_size);
  80. /*
  81. * [DEPRECATED] Use sgx_calc_quote_size function instead of this one
  82. * Function used to get quote size.
  83. *
  84. * @param p_sig_rl[in] OPTIONAL Signature Revocation List.
  85. * @param p_quote_size[out] Quote size, in bytes.
  86. * @return If quote size is calculated,return SGX_SCCUESS, otherwise return
  87. * SGX_ERROR_INVALID_PARAMETER to indicate special error condition.
  88. */
  89. SGX_DEPRECATED
  90. sgx_status_t SGXAPI sgx_get_quote_size(
  91. const uint8_t *p_sig_rl,
  92. uint32_t* p_quote_size);
  93. /*
  94. * Function used to get quote.
  95. *
  96. * @param p_report[in] Report of enclave for which quote is being calculated.
  97. * @param quote_type[in] Linkable or unlinkable quote.
  98. * @param p_spid[in] Pointer of SPID.
  99. * @param p_nonce[in] OPTIONAL nonce.
  100. * @param p_sig_rl[in] OPTIONAL list of signature made fore EPID.
  101. * @param sig_rl_size[in] The size of p_sig_rl, in bytes.
  102. * @param p_qe_report[out] OPTIONAL The QE report.
  103. * @param p_quote[out] The quote buffer, can not be NULL.
  104. * @param quote_size[in] Quote buffer size, in bytes.
  105. * @return If quote is generated,return SGX_SCCUESS,
  106. * error code or SGX_ERROR_AE_INVALID_EPIDBLOB,
  107. * SGX_ERROR_INVALID_PARAMETER to indicate special error condition.
  108. * SGX_ERROR_EPID_MEMBER_REVOKED to indicate the EPID group membership has been revoked.
  109. */
  110. sgx_status_t SGXAPI sgx_get_quote(
  111. const sgx_report_t *p_report,
  112. sgx_quote_sign_type_t quote_type,
  113. const sgx_spid_t *p_spid,
  114. const sgx_quote_nonce_t *p_nonce,
  115. const uint8_t *p_sig_rl,
  116. uint32_t sig_rl_size,
  117. sgx_report_t *p_qe_report,
  118. sgx_quote_t *p_quote,
  119. uint32_t quote_size);
  120. /**
  121. * Get the platform service capabilities
  122. *
  123. * @param sgx_ps_cap Platform capabilities reported by AESM.
  124. * @return if OK, return SGX_SUCCESS
  125. */
  126. sgx_status_t SGXAPI sgx_get_ps_cap(sgx_ps_cap_t* p_sgx_ps_cap);
  127. /**
  128. * Get the white list's size
  129. *
  130. * @param p_whitelist_size Save the size of the white list.
  131. * @return if OK, return SGX_SUCCESS
  132. */
  133. sgx_status_t SGXAPI sgx_get_whitelist_size(uint32_t* p_whitelist_size);
  134. /**
  135. * Get the white list value
  136. *
  137. * @param p_whitelist Save the white list value
  138. * @param whitelist_size The size of the white list and the read data size is whitelist_size
  139. * @return if OK, return SGX_SUCCESS
  140. */
  141. sgx_status_t SGXAPI sgx_get_whitelist(uint8_t* p_whitelist, uint32_t whitelist_size);
  142. /**
  143. * Get the extended epid group id
  144. *
  145. * @param p_extended_epid_group_id Save the extended epid group id.
  146. * @return if OK, return SGX_SUCCESS
  147. */
  148. sgx_status_t SGXAPI sgx_get_extended_epid_group_id(uint32_t* p_extended_epid_group_id);
  149. #define SGX_IS_TRUSTED_TIME_AVAILABLE(cap) ((((uint32_t)PS_CAP_TRUSTED_TIME)&((cap).ps_cap0))!=0)
  150. #define SGX_IS_MONOTONIC_COUNTER_AVAILABLE(cap) ((((uint32_t)PS_CAP_MONOTONIC_COUNTER)&((cap).ps_cap0))!=0)
  151. /*
  152. * Function used to report the status of the attestation.
  153. *
  154. * @param p_platform_info[in] platform information received from Intel Attestation Server.
  155. * @param attestation_status[in] Value representing status during attestation. 0 if attestation succeeds.
  156. * @param p_update_info[out] update information of the SGX platform.
  157. * @return If OK, return SGX_SUCCESS. If update is needed, return SGX_ERROR_UPDATE_NEEDED and update_info contains update information.
  158. */
  159. sgx_status_t SGXAPI sgx_report_attestation_status(
  160. const sgx_platform_info_t* p_platform_info,
  161. int attestation_status,
  162. sgx_update_info_bit_t* p_update_info);
  163. /**
  164. * Register white list certificate chain
  165. *
  166. * @param p_wl_cert_chain The white list to be registered.
  167. * @param wl_cert_chain_size The size of the white list.
  168. * @return If OK, return SGX_SUCCESS
  169. */
  170. sgx_status_t SGXAPI sgx_register_wl_cert_chain(uint8_t* p_wl_cert_chain, uint32_t wl_cert_chain_size);
  171. #ifdef __cplusplus
  172. }
  173. #endif
  174. #endif