image: fix pcr 12 calculation (#1706)

Kernel cmdline embedded in UKIs had no null terminator before. With newer versions of mkosi, it is already null-terminated so we shouldn't null terminate it twice.

Co-authored-by: Malte Poll <1780588+malt3@users.noreply.github.com>
This commit is contained in:
Paul Meyer 2023-05-02 12:35:52 +02:00 committed by GitHub
parent c2439cbf74
commit 9bee6fc69c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -23,9 +23,8 @@ cmdline_measure() {
local path="$1"
local tmp
tmp=$(mktemp)
# convert to utf-16le and add a null terminator
# convert to utf-16le
iconv -f utf-8 -t utf-16le "${path}" -o "${tmp}"
truncate -s +2 "${tmp}"
sha256sum "${tmp}" | cut -d " " -f 1
rm "${tmp}"
}