]> git.proxmox.com Git - mirror_edk2.git/blame - SecurityPkg/Library/TpmCommLib/TpmComm.c
Enhance GPT measurement to be able to handle different partition entry size.
[mirror_edk2.git] / SecurityPkg / Library / TpmCommLib / TpmComm.c
CommitLineData
0c18794e 1/** @file\r
2 Basic TPM command functions.\r
3\r
4Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved.<BR>\r
5This program and the accompanying materials \r
6are licensed and made available under the terms and conditions of the BSD License \r
7which accompanies this distribution. The full text of the license may be found at \r
8http://opensource.org/licenses/bsd-license.php\r
9\r
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14\r
15#include "CommonHeader.h"\r
16\r
17/**\r
18 Single function calculates SHA1 digest value for all raw data. It\r
19 combines Sha1Init(), Sha1Update() and Sha1Final().\r
20\r
21 @param[in] Data Raw data to be digested.\r
22 @param[in] DataLen Size of the raw data.\r
23 @param[out] Digest Pointer to a buffer that stores the final digest.\r
24 \r
25 @retval EFI_SUCCESS Always successfully calculate the final digest.\r
26**/\r
27EFI_STATUS\r
28EFIAPI\r
29TpmCommHashAll (\r
30 IN CONST UINT8 *Data,\r
31 IN UINTN DataLen,\r
32 OUT TPM_DIGEST *Digest\r
33 )\r
34{\r
35 VOID *Sha1Ctx;\r
36 UINTN CtxSize;\r
37\r
38 CtxSize = Sha1GetContextSize ();\r
39 Sha1Ctx = AllocatePool (CtxSize);\r
40 ASSERT (Sha1Ctx != NULL);\r
41\r
42 Sha1Init (Sha1Ctx);\r
43 Sha1Update (Sha1Ctx, Data, DataLen);\r
44 Sha1Final (Sha1Ctx, (UINT8 *)Digest);\r
45\r
46 FreePool (Sha1Ctx);\r
47\r
48 return EFI_SUCCESS;\r
49}\r
50\r