diff options
Diffstat (limited to 'lib/tables_csum.c')
-rw-r--r-- | lib/tables_csum.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/tables_csum.c b/lib/tables_csum.c new file mode 100644 index 00000000000..340d7b3b11d --- /dev/null +++ b/lib/tables_csum.c @@ -0,0 +1,20 @@ +/* + * Copyright (C) 2015, Bin Meng <bmeng.cn@gmail.com> + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include <common.h> +#include <linux/ctype.h> + +u8 table_compute_checksum(void *v, int len) +{ + u8 *bytes = v; + u8 checksum = 0; + int i; + + for (i = 0; i < len; i++) + checksum -= bytes[i]; + + return checksum; +} |