]>
git.proxmox.com Git - mirror_edk2.git/blob - BaseTools/Source/C/Common/Crc32.c
2 CalculateCrc32 routine.
4 Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
12 UINT32 mCrcTable
[256] = {
275 IN OUT UINT32
*CrcOut
281 The CalculateCrc32 routine.
285 Data - The buffer containing the data to be processed
286 DataSize - The size of data to be processed
287 CrcOut - A pointer to the caller allocated UINT32 that on
288 contains the CRC32 checksum of Data
292 EFI_SUCCESS - Calculation is successful.
293 EFI_INVALID_PARAMETER - Data / CrcOut = NULL, or DataSize = 0
301 if ((DataSize
== 0) || (Data
== NULL
) || (CrcOut
== NULL
)) {
302 return EFI_INVALID_PARAMETER
;
306 for (Index
= 0, Ptr
= Data
; Index
< DataSize
; Index
++, Ptr
++) {
307 Crc
= (Crc
>> 8) ^ mCrcTable
[(UINT8
) Crc
^ *Ptr
];
310 *CrcOut
= Crc
^ 0xffffffff;