summaryrefslogtreecommitdiffstats
path: root/MdePkg/Include
diff options
context:
space:
mode:
authorPedro Falcato <pedro.falcato@gmail.com>2022-04-08 06:02:00 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2022-06-13 02:41:35 +0000
commit92288f433485e84863047fae698614c6785869d1 (patch)
treee699d3a37ee422eca15ef9eaf472e6786c485435 /MdePkg/Include
parentb09ada6edc7f3f28d3b4f2ef09852ebd39f17920 (diff)
downloadedk2-92288f433485e84863047fae698614c6785869d1.tar.gz
edk2-92288f433485e84863047fae698614c6785869d1.tar.bz2
edk2-92288f433485e84863047fae698614c6785869d1.zip
MdePkg/BaseLib: Add CRC16-ANSI and CRC32c implementations
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3871 Add the CRC16-ANSI and CRC32C implementations previously found at Features/Ext4Pkg/Ext4Dxe/Crc{16,32c}.c to BaseLib. Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Zhiguang Liu <zhiguang.liu@intel.com> Signed-off-by: Pedro Falcato <pedro.falcato@gmail.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Diffstat (limited to 'MdePkg/Include')
-rw-r--r--MdePkg/Include/Library/BaseLib.h35
1 files changed, 34 insertions, 1 deletions
diff --git a/MdePkg/Include/Library/BaseLib.h b/MdePkg/Include/Library/BaseLib.h
index 9d58a7c4ad..a6f9a194ef 100644
--- a/MdePkg/Include/Library/BaseLib.h
+++ b/MdePkg/Include/Library/BaseLib.h
@@ -4503,6 +4503,40 @@ CalculateCrc32 (
IN UINTN Length
);
+/**
+ Calculates the CRC16-ANSI checksum of the given buffer.
+
+ @param[in] Buffer Pointer to the buffer.
+ @param[in] Length Length of the buffer, in bytes.
+ @param[in] InitialValue Initial value of the CRC.
+
+ @return The CRC16-ANSI checksum.
+**/
+UINT16
+EFIAPI
+CalculateCrc16Ansi (
+ IN CONST VOID *Buffer,
+ IN UINTN Length,
+ IN UINT16 InitialValue
+ );
+
+/**
+ Calculates the CRC32c checksum of the given buffer.
+
+ @param[in] Buffer Pointer to the buffer.
+ @param[in] Length Length of the buffer, in bytes.
+ @param[in] InitialValue Initial value of the CRC.
+
+ @return The CRC32c checksum.
+**/
+UINT32
+EFIAPI
+CalculateCrc32c (
+ IN CONST VOID *Buffer,
+ IN UINTN Length,
+ IN UINT32 InitialValue
+ );
+
//
// Base Library CPU Functions
//
@@ -4512,7 +4546,6 @@ CalculateCrc32 (
@param Context1 Context1 parameter passed into SwitchStack().
@param Context2 Context2 parameter passed into SwitchStack().
-
**/
typedef
VOID