Skip to content

Commit fefb9f1

Browse files
James Bottomleyjarkkojs
authored andcommitted
tpm: export the context save and load commands
The TPM2 session HMAC and encryption handling code needs to save and restore a single volatile context for the elliptic curve version of the NULL seed, so export the APIs which do this for internal use. Signed-off-by: James Bottomley <[email protected]> Reviewed-by: Stefan Berger <[email protected]> Reviewed-by: Jarkko Sakkinen <[email protected]> Tested-by: Jarkko Sakkinen <[email protected]> Signed-off-by: Jarkko Sakkinen <[email protected]>
1 parent 11189d6 commit fefb9f1

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

drivers/char/tpm/tpm.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,10 @@ int tpm2_commit_space(struct tpm_chip *chip, struct tpm_space *space, void *buf,
312312
size_t *bufsiz);
313313
int tpm_devs_add(struct tpm_chip *chip);
314314
void tpm_devs_remove(struct tpm_chip *chip);
315+
int tpm2_save_context(struct tpm_chip *chip, u32 handle, u8 *buf,
316+
unsigned int buf_size, unsigned int *offset);
317+
int tpm2_load_context(struct tpm_chip *chip, u8 *buf,
318+
unsigned int *offset, u32 *handle);
315319

316320
void tpm_bios_log_setup(struct tpm_chip *chip);
317321
void tpm_bios_log_teardown(struct tpm_chip *chip);

drivers/char/tpm/tpm2-space.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ void tpm2_del_space(struct tpm_chip *chip, struct tpm_space *space)
6868
kfree(space->session_buf);
6969
}
7070

71-
static int tpm2_load_context(struct tpm_chip *chip, u8 *buf,
72-
unsigned int *offset, u32 *handle)
71+
int tpm2_load_context(struct tpm_chip *chip, u8 *buf,
72+
unsigned int *offset, u32 *handle)
7373
{
7474
struct tpm_buf tbuf;
7575
struct tpm2_context *ctx;
@@ -119,8 +119,8 @@ static int tpm2_load_context(struct tpm_chip *chip, u8 *buf,
119119
return 0;
120120
}
121121

122-
static int tpm2_save_context(struct tpm_chip *chip, u32 handle, u8 *buf,
123-
unsigned int buf_size, unsigned int *offset)
122+
int tpm2_save_context(struct tpm_chip *chip, u32 handle, u8 *buf,
123+
unsigned int buf_size, unsigned int *offset)
124124
{
125125
struct tpm_buf tbuf;
126126
unsigned int body_size;

0 commit comments

Comments
 (0)