add dlink-sge-image for D-Link devices by SGE
authorSebastian Schaper <openwrt@sebastianschaper.net>
Thu, 2 Nov 2023 19:16:06 +0000 (20:16 +0100)
committerPaul Spooren <mail@aparcar.org>
Thu, 2 Nov 2023 23:45:54 +0000 (00:45 +0100)
commitba5bc4e1ae9d3e7b41d3bed39ce505670dc95078
tree9a35723e91900c292b2089fd2b190513e39c139d
parent635466123429ba8682b575245bbf52e3b33b7163
add dlink-sge-image for D-Link devices by SGE

This tool will encrypt/decrypt factory images requiring the "SHRS" header
e.g. COVR-C1200, COVR-P2500, COVR-X1860, DIR-878, DIR-882, ...

Encryption is loosely based on a series of blogposts by ricksanchez [1]
and the provided code [2], as well as patches to qca-uboot found in the
GPL tarball released for D-Link COVR-P2500 Rev. A1 [3].

Further scripts (e.g. /lib/upgrade/) and keys were found in the GPL tarball
and/or rootfs of COVR-C1200 (the devices are based on OpenWrt Chaos Calmer
and failsafe can be entered by pressing 'f' on the serial console during
boot, allowing to access the file system of the running device).

For newer devices like COVR-X1860 and DIR-X3260, an updated method of
vendor key derivation is implemented based on enk.txt from the GPL release.

[1] https://0x00sec.org/t/breaking-the-d-link-dir3060-firmware-encryption-recon-part-1/21943
[2] https://github.com/0xricksanchez/dlink-decrypt
[3] https://tsd.dlink.com.tw/GPL.asp

Signed-off-by: Sebastian Schaper <openwrt@sebastianschaper.net>
Tested-By: Alan Luck <luckyhome2008@gmail.com>
Tested-By: Paul Spooren <mail@aparcar.org>
CMakeLists.txt
src/dlink-sge-image.c [new file with mode: 0644]
src/dlink-sge-image.h [new file with mode: 0644]