coreboot-kgpe-d16/util
Jonathan Neuschäfer 92d483a892 buildgcc: Implement simple tarball hash verification
This patch implements a relatively simple hash-based verification scheme
for downloaded files (tarballs):

After buildgcc downloads a file or notices that it has already been
downloaded, it hashes the file, and compares the hash against the known
hash stored in util/crossgcc/sum/$filename.cksum. Two errors can occur:

1. The hash file is missing. In this case, crossgcc asks the user to
   verify the authenticity of the downloaded file. It also calculates
   its hash and stores it in util/crossgcc/sum/$filename.cksum.calc.
   If the file is authentic, the user may rename the calculated hash
   file to $filename.cksum, so that it can be found the next time
   buildgcc is started.

2. The known hash and the calculated hash differ. This is the case that
   this patch seeks to protect against, because it may imply that the
   downloaded file was unexpectedly changed, either in transit
   (Man-in-the-Middle attack) or on the file server that it was
   downloaded from. If buildgcc detects such a hash mismatch, it asks
   the user to delete the downloaded file and retry, because it can also
   be caused by a benign network error. If, however, the error persists,
   buildgcc can't continue without risking that the user runs malicious
   code, and it stops.

Note: The hash algorithm may be changed in the future, but for now I
left it at SHA-1, to avoid bloating this patch.

Change-Id: I0d5d67b34684d02011a845d00f6f5b6769f43b4f
Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
Reviewed-on: https://review.coreboot.org/21592
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
2017-10-04 02:43:02 +00:00
..
abuild abuild: Allow building with any toolchain 2017-09-06 04:31:30 +00:00
acpi
amdfwtool amdfwtool: Move normal firmware 2 after fanless firmware2s 2017-04-27 23:27:06 +02:00
amdtools Use more secure HTTPS URLs for coreboot sites 2017-06-07 12:04:50 +02:00
archive
arm_boot_tools/mksunxiboot
autoport util/autoport: Remove copy-pasting of PMIR register 2017-07-31 15:00:43 +00:00
bimgtool
blobtool util/blobtool: add spec files for DDR3 SPDs 2017-06-27 16:06:53 +00:00
board_status board_status: Tell user where to find output when results are uploaded 2017-09-20 01:22:41 +00:00
broadcom util/broadcom: Check for successful file access 2016-12-16 18:22:43 +01:00
cbfstool util/cbfstool: Add "expand" command to make CBFS span an fmap region 2017-09-20 13:45:00 +00:00
cbmem util/cbmem: fix feedback for 'be explicit about memory map sizes' 2017-10-02 17:16:14 +00:00
checklist
chromeos
crossgcc buildgcc: Implement simple tarball hash verification 2017-10-04 02:43:02 +00:00
docker util/docker: Update coreboot-sdk dockerfile 2017-09-20 01:29:55 +00:00
dtd_parser
ectool util/ectool: Dump ram by default 2017-04-25 18:46:04 +02:00
exynos
futility util/futility/Makefile: Update clean target 2017-03-29 05:16:49 +02:00
fuzz-tests
genbuild_h
genprof
gitconfig lint: update signed-off-by check 2017-08-17 11:26:31 +00:00
hugo util: change coreboot to lowercase 2017-06-27 18:26:01 +00:00
ifdfake
ifdtool ifdtool: Refactor some code 2017-09-17 21:31:22 +00:00
intelmetool intelmetool: Add support for Sunrise Point-H 2017-09-06 04:35:02 +00:00
inteltool util/inteltool: Remove duplicated error message, switch to snprintf 2017-08-22 10:10:34 +00:00
intelvbttool
ipqheader
k8resdump
kbc1126 kbc1126_ec_dump: fix some errors 2017-08-18 15:32:08 +00:00
kconfig
lint util/lint: update checkpatch & spelling.txt to upstream versions 2017-09-20 01:28:13 +00:00
marvell
me_cleaner util/me_cleaner: Pull the latest changes from upstream 2017-08-20 21:19:47 +00:00
mma mma: update mma setup script for v2.1018 2017-04-24 19:11:34 +02:00
msrtool util/msrtool: Exit program after displaying the help message 2017-08-22 10:10:49 +00:00
mtkheader
nvidia util/nvidia/cbootimage: Update to upstream master 2017-04-24 19:19:39 +02:00
nvramtool util: change coreboot to lowercase 2017-06-27 18:26:01 +00:00
optionlist util: change coreboot to lowercase 2017-06-27 18:26:01 +00:00
post
release util/release: Update build-release script 2017-05-16 10:54:06 +02:00
riscvtools
rockchip
romcc smbus: Fix a typo ("Set the device I'm talking too") 2017-09-27 16:38:18 +00:00
sconfig lib: provide clearer devicetree semantics 2017-04-25 18:14:38 +02:00
scripts util/scripts/cross-repo-cherrypick: improve cros-side rewrite 2017-09-15 20:57:57 +00:00
showdevicetree
spkmodem_recv
superiotool util/superiotool: Check for libpci before builing 2017-06-28 00:49:32 +00:00
testing util/testing: Don't keep tegra lp0 build results 2017-09-06 11:36:27 +00:00
uio_usbdebug
vgabios util/vgabios: Don't call redefined printk in printk 2017-07-21 15:45:41 +00:00
viatool Use more secure HTTPS URLs for coreboot sites 2017-06-07 12:04:50 +02:00
xcompile clang: Enable integrated assembler on clang builds 2017-09-02 15:21:35 +00:00