sgx_uae_service.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. /*
  2. * Copyright (C) 2011-2017 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 get quote size.
  69. *
  70. * @param p_sig_rl[in] OPTIONAL Signature Revocation List.
  71. * @param p_quote_size[out] Quote size, in bytes.
  72. * @return If quote size is calculated,return SGX_SCCUESS, otherwise return
  73. * SGX_ERROR_INVALID_PARAMETER to indicate special error condition.
  74. */
  75. sgx_status_t SGXAPI sgx_get_quote_size(
  76. const uint8_t *p_sig_rl,
  77. uint32_t* p_quote_size);
  78. /*
  79. * Function used to get quote.
  80. *
  81. * @param p_report[in] Report of enclave for which quote is being calculated.
  82. * @param quote_type[in] Linkable or unlinkable quote.
  83. * @param p_spid[in] Pointer of SPID.
  84. * @param p_nonce[in] OPTIONAL nonce.
  85. * @param p_sig_rl[in] OPTIONAL list of signature made fore EPID.
  86. * @param sig_rl_size[in] The size of p_sig_rl, in bytes.
  87. * @param p_qe_report[out] OPTIONAL The QE report.
  88. * @param p_quote[out] The quote buffer, can not be NULL.
  89. * @param quote_size[in] Quote buffer size, in bytes.
  90. * @return If quote is generated,return SGX_SCCUESS,
  91. * error code or SGX_ERROR_AE_INVALID_EPIDBLOB,
  92. * SGX_ERROR_INVALID_PARAMETER to indicate special error condition.
  93. * SGX_ERROR_EPID_MEMBER_REVOKED to indicate the EPID group membership has been revoked.
  94. */
  95. sgx_status_t SGXAPI sgx_get_quote(
  96. const sgx_report_t *p_report,
  97. sgx_quote_sign_type_t quote_type,
  98. const sgx_spid_t *p_spid,
  99. const sgx_quote_nonce_t *p_nonce,
  100. const uint8_t *p_sig_rl,
  101. uint32_t sig_rl_size,
  102. sgx_report_t *p_qe_report,
  103. sgx_quote_t *p_quote,
  104. uint32_t quote_size);
  105. /**
  106. * Get the platform service capabilities
  107. *
  108. * @param sgx_ps_cap Platform capabilities reported by AESM.
  109. * @return if OK, return SGX_SUCCESS
  110. */
  111. sgx_status_t SGXAPI sgx_get_ps_cap(sgx_ps_cap_t* p_sgx_ps_cap);
  112. /**
  113. * Get the white list's size
  114. *
  115. * @param p_whitelist_size Save the size of the white list.
  116. * @return if OK, return SGX_SUCCESS
  117. */
  118. sgx_status_t SGXAPI sgx_get_whitelist_size(uint32_t* p_whitelist_size);
  119. /**
  120. * Get the white list value
  121. *
  122. * @param p_whitelist Save the white list value
  123. * @param whitelist_size The size of the white list and the read data size is whitelist_size
  124. * @return if OK, return SGX_SUCCESS
  125. */
  126. sgx_status_t SGXAPI sgx_get_whitelist(uint8_t* p_whitelist, uint32_t whitelist_size);
  127. /**
  128. * Get the extended epid group id
  129. *
  130. * @param p_extended_epid_group_id Save the extended epid group id.
  131. * @return if OK, return SGX_SUCCESS
  132. */
  133. sgx_status_t SGXAPI sgx_get_extended_epid_group_id(uint32_t* p_extended_epid_group_id);
  134. #define SGX_IS_TRUSTED_TIME_AVAILABLE(cap) ((((uint32_t)PS_CAP_TRUSTED_TIME)&((cap).ps_cap0))!=0)
  135. #define SGX_IS_MONOTONIC_COUNTER_AVAILABLE(cap) ((((uint32_t)PS_CAP_MONOTONIC_COUNTER)&((cap).ps_cap0))!=0)
  136. /*
  137. * Function used to report the status of the attestation.
  138. *
  139. * @param p_platform_info[in] platform information received from Intel Attestation Server.
  140. * @param attestation_status[in] Value representing status during attestation. 0 if attestation succeeds.
  141. * @param p_update_info[out] update information of the SGX platform.
  142. * @return If OK, return SGX_SUCCESS. If update is needed, return SGX_ERROR_UPDATE_NEEDED and update_info contains update information.
  143. */
  144. sgx_status_t SGXAPI sgx_report_attestation_status(
  145. const sgx_platform_info_t* p_platform_info,
  146. int attestation_status,
  147. sgx_update_info_bit_t* p_update_info);
  148. #ifdef __cplusplus
  149. }
  150. #endif
  151. #endif