2008-04-10 10:49:28 +02:00
|
|
|
/** @file
|
2008-12-23 17:20:43 +01:00
|
|
|
This file implements CalculateCrc32 Boot Services as defined in
|
|
|
|
Platform Initialization specification 1.0 VOLUME 2 DXE Core Interface.
|
2008-04-10 10:49:28 +02:00
|
|
|
|
2008-07-28 04:43:46 +02:00
|
|
|
This Boot Services is in the Runtime Driver because this service is
|
|
|
|
also required by SetVirtualAddressMap() when the EFI System Table and
|
|
|
|
EFI Runtime Services Table are converted from physical address to
|
2008-12-23 17:20:43 +01:00
|
|
|
virtual addresses. This requires that the 32-bit CRC be recomputed.
|
2008-07-28 04:43:46 +02:00
|
|
|
|
2017-09-08 07:18:25 +02:00
|
|
|
Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
|
2010-04-24 11:49:11 +02:00
|
|
|
This program and the accompanying materials
|
2008-04-10 10:49:28 +02:00
|
|
|
are licensed and made available under the terms and conditions of the BSD License
|
|
|
|
which accompanies this distribution. The full text of the license may be found at
|
|
|
|
http://opensource.org/licenses/bsd-license.php
|
2007-07-19 10:36:30 +02:00
|
|
|
|
2008-04-10 10:49:28 +02:00
|
|
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
2007-07-19 10:36:30 +02:00
|
|
|
|
2008-04-10 10:49:28 +02:00
|
|
|
**/
|
2007-07-19 10:36:30 +02:00
|
|
|
|
2007-07-20 08:10:09 +02:00
|
|
|
|
2008-08-30 16:09:38 +02:00
|
|
|
#include <Uefi.h>
|
2017-09-08 07:18:25 +02:00
|
|
|
#include <Library/BaseLib.h>
|
2007-07-19 10:36:30 +02:00
|
|
|
|
2008-04-10 10:49:28 +02:00
|
|
|
/**
|
|
|
|
Calculate CRC32 for target data.
|
|
|
|
|
2008-07-14 07:43:37 +02:00
|
|
|
@param Data The target data.
|
2008-04-10 10:49:28 +02:00
|
|
|
@param DataSize The target data size.
|
|
|
|
@param CrcOut The CRC32 for target data.
|
|
|
|
|
|
|
|
@retval EFI_SUCCESS The CRC32 for target data is calculated successfully.
|
|
|
|
@retval EFI_INVALID_PARAMETER Some parameter is not valid, so the CRC32 is not
|
|
|
|
calculated.
|
|
|
|
|
|
|
|
**/
|
2007-07-19 10:36:30 +02:00
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
RuntimeDriverCalculateCrc32 (
|
|
|
|
IN VOID *Data,
|
|
|
|
IN UINTN DataSize,
|
|
|
|
OUT UINT32 *CrcOut
|
|
|
|
)
|
|
|
|
{
|
2017-10-12 06:22:57 +02:00
|
|
|
if (Data == NULL || DataSize == 0 || CrcOut == NULL) {
|
|
|
|
return EFI_INVALID_PARAMETER;
|
|
|
|
}
|
|
|
|
|
2017-09-08 07:18:25 +02:00
|
|
|
*CrcOut = CalculateCrc32 (Data, DataSize);
|
2007-07-19 10:36:30 +02:00
|
|
|
return EFI_SUCCESS;
|
|
|
|
}
|