From b946052a56318dc1f4f04e6f0205d93cd66f2851 Mon Sep 17 00:00:00 2001 From: Vadim Bendebury Date: Wed, 10 Jan 2018 11:09:50 -0800 Subject: ccd: refactor to allow clear indication of CCD command being in progress We want to be able to tell between cases when a CCD command executed on the TPM vendor command context was invoked through CLI or received over /dev/tpm0. Let's add a flag set for the duration of execution of the CLI command. BRANCH=cr50 BUG=b:62537474 TEST=none, this is not used yet. Change-Id: I309b4364285816a5f54522b00c93a4bf5025e2c4 Signed-off-by: Vadim Bendebury Reviewed-on: https://chromium-review.googlesource.com/860913 Reviewed-by: Randall Spangler --- common/ccd_config.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'common') diff --git a/common/ccd_config.c b/common/ccd_config.c index bbf3b10f67..bb535dea06 100644 --- a/common/ccd_config.c +++ b/common/ccd_config.c @@ -152,6 +152,7 @@ static struct ccd_config config; static uint8_t ccd_config_loaded; static uint8_t force_disabled; static struct mutex ccd_config_mutex; +static uint8_t ccd_console_active; /* CCD console command is in progress. */ /******************************************************************************/ /* Raw config accessors */ @@ -1163,7 +1164,7 @@ static int command_ccd_help(void) /** * Case closed debugging config command. */ -static int command_ccd(int argc, char **argv) +static int command_ccd_body(int argc, char **argv) { /* If no args or 'get', print info */ if (argc < 2 || !strcasecmp(argv[1], "get")) @@ -1205,6 +1206,17 @@ static int command_ccd(int argc, char **argv) /* Anything else (including "help") prints help */ return command_ccd_help(); } + +static int command_ccd(int argc, char **argv) +{ + int rv; + + ccd_console_active = 1; + rv = command_ccd_body(argc, argv); + ccd_console_active = 0; + + return rv; +} DECLARE_SAFE_CONSOLE_COMMAND(ccd, command_ccd, "[help | ...]", "Configure case-closed debugging"); -- cgit v1.2.1