File tree Expand file tree Collapse file tree
recipes-core/initrdscripts
openxt-measuredlaunch/openxt-measuredlaunch
xenclient-root-ro/xenclient-root-ro
xenclient-tpm-scripts/xenclient-tpm-scripts Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2828pcr_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
Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ RDEPENDS_initramfs-module-tpm = "${PN}-base initramfs-module-bootfs tpm-tools-sa
5757FILES_initramfs -module -tpm = "/init.d/92-tpm"
5858
5959SUMMARY_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 "
6161FILES_initramfs -module -tpm2 = "/init.d/92-tpm2"
6262
6363SUMMARY_initramfs -module -selinux = "initramfs support for selinux"
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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
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} "
437437else
438438 echo -n " MEASUREDLAUNCHCLOSED" | TCSD_LOG_OFF=yes tpm_extendpcr_sa -p 15
439439fi
You can’t perform that action at this time.
0 commit comments