audk/MdePkg/Include
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/ProcessorBind AARCH64: Add asm macro to emit GNU BTI note 2023-03-30 11:05:22 +00:00
Arm MdePkg: Remove RVCT support 2022-05-13 14:58:54 +00:00
Ebc MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
Guid MdePkg: Update MemoryAttributesTable to v2.10 2023-03-30 11:05:22 +00:00
Ia32 MdePkg: Remove VS2008-VS2013 remnants 2023-05-05 11:41:35 +00:00
IndustryStandard MdePkg/Tdx.h: Add TDVMCALL_STATUS_RETRY 2023-11-09 17:15:39 +00:00
Library MdePkg/BaseLib: Fix CRC16-ANSI calculation 2023-12-03 02:37:26 +00:00
LoongArch64 MdePkg: Fix UINT64 and INT64 word length for LoongArch64 2023-02-01 02:12:41 +00:00
Pi MdePkg: PiStatusCode: Add TPM subclass definition to MdePkg 2023-06-23 16:28:24 +00:00
Ppi MdePkg/Include/Ppi: Remove Itanium leftover data structure 2023-03-26 02:03:50 +00:00
Protocol RedfishPkg/RedfishRestExDxe: return HTTP status code to caller. 2023-09-19 15:41:18 +00:00
Register MdePkg/Register: RISC-V: Add satp mode bits shift definition 2023-07-15 14:10:18 +00:00
RiscV64 MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
Uefi MdePkg: Add missing status codes 2023-08-07 22:56:02 +00:00
X64 MdePkg: don't set visibility to hidden 2023-06-01 10:53:35 +00:00
Base.h MdePkg: Add missing status codes 2023-08-07 22:56:02 +00:00
ConfidentialComputingGuestAttr.h MdePkg: Add CC_GUEST_TYPE in ConfidentialComputingGuestAttr.h 2022-04-19 01:26:08 +00:00
PiDxe.h MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
PiMm.h MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
PiPei.h MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
PiSmm.h MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
Uefi.h MdePkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00