gadged: thor: add board signature check when download 'u-boot-mmc.bin'
authorInha Song <ideal.song@samsung.com>
Mon, 28 Oct 2013 06:52:53 +0000 (15:52 +0900)
committerJaehoon Chung <jh80.chung@samsung.com>
Tue, 20 Oct 2020 00:42:15 +0000 (09:42 +0900)
commit27d6c54bce75eb19e1714c52bf3868be48df3396
tree784401bcf23f870d72802b9a9a825c8844e19835
parenteab0475f7dc860c2b071d6ac9cad40e5c98a4d5f
gadged: thor: add board signature check when download 'u-boot-mmc.bin'

This patch adds checking the special signature of downloaded U-Boot binary.
The new function check_board_signature() is called before do dfu_write()
in thor gadged code.

The board signature is checked for:
- the running U-Boot
- downloaded 'u-boot-mmc.bin'
at offset of binary start defined by:
- (CONFIG_SIGN_IMAGE_SIZE - HDR_SIZE)

The download can succeed when signatures are equal.

The default U-Boot image size defined by CONFIG_SIGN_IMAGE_SIZE is 1MB.

Other changes:
- print info about running/downloading U-Boot signature
- print info about wrong image signature/size
- don't allow downloading unsigned or signed wrong U-Boot image
- allow download any image if no signature found at running U-Boot

The first version added by:
Signed-off-by: Inha Song <ideal.song@samsung.com>
Upgrade:
Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
board/samsung/common/Makefile
board/samsung/common/sig_header.c [new file with mode: 0644]
drivers/usb/gadget/f_thor.c
include/samsung/sighdr.h [new file with mode: 0644]