tpm2-cmd.c (6ea24cf79e055f0a62a64baa8587e2254a493c7b) tpm2-cmd.c (8cfffc9d4d3786d3b496a021d7224e06328bac7d)
1/*
2 * Copyright (C) 2014, 2015 Intel Corporation
3 *
4 * Authors:
5 * Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
6 *
7 * Maintained by: <tpmdd-devel@lists.sourceforge.net>
8 *

--- 583 unchanged lines hidden (view full) ---

592
593static void tpm2_flush_context(struct tpm_chip *chip, u32 handle)
594{
595 struct tpm_buf buf;
596 int rc;
597
598 rc = tpm_buf_init(&buf, TPM2_ST_NO_SESSIONS, TPM2_CC_FLUSH_CONTEXT);
599 if (rc) {
1/*
2 * Copyright (C) 2014, 2015 Intel Corporation
3 *
4 * Authors:
5 * Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
6 *
7 * Maintained by: <tpmdd-devel@lists.sourceforge.net>
8 *

--- 583 unchanged lines hidden (view full) ---

592
593static void tpm2_flush_context(struct tpm_chip *chip, u32 handle)
594{
595 struct tpm_buf buf;
596 int rc;
597
598 rc = tpm_buf_init(&buf, TPM2_ST_NO_SESSIONS, TPM2_CC_FLUSH_CONTEXT);
599 if (rc) {
600 dev_warn(chip->pdev, "0x%08x was not flushed, out of memory\n",
600 dev_warn(&chip->dev, "0x%08x was not flushed, out of memory\n",
601 handle);
602 return;
603 }
604
605 tpm_buf_append_u32(&buf, handle);
606
607 rc = tpm_transmit_cmd(chip, buf.data, PAGE_SIZE, "flushing context");
608 if (rc)
601 handle);
602 return;
603 }
604
605 tpm_buf_append_u32(&buf, handle);
606
607 rc = tpm_transmit_cmd(chip, buf.data, PAGE_SIZE, "flushing context");
608 if (rc)
609 dev_warn(chip->pdev, "0x%08x was not flushed, rc=%d\n", handle,
609 dev_warn(&chip->dev, "0x%08x was not flushed, rc=%d\n", handle,
610 rc);
611
612 tpm_buf_destroy(&buf);
613}
614
615static int tpm2_unseal(struct tpm_chip *chip,
616 struct trusted_key_payload *payload,
617 struct trusted_key_options *options,

--- 147 unchanged lines hidden (view full) ---

765 cmd.params.startup_in.startup_type = cpu_to_be16(shutdown_type);
766
767 rc = tpm_transmit_cmd(chip, &cmd, sizeof(cmd), "stopping the TPM");
768
769 /* In places where shutdown command is sent there's no much we can do
770 * except print the error code on a system failure.
771 */
772 if (rc < 0)
610 rc);
611
612 tpm_buf_destroy(&buf);
613}
614
615static int tpm2_unseal(struct tpm_chip *chip,
616 struct trusted_key_payload *payload,
617 struct trusted_key_options *options,

--- 147 unchanged lines hidden (view full) ---

765 cmd.params.startup_in.startup_type = cpu_to_be16(shutdown_type);
766
767 rc = tpm_transmit_cmd(chip, &cmd, sizeof(cmd), "stopping the TPM");
768
769 /* In places where shutdown command is sent there's no much we can do
770 * except print the error code on a system failure.
771 */
772 if (rc < 0)
773 dev_warn(chip->pdev, "transmit returned %d while stopping the TPM",
773 dev_warn(&chip->dev, "transmit returned %d while stopping the TPM",
774 rc);
775}
776EXPORT_SYMBOL_GPL(tpm2_shutdown);
777
778/*
779 * tpm2_calc_ordinal_duration() - maximum duration for a command
780 * @chip: TPM chip to use.
781 * @ordinal: command code number.

--- 50 unchanged lines hidden (view full) ---

832
833 rc = tpm_transmit_cmd(chip, &cmd, TPM2_SELF_TEST_IN_SIZE,
834 "continue selftest");
835
836 /* At least some prototype chips seem to give RC_TESTING error
837 * immediately. This is a workaround for that.
838 */
839 if (rc == TPM2_RC_TESTING) {
774 rc);
775}
776EXPORT_SYMBOL_GPL(tpm2_shutdown);
777
778/*
779 * tpm2_calc_ordinal_duration() - maximum duration for a command
780 * @chip: TPM chip to use.
781 * @ordinal: command code number.

--- 50 unchanged lines hidden (view full) ---

832
833 rc = tpm_transmit_cmd(chip, &cmd, TPM2_SELF_TEST_IN_SIZE,
834 "continue selftest");
835
836 /* At least some prototype chips seem to give RC_TESTING error
837 * immediately. This is a workaround for that.
838 */
839 if (rc == TPM2_RC_TESTING) {
840 dev_warn(chip->pdev, "Got RC_TESTING, ignoring\n");
840 dev_warn(&chip->dev, "Got RC_TESTING, ignoring\n");
841 rc = 0;
842 }
843
844 return rc;
845}
846
847/**
848 * tpm2_do_selftest() - run a full self test

--- 97 unchanged lines hidden ---
841 rc = 0;
842 }
843
844 return rc;
845}
846
847/**
848 * tpm2_do_selftest() - run a full self test

--- 97 unchanged lines hidden ---