You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

WinCertificate.h 3.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. /** @file
  2. GUID for UEFI WIN_CERTIFICATE structure.
  3. Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
  4. This program and the accompanying materials
  5. are licensed and made available under the terms and conditions of the BSD License
  6. which accompanies this distribution. The full text of the license may be found at
  7. http://opensource.org/licenses/bsd-license.php
  8. THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
  10. @par Revision Reference:
  11. GUID defined in UEFI 2.0 spec.
  12. **/
  13. #ifndef __EFI_WIN_CERTIFICATE_H__
  14. #define __EFI_WIN_CERTIFICATE_H__
  15. //
  16. // _WIN_CERTIFICATE.wCertificateType
  17. //
  18. #define WIN_CERT_TYPE_PKCS_SIGNED_DATA 0x0002
  19. #define WIN_CERT_TYPE_EFI_PKCS115 0x0EF0
  20. #define WIN_CERT_TYPE_EFI_GUID 0x0EF1
  21. ///
  22. /// The WIN_CERTIFICATE structure is part of the PE/COFF specification.
  23. ///
  24. typedef struct {
  25. ///
  26. /// The length of the entire certificate,
  27. /// including the length of the header, in bytes.
  28. ///
  29. UINT32 dwLength;
  30. ///
  31. /// The revision level of the WIN_CERTIFICATE
  32. /// structure. The current revision level is 0x0200.
  33. ///
  34. UINT16 wRevision;
  35. ///
  36. /// The certificate type. See WIN_CERT_TYPE_xxx for the UEFI
  37. /// certificate types. The UEFI specification reserves the range of
  38. /// certificate type values from 0x0EF0 to 0x0EFF.
  39. ///
  40. UINT16 wCertificateType;
  41. ///
  42. /// The following is the actual certificate. The format of
  43. /// the certificate depends on wCertificateType.
  44. ///
  45. /// UINT8 bCertificate[ANYSIZE_ARRAY];
  46. ///
  47. } WIN_CERTIFICATE;
  48. ///
  49. /// WIN_CERTIFICATE_UEFI_GUID.CertType
  50. ///
  51. #define EFI_CERT_TYPE_RSA2048_SHA256_GUID \
  52. {0xa7717414, 0xc616, 0x4977, {0x94, 0x20, 0x84, 0x47, 0x12, 0xa7, 0x35, 0xbf } }
  53. ///
  54. /// WIN_CERTIFICATE_UEFI_GUID.CertData
  55. ///
  56. typedef struct {
  57. EFI_GUID HashType;
  58. UINT8 PublicKey[256];
  59. UINT8 Signature[256];
  60. } EFI_CERT_BLOCK_RSA_2048_SHA256;
  61. ///
  62. /// Certificate which encapsulates a GUID-specific digital signature
  63. ///
  64. typedef struct {
  65. ///
  66. /// This is the standard WIN_CERTIFICATE header, where
  67. /// wCertificateType is set to WIN_CERT_TYPE_UEFI_GUID.
  68. ///
  69. WIN_CERTIFICATE Hdr;
  70. ///
  71. /// This is the unique id which determines the
  72. /// format of the CertData. .
  73. ///
  74. EFI_GUID CertType;
  75. ///
  76. /// The following is the certificate data. The format of
  77. /// the data is determined by the CertType.
  78. /// If CertType is EFI_CERT_TYPE_RSA2048_SHA256_GUID,
  79. /// the CertData will be EFI_CERT_BLOCK_RSA_2048_SHA256 structure.
  80. ///
  81. UINT8 CertData[1];
  82. } WIN_CERTIFICATE_UEFI_GUID;
  83. ///
  84. /// Certificate which encapsulates the RSASSA_PKCS1-v1_5 digital signature.
  85. ///
  86. /// The WIN_CERTIFICATE_UEFI_PKCS1_15 structure is derived from
  87. /// WIN_CERTIFICATE and encapsulate the information needed to
  88. /// implement the RSASSA-PKCS1-v1_5 digital signature algorithm as
  89. /// specified in RFC2437.
  90. ///
  91. typedef struct {
  92. ///
  93. /// This is the standard WIN_CERTIFICATE header, where
  94. /// wCertificateType is set to WIN_CERT_TYPE_UEFI_PKCS1_15.
  95. ///
  96. WIN_CERTIFICATE Hdr;
  97. ///
  98. /// This is the hashing algorithm which was performed on the
  99. /// UEFI executable when creating the digital signature.
  100. ///
  101. EFI_GUID HashAlgorithm;
  102. ///
  103. /// The following is the actual digital signature. The
  104. /// size of the signature is the same size as the key
  105. /// (1024-bit key is 128 bytes) and can be determined by
  106. /// subtracting the length of the other parts of this header
  107. /// from the total length of the certificate as found in
  108. /// Hdr.dwLength.
  109. ///
  110. /// UINT8 Signature[];
  111. ///
  112. } WIN_CERTIFICATE_EFI_PKCS1_15;
  113. extern EFI_GUID gEfiCertTypeRsa2048Sha256Guid;
  114. #endif