protocol.h 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. * File: protocol.h
  33. * Description: Header file of interface functions for provision enclave
  34. *
  35. * Function to generate ProvMsg1, ProvMsg3 and function to process ProvMsg2/ProvMsg4
  36. */
  37. #ifndef _PROTOCOL_H
  38. #define _PROTOCOL_H
  39. #include "provision_msg.h"
  40. #include "helper.h"
  41. /*Function to generate ProvMsg1 required data inside PvE
  42. return PVEC_SUCCESS on success
  43. return other value to indicate correpondent error*/
  44. pve_status_t gen_prov_msg1_data(const sgx_target_info_t& pce_target_info,
  45. const extended_epid_group_blob_t& xegb,
  46. const signed_pek_t& pek, /*input the signed PEK*/
  47. sgx_report_t& pek_report); /*output report of PEK for PCE to verify it*/
  48. /*Function to process ProvMsg2 data and generate ProvMsg3 data in PvE
  49. return PVEC_SUCCESS on success
  50. return other value to indicate correpondent error*/
  51. pve_status_t proc_prov_msg2_data(const proc_prov_msg2_blob_input_t *msg2_blob_input, /*Input data from ProvMsg2*/
  52. uint8_t performance_rekey_used, /*1 if performance rekey*/
  53. const external_memory_byte_t *sigrl, /*optional sigrl inside external memory*/
  54. uint32_t sigrl_size,
  55. gen_prov_msg3_output_t *msg3_output, /*the output buffer for fixed part of msg3 data*/
  56. external_memory_byte_t *emp_epid_sig, /*optional epid signature buffer for output*/
  57. uint32_t epid_sig_buffer_size); /*input length of buffer 'emp_epid_sig'*/
  58. /*Function to process ProvMsg4 and generate new EPID BLOB data
  59. return PVEC_SUCCESS on success
  60. return other value to indicate error*/
  61. pve_status_t proc_prov_msg4_data(const proc_prov_msg4_input_t *msg4_input, /*Input data from ProvMsg4*/
  62. sgx_sealed_data_t *epid_blob); /*Output the EPID BLOB, the size of the buffer should be at least SGX_TRUSTED_EPID_BLOB_SIZE_SDK*/
  63. /*Function to generate endpoint selection msg1 for SGX Provisioning*/
  64. pve_status_t gen_es_msg1_data(gen_endpoint_selection_output_t *es_selector);
  65. #endif