summaryrefslogtreecommitdiff
path: root/extra
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@chromium.org>2018-01-05 16:16:07 -0800
committerchrome-bot <chrome-bot@chromium.org>2018-01-10 15:44:29 -0800
commit877e5909b403cd40b415757b2921594bb6d8a021 (patch)
treed651caeee9b765a6e35bf29812f65a1fa6f9abd2 /extra
parent4cb76d6c526da009808579b05f8cb7c409ce2ead (diff)
downloadchrome-ec-877e5909b403cd40b415757b2921594bb6d8a021.tar.gz
ccd: prepare for handling crucial CCD commands through TPM task context
We want CCD commands lock, open, password, and unlock (at least to start with) to be available over both CLI and through crosh (i.e. coming over /dev/tpm0). Let's allocate a TPM vendor command for handling all CCD subcommands, and move to this new framework the 'ccd password' command, which already is available over vendor command. BRANCH=cr50 BUG=b:62537474 TEST=verified that 'ccd password' still works both over Suzy-Q CLI and using gsctool on the target. Change-Id: I2d06230b762f47af7e580b188a587bc5678ca169 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/853280 Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'extra')
-rw-r--r--extra/usb_updater/gsctool.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/extra/usb_updater/gsctool.c b/extra/usb_updater/gsctool.c
index 205983e198..2dc0b6568c 100644
--- a/extra/usb_updater/gsctool.c
+++ b/extra/usb_updater/gsctool.c
@@ -27,6 +27,7 @@
#include "config.h"
+#include "ccd_config.h"
#include "compile_time_macros.h"
#include "misc_util.h"
#include "signed_header.h"
@@ -1585,12 +1586,13 @@ static void process_password(struct transfer_descriptor *td)
}
/*
- * Ok, we have a password, let's drop the newline in the end and send
- * it down.
+ * Ok, we have a password, let's move it in the buffer to overwrite
+ * the newline and free a byte to prepend the subcommand code.
*/
- password[--len] = '\0';
+ memmove(password + 1, password, len - 1);
+ password[0] = CCDV_PASSWORD;
response_size = sizeof(response);
- rv = send_vendor_command(td, VENDOR_CC_CCD_PASSWORD,
+ rv = send_vendor_command(td, VENDOR_CC_CCD,
password, len,
&response, &response_size);
free(password);