+/**\r
+ Computes and returns a 32-bit CRC for a data buffer.\r
+ CRC32 value bases on ITU-T V.42.\r
+\r
+ If Buffer is NULL, then ASSERT().\r
+ If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r
+\r
+ @param[in] Buffer A pointer to the buffer on which the 32-bit CRC is to be computed.\r
+ @param[in] Length The number of bytes in the buffer Data.\r
+\r
+ @retval Crc32 The 32-bit CRC was computed for the data buffer.\r
+\r
+**/\r
+UINT32\r
+EFIAPI\r
+CalculateCrc32(\r
+ IN VOID *Buffer,\r
+ IN UINTN Length\r
+ )\r
+{\r
+ UINTN Index;\r
+ UINT32 Crc;\r
+ UINT8 *Ptr;\r
+\r
+ ASSERT (Buffer != NULL);\r
+ ASSERT (Length <= (MAX_ADDRESS - ((UINTN) Buffer) + 1));\r
+\r
+ //\r
+ // Compute CRC\r
+ //\r
+ Crc = 0xffffffff;\r
+ for (Index = 0, Ptr = Buffer; Index < Length; Index++, Ptr++) {\r
+ Crc = (Crc >> 8) ^ mCrcTable[(UINT8) Crc ^ *Ptr];\r
+ }\r
+\r
+ return Crc ^ 0xffffffff;\r
+}\r