utils: Rename crc32() to pldm_edac_crc32()

Chip away at transitioning the library API surface to a consistent
symbol prefix.

Change-Id: I1abd96407867ddf8390cb9fbba9a8085478f08dd
Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 259f96c..c4626b1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -19,6 +19,8 @@
 
 ### Added
 
+- utils: Introduce `pldm_edac_crc32()`
+
 ### Changed
 
 ### Deprecated
@@ -26,6 +28,10 @@
 - utils: Deprecate `is_time_legal()`
 - utils: Deprecate `is_transfer_flag_valid()`
 
+- utils: Deprecate `crc32()`
+
+  Users of `crc32()` should move to `pldm_edac_crc32()`
+
 ### Removed
 
 - requester: Remove related deprecated APIs
diff --git a/abi/x86_64/gcc.dump b/abi/x86_64/gcc.dump
index 1f2884c..8d4f2a7 100644
--- a/abi/x86_64/gcc.dump
+++ b/abi/x86_64/gcc.dump
@@ -260,7 +260,7 @@
     },
     '5959' => {
       'Header' => 'utils.h',
-      'Line' => '108',
+      'Line' => '109',
       'Param' => {
         '0' => {
           'name' => 'transfer_flag',
@@ -272,7 +272,7 @@
     },
     '6019' => {
       'Header' => 'utils.h',
-      'Line' => '99',
+      'Line' => '100',
       'Param' => {
         '0' => {
           'name' => 'seconds',
@@ -304,7 +304,7 @@
     },
     '6263' => {
       'Header' => 'utils.h',
-      'Line' => '87',
+      'Line' => '88',
       'Param' => {
         '0' => {
           'name' => 'dec',
@@ -316,7 +316,7 @@
     },
     '6392' => {
       'Header' => 'utils.h',
-      'Line' => '81',
+      'Line' => '82',
       'Param' => {
         '0' => {
           'name' => 'bcd',
@@ -328,7 +328,7 @@
     },
     '6495' => {
       'Header' => 'utils.h',
-      'Line' => '75',
+      'Line' => '76',
       'Param' => {
         '0' => {
           'name' => 'dec',
@@ -340,7 +340,7 @@
     },
     '6611' => {
       'Header' => 'utils.h',
-      'Line' => '69',
+      'Line' => '70',
       'Param' => {
         '0' => {
           'name' => 'bcd',
@@ -352,7 +352,7 @@
     },
     '6714' => {
       'Header' => 'utils.h',
-      'Line' => '63',
+      'Line' => '64',
       'Param' => {
         '0' => {
           'name' => 'dec',
@@ -364,7 +364,7 @@
     },
     '6767' => {
       'Header' => 'utils.h',
-      'Line' => '57',
+      'Line' => '58',
       'Param' => {
         '0' => {
           'name' => 'bcd',
@@ -376,7 +376,7 @@
     },
     '6820' => {
       'Header' => 'utils.h',
-      'Line' => '51',
+      'Line' => '52',
       'Param' => {
         '0' => {
           'name' => 'version',
@@ -418,6 +418,7 @@
       'ShortName' => 'crc8'
     },
     '7063' => {
+      'Alias' => 'pldm_edac_crc32',
       'Header' => 'utils.h',
       'Line' => '39',
       'Param' => {
@@ -9632,6 +9633,7 @@
       'pldm_bios_table_string_entry_encode_length' => 1,
       'pldm_bios_table_string_find_by_handle' => 1,
       'pldm_bios_table_string_find_by_string' => 1,
+      'pldm_edac_crc32' => 1,
       'pldm_entity_association_pdr_add' => 1,
       'pldm_entity_association_pdr_add_from_node' => 1,
       'pldm_entity_association_pdr_add_from_node_with_record_handle' => 1,
diff --git a/evolutions/current/crc32.yaml b/evolutions/current/crc32.yaml
new file mode 100644
index 0000000..af06c55
--- /dev/null
+++ b/evolutions/current/crc32.yaml
@@ -0,0 +1,2 @@
+- QualifiedName: crc32
+  NewName: pldm_edac_crc32
diff --git a/include/libpldm/utils.h b/include/libpldm/utils.h
index 5966178..7b719e1 100644
--- a/include/libpldm/utils.h
+++ b/include/libpldm/utils.h
@@ -30,12 +30,13 @@
  */
 uint8_t crc8(const void *data, size_t size);
 
-/** @brief Compute Crc32(same as the one used by IEEE802.3)
+/** @brief Compute crc32 (same as the one used by IEEE802.3)
  *
  *  @param[in] data - Pointer to the target data
  *  @param[in] size - Size of the data
  *  @return The checksum
  */
+uint32_t pldm_edac_crc32(const void *data, size_t size);
 uint32_t crc32(const void *data, size_t size);
 
 /** @brief Convert ver32_t to string
diff --git a/meson.build b/meson.build
index ce79813..4821698 100644
--- a/meson.build
+++ b/meson.build
@@ -46,7 +46,7 @@
     entrypoint += ' __attribute__((tainted_args))'
 endif
 
-libpldm_deprecated_aliases = []
+libpldm_deprecated_aliases = [['crc32', 'pldm_edac_crc32']]
 if get_option('abi').contains('deprecated')
     conf.set('LIBPLDM_ABI_DEPRECATED', entrypoint)
     conf.set(
diff --git a/src/dsp/bios_table.c b/src/dsp/bios_table.c
index 436b7e3..fd3b383 100644
--- a/src/dsp/bios_table.c
+++ b/src/dsp/bios_table.c
@@ -947,7 +947,7 @@
 	size_t pad_size = pad_size_get(*size);
 	table_end = pad_append(table_end, pad_size);
 
-	uint32_t checksum = crc32(table, *size + pad_size);
+	uint32_t checksum = pldm_edac_crc32(table, *size + pad_size);
 	checksum_append(table_end, checksum);
 	*size = total_length;
 
@@ -1243,7 +1243,7 @@
 	}
 
 	uint32_t src_crc = le32toh(*(uint32_t *)(table + size - 4));
-	uint32_t dst_crc = crc32(table, size - 4);
+	uint32_t dst_crc = pldm_edac_crc32(table, size - 4);
 
 	return src_crc == dst_crc;
 }
diff --git a/src/utils.c b/src/utils.c
index 5e92cbf..cb9d10e 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -86,7 +86,7 @@
 };
 
 LIBPLDM_ABI_STABLE
-uint32_t crc32(const void *data, size_t size)
+uint32_t pldm_edac_crc32(const void *data, size_t size)
 {
 	const uint8_t *p = data;
 	uint32_t crc = ~0U;
diff --git a/tests/dsp/bios_table.cpp b/tests/dsp/bios_table.cpp
index 19fb929..bdef5a6 100644
--- a/tests/dsp/bios_table.cpp
+++ b/tests/dsp/bios_table.cpp
@@ -22,7 +22,7 @@
 {
     auto padSize = ((table.size() % 4) ? (4 - table.size() % 4) : 0);
     table.insert(table.end(), padSize, 0);
-    uint32_t checksum = crc32(table.data(), table.size());
+    uint32_t checksum = pldm_edac_crc32(table.data(), table.size());
     checksum = htole32(checksum);
     uint8_t a[4];
     std::memcpy(a, &checksum, sizeof(checksum));
diff --git a/tests/dsp/bios_table_iter.c b/tests/dsp/bios_table_iter.c
index 7260054..8afb651 100644
--- a/tests/dsp/bios_table_iter.c
+++ b/tests/dsp/bios_table_iter.c
@@ -15,8 +15,8 @@
 #include "dsp/bios_table.c"
 
 /* Satisfy the symbol needs of bios_table.c */
-uint32_t crc32(const void* data LIBPLDM_CC_UNUSED,
-               size_t size LIBPLDM_CC_UNUSED)
+uint32_t pldm_edac_crc32(const void* data LIBPLDM_CC_UNUSED,
+                         size_t size LIBPLDM_CC_UNUSED)
 {
     return 0;
 }
diff --git a/tests/utils.cpp b/tests/utils.cpp
index 88b8c8e..b9d3197 100644
--- a/tests/utils.cpp
+++ b/tests/utils.cpp
@@ -9,7 +9,7 @@
 TEST(Crc32, CheckSumTest)
 {
     const char* password = "123456789";
-    auto checksum = crc32(password, 9);
+    auto checksum = pldm_edac_crc32(password, 9);
     EXPECT_EQ(checksum, 0xcbf43926);
 }