| diff --git a/sys/boot/common/crc32.c b/sys/boot/common/crc32.c |
| index 1a3e3a3..62d9bed 100644 |
| --- a/sys/boot/common/crc32.c |
| +++ b/sys/boot/common/crc32.c |
| @@ -42,10 +42,8 @@ |
| * CRC32 code derived from work by Gary S. Brown. |
| */ |
| |
| -#include <sys/cdefs.h> |
| -__FBSDID("$FreeBSD$"); |
| - |
| -#include <sys/types.h> |
| +#include <stddef.h> |
| +#include <stdint.h> |
| |
| #include "crc32.h" |
| |
| @@ -96,12 +94,13 @@ static const uint32_t crc32_tab[] = { |
| }; |
| |
| uint32_t |
| -crc32(const void *buf, size_t size) |
| +crc32(uint32_t crc, const void *buf, size_t size) |
| { |
| - const uint8_t *p = buf; |
| - uint32_t crc; |
| + const uint8_t *p; |
| + |
| + p = buf; |
| + crc = (crc ^ ~0U); |
| |
| - crc = ~0U; |
| while (size--) |
| crc = crc32_tab[(crc ^ *p++) & 0xFF] ^ (crc >> 8); |
| return (crc ^ ~0U); |
| diff --git a/sys/boot/common/crc32.h b/sys/boot/common/crc32.h |
| index adfd628..19fdd50 100644 |
| --- a/sys/boot/common/crc32.h |
| +++ b/sys/boot/common/crc32.h |
| @@ -8,6 +8,18 @@ |
| #ifndef _CRC32_H_ |
| #define _CRC32_H_ |
| |
| -uint32_t crc32(const void *buf, size_t size); |
| + |
| +#include <stddef.h> |
| +#include <stdint.h> |
| + |
| +#ifdef __cplusplus |
| +extern "C" { |
| +#endif |
| + |
| +uint32_t crc32(uint32_t crc, const void *buf, size_t size); |
| + |
| +#ifdef __cplusplus |
| +} |
| +#endif |
| |
| #endif /* !_CRC32_H_ */ |