extend_all.sh: support kernels with embedded initramfs#54
Merged
dpsmith merged 1 commit intoTrenchBoot:masterfrom Jul 27, 2020
Merged
extend_all.sh: support kernels with embedded initramfs#54dpsmith merged 1 commit intoTrenchBoot:masterfrom
dpsmith merged 1 commit intoTrenchBoot:masterfrom
Conversation
dpsmith
reviewed
Jul 27, 2020
dpsmith
reviewed
Jul 27, 2020
extend_all.sh
Outdated
| # see https://www.kernel.org/doc/html/latest/x86/boot.html#details-of-harder-fileds | ||
| KERNEL_PROT_SKIP=$((`hexdump "$1" -s0x1f1 -n1 -e '/1 "%u"'` * 512 + 512)) | ||
| if [[ $# -eq 2 ]] && [[ -e "$1" ]] && [[ -e "$2" ]] ; then | ||
| extend_sha1 "$(extend_sha1)" "`dd if="$1" bs=1 skip=$KERNEL_PROT_SKIP 2>/dev/null | sha1sum`" "$2" |
Collaborator
There was a problem hiding this comment.
I think this is logically correct but for me I find it easier to read/reason if the inner extend_shaXXX and its parameter is under the same subshell call, i.e.
extend_sha1 "$(extend_sha1 `dd if="$1" bs=1 skip=$KERNEL_PROT_SKIP 2>/dev/null | sha1sum`)" "$2"
dpsmith
approved these changes
Jul 27, 2020
Collaborator
dpsmith
left a comment
There was a problem hiding this comment.
Reviewed-by: Daniel P. Smith dpsmith@apertussolutions.com
andyhhp
approved these changes
Jul 27, 2020
Modify test for number of command line arguments. For one argument, measure the file pointed by that argument assuming it is a Linux kernel and simulate a PCR extend operation for just the LZ and the kernel's hash. This commit also refactors code for extend_shaXX functions and adds more helpers - separate functions for calculating hashes of measured parts of LZ and kernel. Signed-off-by: Krystian Hebel <krystian.hebel@3mdeb.com>
e356efc to
e20bc36
Compare
dpsmith
approved these changes
Jul 27, 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.
Modify test for number of command line arguments. For one argument,
measure the file pointed by that argument assuming it is a Linux kernel
and simulate a PCR extend operation for just the LZ and the kernel's hash.
Signed-off-by: Krystian Hebel krystian.hebel@3mdeb.com