libpldm: utils: Add crc8 implementation
Add crc8 implementation
Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: Icfa5e9815098783932d9234c71e6592127fd8273
diff --git a/test/libpldm_utils_test.cpp b/test/libpldm_utils_test.cpp
index a40aec1..990a62b 100644
--- a/test/libpldm_utils_test.cpp
+++ b/test/libpldm_utils_test.cpp
@@ -12,6 +12,13 @@
EXPECT_EQ(checksum, 0xcbf43926);
}
+TEST(Crc8, CheckSumTest)
+{
+ const char* data = "123456789";
+ auto checksum = crc8(data, 9);
+ EXPECT_EQ(checksum, 0xf4);
+}
+
TEST(Ver2string, Ver2string)
{
ver32_t version{0xf3, 0xf7, 0x10, 0x61};