]>
Commit | Line | Data |
---|---|---|
1 | /** @file\r | |
2 | Basic TPM command functions.\r | |
3 | \r | |
4 | Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.<BR>\r | |
5 | SPDX-License-Identifier: BSD-2-Clause-Patent\r | |
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 | |
18 | \r | |
19 | @retval EFI_SUCCESS Always successfully calculate the final digest.\r | |
20 | **/\r | |
21 | EFI_STATUS\r | |
22 | EFIAPI\r | |
23 | TpmCommHashAll (\r | |
24 | IN CONST UINT8 *Data,\r | |
25 | IN UINTN DataLen,\r | |
26 | OUT TPM_DIGEST *Digest\r | |
27 | )\r | |
28 | {\r | |
29 | VOID *Sha1Ctx;\r | |
30 | UINTN CtxSize;\r | |
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 |