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.
This commit is contained in:
Malte Poll 2023-05-02 12:01:30 +02:00 committed by GitHub
parent 1180b376fa
commit cb6cc8df22
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 path="$1"
local tmp local tmp
tmp=$(mktemp) 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}" iconv -f utf-8 -t utf-16le "${path}" -o "${tmp}"
truncate -s +2 "${tmp}"
sha256sum "${tmp}" | cut -d " " -f 1 sha256sum "${tmp}" | cut -d " " -f 1
rm "${tmp}" rm "${tmp}"
} }