aboutsummaryrefslogtreecommitdiff
path: root/libstb/tpm_chip.c
AgeCommit message (Collapse)AuthorFilesLines
2020-10-01libstb/tss2: Switch to new implementation of PCR Read/Extend and EventlogMauro S. M. Rodrigues1-18/+21
The new implementation of PCR_Read, PCR_Extend and Eventlog uses the recently introduced standard TSS library. Old TSS implementation will be removed in the following commit. Signed-off-by: Mauro S. M. Rodrigues <maurosr@linux.vnet.ibm.com> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
2020-10-01TPM/TSS: Register TPM chip for further use within TSSMauro S. M. Rodrigues1-0/+1
TSS will know which device and transmit handler to use through this registration, and the equivalent unregistering process. Signed-off-by: Mauro S. M. Rodrigues <maurosr@linux.vnet.ibm.com> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
2020-10-01libstb/tss2: Add basic Build infrastructure for tss2Mauro S. M. Rodrigues1-0/+25
Co-authored-by: Eric Richter <erichte@linux.ibm.com> Signed-off-by: Mauro S. M. Rodrigues <maurosr@linux.vnet.ibm.com> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
2020-03-12Re-license IBM written files as Apache 2.0 OR GPLv2+Stewart Smith1-1/+1
SPDX makes it a simpler diff. I have audited the commit history of each file to ensure that they are exclusively authored by IBM and thus we have the right to relicense. The motivation behind this is twofold: 1) We want to enable experiments with coreboot, which is GPLv2 licensed 2) An upcoming firmware component wants to incorporate code from skiboot and code from the Linux kernel, which is GPLv2 licensed. I have gone through the IBM internal way of gaining approval for this. The following files are not exclusively authored by IBM, so are *not* included in this update (I will be seeking approval from contributors): core/direct-controls.c core/flash.c core/pcie-slot.c external/common/arch_flash_unknown.c external/common/rules.mk external/gard/Makefile external/gard/rules.mk external/opal-prd/Makefile external/pflash/Makefile external/xscom-utils/Makefile hdata/vpd.c hw/dts.c hw/ipmi/ipmi-watchdog.c hw/phb4.c include/cpu.h include/phb4.h include/platform.h libflash/libffs.c libstb/mbedtls/sha512.c libstb/mbedtls/sha512.h platforms/astbmc/barreleye.c platforms/astbmc/garrison.c platforms/astbmc/mihawk.c platforms/astbmc/nicole.c platforms/astbmc/p8dnu.c platforms/astbmc/p8dtu.c platforms/astbmc/p9dsu.c platforms/astbmc/vesnin.c platforms/rhesus/ec/config.h platforms/rhesus/ec/gpio.h platforms/rhesus/gpio.c platforms/rhesus/rhesus.c platforms/astbmc/talos.c platforms/astbmc/romulus.c Signed-off-by: Stewart Smith <stewart@linux.ibm.com> [oliver: fixed up the drift] Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
2019-07-26SPDX-ify all skiboot codeStewart Smith1-15/+2
Use Software Package Data Exchange (SPDX) to indicate license for each file that is unique to skiboot. At the same time, ensure the (C) who and years are correct. See https://spdx.org/ Signed-off-by: Stewart Smith <stewart@linux.ibm.com> [oliver: Added a few missing files] Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
2018-02-07libstb/tpm_chip: Add missing new line to print messages.Pridhiviraj Paidipeddi1-2/+2
Signed-off-by: Pridhiviraj Paidipeddi <ppaidipe@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-12-18libstb/tpm_chip.c: define pr_fmt and fix messages loggedClaudio Carvalho1-36/+42
This defines pr_fmt and also fix messages logged: - EV_SEPARATOR instead of 0xFFFFFFFF - when an event is measured it also prints the tpm id, event type and event log length (yay!) Now we can filter the messages logged by libstb and its sub-modules by running: $> grep STB /sys/firmware/opal/msglog Signed-off-by: Claudio Carvalho <cclaudio@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-12-18libstb: import stb_init() breaking it into multiple filesClaudio Carvalho1-19/+8
This imports stb_init() from stb.c, but breaking it into multiple files in order to make the code easier to read and to maintain. New files created: secureboot.c, trustedboot.c and cvc.c. The secureboot_init() in secureboot.c also initializes the hardware key hash and the hardware key hash size, which are used to call the CVC verify wrapper. These variables were initialized in the romcode_probe() function, libstb/drivers/romcode.c. The cvc_init() in cvc.c is slightly modified from what exists in stb_init(). Now it calls cvc_register() and cvc_service_register(). Signed-off-by: Claudio Carvalho <cclaudio@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2016-11-02tpm_extendl: don't measure when no tpm is registeredClaudio Carvalho1-2/+8
This fixes tpm_extendl() to measure only when the list of registered tpms is not empty. Fixes: 3837c6f0cf4cffb5de874413eed755c0c698b076 Signed-off-by: Claudio Carvalho <cclaudio@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2016-11-02tpm_extendl: log the calling resultsClaudio Carvalho1-1/+7
Currently, the tpm_extendl() results are logged by the caller, but tpm_extendl() walks through all the tpm_chip registered and consequently multiple tpm_chips can fail. This turns the logging over to tpm_extendl(), which now logs how many tpm_chips successfully measured and failed to measure a given data. Another option would be to provide the caller the number of tpm_chips that failed and successfully measured the data, but the caller will use this information only for logging. Signed-off-by: Claudio Carvalho <cclaudio@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2016-11-02tpm_extendl: disable all failed tpms rather than only the firstClaudio Carvalho1-16/+28
Each tpm_chip structure is associated with one tpm device and one firmware event log. If tpm_extendl() returns when the first tpm_chip operation (pcr extend or event log record) fails, the remaining registered tpm_chips will be in an inconsistent state, i.e, missing one measurement. This walks through all registered tpm_chips and disable all tpm_chips that failed rather than only first one. Signed-off-by: Claudio Carvalho <cclaudio@linux.vnet.ibm.com> [stewart@linux.vnet.ibm.com: assert(tpm) in disable_tpm] Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2016-10-10libstb/tpm_chip: add tpm_extendl()Claudio Carvalho1-0/+116
This adds the tpm_extendl() function to tpm_chip interface For each TPM device, tpm_extendl() extends the sha1 and sha256 digests provided to the indicated PCR and also records an event for the same PCR in the event log. Signed-off-by: Claudio Carvalho <cclaudio@linux.vnet.ibm.com> [stewart@linux.vnet.ibm.com: remove special char, align comments to 80 cols] Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2016-10-10libstb/tss: build TSS and tpmLogMgrClaudio Carvalho1-3/+68
This adds both TSS and tpmLogMgr to be built as part of libstb. We map some routines and types from TSS and tpmLogMgr codes to equivalent skiboot routines and types. Signed-off-by: Claudio Carvalho <cclaudio@linux.vnet.ibm.com> [stewart@linux.vnet.ibm.com: merge skiboot/HB mappings into makefile patch, and fix pointer to int without cast warning (NULL vs 0) ] Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2016-10-10Add i2c Nuvoton TPM 2.0 DriverClaudio Carvalho1-0/+2
This adds the 1/5 step performed by the TPM I2C Nuvoton driver to transmit a command to the TPM device. In this step the driver checks if the TPM device is ready to receive a new command. This adds the 2/5 step performed by the TPM I2C Nuvoton driver to transmit a command to the TPM device. In this step the driver writes a given command to master I2C FIFO. This adds the 3/5 step performed by the TPM I2C Nuvoton driver to transmit a command to the TPM device. In this step the driver sets the TPMGO bit in the I2C master status register to indicate that the command stored in the FIFO can be sent to the TPM device. This adds the 4/5 step performed by the TPM I2C Nuvoton driver to transmit a command to the TPM device. In this step the driver reads from the I2C master FIFO the result that the TPM device returned for the last command sent. This adds the 5/5 step performed by the TPM I2C Nuvoton driver to transmit a command to the TPM device. In this step the driver sets the COMMAND_READY bit in the status register to indicate that the TPM device is ready to receive a new command. This adds the probe function to the TPM Nuvoton driver and also updates the tpm_init() in tpm_chip.c to call the probe function. Signed-off-by: Claudio Carvalho <cclaudio@linux.vnet.ibm.com> [stewart@linux.vnet.ibm.com: squash commits into one] Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2016-10-10libstb: add tpm_chip interfaceClaudio Carvalho1-0/+117
This adds the TPM chip interface for libstb: - tpm_init(): call drivers' probe to find TPM devices that are compatible with them. - tpm_register_chip(): register a TPM chip which includes pointers to the TPM device and TPM driver structures. - tpm_add_status_property(): add the status device tree property for each registered TPM device. The TPM chip interface is documented in 'libstb/tpm_chip.h' and the tpm device tree node is documented in 'doc/device-tree/tpm.rst' Signed-off-by: Claudio Carvalho <cclaudio@linux.vnet.ibm.com> [stewart@linux.vnet.ibm.com: shuffle unused error path around] Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>