summaryrefslogtreecommitdiff
path: root/firmware/2lib/include/2crc8.h
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/2lib/include/2crc8.h')
-rw-r--r--firmware/2lib/include/2crc8.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/firmware/2lib/include/2crc8.h b/firmware/2lib/include/2crc8.h
new file mode 100644
index 00000000..f01eabd9
--- /dev/null
+++ b/firmware/2lib/include/2crc8.h
@@ -0,0 +1,20 @@
+/* Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ *
+ * Very simple 8-bit CRC function.
+ */
+
+#ifndef VBOOT_REFERENCE_2_CRC8_H_
+#define VBOOT_REFERENCE_2_CRC8_H_
+
+/**
+ * Calculate CRC-8 of the data, using x^8 + x^2 + x + 1 polynomial.
+ *
+ * @param data Data to CRC
+ * @param size Size of data in bytes
+ * @return CRC-8 of the data.
+ */
+uint8_t vb2_crc8(const void *data, uint32_t size);
+
+#endif /* VBOOT_REFERENCE_2_CRC8_H_ */