summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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,
};