summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@chromium.org>2017-10-03 11:08:53 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2017-10-24 01:53:44 +0000
commit55d60f1371963381144a97cb1dc7ee5a956efc48 (patch)
treeffc3ac57a613e471343972f4e743f63e50ab8042 /include
parent83061a192b03233097fd841643b9fb44d1610247 (diff)
downloadchrome-ec-55d60f1371963381144a97cb1dc7ee5a956efc48.tar.gz
common: add alternative TPM command execution context
The TPM task provides access to various cryptographic functions which require huge stack size. Some other contexts might require to execute these functions, but no other task in the system has enough stack. The suggested solution is to create an alternative TPM task execution path, where the command comes not from the communications interface (SPI or I2C), but from another task in the system. An interface function is created to allow a single task to pass the command to the TPM task. The task requesting the alternative execution path creates the command context, sends an event to the TPM task to alert it to the presence of the command and then polls the flag indicating that the TPM task has completed execution of the command. BRANCH=cr50 BUG=b:67008109 TEST=tested after applying the next patch (add console command for generating RMA auth challenge). Change-Id: I168489a5fbb4a3e1d718198812019116738b2f61 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/699523 (cherry picked from commit a960c5684cfadcec348ba101aa2cecea57e5e2ab) Reviewed-on: https://chromium-review.googlesource.com/734786
Diffstat (limited to 'include')
-rw-r--r--include/tpm_registers.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/include/tpm_registers.h b/include/tpm_registers.h
index ed26591791..38cb68ef9e 100644
--- a/include/tpm_registers.h
+++ b/include/tpm_registers.h
@@ -65,6 +65,26 @@ struct tpm_cmd_header {
} __packed;
/*
+ * This function allows to process a TPM command coming from elsewhere, not
+ * from the communications interface.
+ *
+ * A common use case would be making cryptographic calculation on task
+ * contexts where stack the size is not large enough, for instance console
+ * commands. This function will block to let the TPM task a chance to run to
+ * execute the command and return the result in the same buffer.
+ *
+ * @param tpmh pointer to a buffer containing a marshalled TPM command, if it
+ * arrived over the communications channel. One of the header
+ * fields defines the command size.
+ *
+ * @param buffer_size the size of the buffer pointed to by tpmh - tells the
+ * TPM task how much room there is to store the response.
+ *
+ * Command execution result is reported in the response body.
+ */
+void tpm_alt_extension(struct tpm_cmd_header *tpmh, size_t buffer_size);
+
+/*
* The only TPM2 command we care about on the driver level, see
* crosbug.com/p/55667 for detals.
*/