mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-18 02:38:56 +00:00
60d18d3fe9
Add an implementation of the CRC8 algorithm. This is required by the TPM emulation, but is probably useful to U-Boot in general. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
23 lines
492 B
C
23 lines
492 B
C
/*
|
|
* Copyright (c) 2013 Google, Inc
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0+
|
|
*/
|
|
|
|
|
|
#ifndef __linux_crc8_h
|
|
#define __linux_crc8_h
|
|
|
|
/**
|
|
* crc8() - Calculate and return CRC-8 of the data
|
|
*
|
|
* This uses an x^8 + x^2 + x + 1 polynomial. A table-based algorithm would
|
|
* be faster, but for only a few bytes it isn't worth the code size
|
|
*
|
|
* @vptr: Buffer to checksum
|
|
* @len: Length of buffer in bytes
|
|
* @return CRC8 checksum
|
|
*/
|
|
unsigned int crc8(const unsigned char *vptr, int len);
|
|
|
|
#endif
|