]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Core/RuntimeDxe/Crc32.c
MdeModulePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdeModulePkg / Core / RuntimeDxe / Crc32.c
CommitLineData
fb0b259e 1/** @file\r
48557c65 2 This file implements CalculateCrc32 Boot Services as defined in\r
3 Platform Initialization specification 1.0 VOLUME 2 DXE Core Interface.\r
fb0b259e 4\r
9920ae74 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
48557c65 8 virtual addresses. This requires that the 32-bit CRC be recomputed.\r
9920ae74 9\r
05542f49 10Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>\r
9d510e61 11SPDX-License-Identifier: BSD-2-Clause-Patent\r
f2abdc91 12\r
fb0b259e 13**/\r
f2abdc91 14\r
ed7748fe 15\r
60c93673 16#include <Uefi.h>\r
05542f49 17#include <Library/BaseLib.h>\r
f2abdc91 18\r
fb0b259e 19/**\r
20 Calculate CRC32 for target data.\r
21\r
9fc78752 22 @param Data The target data.\r
fb0b259e 23 @param DataSize The target data size.\r
24 @param CrcOut The CRC32 for target data.\r
25\r
26 @retval EFI_SUCCESS The CRC32 for target data is calculated successfully.\r
27 @retval EFI_INVALID_PARAMETER Some parameter is not valid, so the CRC32 is not\r
28 calculated.\r
29\r
30**/\r
f2abdc91 31EFI_STATUS\r
32EFIAPI\r
33RuntimeDriverCalculateCrc32 (\r
34 IN VOID *Data,\r
35 IN UINTN DataSize,\r
36 OUT UINT32 *CrcOut\r
37 )\r
f2abdc91 38{\r
3372ab3c
LG
39 if (Data == NULL || DataSize == 0 || CrcOut == NULL) {\r
40 return EFI_INVALID_PARAMETER;\r
41 }\r
42\r
05542f49 43 *CrcOut = CalculateCrc32 (Data, DataSize);\r
f2abdc91 44 return EFI_SUCCESS;\r
45}\r