On Wed, Nov 14, 2018 at 04:31:05PM +0100, Roberto Sassu wrote: > Currently the TPM driver allows other kernel subsystems to read only the > SHA1 PCR bank. This patch modifies the parameters of tpm_pcr_read() and > tpm2_pcr_read() to pass a tpm_digest structure, which contains the desired > hash algorithm. Also, since commit 125a22105410 ("tpm: React correctly to > RC_TESTING from TPM 2.0 self tests") removed the call to tpm2_pcr_read(), > the new parameter is expected to be always not NULL. > > Due to the API change, IMA functions have been modified. > > Signed-off-by: Roberto Sassu <roberto.sassu@xxxxxxxxxx> > Acked-by: Mimi Zohar <zohar@xxxxxxxxxxxxx> > --- > drivers/char/tpm/tpm-interface.c | 9 +++++---- > drivers/char/tpm/tpm.h | 3 ++- > drivers/char/tpm/tpm2-cmd.c | 23 ++++++++++++++++------- > include/linux/tpm.h | 6 ++++-- > security/integrity/ima/ima_crypto.c | 10 +++++----- > 5 files changed, 32 insertions(+), 19 deletions(-) > > diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c > index 96c8261d0f04..04aa39432f58 100644 > --- a/drivers/char/tpm/tpm-interface.c > +++ b/drivers/char/tpm/tpm-interface.c > @@ -451,11 +451,12 @@ EXPORT_SYMBOL_GPL(tpm_is_tpm2); > * tpm_pcr_read - read a PCR value from SHA1 bank > * @chip: a &struct tpm_chip instance, %NULL for the default chip > * @pcr_idx: the PCR to be retrieved > - * @res_buf: the value of the PCR > + * @digest_struct: the PCR bank and buffer current PCR value is written to > * > * Return: same as with tpm_transmit_cmd() > */ > -int tpm_pcr_read(struct tpm_chip *chip, u32 pcr_idx, u8 *res_buf) > +int tpm_pcr_read(struct tpm_chip *chip, u32 pcr_idx, > + struct tpm_digest *digest_struct) Should be just struct tpm_digest *digest /Jarkko