Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1636421
| From | Roberto Sassu <roberto.sassu@huawei.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v2 4/5] keys, trusted: modify arguments of tpm_pcr_extend() |
| Date | 2017-05-05 16:30 +0200 |
| Message-ID | <tDMp4-2VD-7@gated-at.bofh.it> (permalink) |
| References | <tDMp3-2VD-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
pcrlock() has been modified to pass the correct arguments
to tpm_pcr_extend(): the pointer of a tpm2_digest structure containing
a random value generated by tpm_get_random() and the size of the array (1).
Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
---
security/keys/trusted.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/security/keys/trusted.c b/security/keys/trusted.c
index 2ae31c5..3eb89e6 100644
--- a/security/keys/trusted.c
+++ b/security/keys/trusted.c
@@ -377,15 +377,15 @@ static int trusted_tpm_send(const u32 chip_num, unsigned char *cmd,
*/
static int pcrlock(const int pcrnum)
{
- unsigned char hash[SHA1_DIGEST_SIZE];
+ struct tpm2_digest digestarg = {.alg_id = TPM2_ALG_SHA1};
int ret;
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
- ret = tpm_get_random(TPM_ANY_NUM, hash, SHA1_DIGEST_SIZE);
+ ret = tpm_get_random(TPM_ANY_NUM, digestarg.digest, SHA1_DIGEST_SIZE);
if (ret != SHA1_DIGEST_SIZE)
return ret;
- return tpm_pcr_extend(TPM_ANY_NUM, pcrnum, hash) ? -EINVAL : 0;
+ return tpm_pcr_extend(TPM_ANY_NUM, pcrnum, 1, &digestarg) ? -EINVAL : 0;
}
/*
--
2.9.3
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
[PATCH v2 4/5] keys, trusted: modify arguments of tpm_pcr_extend() Roberto Sassu <roberto.sassu@huawei.com> - 2017-05-05 16:30 +0200
csiph-web