uae_oal_api.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  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 _UAE_OAL_H
  32. #define _UAE_OAL_H
  33. #include "sgx_quote.h"
  34. #include "sgx_error.h"
  35. #include "sgx_urts.h"
  36. #include <arch.h>
  37. #include <aesm_error.h>
  38. typedef enum{
  39. UAE_OAL_SUCCESS = 0,
  40. UAE_OAL_ERROR_UNEXPECTED ,
  41. UAE_OAL_ERROR_AESM_UNAVAILABLE ,
  42. UAE_OAL_ERROR_TIMEOUT ,
  43. UAE_OAL_ERROR_INVALID ,
  44. } uae_oal_status_t;
  45. /*OAL methods from here forward */
  46. extern "C"
  47. {
  48. uae_oal_status_t SGXAPI oal_get_launch_token(
  49. const enclave_css_t* signature,
  50. const sgx_attributes_t* attribute,
  51. sgx_launch_token_t* launch_token,
  52. uint32_t timeout_usec,
  53. aesm_error_t *result);
  54. uae_oal_status_t SGXAPI oal_init_quote(
  55. sgx_target_info_t *p_target_info,
  56. sgx_epid_group_id_t *p_gid,
  57. uint32_t timeout_usec,
  58. aesm_error_t *result);
  59. uae_oal_status_t SGXAPI oal_get_quote(
  60. const sgx_report_t *p_report,
  61. sgx_quote_sign_type_t quote_type,
  62. const sgx_spid_t *p_spid,
  63. const sgx_quote_nonce_t *p_nonce,
  64. const uint8_t *p_sig_rl,
  65. uint32_t sig_rl_size,
  66. sgx_report_t *p_qe_report,
  67. sgx_quote_t *p_quote,
  68. uint32_t quote_size,
  69. uint32_t timeout_usec,
  70. aesm_error_t *result);
  71. uae_oal_status_t SGXAPI oal_get_ps_cap(
  72. uint64_t* p_ps_cap,
  73. uint32_t timeout_usec,
  74. aesm_error_t *result);
  75. uae_oal_status_t SGXAPI oal_report_attestation_status(
  76. const sgx_platform_info_t* p_platform_info,
  77. int attestation_status,
  78. sgx_update_info_bit_t* p_update_info,
  79. uint32_t timeout_usec,
  80. aesm_error_t *result);
  81. uae_oal_status_t oal_create_session(
  82. uint32_t *session_id,
  83. uint8_t *se_dh_msg1,
  84. uint32_t dh_msg1_size,
  85. uint32_t timeout_usec,
  86. aesm_error_t *result);
  87. uae_oal_status_t oal_exchange_report(
  88. uint32_t session_id,
  89. const uint8_t *se_dh_msg2,
  90. uint32_t dh_msg2_size,
  91. uint8_t *se_dh_msg3,
  92. uint32_t dh_msg3_size,
  93. uint32_t timeout_usec,
  94. aesm_error_t *result);
  95. uae_oal_status_t oal_close_session(
  96. uint32_t session_id,
  97. uint32_t timeout_usec,
  98. aesm_error_t *result);
  99. uae_oal_status_t oal_invoke_service(
  100. const uint8_t *pse_message_req,
  101. uint32_t pse_message_req_size,
  102. uint8_t *pse_message_resp,
  103. uint32_t pse_message_resp_size,
  104. uint32_t timeout_usec,
  105. aesm_error_t *response);
  106. uae_oal_status_t oal_get_whitelist_size(
  107. uint32_t* p_whitelist_size,
  108. uint32_t timeout_usec,
  109. aesm_error_t* result);
  110. uae_oal_status_t oal_get_whitelist(
  111. uint8_t* p_whitelist,
  112. uint32_t whitelist_size,
  113. uint32_t timeout_usec,
  114. aesm_error_t *result);
  115. uae_oal_status_t oal_get_extended_epid_group_id(
  116. uint32_t* extended_group_id,
  117. uint32_t timeout_usec,
  118. aesm_error_t *result);
  119. uae_oal_status_t oal_switch_extended_epid_group(
  120. uint32_t x_group_id,
  121. uint32_t timeout_usec,
  122. aesm_error_t *result);
  123. sgx_status_t oal_map_status(uae_oal_status_t status);
  124. sgx_status_t oal_map_result(aesm_error_t result);
  125. } /* end of extern "C" */
  126. #endif