summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@chromium.org>2018-01-10 11:31:03 -0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2018-02-01 00:48:17 +0000
commitbdd8e5bbf7eec7bb6356e7bd30e07432251c02e6 (patch)
tree05bdf2489402665a9d082eab473a2b498c8e0fab
parent7fea01ecf3f35561ada34dff70fc608aa336802f (diff)
downloadchrome-ec-bdd8e5bbf7eec7bb6356e7bd30e07432251c02e6.tar.gz
ccd: add 'in progress' return value
Depending on device configuration and compile time options, CCD commands 'open' and 'unlock' could either be executed immediately, or require the user to take the device through physical presence state machine. As these commands execute through TPM vendor commands, there needs to be a different return value indicating that the command action is not finished and PP process is in progress. Let's add another vendor command return value, and do not consider it a failure if vendor command returns this value in response to 'ccd open' or 'ccd unlock'. BRANCH=cr50 BUG=b:62537474 TEST=took an Eve through 'ccd open' sequence Change-Id: Ie62ccfb4319a13b6fb6c1c854a0ea26beb9f517c Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/860999 Reviewed-by: Randall Spangler <rspangler@chromium.org> (cherry picked from commit 88c5e62f89a7d9eab423c8fd11dd49c51e512826) Reviewed-on: https://chromium-review.googlesource.com/896761
-rw-r--r--common/ccd_config.c19
-rw-r--r--include/tpm_vendor_cmds.h2
2 files changed, 14 insertions, 7 deletions
diff --git a/common/ccd_config.c b/common/ccd_config.c
index bb535dea06..185b29278a 100644
--- a/common/ccd_config.c
+++ b/common/ccd_config.c
@@ -826,6 +826,7 @@ static int ccd_command_wrapper(int argc, char *password,
struct ccd_vendor_cmd_header *vch;
size_t command_size;
size_t password_size;
+ uint32_t return_code;
if (argc > 1) {
password_size = strlen(password);
@@ -855,7 +856,8 @@ static int ccd_command_wrapper(int argc, char *password,
* Return status in the command code field now, in case of error,
* error code is the first byte after the header.
*/
- if (vch->tpm_header.command_code) {
+ return_code = be32toh(vch->tpm_header.command_code);
+ if (return_code && (return_code != VENDOR_RC_IN_PROGRESS)) {
ccprintf("Command error %d\n", vch->ccd_subcommand);
rv = EC_ERROR_UNKNOWN;
} else {
@@ -937,11 +939,12 @@ static enum vendor_cmd_rc ccd_open(void *buf,
buffer[0] = rv;
return VENDOR_RC_INTERNAL_ERROR;
}
- } else {
- /* No physical presence required; go straight to done */
- ccd_open_done();
+ return VENDOR_RC_IN_PROGRESS;
}
+ /* No physical presence required; go straight to done */
+ ccd_open_done();
+
return VENDOR_RC_SUCCESS;
}
@@ -1038,10 +1041,12 @@ static enum vendor_cmd_rc ccd_unlock(void *buf,
buffer[0] = rv;
return VENDOR_RC_INTERNAL_ERROR;
}
- } else {
- /* Unlock immediately */
- ccd_unlock_done();
+ return VENDOR_RC_IN_PROGRESS;
}
+
+ /* Unlock immediately */
+ ccd_unlock_done();
+
return VENDOR_RC_SUCCESS;
}
diff --git a/include/tpm_vendor_cmds.h b/include/tpm_vendor_cmds.h
index 390097a45c..55066dd221 100644
--- a/include/tpm_vendor_cmds.h
+++ b/include/tpm_vendor_cmds.h
@@ -73,6 +73,8 @@ enum vendor_cmd_rc {
VENDOR_RC_INTERNAL_ERROR = 6,
VENDOR_RC_NOT_ALLOWED = 7,
VENDOR_RC_NO_SUCH_SUBCOMMAND = 8,
+ VENDOR_RC_IN_PROGRESS = 9,
+
/* Only 7 bits available; max is 127 */
VENDOR_RC_NO_SUCH_COMMAND = 127,
};