Commit 220167e6 authored by Jarkko Sakkinen's avatar Jarkko Sakkinen Committed by Greg Kroah-Hartman

tpm: fix: set continueSession attribute for the unseal operation

commit c0b5eed1 upstream.

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: default avatarJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Fixes: 5beb0c43 ("keys, trusted: seal with a TPM2 authorization policy")
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 5504693f
...@@ -20,7 +20,11 @@ ...@@ -20,7 +20,11 @@
#include <keys/trusted-type.h> #include <keys/trusted-type.h>
enum tpm2_object_attributes { enum tpm2_object_attributes {
TPM2_ATTR_USER_WITH_AUTH = BIT(6), TPM2_OA_USER_WITH_AUTH = BIT(6),
};
enum tpm2_session_attributes {
TPM2_SA_CONTINUE_SESSION = BIT(0),
}; };
struct tpm2_startup_in { struct tpm2_startup_in {
...@@ -489,7 +493,7 @@ int tpm2_seal_trusted(struct tpm_chip *chip, ...@@ -489,7 +493,7 @@ int tpm2_seal_trusted(struct tpm_chip *chip,
tpm_buf_append(&buf, options->policydigest, tpm_buf_append(&buf, options->policydigest,
options->policydigest_len); options->policydigest_len);
} else { } else {
tpm_buf_append_u32(&buf, TPM2_ATTR_USER_WITH_AUTH); tpm_buf_append_u32(&buf, TPM2_OA_USER_WITH_AUTH);
tpm_buf_append_u16(&buf, 0); tpm_buf_append_u16(&buf, 0);
} }
...@@ -627,7 +631,7 @@ static int tpm2_unseal(struct tpm_chip *chip, ...@@ -627,7 +631,7 @@ static int tpm2_unseal(struct tpm_chip *chip,
options->policyhandle ? options->policyhandle ?
options->policyhandle : TPM2_RS_PW, options->policyhandle : TPM2_RS_PW,
NULL /* nonce */, 0, NULL /* nonce */, 0,
0 /* session_attributes */, TPM2_SA_CONTINUE_SESSION,
options->blobauth /* hmac */, options->blobauth /* hmac */,
TPM_DIGEST_SIZE); TPM_DIGEST_SIZE);
......
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