aboutsummaryrefslogtreecommitdiff
path: root/board-qemu/slof/vtpm-sml.fs
diff options
context:
space:
mode:
authorStefan Berger <stefanb@linux.ibm.com>2020-01-21 15:01:45 -0500
committerAlexey Kardashevskiy <aik@ozlabs.ru>2020-02-21 14:03:07 +1100
commitae2e38c3ad59bfebfd35f1f5c1f4636147d67999 (patch)
treedab8becf6979008976841e1a54fb8865bb93a84b /board-qemu/slof/vtpm-sml.fs
parent8356a34d2ce9bf390030942f3fa537cc0f8aec4b (diff)
downloadSLOF-ae2e38c3ad59bfebfd35f1f5c1f4636147d67999.zip
SLOF-ae2e38c3ad59bfebfd35f1f5c1f4636147d67999.tar.gz
SLOF-ae2e38c3ad59bfebfd35f1f5c1f4636147d67999.tar.bz2
tcgbios: Add TPM 2.0 support and firmware API
This patch adds TPM 2.0 support along with the firmware API that Linux uses to transfer the firmware log. The firmware API follows the "PFW Virtual TPM Driver" specification. The API has callers in existing Linux code (prom_init.c) from TPM 1.2 times but the API also works for TPM 2.0 without modifications. The TPM 2.0 support logs PCR extensions of measurements of code and data. For this part we follow the TCG specification "TCG PC Client Platform Firmware Profile Specification" (section "Event Logging"). Other relevant specs for the construction of TPM commands are: - Trusted Platform Module Library; Part 2 Structures - Trusted Platform Module Library; Part 3 Commands Signed-off-by: Stefan Berger <stefanb@linux.ibm.com> Signed-off-by: Kevin O'Connor <kevin@koconnor.net> [aik: removed new blank lines at EOF] Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Diffstat (limited to 'board-qemu/slof/vtpm-sml.fs')
-rw-r--r--board-qemu/slof/vtpm-sml.fs67
1 files changed, 67 insertions, 0 deletions
diff --git a/board-qemu/slof/vtpm-sml.fs b/board-qemu/slof/vtpm-sml.fs
new file mode 100644
index 0000000..a1fb8ec
--- /dev/null
+++ b/board-qemu/slof/vtpm-sml.fs
@@ -0,0 +1,67 @@
+\ *****************************************************************************
+\ * Copyright (c) 2015-2020 IBM Corporation
+\ * All rights reserved.
+\ * This program and the accompanying materials
+\ * are made available under the terms of the BSD License
+\ * which accompanies this distribution, and is available at
+\ * http://www.opensource.org/licenses/bsd-license.php
+\ *
+\ * Contributors:
+\ * IBM Corporation - initial implementation
+\ ****************************************************************************/
+
+" /" find-device
+
+new-device
+
+false VALUE vtpm-debug?
+
+\ create /ibm,vtpm
+s" ibm,vtpm" 2dup device-name device-type
+
+\
+\ only internal API calls
+\
+
+: separator-event ( start-pcr end-pcr -- )
+ tpm-add-event-separators ( errcode )
+ ?dup IF
+ ." VTPM: Error code from tpm-add-event-separators: " . cr
+ THEN
+;
+
+80 CONSTANT BCV_DEVICE_HDD
+
+: measure-hdd-mbr ( addr length -- )
+ 0 7 separator-event
+ BCV_DEVICE_HDD ( addr length bootdrv )
+ -rot ( bootdrv addr length )
+ tpm-measure-bcv-mbr ( errcode )
+ ?dup IF
+ ." VTPM: Error code from tpm-measure-hdd: " . cr
+ THEN
+;
+
+: leave-firmware ( -- )
+ tpm-leave-firmware ( errcode )
+ ?dup IF
+ ." VTPM: Error code from tpm-leave-firmware: " . cr
+ THEN
+;
+
+: measure-scrtm ( -- )
+ tpm-measure-scrtm ( errcode )
+ ?dup IF
+ ." VTPM: Error code from tpm-measure-scrtm: " . cr
+ THEN
+;
+
+: open true ;
+: close ;
+
+finish-device
+device-end
+
+s" /ibm,vtpm" find-node ?dup IF
+ s" measure-scrtm" rot $call-static
+THEN