remote_attestation_result.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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 _REMOTE_ATTESTATION_RESULT_H_
  32. #define _REMOTE_ATTESTATION_RESULT_H_
  33. #include <stdint.h>
  34. #ifdef __cplusplus
  35. extern "C" {
  36. #endif
  37. #define SAMPLE_MAC_SIZE 16 /* Message Authentication Code*/
  38. /* - 16 bytes*/
  39. typedef uint8_t sample_mac_t[SAMPLE_MAC_SIZE];
  40. #ifndef SAMPLE_FEBITSIZE
  41. #define SAMPLE_FEBITSIZE 256
  42. #endif
  43. #define SAMPLE_NISTP256_KEY_SIZE (SAMPLE_FEBITSIZE/ 8 /sizeof(uint32_t))
  44. typedef struct sample_ec_sign256_t
  45. {
  46. uint32_t x[SAMPLE_NISTP256_KEY_SIZE];
  47. uint32_t y[SAMPLE_NISTP256_KEY_SIZE];
  48. } sample_ec_sign256_t;
  49. #pragma pack(push,1)
  50. #define SAMPLE_SP_TAG_SIZE 16
  51. typedef struct sp_aes_gcm_data_t {
  52. uint32_t payload_size; /* 0: Size of the payload which is*/
  53. /* encrypted*/
  54. uint8_t reserved[12]; /* 4: Reserved bits*/
  55. uint8_t payload_tag[SAMPLE_SP_TAG_SIZE];
  56. /* 16: AES-GMAC of the plain text,*/
  57. /* payload, and the sizes*/
  58. uint8_t payload[]; /* 32: Ciphertext of the payload*/
  59. /* followed by the plain text*/
  60. } sp_aes_gcm_data_t;
  61. #define ISVSVN_SIZE 2
  62. #define PSDA_SVN_SIZE 4
  63. #define GID_SIZE 4
  64. #define PSVN_SIZE 18
  65. /* @TODO: Modify at production to use the values specified by an Production*/
  66. /* attestation server API*/
  67. typedef struct ias_platform_info_blob_t
  68. {
  69. uint8_t sample_epid_group_status;
  70. uint16_t sample_tcb_evaluation_status;
  71. uint16_t pse_evaluation_status;
  72. uint8_t latest_equivalent_tcb_psvn[PSVN_SIZE];
  73. uint8_t latest_pse_isvsvn[ISVSVN_SIZE];
  74. uint8_t latest_psda_svn[PSDA_SVN_SIZE];
  75. uint8_t performance_rekey_gid[GID_SIZE];
  76. sample_ec_sign256_t signature;
  77. } ias_platform_info_blob_t;
  78. typedef struct sample_ra_att_result_msg_t {
  79. ias_platform_info_blob_t platform_info_blob;
  80. sample_mac_t mac; /* mac_smk(attestation_status)*/
  81. sp_aes_gcm_data_t secret;
  82. } sample_ra_att_result_msg_t;
  83. #pragma pack(pop)
  84. #ifdef __cplusplus
  85. }
  86. #endif
  87. #endif