]>
Commit | Line | Data |
---|---|---|
0c18794e | 1 | /** @file\r |
2 | Basic TPM command functions.\r | |
3 | \r | |
b3548d32 LG |
4 | Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.<BR>\r |
5 | This program and the accompanying materials\r | |
6 | are licensed and made available under the terms and conditions of the BSD License\r | |
7 | which accompanies this distribution. The full text of the license may be found at\r | |
0c18794e | 8 | http://opensource.org/licenses/bsd-license.php\r |
9 | \r | |
b3548d32 | 10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r |
0c18794e | 11 | WITHOUT 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 | |
b3548d32 | 24 | \r |
0c18794e | 25 | @retval EFI_SUCCESS Always successfully calculate the final digest.\r |
26 | **/\r | |
27 | EFI_STATUS\r | |
28 | EFIAPI\r | |
29 | TpmCommHashAll (\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 |