build: move bootloader data out of measured block#18
Merged
dpsmith merged 4 commits intoTrenchBoot:masterfrom Jan 30, 2020
Merged
build: move bootloader data out of measured block#18dpsmith merged 4 commits intoTrenchBoot:masterfrom
dpsmith merged 4 commits intoTrenchBoot:masterfrom
Conversation
andyhhp
reviewed
Jan 16, 2020
6d7db32 to
694cad5
Compare
extend_lz_only.sh: print expected values of PCR17 after SKINIT, after
they are extended with SL hash only (both SHA1 and SHA256).
extend_all.sh: takes path to bzImage and initrd (in that order) as
arguments and calculates values expected after extending with LZ,
kernel and initrd.
sanity_check.sh: checks for LZ UUID at the correct offset, will be used
by the following commit.
util.sh: helper functions for above scripts.
Signed-off-by: Krystian Hebel <krystian.hebel@3mdeb.com>
Previous code assumed existence of intermediate loader before the Linux kernel. As it was not used, code improperly calculated hash from block of 0 bytes. Signed-off-by: Krystian Hebel <krystian.hebel@3mdeb.com>
Bootloader must pass pointer to the zeropage, which is not constant. To keep hash values independent of memory layout, those variables are moved to a separate section out of SL (but still inside SLB). Length in SL header is no longer set to maximum possible value, it points to the end of constant data. GRUB2 code must be changed accordingly. Signed-off-by: Krystian Hebel <krystian.hebel@3mdeb.com>
aeb56f5 to
af55563
Compare
andyhhp
reviewed
Jan 23, 2020
| #!/bin/bash | ||
| . util.sh | ||
|
|
||
| if [[ $# -ne 2 ]] || [[ ! -e "$1" ]] || [[ ! -e "$2" ]] ; then |
Member
Author
There was a problem hiding this comment.
! -n is -z, -e checks if it is a file. I didn't go with -f because I thought about using symlinks in the build scripts, now I'm not so sure about that.
util.sh
Outdated
| >&2 echo "\"$TRIM\" is not a valid SHA1/SHA256 hash" | ||
| return | ||
| fi | ||
| echo -n $TRIM | sed -r -e "s/([a-f0-9]{2})/\\\\\x\1/g" |
Collaborator
There was a problem hiding this comment.
You can half the number of escapes for \x given the -r
Member
Author
There was a problem hiding this comment.
Why do I still need to use 3 backslashes, is the first escape consumed already by quotation?
Collaborator
|
No major problems. Couple of nice-to-haves |
Signed-off-by: Krystian Hebel <krystian.hebel@3mdeb.com>
andyhhp
approved these changes
Jan 28, 2020
dpsmith
approved these changes
Jan 30, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bootloader must fill some information about the kernel (address, size).
Those pieces of information are not constant. To keep hash values
independent of memory layout, those variables are moved to a separate
section out of SL (but still inside SLB). Length in SL header is no
longer set to maximum possible value, it points to the end of constant
data instead.
GRUB2 code must be changed accordingly.
Util for calculating initial PCR values after SKINIT is included
(calc_skinit_lz_sums.sh).
Signed-off-by: Krystian Hebel krystian.hebel@3mdeb.com