Skip to content

Commit 2ed90a8

Browse files
committed
Modify tpm2 scripts/recipes to align with tools/tss uprev
These changes align with the uprev to tpm2-tools v5.7 and tpm2-tss v3.2.3, iincluding command line utilities updates and changes in output formats
1 parent 4d55085 commit 2ed90a8

5 files changed

Lines changed: 185 additions & 111 deletions

File tree

recipes-core/initrdscripts/initramfs-framework/tpm2

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,9 @@
2828
pcr_bank_exists () {
2929
local alg_in=$1
3030

31-
banks=$(tpm2_pcrlist -s | cut -d ':' -f 2)
31+
banks=$(tpm2_pcrread | cut -d ':' -f 1 | grep -i "sha")
3232
for bank in $banks; do
33-
alg=$(echo $bank | cut -d '(' -f 1)
34-
if [ "$alg" = $alg_in ]; then
33+
if [ "$bank" = $alg_in ]; then
3534
return 0
3635
fi
3736
done
@@ -75,15 +74,15 @@ tpm2_run() {
7574
info -n "Measuring rootfs device..."
7675
if pcr_bank_exists "sha256"; then
7776
local digest="$(sha256sum $bootparam_root | head -c64)"
78-
local algid="0xB"
77+
local algid="sha256"
7978
else
8079
local digest="$(sha1sum $bootparam_root | head -c40)"
81-
local algid="0x4"
80+
local algid="sha1"
8281
fi
8382
info "done"
8483

8584
info -n "Extending TPM PCR..."
86-
tpm2_extendpcr -c 15 -g ${algid} -s ${digest}
85+
tpm2_pcrextend 15:${algid}=${digest}
8786
if [ $? -ne 0 ]; then
8887
info "PCR-15 extend failed"
8988
return

recipes-core/initrdscripts/initramfs-framework_%.bbappend

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ RDEPENDS_initramfs-module-tpm = "${PN}-base initramfs-module-bootfs tpm-tools-sa
5757
FILES_initramfs-module-tpm = "/init.d/92-tpm"
5858

5959
SUMMARY_initramfs-module-tpm2 = "initramfs support for tpm2"
60-
RDEPENDS_initramfs-module-tpm2 = "${PN}-base initramfs-module-bootfs tpm2-tools-initrd"
60+
RDEPENDS_initramfs-module-tpm2 = "${PN}-base initramfs-module-bootfs tpm2-tools tpm2-tss"
6161
FILES_initramfs-module-tpm2 = "/init.d/92-tpm2"
6262

6363
SUMMARY_initramfs-module-selinux = "initramfs support for selinux"

recipes-openxt/openxt-measuredlaunch/openxt-measuredlaunch/ml-functions

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,7 @@ write_config_pcrs() {
681681
}
682682

683683
# Function to configure measured launch on platform. The next boot will cause
684-
# init-root.ro to perform first sealing operation.
684+
# init.root-ro to perform first sealing operation.
685685
# parameter 0: mount point for rootfs
686686
# parameter 1: key to unlock partition
687687
# parameter 2: device path for partition

recipes-openxt/xenclient-root-ro/xenclient-root-ro/init.root-ro

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ unlock_config()
287287
local sig=$(dd if="${lv_path}" bs=4 count=1 2>/dev/null)
288288
case "${sig}" in
289289
LUKS)
290-
if [ -e /boot/system/tpm/enabled ]; then
290+
if [ -e ${SYS_TPM_DIR}/enabled ]; then
291291
# This will seal/reboot or fail/halt
292292
if [ -e ${SYS_TPM_DIR}/setup ]; then
293293
# create a small tmpfs to use for sealing, then remove
@@ -432,8 +432,8 @@ then
432432
#cap pcr 15 in all available banks. This is a cheap operation and works for all cases
433433
sha256cap=$(echo -n "MEASUREDLAUNCHCLOSED"|sha256sum|cut -f1 -d\ |tr -d "\n")
434434
sha1cap=$(echo -n "MEASUREDLAUNCHCLOSED"|sha1sum|cut -f1 -d\ |tr -d "\n")
435-
pcr_bank_exists "sha256" && tpm2_extendpcr -c 15 -g 0xB -s "${sha256cap}"
436-
pcr_bank_exists "sha1" && tpm2_extendpcr -c 15 -g 0x4 -s "${sha1cap}"
435+
pcr_bank_exists "sha256" && tpm2_pcrextend -Q 15:sha256="${sha256cap}"
436+
pcr_bank_exists "sha1" && tpm2_pcrextend -Q 15:sha1="${sha1cap}"
437437
else
438438
echo -n "MEASUREDLAUNCHCLOSED" | TCSD_LOG_OFF=yes tpm_extendpcr_sa -p 15
439439
fi

0 commit comments

Comments
 (0)