]> git.proxmox.com Git - mirror_edk2.git/blame - SecurityPkg/Library/TpmCommLib/TpmComm.c
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / SecurityPkg / Library / TpmCommLib / TpmComm.c
CommitLineData
0c18794e 1/** @file\r
2 Basic TPM command functions.\r
3\r
b3548d32 4Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.<BR>\r
289b714b 5SPDX-License-Identifier: BSD-2-Clause-Patent\r
0c18794e 6\r
7**/\r
8\r
9#include "CommonHeader.h"\r
10\r
11/**\r
12 Single function calculates SHA1 digest value for all raw data. It\r
13 combines Sha1Init(), Sha1Update() and Sha1Final().\r
14\r
15 @param[in] Data Raw data to be digested.\r
16 @param[in] DataLen Size of the raw data.\r
17 @param[out] Digest Pointer to a buffer that stores the final digest.\r
b3548d32 18\r
0c18794e 19 @retval EFI_SUCCESS Always successfully calculate the final digest.\r
20**/\r
21EFI_STATUS\r
22EFIAPI\r
23TpmCommHashAll (\r
c411b485
MK
24 IN CONST UINT8 *Data,\r
25 IN UINTN DataLen,\r
26 OUT TPM_DIGEST *Digest\r
0c18794e 27 )\r
28{\r
c411b485
MK
29 VOID *Sha1Ctx;\r
30 UINTN CtxSize;\r
0c18794e 31\r
32 CtxSize = Sha1GetContextSize ();\r
33 Sha1Ctx = AllocatePool (CtxSize);\r
34 ASSERT (Sha1Ctx != NULL);\r
35\r
36 Sha1Init (Sha1Ctx);\r
37 Sha1Update (Sha1Ctx, Data, DataLen);\r
38 Sha1Final (Sha1Ctx, (UINT8 *)Digest);\r
39\r
40 FreePool (Sha1Ctx);\r
41\r
42 return EFI_SUCCESS;\r
43}\r