openwrtv4/tools/firmware-utils/src
Rafał Miłecki 23da3fbf68 firmware-utils: mktplinkfw2: fix MD5 salt
LEDE supports few devices using TP-Link firmware format (V2 or V3):
ArcherC20i, ArcherC50, ArcherMR200, TDW8970, TDW8980, TL-WR840N v4,
TL-WR841N v13 and VR200v

Testing mktplinkfw2 tool with official (vendor generated) firmware files
for above devices has shown an error when comparing calculated and
included MD5 sum, e.g.:
> mktplinkfw2 -i Archer_C20iv1_0.9.1_3.2_up_boot\(170221\)_2017-02-21_17.14.03.bin | grep -A 1 MD5Sum1
Header MD5Sum1         : 22 5a cb 92 10 d2 95 7b df 62 9a f8 62 17 37 10 (*ERROR*)
          --> expected : ad 19 11 d1 78 98 a7 42 5f 2e 64 da 8a 34 ec cb

This problem has been verified to occur with:
Archer_C20iv1_0.9.1_3.2_up_boot(170221)_2017-02-21_17.14.03.bin
Archer MR200v1_0.9.1_1.1_up_boot_v004a.0 Build 160905 Rel.60037n.bin
TD-W8970v3_0.9.1_2.0_up_boot(160816)_2016-08-16_10.40.57.bin
TD-W8980v1_0.6.0_1.8_up_boot(150514)_2015-05-14_11.16.43.bin
Archer_VR200vv2_0.2.0_0.8.0_up_boot(161202)_2016-12-05_14.39.06.bin

For some images, e.g.:
Archer_C50v3_EU_0.9.1_0.3_up_boot[170417-rel52298].bin
TL-WR840Nv4_EU_0.9.1_4.16_up_boot[170421-rel70692].bin
TL-WR841Nv13_0.9.1_3.16_up_boot(161012).bin
mktplinkfw2 calculates zero MD5 so these has to be fixed separately:
> mktplinkfw2 -i TL-WR841Nv13_0.9.1_3.16_up_boot\(161012\).bin | grep -A 1 MD5Sum1
Header MD5Sum1         : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 (*ERROR*)
          --> expected : 6f 1d 9b 57 5d 42 14 6d bf a2 03 9d 46 7d 55 55

