28 UINTN PublicKeyDataLength;
29 UINT8 *PublicKeyDataXdr;
30 UINT8 *PublicKeyDataXdrEnd;
33 UINTN TestKeyDigestSize;
39 TestKeyDigestSize =
PcdGetSize (PcdFmpDeviceTestKeySha256Digest);
55 PublicKeyDataXdr =
PcdGetPtr (PcdFmpDevicePkcs7CertBufferXdr);
56 PublicKeyDataXdrEnd = PublicKeyDataXdr +
PcdGetSize (PcdFmpDevicePkcs7CertBufferXdr);
57 if ((PublicKeyDataXdr ==
NULL) || (PublicKeyDataXdr == PublicKeyDataXdrEnd)) {
65 if (HashContext ==
NULL) {
72 while (!TestKeyUsed && PublicKeyDataXdr < PublicKeyDataXdrEnd) {
73 if (PublicKeyDataXdr +
sizeof (UINT32) > PublicKeyDataXdrEnd) {
83 PublicKeyDataLength =
SwapBytes32 (*(UINT32 *)(PublicKeyDataXdr));
87 PublicKeyDataXdr +=
sizeof (UINT32);
88 if (PublicKeyDataXdr + PublicKeyDataLength > PublicKeyDataXdrEnd) {
105 if (!
Sha256Update (HashContext, PublicKeyDataXdr, PublicKeyDataLength)) {
126 PublicKeyDataXdr += PublicKeyDataLength;
127 PublicKeyDataXdr = (UINT8 *)
ALIGN_POINTER (PublicKeyDataXdr,
sizeof (UINT32));
133 if (HashContext !=
NULL) {
143 DEBUG ((DEBUG_INFO,
"FmpDxe(%s): Test key detected in PcdFmpDevicePkcs7CertBufferXdr.\n",
mImageIdName));
146 DEBUG ((DEBUG_INFO,
"FmpDxe(%s): No test key detected in PcdFmpDevicePkcs7CertBufferXdr.\n",
mImageIdName));
UINTN EFIAPI Sha256GetContextSize(VOID)
BOOLEAN EFIAPI Sha256Init(OUT VOID *Sha256Context)
BOOLEAN EFIAPI Sha256Final(IN OUT VOID *Sha256Context, OUT UINT8 *HashValue)
#define SHA256_DIGEST_SIZE
BOOLEAN EFIAPI Sha256Update(IN OUT VOID *Sha256Context, IN CONST VOID *Data, IN UINTN DataSize)
UINT32 EFIAPI SwapBytes32(IN UINT32 Value)
INTN EFIAPI CompareMem(IN CONST VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
VOID EFIAPI FreePool(IN VOID *Buffer)
#define ALIGN_POINTER(Pointer, Alignment)
#define DEBUG(Expression)
#define PcdGetSize(TokenName)
#define PcdSetBoolS(TokenName, Value)
#define PcdGetBool(TokenName)
#define PcdGetPtr(TokenName)
VOID *EFIAPI AllocatePool(IN UINTN AllocationSize)