platform_info_blob.h 3.6 KB

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