From 877e5909b403cd40b415757b2921594bb6d8a021 Mon Sep 17 00:00:00 2001 From: Vadim Bendebury Date: Fri, 5 Jan 2018 16:16:07 -0800 Subject: 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 Reviewed-on: https://chromium-review.googlesource.com/853280 Reviewed-by: Randall Spangler --- extra/usb_updater/gsctool.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'extra/usb_updater/gsctool.c') 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); -- cgit v1.2.1