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)
committerDavid Bauer <mail@david-bauer.net>
Fri, 29 Dec 2023 14:05:42 +0000 (15:05 +0100)
commit8cad449bdb5ccda4e8eebcd8500be941350f4f16
treea319b03d0d9318f8ebf61bd0753c689af6b1b861
parent9e2de8515be15e2b61ae518ce592e5b446ef2d48
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>
(cherry picked from commit ba5bc4e1ae9d3e7b41d3bed39ce505670dc95078)
Signed-off-by: Florian Maurer <f.maurer@outlook.de>
CMakeLists.txt
src/dlink-sge-image.c [new file with mode: 0644]
src/dlink-sge-image.h [new file with mode: 0644]