summaryrefslogtreecommitdiff
path: root/drivers/char/tpm/tpm-buf.c
diff options
context:
space:
mode:
authorJames Bottomley <James.Bottomley@HansenPartnership.com>2024-04-29 23:28:03 +0300
committerJarkko Sakkinen <jarkko@kernel.org>2024-05-09 22:30:51 +0300
commit699e3efd6c645c741ea4d6d58282c56b6d108cf7 (patch)
treed18c0bf357bbef9fc5adfc6bfd51cc3a4a4aa769 /drivers/char/tpm/tpm-buf.c
parent033ee84e5f01c86997cde29947805e9781ddf233 (diff)
downloadlinux-699e3efd6c645c741ea4d6d58282c56b6d108cf7.tar.xz
tpm: Add HMAC session start and end functions
Add session based HMAC authentication plus parameter decryption and response encryption using AES. The basic design is to segregate all the nasty crypto, hash and hmac code into tpm2-sessions.c and export a usable API. The API first of all starts off by gaining a session with tpm2_start_auth_session() which initiates a session with the TPM and allocates an opaque tpm2_auth structure to handle the session parameters. The design is that session use will be single threaded from start to finish under the ops lock, so the tpm2_auth structure is stored in struct tpm2_chip to simpify the externally visible API. The session can be ended with tpm2_end_auth_session() which is designed only to be used in error legs. Ordinarily the further session API (future patches) will end or continue the session appropriately without having to call this. Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> # crypto API parts Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org> Tested-by: Jarkko Sakkinen <jarkko@kernel.org> Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
Diffstat (limited to 'drivers/char/tpm/tpm-buf.c')
-rw-r--r--drivers/char/tpm/tpm-buf.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/char/tpm/tpm-buf.c b/drivers/char/tpm/tpm-buf.c
index 6e4595cc98bc..647c6ca92ac3 100644
--- a/drivers/char/tpm/tpm-buf.c
+++ b/drivers/char/tpm/tpm-buf.c
@@ -44,6 +44,7 @@ void tpm_buf_reset(struct tpm_buf *buf, u16 tag, u32 ordinal)
head->tag = cpu_to_be16(tag);
head->length = cpu_to_be32(sizeof(*head));
head->ordinal = cpu_to_be32(ordinal);
+ buf->handles = 0;
}
EXPORT_SYMBOL_GPL(tpm_buf_reset);