Julian Hall | d635ad7 | 2022-09-20 15:50:35 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2022, Arm Limited. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | #ifndef COMMON_CRC32_H |
| 8 | #define COMMON_CRC32_H |
| 9 | |
| 10 | #include <stddef.h> |
| 11 | #include <stdint.h> |
| 12 | |
| 13 | #ifdef __cplusplus |
| 14 | extern "C" { |
| 15 | #endif |
| 16 | |
| 17 | /** |
| 18 | * \brief Calculate a CRC32 over the provided data |
| 19 | * |
| 20 | * \param[in] crc The starting CRC for previous data |
| 21 | * \param[in] buf The buffer to calculate the CRC over |
| 22 | * \param[in] size Number of bytes in the buffer |
| 23 | * |
| 24 | * \return The calculated CRC32 |
| 25 | */ |
| 26 | uint32_t crc32(uint32_t crc, const unsigned char *buf, size_t size); |
| 27 | |
| 28 | #ifdef __cplusplus |
| 29 | } |
| 30 | #endif |
| 31 | |
| 32 | #endif /* COMMON_CRC32_H */ |