uae_oal_api.h 4.8 KB

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