msg3_parm.h 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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 _PVE_MSG3_PARM_H_
  32. #define _PVE_MSG3_PARM_H_
  33. #include "provision_msg.h"
  34. #include "protocol.h"
  35. #include "epid/common/errors.h"
  36. #include "epid/member/api.h"
  37. #include "sgx_tcrypto.h"
  38. #include "pve_qe_common.h"
  39. #include "se_sig_rl.h"
  40. #ifndef UINT32_MAX
  41. #define UINT32_MAX 0xFFFFFFFFU
  42. #endif
  43. typedef MemberCtx EPIDMember;
  44. /*define a local structure to collect information required for ProvMsg3*/
  45. typedef struct _prov_msg3_parm_t{
  46. se_sig_rl_t sigrl_header; /*used to keep a copy of sigrl_header from msg2 in trusted memory*/
  47. extended_epid_group_blob_t local_xegb;
  48. uint8_t iv[IV_SIZE]; /*iv to encrypt EPIDSigTLV by EK1*/
  49. const external_memory_byte_t *emp_sigrl_sig_entries; /*pointer to start address of sigrl_body in external memory*/
  50. EpidSignature signature_header; /*keep a copy of signature_header in ProvMsg3*/
  51. uint32_t sigrl_count; /*Count of SigRL Entry in the Previous SigRL*/
  52. EPIDMember *epid_member; /*A handle to Epid Member Ctx in epid library. Save here for piece meal processing*/
  53. IppsAES_GCMState *p_msg3_state; /*State to encrypt ProvMsg3 in piece meal processing*/
  54. uint32_t msg3_state_size;
  55. sgx_sha_state_handle_t sha_state; /*State to calcuate SHA256 value of PreviousSigRL in ProvMsg2 in piece meal processing*/
  56. }prov_msg3_parm_t;
  57. /*declare gen_prov_msg3. It will be called by function to process ProvMsg2 to generate ProvMsg3*/
  58. pve_status_t gen_prov_msg3_data(const proc_prov_msg2_blob_input_t *msg2_blob_input,
  59. prov_msg3_parm_t& msg3_parm,
  60. uint8_t performance_rekey_used,
  61. gen_prov_msg3_output_t *msg3_output,
  62. external_memory_byte_t *emp_epid_sig,
  63. uint32_t epid_sig_buffer_size);
  64. #endif