audk/MdePkg/Library/BaseLib
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
..
AArch64 MdePkg/BaseLib: correct register sizes in AArch64 SetJump/LongJump 2023-10-02 15:48:02 +00:00
Arm MdePkg/BaseLib: fix typo in Arm SetJump 2023-10-03 11:56:52 +00:00
Ebc MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
Ia32 MdePkg: Replace Opcode with the corresponding instructions. 2022-03-01 01:45:47 +00:00
LoongArch64 MdePkg/BaseLib: BaseLib for LOONGARCH64 architecture. 2022-10-14 02:16:33 +00:00
RiscV64 RISCV: Fix InternalLongJump to return correct value 2023-09-21 04:57:57 +00:00
X64 MdePkg/BaseLib: Update TdVmcall to always output the value in R11 2023-11-09 17:15:39 +00:00
ARShiftU64.c MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
BaseLib.inf MdePkg/BaseLib: Add SpeculationBarrier implementation for RiscV64 2023-06-06 20:37:18 +00:00
BaseLib.uni MdePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:13 -07:00
BaseLibInternals.h MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
BitField.c MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
CheckSum.c MdePkg/BaseLib: Fix CRC16-ANSI calculation 2023-12-03 02:37:26 +00:00
ChkStkGcc.c MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
Cpu.c MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
CpuDeadLoop.c MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
DivS64x64Remainder.c MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
DivU64x32.c MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
DivU64x32Remainder.c MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
DivU64x64Remainder.c MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
FilePaths.c MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
GetPowerOfTwo32.c MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
GetPowerOfTwo64.c MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
HighBitSet32.c MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
HighBitSet64.c MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
IntelTdxNull.c MdePkg: Introduce basic Tdx functions in BaseLib 2022-04-02 08:15:12 +00:00
LRotU32.c MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
LRotU64.c MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
LShiftU64.c MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
LinkedList.c MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
LongJump.c MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
LowBitSet32.c MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
LowBitSet64.c MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
Math64.c MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
ModU64x32.c MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
MultS64x64.c MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
MultU64x32.c MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
MultU64x64.c MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
QuickSort.c MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
RRotU32.c MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
RRotU64.c MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
RShiftU64.c MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
SafeString.c MdePkg: Update code to be more C11 compliant by using __func__ 2023-03-17 17:55:48 +00:00
SetJump.c MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
String.c MdePkg: Fix conditionally uninitialized variables 2023-04-03 15:29:08 +00:00
SwapBytes16.c MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
SwapBytes32.c MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
SwapBytes64.c MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
SwitchStack.c MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
Unaligned.c MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
UnitTestHost.c MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
UnitTestHost.h MdePkg/Library/BaseLib: Add BaseLib instance for host based unit tests 2020-07-15 05:25:21 +00:00
UnitTestHostBaseLib.inf MdePkg/Library/BaseLib: HOST_APPLICATION IA32/X64 only 2023-04-10 05:59:02 +00:00
UnitTestHostBaseLib.uni MdePkg/Library/BaseLib: Add BaseLib instance for host based unit tests 2020-07-15 05:25:21 +00:00
X86DisablePaging32.c MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
X86DisablePaging64.c MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
X86EnablePaging32.c MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
X86EnablePaging64.c MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
X86FxRestore.c MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
X86FxSave.c MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
X86GetInterruptState.c MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
X86MemoryFence.c MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
X86Msr.c MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
X86PatchInstruction.c MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
X86RdRand.c MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
X86ReadGdtr.c MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
X86ReadIdtr.c MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
X86SpeculationBarrier.c MdePkg/BaseLib: Use PcdSpeculationBarrierType 2019-04-30 16:39:15 -07:00
X86Thunk.c MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
X86UnitTestHost.c MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
X86WriteGdtr.c MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
X86WriteIdtr.c MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00