diff options
author | Petr Štetiar <ynezz@true.cz> | 2019-11-09 14:33:13 +0100 |
---|---|---|
committer | Petr Štetiar <ynezz@true.cz> | 2019-11-11 16:37:13 +0100 |
commit | 4ba8f7b1ef1e4c0607185a41c06b51928c625d8b (patch) | |
tree | fa0d31cfe601301c0b900850131f59c808f832ba /package/system/fwtool/src/crc32.h | |
parent | e97113d5e18c31050bc06f7c6b7a5c663b5f31a4 (diff) | |
download | upstream-4ba8f7b1ef1e4c0607185a41c06b51928c625d8b.tar.gz upstream-4ba8f7b1ef1e4c0607185a41c06b51928c625d8b.tar.bz2 upstream-4ba8f7b1ef1e4c0607185a41c06b51928c625d8b.zip |
fwtool: update to latest Git head
Includes following changes:
9d9d4c284786 fix possible garbage in unitialized char* struct members
dbc1b1b71b24 fix possible copy of null buffer and validation of unitialized header
76d53deef8bb crc32: add missing stdint.h dependency
e5666ed3b47c add cram based unit tests
abe0cf7de053 add initial GitLab CI support
e43042507b4f iron out extra compiler warnings
5df0cd6e1523 convert into CMake project
a7dc0526f819 refactor into separate Git project
adds missing PKG_LICENSE field and converts the package build to utilize
CMake.
Signed-off-by: Petr Štetiar <ynezz@true.cz>
Diffstat (limited to 'package/system/fwtool/src/crc32.h')
-rw-r--r-- | package/system/fwtool/src/crc32.h | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/package/system/fwtool/src/crc32.h b/package/system/fwtool/src/crc32.h deleted file mode 100644 index 022c69fc7f..0000000000 --- a/package/system/fwtool/src/crc32.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (C) 2016 Felix Fietkau <nbd@nbd.name> - * - * Based on busybox code: - * CRC32 table fill function - * Copyright (C) 2006 by Rob Sullivan <cogito.ergo.cogito@gmail.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 - * as published by the Free Software Foundation - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ -#ifndef __BB_CRC32_H -#define __BB_CRC32_H - -static inline void -crc32_filltable(uint32_t *crc_table) -{ - uint32_t polynomial = 0xedb88320; - uint32_t c; - int i, j; - - for (i = 0; i < 256; i++) { - c = i; - for (j = 8; j; j--) - c = (c&1) ? ((c >> 1) ^ polynomial) : (c >> 1); - - *crc_table++ = c; - } -} - -static inline uint32_t -crc32_block(uint32_t val, const void *buf, unsigned len, uint32_t *crc_table) -{ - const void *end = (uint8_t*)buf + len; - - while (buf != end) { - val = crc_table[(uint8_t)val ^ *(uint8_t*)buf] ^ (val >> 8); - buf = (uint8_t*)buf + 1; - } - return val; -} - -#endif |