1 /* Copyright 2014 The ChromiumOS Authors 2 * Use of this source code is governed by a BSD-style license that can be 3 * found in the LICENSE file. 4 * 5 * Very simple 8-bit CRC function. 6 */ 7 8 #ifndef VBOOT_REFERENCE_2CRC8_H_ 9 #define VBOOT_REFERENCE_2CRC8_H_ 10 11 #include "2sysincludes.h" 12 13 /** 14 * Calculate CRC-8 of the data, using the ITU version. 15 * 16 * Calculate CRC-8 ITU version of the given buffer, using x^8 + x^2 + x + 1 17 * polynomial. Note that the CRC-8 will evaluate to zero for a buffer of all 18 * zeroes. 19 * 20 * @param data Data to CRC 21 * @param size Size of data in bytes 22 * @return CRC-8 of the data. 23 */ 24 uint8_t vb2_crc8(const void *data, uint32_t size); 25 26 #endif /* VBOOT_REFERENCE_2CRC8_H_ */ 27