It's most likely that MD5 salt used in mktplinkfw2 has been always wrong
(and it's not a matter of e.g. a vendor change). Update it to fix MD5
calculation.

This has been also verified to calculate MD5 correctly for other (not
yet supported) devices, e.g.:
Archer_C3150v2_0.1.0_0.9.1_up_boot(160812)_2016-08-12_10.52.54.bin
Archer_C3200v1_0.9.1_0.1_up_boot(160704)_2016-07-04_15.48.28.bin

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Acked-by: Mathias Kresin <dev@kresin.me>
2017-07-03 07:04:58 +02:00
..
add_header.c
addpattern.c firmware-utils: honor env SOURCE_DATE_EPOCH 2017-06-19 14:34:52 +02:00
asustrx.c tools: firmware-utils: fix compiler warnings 2015-10-11 19:00:41 +00:00
bcm_tag.h firmware-utils: move bcm_tag.h here 2012-10-08 09:59:50 +00:00
bcmalgo.c tools: add Broadcom cable modem firmware image creator 2013-06-06 22:21:52 +00:00
bcmalgo.h tools: add Broadcom cable modem firmware image creator 2013-06-06 22:21:52 +00:00
buffalo-enc.c firmware-utils: improve tools for Buffalo DHP series 2017-01-31 10:55:02 +01:00
buffalo-lib.c firmware-utils/buffalo-enc: explicitly use signed char for checksum function 2015-10-12 13:11:20 +00:00
buffalo-lib.h firmware-utils: improve tools for Buffalo DHP series 2017-01-31 10:55:02 +01:00
buffalo-tag.c firmware-utils: improve tools for Buffalo DHP series 2017-01-31 10:55:02 +01:00
buffalo-tftp.c firmware-utils: fix compilation warnings. 2014-10-20 06:29:13 +00:00
csysimg.h adds support for Edimax BR-6524N 2013-01-06 11:11:30 +00:00
cyg_crc.h
cyg_crc16.c
cyg_crc32.c
dgfirmware.c firmware-utils: fix various compiler warnings 2015-12-11 15:09:30 +00:00
dgn3500sum.c firmware-utils: fix dgn3500sum compiler warnings 2017-06-26 20:08:36 +02:00
edimax_fw_header.c tools: edimax_fw_header: fix suspicious memset usage 2015-01-10 18:08:16 +00:00
encode_crc.c
fix-u-media-header.c firmware-utils: new tool for fixing U-Media firmware headers 2012-10-18 07:23:09 +00:00
fw.h
hcsmakeimage.c firmware-utils: honor env SOURCE_DATE_EPOCH 2017-06-19 14:34:52 +02:00
imagetag.c firmware-utils: honor env SOURCE_DATE_EPOCH 2017-06-19 14:34:52 +02:00
imagetag.ggo brcm63xx: do not align squashfs rootfs start 2015-02-27 17:38:14 +00:00
imagetag_cmdline.c brcm63xx: do not align squashfs rootfs start 2015-02-27 17:38:14 +00:00
imagetag_cmdline.h brcm63xx: do not align squashfs rootfs start 2015-02-27 17:38:14 +00:00
jcgimage.c firmware-utils: honor env SOURCE_DATE_EPOCH 2017-06-19 14:34:52 +02:00
lzma2eva.c firmware-utils: fix various compiler warnings 2015-12-11 15:09:30 +00:00
makeamitbin.c
md5.c firmware-utils: replace md5 code with Alexander Peslyak's implementation 2016-11-28 07:52:31 +01:00
md5.h firmware-utils: replace md5 code with Alexander Peslyak's implementation 2016-11-28 07:52:31 +01:00
mkbrncmdline.c
mkbrnimg.c tools: firmware-utils: fix compiler warnings 2015-10-11 19:00:41 +00:00
mkbuffaloimg.c ar71xx: add support for Buffalo BHR-4GRV2 2016-11-16 10:54:33 +01:00
mkcameofw.c firmware-utils/mkcameofw: allow to use combined kernel image 2013-05-08 17:11:08 +00:00
mkcasfw.c tools: firmware-utils: fix compiler warnings 2015-10-11 19:00:41 +00:00
mkchkimg.c
mkcsysimg.c tools: firmware-utils: fix compiler warnings 2015-10-11 19:00:41 +00:00
mkdapimg.c Add Netgear WNCE2001 (OF version) 2013-04-09 14:19:33 +00:00
mkdcs932.c tools: add tool to generate dcs93xl images 2013-10-07 15:01:05 +00:00
mkdhpimg.c firmware-utils: improve tools for Buffalo DHP series 2017-01-31 10:55:02 +01:00
mkdniimg.c tools: firmware-utils: fix compiler warnings 2015-10-11 19:00:41 +00:00
mkedimaximg.c
mkfwimage.c firmware-utils: mkfwimage: fix firmware_max_length for XM layout 2016-02-29 20:11:33 +00:00
mkfwimage2.c tools/mkfwimage2: remove 256 length limit for partition images 2016-06-14 22:13:37 -07:00
mkheader_gemtek.c firmware-utils: add Gemtek header tool 2014-04-22 08:08:39 +00:00
mkhilinkfw.c firmware-utils: fix various compiler warnings 2015-12-11 15:09:30 +00:00
mkmerakifw-old.c tools/firmware-utils: fix portability issue in mkmerakifw-old 2016-09-22 13:37:23 +02:00
mkmerakifw.c firmware-utils: Fix build failure in mkmerakifw.c FS#298 2016-11-26 22:39:27 +01:00
mkmylofw.c ar71xx: Revert "added board support for compex wpj558" 2015-02-02 10:32:04 +00:00
mkplanexfw.c tools: firmware-utils: fix compiler warnings 2015-10-11 19:00:41 +00:00
mkporayfw.c ramips: generate factory images for Nexx devices 2014-12-07 16:53:22 +00:00
mkrtn56uimg.c firmware-utils: honor env SOURCE_DATE_EPOCH 2017-06-19 14:34:52 +02:00
mksenaofw.c firmware-utils: mksenaofw: rework option validation 2016-08-17 20:08:52 +02:00
mktitanimg.c
mktitanimg.h
mktplinkfw-kernel.c firmware-utils: kernel image generator for TP-Link RE450 2016-12-22 14:50:05 +01:00
mktplinkfw.c firmware-utils: add support for TL-WR1043ND v4 to mktplinkfw and tplink-safeloader 2016-12-20 14:38:48 +01:00
mktplinkfw2.c firmware-utils: mktplinkfw2: fix MD5 salt 2017-07-03 07:04:58 +02:00
mkwrggimg.c firmware-utils: fix compilation on MacOS X 2016-10-31 12:39:09 +01:00
mkwrgimg.c
mkzcfw.c tools: firmware-utils: fix compiler warnings 2015-10-11 19:00:41 +00:00
mkzynfw.c tools: firmware-utils: fix compiler warnings 2015-10-11 19:00:41 +00:00
motorola-bin.c
myloader.h ar71xx: Revert "added board support for compex wpj558" 2015-02-02 10:32:04 +00:00
nand_ecc.c treewide: replace nbd@openwrt.org with nbd@nbd.name 2016-06-07 08:58:42 +02:00
osbridge-crc.c tools: firmware-utils: fix compiler warnings 2015-10-11 19:00:41 +00:00
oseama.c firmware-utils: oseama: support extracting entity 2016-06-15 10:54:16 +02:00
pc1crypt.c tools: firmware-utils: fix compiler warnings 2015-10-11 19:00:41 +00:00
ptgen.c ptgen: work around gcc miscompilation 2016-09-26 12:23:41 +02:00
seama.c tools: firmware-utils: fix compiler warnings 2015-10-11 19:00:41 +00:00
seama.h tools/firmware-utils: add seama tool 2012-10-18 07:22:57 +00:00
sha1.c
sha1.h
spw303v.c firmware-utils: honor env SOURCE_DATE_EPOCH 2017-06-19 14:34:52 +02:00
srec2bin.c firmware-utils: fix various compiler warnings 2015-12-11 15:09:30 +00:00
tplink-safeloader.c ar71xx: add support for TP-Link Archer C58 v1 2017-06-29 10:37:36 +02:00
trx.c firmware-utils: improve tools for Buffalo DHP series 2017-01-31 10:55:02 +01:00
trx2edips.c
trx2usr.c
wrt400n.c Revert "tools: wrt400n: fix making factory images with kernel bigger than 1MB" 2017-01-20 06:43:13 +01:00
xorimage.c firmware-utils: honor env SOURCE_DATE_EPOCH 2017-06-19 14:34:52 +02:00
zyimage.c firmware-utils: add tool to create zyxel images 2016-11-17 20:01:21 +01:00
zynos.h
zyxbcm.c firmware-utils: honor env SOURCE_DATE_EPOCH 2017-06-19 14:34:52 +02:00