]>
git.proxmox.com Git - mirror_edk2.git/blob - BaseTools/Source/C/Common/Crc32.c
4 Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 UINT32 mCrcTable
[256] = {
281 IN OUT UINT32
*CrcOut
287 The CalculateCrc32 routine.
291 Data - The buffer contaning the data to be processed
292 DataSize - The size of data to be processed
293 CrcOut - A pointer to the caller allocated UINT32 that on
294 contains the CRC32 checksum of Data
298 EFI_SUCCESS - Calculation is successful.
299 EFI_INVALID_PARAMETER - Data / CrcOut = NULL, or DataSize = 0
307 if ((DataSize
== 0) || (Data
== NULL
) || (CrcOut
== NULL
)) {
308 return EFI_INVALID_PARAMETER
;
312 for (Index
= 0, Ptr
= Data
; Index
< DataSize
; Index
++, Ptr
++) {
313 Crc
= (Crc
>> 8) ^ mCrcTable
[(UINT8
) Crc
^ *Ptr
];
316 *CrcOut
= Crc
^ 0xffffffff;