aboutsummaryrefslogtreecommitdiffstats
path: root/src/tcgbios.h
Commit message (Collapse)AuthorAgeFilesLines
* tpm: Rework the assertion of physical presenceStefan Berger2016-01-071-1/+1
| | | | | | | | | | Rework the assertion of physical presence by calling assert_physical_presence in tpm_setup. This call will assert physical presence if SW assertion is possible or by checking whether HW physical presence is enabled. The TPM menu will only be shown if physical presence is asserted or HW physical presence is enabled after this call. Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
* tpm: Don't return a status from external bios measurement functionsKevin O'Connor2016-01-051-4/+4
| | | | | | | The callers of the measurements don't care what happens, so no need to return a status. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tpm: Add a menu for TPM configurationStefan Berger2015-12-201-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds an new menu entry to the main menu. This menu item enables the user to enter a TPM control menu which allows control of those aspects of the TPM's state that can only be controlled while in the firmware and while physical presence can be asserted. If the machine has a TPM, the boot menu will look as follows, with the new menu item accessible by pressing the 't' key. Select boot device: 1. ata0-1: QEMU HARDDISK ATA-7 Hard-Disk (6144 MiBytes) 2. Legacy option rom 3. iPXE (PCI 00:03.0) t. TPM Menu Upon pressing t the TPM submenu will be shown: The Trusted Platform Module (TPM) is a hardware device in this machine. It can help verify the integrity of system software. The current state of the TPM is: Enabled and active Ownership has not been taken A user can take ownership of the TPM Available options are: d. Disable the TPM v. Deactivate the TPM p. Prevent installation of an owner If no change is desired or if this menu was reached by mistake, press ESC to reboot the machine. The TPM menu only shows those options that are currently accessible considering the state of the TPM. The patch adds several functions for sending those messages to the TPM required for supporting those menu items. Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
* tpm: Don't implement scatter-gather in transmit()Kevin O'Connor2015-11-231-8/+0
| | | | | | | | | | | | | | | There are no longer any callers to transmit() that use multiple buffers. Simplify transmit() so that it takes a single request buffer. The pass_through_to_tpm() wrapper around transmit() is no longer needed. Remove the function and have all callers use transmit() directly. Now that tpm_extend() function calls transmit directly, it can use TPM_DURATION_TYPE_SHORT duration. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tpm: Open code tpm_ipl() into callersKevin O'Connor2015-11-221-6/+0
| | | | | | | | The only three callers of tpm_ipl() exactly correlate with the three switch branches in tpm_ipl(), so just move the appropriate code into the callers. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tpm: Move standard definitions from tcgbios.h to new file std/tcg.hKevin O'Connor2015-11-191-345/+0
| | | | | Tested-by: Stefan Berger <stefanb@us.ibm.com> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* tpm: Refactor function building TPM commandsStefan Berger2015-11-191-1/+1
| | | | | | | | | Refactor the function building TPM commands to get rid of one of the buffers it uses for building a command. To do that, have it use the iovec also for the 'append' array that's being passed to the function. Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
* tpm: Temporarily deactivate the TPM in case of failureStefan Berger2015-11-191-0/+1
| | | | | | | | | | | | Temporarily deactivate the TPM in case of failure of TPM commands and failure to log measurements. Introduce the tpm_set_failure() function replacing occurrences of 'tpm_state.tpm_working = 0' and invoke it in error paths. Temporarily deactivating the TPM means that it will be active again upon reboot. Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
* tcg: Use seabios setup()/prepboot() calling convention for tcgKevin O'Connor2015-06-111-3/+3
| | | | | | | | Rename tcg externally called functions to more closely match other subsystems. Signed-off-by: Kevin O'Connor <kevin@koconnor.net> Tested-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
* tpm: Clean up in tcgbios.hStefan Berger2015-06-111-20/+0
| | | | | | | Remove some unused #defines and remove comments pointing to sections in specs. Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
* tpm: Introduce a #define for command tagStefan Berger2015-06-111-0/+2
| | | | | | Introduce a #define for the TPM command tag 0x00c1. Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
* Add 'measurement' code to the BIOSStefan Berger2015-06-011-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds invocations of functions that measure various parts of the code and data through various parts of the BIOS code. It follows TCG specifications on what needs to be measured. It also adds the implementation of the called functions. Reference for what needs to be measured can be found in specs found here: http://www.trustedcomputinggroup.org/resources/pc_client_work_group_specific_implementation_specification_for_conventional_bios The first measurements are done once the ACPI tables have been initialized. Once booted into Linux, the current measurements produce the following logs which can be found in /sys/kernel/security/tpm0/ascii_bios_measurements. The below log also shows measurements from trusted grub. 1 3fb240d2a04085a4e84f81e4398e070ed5a18163 06 [SMBIOS] 2 cc812353fc277c1fab99e0b721752a1392984566 06 [Option ROM] 2 9dbd87163112e5670378abe4510491259a61f411 05 [Start Option ROM Scan] 2 6f74e357331b8dee11bbad85f27bc66cb873106c 06 [Option ROM] 2 5626eb7ac05c7231e46d7461e7d3839b03ae9fad 06 [Option ROM] 4 c1e25c3f6b0dc78d57296aa2870ca6f782ccf80f 05 [Calling INT 19h] 0 d9be6524a5f5047db5866813acf3277892a7a30a 04 [] 1 d9be6524a5f5047db5866813acf3277892a7a30a 04 [] 2 d9be6524a5f5047db5866813acf3277892a7a30a 04 [] 3 d9be6524a5f5047db5866813acf3277892a7a30a 04 [] 4 d9be6524a5f5047db5866813acf3277892a7a30a 04 [] 5 d9be6524a5f5047db5866813acf3277892a7a30a 04 [] 6 d9be6524a5f5047db5866813acf3277892a7a30a 04 [] 7 d9be6524a5f5047db5866813acf3277892a7a30a 04 [] 4 8cf2fe6c87d4d0b2998a43da630292e6d85ee8b6 05 [Booting BCV device 80h (HDD)] 4 5dff94459a3e2d13a433ef94afdc306144565bf7 0d [IPL] 5 d1b33afde65ad47502332af957c60f20c84c1edc 0e [IPL Partition Data] 4 487ce764b527ccad17f1d04243d0136fa981e6c4 0d [IPL] 4 91d285e4dead566324c8938a3cc75803f462d9a1 0d [IPL] 4 8ba79ac98bb491524fef29defc724daaf6263d35 0d [IPL] 4 c591c15b82e4ff30e7383a4ff1ef3b41b38521ac 06 [] 4 8cdc27ec545eda33fbba1e8b8dae4da5c7206972 04 [Grub Event Separator] 5 8cdc27ec545eda33fbba1e8b8dae4da5c7206972 04 [Grub Event Separator] 5 e8673b9e14b02dc12d8ccfd0176bca7a3de7fc3c 0e [IPL Partition Data] 5 0163e375a0af7525c5dac1a8e74b277359e40d1d 1105 [] 8 4be30f67c3d48ab7f04d9c0fd07f06d4c68379be 1205 [] 8 54c83965978de9708d026016ecb0e70660e04388 1305 [] 5 2431ed60130faeaf3a045f21963f71cacd46a029 04 [OS Event Separator] 8 2431ed60130faeaf3a045f21963f71cacd46a029 04 [OS Event Separator] 8 f3973cae05d6e2055062119d6e6e1e077b7df876 1005 [] Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
* Support for BIOS interrupt handlerStefan Berger2015-05-211-0/+3
| | | | | | | | | | | | | | | | | | | | | | This patch implements the TCG BIOS interrupt handler 1ah. It is for example used by trusted grub. This patch adds an implementation of SHA1 (following NIST specs., IETF RFC 3147 and Wikipedia) for speeding up measurements of code. Trusted Grub for example makes use of this interface and measures (calculates SHA1) of the Linux kernel and initrd. Those files can be rather large and hunting their bytes through the TIS interface as part of the int handler commands invoked by trusted grub does take quite some time due to the many vmexits the interface is creating (one per byte). There is also a threshold for the size of data to hash (100k) below which the TPM is used and above the internal faster SHA1 algorithm is used. This patch for example enables trusted grub to interact with the TPM and take additional measurements. Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Implementation of the TCG BIOS extensionsStefan Berger2015-05-211-0/+386
This patch implements the main part of the TCG BIOS extensions. It provides the following functionality: - initialization of the TCPA ACPI table used for logging of measurements - initialization of the TPM by sending a sequence of commands to it - proper setup of the TPM before the BIOS hands over control to the bootloader - support for S3 resume; BIOS sends TPM_Startup(ST_STATE) to TPM - enable configuration of SeaBIOS to be built with TCGBIOS extensions All TCG BIOS extensions are activated with CONFIG_TCGBIOS. Structures that are needed in subsequent patches are also included in tcgbios.h at this point. The effect of this patch is that it initialized the TPM upon VM start and S3 resume. Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>