platform_info_blob.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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 _PLATFORM_INFO_BLOB_H_
  32. #define _PLATFORM_INFO_BLOB_H_
  33. #include <stdint.h>
  34. #include "aeerror.h"
  35. #include "epid_pve_type.h"
  36. #include "sgx_tcrypto.h"
  37. #pragma pack(push, 1)
  38. #define ISVSVN_SIZE 2
  39. #define PSDA_SVN_SIZE 4
  40. #define RSA_SHA256_SIZE 256
  41. typedef uint8_t tcb_psvn_t[PSVN_SIZE];
  42. typedef uint8_t psda_svn_t[PSDA_SVN_SIZE];
  43. typedef uint8_t pse_isvsvn_t[ISVSVN_SIZE];
  44. /* Masks for sgx_epid_group_flags*/
  45. const uint8_t QE_EPID_GROUP_REVOKED = 0x01;
  46. const uint8_t PERF_REKEY_FOR_QE_EPID_GROUP_AVAILABLE = 0x02;
  47. const uint8_t QE_EPID_GROUP_OUT_OF_DATE = 0x04;
  48. /* Masks for sgx_tcb_evaluation_flags*/
  49. const uint16_t QUOTE_CPUSVN_OUT_OF_DATE = 0x0001;
  50. const uint16_t QUOTE_ISVSVN_QE_OUT_OF_DATE = 0x0002;
  51. const uint16_t QUOTE_ISVSVN_PCE_OUT_OF_DATE = 0x0004;
  52. /* Masks for sgx_pse_evaluation_flags
  53. PS_SEC_PROP_DESC.PSE_ISVSVN is out of date*/
  54. const int PSE_ISVSVN_OUT_OF_DATE = 0x0001;
  55. /* CSME EPID 1.1 group identified by PS_SEC_PROP_DESC. PS_HW_GID has been revoked*/
  56. const int EPID_GROUP_ID_BY_PS_HW_GID_REVOKED = 0x0002;
  57. /* PSDA SVN indicated in PS_SEC_PROP_DESC.PS_HW_SEC_INFO is out of date*/
  58. const int SVN_FROM_PS_HW_SEC_INFO_OUT_OF_DATE = 0x0004;
  59. /* CSME EPID 1.1 SigRL version indicated in PS_SEC_PROP_DESC. PS_HW_SIG_RLver is out of date*/
  60. const int SIGRL_VER_FROM_PS_HW_SIG_RLVER_OUT_OF_DATE = 0x0008;
  61. /* CSME EPID 1.1 PrivRL version indicated in PS_SEC_PROP_DESC. PS_HW_PrivKey_RLver is out of date*/
  62. const int PRIVRL_VER_FROM_PS_HW_PRV_KEY_RLVER_OUT_OF_DATE = 0x0010;
  63. typedef struct _platform_info_blob_wrapper_t
  64. {
  65. bool valid_info_blob;
  66. struct
  67. {
  68. uint8_t sgx_epid_group_flags;
  69. uint8_t sgx_tcb_evaluation_flags[2];
  70. uint8_t pse_evaluation_flags[2];
  71. tcb_psvn_t latest_equivalent_tcb_psvn;
  72. pse_isvsvn_t latest_pse_isvsvn;
  73. psda_svn_t latest_psda_svn;
  74. uint32_t xeid;
  75. GroupId gid;
  76. sgx_ec256_signature_t signature;
  77. } platform_info_blob;
  78. } platform_info_blob_wrapper_t;
  79. #pragma pack(pop)
  80. ae_error_t pib_verify_signature(platform_info_blob_wrapper_t& piBlobWrapper);
  81. #endif