diff options
author | Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> | 2016-02-13 04:51:23 -0500 |
---|---|---|
committer | Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> | 2016-02-20 02:58:21 -0500 |
commit | c0b5eed110dcf520aadafefbcc40658cbdd18b95 (patch) | |
tree | 8015494d553b98e52d3ceacaae21b50de5e813a8 /drivers/char | |
parent | 8e0ee3c9faed7ca68807ea45141775856c438ac0 (diff) |
tpm: fix: set continueSession attribute for the unseal operation
It's better to set the continueSession attribute for the unseal
operation so that the session object is not removed as a side-effect
when the operation is successful. Since a user process created the
session, it should be also decide when the session is destroyed.
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Fixes: 5beb0c435b ("keys, trusted: seal with a TPM2 authorization policy")
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/tpm/tpm2-cmd.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/char/tpm/tpm2-cmd.c b/drivers/char/tpm/tpm2-cmd.c index 66e04b41a73d..b28e4da3d2cf 100644 --- a/drivers/char/tpm/tpm2-cmd.c +++ b/drivers/char/tpm/tpm2-cmd.c | |||
@@ -20,7 +20,11 @@ | |||
20 | #include <keys/trusted-type.h> | 20 | #include <keys/trusted-type.h> |
21 | 21 | ||
22 | enum tpm2_object_attributes { | 22 | enum tpm2_object_attributes { |
23 | TPM2_ATTR_USER_WITH_AUTH = BIT(6), | 23 | TPM2_OA_USER_WITH_AUTH = BIT(6), |
24 | }; | ||
25 | |||
26 | enum tpm2_session_attributes { | ||
27 | TPM2_SA_CONTINUE_SESSION = BIT(0), | ||
24 | }; | 28 | }; |
25 | 29 | ||
26 | struct tpm2_startup_in { | 30 | struct tpm2_startup_in { |
@@ -489,7 +493,7 @@ int tpm2_seal_trusted(struct tpm_chip *chip, | |||
489 | tpm_buf_append(&buf, options->policydigest, | 493 | tpm_buf_append(&buf, options->policydigest, |
490 | options->policydigest_len); | 494 | options->policydigest_len); |
491 | } else { | 495 | } else { |
492 | tpm_buf_append_u32(&buf, TPM2_ATTR_USER_WITH_AUTH); | 496 | tpm_buf_append_u32(&buf, TPM2_OA_USER_WITH_AUTH); |
493 | tpm_buf_append_u16(&buf, 0); | 497 | tpm_buf_append_u16(&buf, 0); |
494 | } | 498 | } |
495 | 499 | ||
@@ -627,7 +631,7 @@ static int tpm2_unseal(struct tpm_chip *chip, | |||
627 | options->policyhandle ? | 631 | options->policyhandle ? |
628 | options->policyhandle : TPM2_RS_PW, | 632 | options->policyhandle : TPM2_RS_PW, |
629 | NULL /* nonce */, 0, | 633 | NULL /* nonce */, 0, |
630 | 0 /* session_attributes */, | 634 | TPM2_SA_CONTINUE_SESSION, |
631 | options->blobauth /* hmac */, | 635 | options->blobauth /* hmac */, |
632 | TPM_DIGEST_SIZE); | 636 | TPM_DIGEST_SIZE); |
633 | 637 | ||