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