--- mimi.txt 2008-12-04 14:02:00.000000000 -0800 +++ mimi1.txt 2008-12-04 14:03:07.000000000 -0800 @@ -1,19 +1,18 @@ +/** -+ * tpm_pcr_read - read a pcr value ++ * tpm_pcr_extend - extend pcr value with hash + * @chip_id: tpm chip identifier + * Upper 2 bytes: ANY, HW_ONLY or SW_ONLY + * Lower 2 bytes: tpm idx # or AN& -+ * @pcr_idx: pcr idx to retrieve -+ * @res_buf: TPM_PCR value -+ * size of res_buf is 20 bytes (or NULL if you don't care) ++ * @pcr_idx: pcr idx to extend ++ * @hash: hash value used to extend pcr value + * + * The TPM driver should be built-in, but for whatever reason it + * isn't, protect against the chip disappearing, by incrementing + * the module usage count. + */ -+int tpm_pcr_read(u32 chip_id, int pcr_idx, u8 *res_buf) ++int tpm_pcr_extend(u32 chip_id, int pcr_idx, const u8 *hash) +{ -+ u8 data[READ_PCR_RESULT_SIZE]; ++ u8 data[EXTEND_PCR_SIZE]; + int rc; + __be32 index; + int chip_num = chip_id & TPM_CHIP_NUM_MASK; @@ -31,17 +30,15 @@ + } + rcu_read_unlock(); + -+ BUILD_BUG_ON(sizeof(pcrread) > READ_PCR_RESULT_SIZE); -+ memcpy(data, pcrread, sizeof(pcrread)); ++ BUILD_BUG_ON(sizeof(pcrextend) > EXTEND_PCR_SIZE); ++ memcpy(data, pcrextend, sizeof(pcrextend)); + index = cpu_to_be32(pcr_idx); + memcpy(data + 10, &index, 4); ++ memcpy(data + 14, hash, TPM_DIGEST_SIZE); + rc = tpm_transmit(chip, data, sizeof(data)); + if (rc > 0) + rc = get_unaligned_be32((__be32 *) (data + 6)); + -+ if (rc == 0 && res_buf) -+ memcpy(res_buf, data + 10, TPM_DIGEST_SIZE); -+ + module_put(chip->dev->driver->owner); + return rc; +}