audk/MdePkg/Include/Library
Pedro Falcato e2d4f75913 MdePkg/BaseLib: Fix CRC16-ANSI calculation
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4609

The current CalculateCrc16Ansi implementation does the following:
1) Invert the passed checksum
2) Calculate the new checksum by going through data and using the
   lookup table
3) Invert it back again

This emulated my design for CalculateCrc32c, where 0 is
passed as the initial checksum, and it inverts in the end.
However, CRC16 does not invert the checksum on input and output.
So this is incorrect.

Fix the problem by not inverting input checksums nor output checksums.
Callers should now pass CRC16ANSI_INIT as the initial value instead of
"0". This is a breaking change.

This problem was found out-of-list when older ext4 filesystems
(that use crc16 checksums) failed to mount with "corruption".

Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Signed-off-by: Pedro Falcato <pedro.falcato@gmail.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
2023-12-03 02:37:26 +00:00
..
ArmTrngLib.h MdePkg/ArmTrngLib: Definition for Arm TRNG library class interface 2022-11-06 16:32:28 +00:00
BaseLib.h MdePkg/BaseLib: Fix CRC16-ANSI calculation 2023-12-03 02:37:26 +00:00
BaseMemoryLib.h MdePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:13 -07:00
BaseRiscVSbiLib.h MdePkg: BaseRiscVSbiLib: make more useful to consumers 2023-05-17 23:47:20 +00:00
CacheMaintenanceLib.h MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
CcProbeLib.h MdePkg: Add CcProbeLibNull 2022-04-19 01:26:08 +00:00
CpuLib.h MdePkg: Move API and implementation from UefiCpuLib to CpuLib 2023-03-10 08:23:56 +00:00
DebugLib.h MdePkg: Add DEBUG_MANAGEABILITY print error level 2023-04-21 15:42:08 +00:00
DebugPrintErrorLevelLib.h MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
DevicePathLib.h MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
DxeCoreEntryPoint.h MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
DxeServicesLib.h MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
DxeServicesTableLib.h MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
ExtractGuidedSectionLib.h MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
FdtLib.h UefiPayloadPkg: Add FIT support 2023-09-26 07:26:21 +00:00
FileHandleLib.h MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
HobLib.h MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
HstiLib.h MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
IoLib.h MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
JedecJep106Lib.h MdePkg: Add new JedecJep106Lib to fetch JEDEC JEP106 manufacturer 2023-04-12 14:29:54 +00:00
MemoryAllocationLib.h MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
MipiSysTLib.h MdePkg: Add MipiSysTLib library 2023-05-11 07:26:38 +00:00
MmServicesTableLib.h MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
MmUnblockMemoryLib.h MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
OrderedCollectionLib.h MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
PcdLib.h MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
PciCf8Lib.h MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
PciExpressLib.h MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
PciLib.h MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
PciSegmentInfoLib.h MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
PciSegmentLib.h MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
PeCoffExtraActionLib.h MdePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:13 -07:00
PeCoffGetEntryPointLib.h MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
PeCoffLib.h MdePkg/PeCoffLib: Capture DLL characteristics fields in image context 2023-04-07 13:18:38 +00:00
PeiCoreEntryPoint.h MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
PeiServicesLib.h MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
PeiServicesTablePointerLib.h MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
PeimEntryPoint.h MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
PerformanceLib.h MdePkg: Update code to be more C11 compliant by using __func__ 2023-03-17 17:55:48 +00:00
PostCodeLib.h MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
PrintLib.h MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
RegisterFilterLib.h MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
ReportStatusCodeLib.h MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
ResourcePublicationLib.h MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
RngLib.h MdePkg/Rng: Add GetRngGuid() to RngLib 2023-09-08 09:48:55 +00:00
S3BootScriptLib.h MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
S3IoLib.h MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
S3PciLib.h MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
S3PciSegmentLib.h MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
S3SmbusLib.h MdePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:13 -07:00
S3StallLib.h MdePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:13 -07:00
SafeIntLib.h MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
SerialPortLib.h MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
SmbusLib.h MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
SmiHandlerProfileLib.h MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
SmmCpuRendezvousLib.h MdePkg: add SmmCpuRendezvousLib.h and SmmCpuRendezvousLibNull implement. 2022-05-09 02:04:11 +00:00
SmmIoLib.h MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
SmmLib.h MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
SmmMemLib.h MdePkg/Library/Smm: Fix various typos 2020-02-10 22:30:07 +00:00
SmmPeriodicSmiLib.h MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
SmmServicesTableLib.h MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
StandaloneMmDriverEntryPoint.h MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
SynchronizationLib.h MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
TdxLib.h MdePkg: Add TdxLib to wrap Tdx operations 2022-04-02 08:15:12 +00:00
TimerLib.h MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
TraceHubDebugSysTLib.h MdePkg: Add NULL library of TraceHubDebugSysTLib 2023-05-11 07:26:38 +00:00
UefiApplicationEntryPoint.h MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
UefiBootServicesTableLib.h MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
UefiDecompressLib.h MdePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:13 -07:00
UefiDriverEntryPoint.h MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
UefiLib.h MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
UefiRuntimeLib.h MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
UefiRuntimeServicesTableLib.h MdePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:13 -07:00
UefiScsiLib.h MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
UefiUsbLib.h MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
UnitTestLib.h MdePkg: Update code to be more C11 compliant by using __func__ 2023-03-17 17:55:48 +00:00