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