linux/drivers/char/tpm
Tadeusz Struk 9488585b21 tpm: add support for partial reads
Currently to read a response from the TPM device an application needs
provide big enough buffer for the whole response and read it in one go.
The application doesn't know how big the response it beforehand so it
always needs to maintain a 4K buffer and read the max (4K).
In case if the user of the TSS library doesn't provide big enough
buffer the TCTI spec says that the library should set the required
size and return TSS2_TCTI_RC_INSUFFICIENT_BUFFER error code so that the
application could allocate a bigger buffer and call receive again.
To make it possible in the TSS library, this requires being able to do
partial reads from the driver.
The library would read the 10 bytes header first to get the actual size
of the response from the header, and then read the rest of the response.

This patch adds support for partial reads, i.e. the user can read the
response in one or multiple reads, until the whole response is consumed.
The user can also read only part of the response and ignore
the rest by issuing a new write to send a new command.

Signed-off-by: Tadeusz Struk <tadeusz.struk@intel.com>
Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Tested-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
2018-12-17 13:45:10 +02:00
..
eventlog tpm: replace kmalloc() + memcpy() with kmemdup() 2018-05-14 13:59:52 +03:00
st33zp24 tpm: move tpm 1.x selftest code from tpm-interface.c tpm1-cmd.c 2018-11-13 13:46:30 +02:00
Kconfig tpm: Make SECURITYFS a weak dependency 2018-10-05 13:47:33 +03:00
Makefile tpm: factor out tpm 1.x duration calculation to tpm1-cmd.c 2018-11-13 13:46:29 +02:00
tpm1-cmd.c tpm: use u32 instead of int for PCR index 2018-11-13 13:46:31 +02:00
tpm2-cmd.c tpm: fix kdoc for tpm2_flush_context_cmd() 2018-11-13 13:46:32 +02:00
tpm2-space.c tpm: tpm-space.c remove unneeded semicolon 2018-11-13 13:46:31 +02:00
tpm_atmel.c tpm/tpm_atmel: remove unnecessary NULL check 2017-06-19 02:36:04 +02:00
tpm_atmel.h tpm: remove tpm_read_index and tpm_write_index from tpm.h 2017-02-03 22:03:14 +02:00
tpm_crb.c tpm: separate cmd_ready/go_idle from runtime_pm 2018-07-28 17:03:11 +03:00
tpm_i2c_atmel.c tpm: Factor out common startup code 2016-07-19 17:43:38 +03:00
tpm_i2c_infineon.c tpm/tpm_i2c_infineon: switch to i2c_lock_bus(..., I2C_LOCK_SEGMENT) 2018-07-28 17:03:11 +03:00
tpm_i2c_nuvoton.c tpm: add tpm_calc_ordinal_duration() wrapper 2018-11-13 13:46:30 +02:00
tpm_ibmvtpm.c tpm: tpm_ibmvtpm: fix kdoc warnings 2018-11-13 13:46:32 +02:00
tpm_ibmvtpm.h tpm_ibmvtpm: properly handle interrupted packet receptions 2015-12-20 15:27:12 +02:00
tpm_infineon.c tpm: replace msleep() with usleep_range() in TPM 1.2/2.0 generic drivers 2017-09-23 21:51:00 -07:00
tpm_nsc.c tpm: remove tpm_read_index and tpm_write_index from tpm.h 2017-02-03 22:03:14 +02:00
tpm_ppi.c ACPI: Switch to use generic guid_t in acpi_evaluate_dsm() 2017-06-07 12:20:49 +02:00
tpm_tis_core.c tpm: move tpm 1.x selftest code from tpm-interface.c tpm1-cmd.c 2018-11-13 13:46:30 +02:00
tpm_tis_core.h tpm: Allow tpm_tis drivers to set hwrng quality. 2018-07-28 17:03:11 +03:00
tpm_tis_spi.c tpm_tis_spi: Pass the SPI IRQ down to the driver 2018-07-28 17:03:11 +03:00
tpm_tis.c tpm: remove unused variables 2018-01-08 12:58:54 +02:00
tpm_vtpm_proxy.c tpm: replace TPM_TRANSMIT_RAW with TPM_TRANSMIT_NESTED 2018-07-28 17:03:11 +03:00
tpm-chip.c tpm: add tpm_auto_startup() into tpm-interface.c 2018-11-13 13:46:31 +02:00
tpm-dev-common.c tpm: add support for partial reads 2018-12-17 13:45:10 +02:00
tpm-dev.c tpm: add support for nonblocking operation 2018-10-05 13:47:33 +03:00
tpm-dev.h tpm: add support for partial reads 2018-12-17 13:45:10 +02:00
tpm-interface.c tpm: tpm_try_transmit() refactor error flow. 2018-11-13 13:46:32 +02:00
tpm-sysfs.c tpm: use u32 instead of int for PCR index 2018-11-13 13:46:31 +02:00
tpm.h tpm: use u32 instead of int for PCR index 2018-11-13 13:46:31 +02:00
tpmrm-dev.c tpm: add support for nonblocking operation 2018-10-05 13:47:33 +03:00
xen-tpmfront.c tpm: add tpm_calc_ordinal_duration() wrapper 2018-11-13 13:46:30 +02:00