Skip to content

Commit 2e19e10

Browse files
b49020Jarkko Sakkinen
authored andcommitted
KEYS: trusted: Move TPM2 trusted keys code
Move TPM2 trusted keys code to trusted keys subsystem. The reason being it's better to consolidate all the trusted keys code to a single location so that it can be maintained sanely. Also, utilize existing tpm_send() exported API which wraps the internal tpm_transmit_cmd() API. Suggested-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> Signed-off-by: Sumit Garg <sumit.garg@linaro.org> Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> Tested-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
1 parent 47f9c27 commit 2e19e10

8 files changed

Lines changed: 342 additions & 394 deletions

File tree

‎drivers/char/tpm/tpm-interface.c‎

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -459,62 +459,6 @@ int tpm_get_random(struct tpm_chip *chip, u8 *out, size_t max)
459459
}
460460
EXPORT_SYMBOL_GPL(tpm_get_random);
461461

462-
/**
463-
* tpm_seal_trusted() - seal a trusted key payload
464-
* @chip: a &struct tpm_chip instance, %NULL for the default chip
465-
* @options: authentication values and other options
466-
* @payload: the key data in clear and encrypted form
467-
*
468-
* Note: only TPM 2.0 chip are supported. TPM 1.x implementation is located in
469-
* the keyring subsystem.
470-
*
471-
* Return: same as with tpm_transmit_cmd()
472-
*/
473-
int tpm_seal_trusted(struct tpm_chip *chip, struct trusted_key_payload *payload,
474-
struct trusted_key_options *options)
475-
{
476-
int rc;
477-
478-
chip = tpm_find_get_ops(chip);
479-
if (!chip || !(chip->flags & TPM_CHIP_FLAG_TPM2))
480-
return -ENODEV;
481-
482-
rc = tpm2_seal_trusted(chip, payload, options);
483-
484-
tpm_put_ops(chip);
485-
return rc;
486-
}
487-
EXPORT_SYMBOL_GPL(tpm_seal_trusted);
488-
489-
/**
490-
* tpm_unseal_trusted() - unseal a trusted key
491-
* @chip: a &struct tpm_chip instance, %NULL for the default chip
492-
* @options: authentication values and other options
493-
* @payload: the key data in clear and encrypted form
494-
*
495-
* Note: only TPM 2.0 chip are supported. TPM 1.x implementation is located in
496-
* the keyring subsystem.
497-
*
498-
* Return: same as with tpm_transmit_cmd()
499-
*/
500-
int tpm_unseal_trusted(struct tpm_chip *chip,
501-
struct trusted_key_payload *payload,
502-
struct trusted_key_options *options)
503-
{
504-
int rc;
505-
506-
chip = tpm_find_get_ops(chip);
507-
if (!chip || !(chip->flags & TPM_CHIP_FLAG_TPM2))
508-
return -ENODEV;
509-
510-
rc = tpm2_unseal_trusted(chip, payload, options);
511-
512-
tpm_put_ops(chip);
513-
514-
return rc;
515-
}
516-
EXPORT_SYMBOL_GPL(tpm_unseal_trusted);
517-
518462
static int __init tpm_init(void)
519463
{
520464
int rc;

‎drivers/char/tpm/tpm.h‎

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -212,24 +212,13 @@ static inline void tpm_add_ppi(struct tpm_chip *chip)
212212
}
213213
#endif
214214

215-
static inline u32 tpm2_rc_value(u32 rc)
216-
{
217-
return (rc & BIT(7)) ? rc & 0xff : rc;
218-
}
219-
220215
int tpm2_get_timeouts(struct tpm_chip *chip);
221216
int tpm2_pcr_read(struct tpm_chip *chip, u32 pcr_idx,
222217
struct tpm_digest *digest, u16 *digest_size_ptr);
223218
int tpm2_pcr_extend(struct tpm_chip *chip, u32 pcr_idx,
224219
struct tpm_digest *digests);
225220
int tpm2_get_random(struct tpm_chip *chip, u8 *dest, size_t max);
226221
void tpm2_flush_context(struct tpm_chip *chip, u32 handle);
227-
int tpm2_seal_trusted(struct tpm_chip *chip,
228-
struct trusted_key_payload *payload,
229-
struct trusted_key_options *options);
230-
int tpm2_unseal_trusted(struct tpm_chip *chip,
231-
struct trusted_key_payload *payload,
232-
struct trusted_key_options *options);
233222
ssize_t tpm2_get_tpm_pt(struct tpm_chip *chip, u32 property_id,
234223
u32 *value, const char *desc);
235224

0 commit comments

Comments
 (0)