diff options
author | Pedro Falcato <pedro.falcato@gmail.com> | 2023-11-30 02:46:10 +0000 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2023-12-03 02:37:26 +0000 |
commit | e2d4f759137dea60a402a1810a4014a7cf00116b (patch) | |
tree | 728869fe1912373b271249ae3ff39c714acc91d9 /MdePkg/Library/SmmIoLib | |
parent | 7182621edc67260a322fa0fb8bb4c8e398d9323e (diff) | |
download | edk2-e2d4f759137dea60a402a1810a4014a7cf00116b.zip edk2-e2d4f759137dea60a402a1810a4014a7cf00116b.tar.gz edk2-e2d4f759137dea60a402a1810a4014a7cf00116b.tar.bz2 |
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>
Diffstat (limited to 'MdePkg/Library/SmmIoLib')
0 files changed, 0 insertions, 0 deletions