Commit 0afd9056 authored by Jason Gunthorpe's avatar Jason Gunthorpe Committed by James Morris

tpm-fixup-pcrs-sysfs-file-update

Signed-off-by: default avatarJason Gunthorpe <jgunthorpe@obsidianresearch.com>
Cc: Debora Velarde <debora@linux.vnet.ibm.com>
Cc: Rajiv Andrade <srajiv@linux.vnet.ibm.com>
Cc: Marcel Selhorst <m.selhorst@sirrix.com>
Cc: James Morris <jmorris@namei.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarJames Morris <jmorris@namei.org>
parent 764db03f
...@@ -742,7 +742,7 @@ EXPORT_SYMBOL_GPL(tpm_pcr_read); ...@@ -742,7 +742,7 @@ EXPORT_SYMBOL_GPL(tpm_pcr_read);
* the module usage count. * the module usage count.
*/ */
#define TPM_ORD_PCR_EXTEND cpu_to_be32(20) #define TPM_ORD_PCR_EXTEND cpu_to_be32(20)
#define EXTEND_PCR_SIZE 34 #define EXTEND_PCR_RESULT_SIZE 34
static struct tpm_input_header pcrextend_header = { static struct tpm_input_header pcrextend_header = {
.tag = TPM_TAG_RQU_COMMAND, .tag = TPM_TAG_RQU_COMMAND,
.length = cpu_to_be32(34), .length = cpu_to_be32(34),
...@@ -760,10 +760,9 @@ int tpm_pcr_extend(u32 chip_num, int pcr_idx, const u8 *hash) ...@@ -760,10 +760,9 @@ int tpm_pcr_extend(u32 chip_num, int pcr_idx, const u8 *hash)
return -ENODEV; return -ENODEV;
cmd.header.in = pcrextend_header; cmd.header.in = pcrextend_header;
BUILD_BUG_ON(be32_to_cpu(cmd.header.in.length) > EXTEND_PCR_SIZE);
cmd.params.pcrextend_in.pcr_idx = cpu_to_be32(pcr_idx); cmd.params.pcrextend_in.pcr_idx = cpu_to_be32(pcr_idx);
memcpy(cmd.params.pcrextend_in.hash, hash, TPM_DIGEST_SIZE); memcpy(cmd.params.pcrextend_in.hash, hash, TPM_DIGEST_SIZE);
rc = transmit_cmd(chip, &cmd, cmd.header.in.length, rc = transmit_cmd(chip, &cmd, EXTEND_PCR_RESULT_SIZE,
"attempting extend a PCR value"); "attempting extend a PCR value");
module_put(chip->dev->driver->owner); module_put(chip->dev->driver->owner);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment