[coreboot-gerrit] Change in coreboot[master]: buildgcc: Implement simple tarball hash verification

Jonathan Neuschäfer (Code Review) gerrit at coreboot.org
Fri Sep 22 23:38:18 CEST 2017


Hello Philipp Deppenwiese, 

I'd like you to reexamine a change. Please visit

    https://review.coreboot.org/21592

to look at the new patch set (#3).

Change subject: buildgcc: Implement simple tarball hash verification
......................................................................

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.

TODO: Maybe improve the error messages

Change-Id: I0d5d67b34684d02011a845d00f6f5b6769f43b4f
Signed-off-by: Jonathan Neuschäfer <j.neuschaefer at gmx.net>
---
M util/crossgcc/buildgcc
1 file changed, 92 insertions(+), 20 deletions(-)


  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/92/21592/3
-- 
To view, visit https://review.coreboot.org/21592
To unsubscribe, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I0d5d67b34684d02011a845d00f6f5b6769f43b4f
Gerrit-Change-Number: 21592
Gerrit-PatchSet: 3
Gerrit-Owner: Jonathan Neuschäfer <j.neuschaefer at gmx.net>
Gerrit-Reviewer: Philipp Deppenwiese <zaolin.daisuki at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20170922/f5eaf512/attachment.html>


More information about the coreboot-gerrit mailing list