1 // SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 2 #ifndef LIBPLDM_SRC_UTILS_H 3 #define LIBPLDM_SRC_UTILS_H 4 5 #include <errno.h> 6 #include <stdint.h> 7 #include <stddef.h> 8 9 /** 10 * @brief Validate the CRC32 checksum of the given data. 11 * 12 * @param[in] expected The expected CRC32 value. 13 * @param[in] data Pointer to the data to validate. 14 * @param[in] size Size of the data in bytes. 15 * @return 0 if the checksum matches, 16 * -EUCLEAN if the checksum mismatches, 17 * -EINVAL if the arguments are invalid 18 */ 19 int pldm_edac_crc32_validate(uint32_t expected, const void *data, size_t size); 20 #endif 21