]>
Commit | Line | Data |
---|---|---|
1 | /** @file\r | |
2 | This file implements CalculateCrc32 Boot Services as defined in\r | |
3 | Platform Initialization specification 1.0 VOLUME 2 DXE Core Interface.\r | |
4 | \r | |
5 | This Boot Services is in the Runtime Driver because this service is\r | |
6 | also required by SetVirtualAddressMap() when the EFI System Table and\r | |
7 | EFI Runtime Services Table are converted from physical address to\r | |
8 | virtual addresses. This requires that the 32-bit CRC be recomputed.\r | |
9 | \r | |
10 | Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>\r | |
11 | SPDX-License-Identifier: BSD-2-Clause-Patent\r | |
12 | \r | |
13 | **/\r | |
14 | \r | |
15 | #include <Uefi.h>\r | |
16 | #include <Library/BaseLib.h>\r | |
17 | \r | |
18 | /**\r | |
19 | Calculate CRC32 for target data.\r | |
20 | \r | |
21 | @param Data The target data.\r | |
22 | @param DataSize The target data size.\r | |
23 | @param CrcOut The CRC32 for target data.\r | |
24 | \r | |
25 | @retval EFI_SUCCESS The CRC32 for target data is calculated successfully.\r | |
26 | @retval EFI_INVALID_PARAMETER Some parameter is not valid, so the CRC32 is not\r | |
27 | calculated.\r | |
28 | \r | |
29 | **/\r | |
30 | EFI_STATUS\r | |
31 | EFIAPI\r | |
32 | RuntimeDriverCalculateCrc32 (\r | |
33 | IN VOID *Data,\r | |
34 | IN UINTN DataSize,\r | |
35 | OUT UINT32 *CrcOut\r | |
36 | )\r | |
37 | {\r | |
38 | if ((Data == NULL) || (DataSize == 0) || (CrcOut == NULL)) {\r | |
39 | return EFI_INVALID_PARAMETER;\r | |
40 | }\r | |
41 | \r | |
42 | *CrcOut = CalculateCrc32 (Data, DataSize);\r | |
43 | return EFI_SUCCESS;\r | |
44 | }\r |