summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorYicheng Li <yichengli@chromium.org>2019-05-22 13:47:14 -0700
committerCommit Bot <commit-bot@chromium.org>2019-06-07 22:45:22 +0000
commit8e7a7fb6cf9e7afcd1b80911c14ae76e8b9860fc (patch)
treed7b36abb4f7c6f9e4244f8c022b6f0119e070073 /util
parent9985215ea27b059e83870d4f7f93918ae058c2dd (diff)
downloadchrome-ec-8e7a7fb6cf9e7afcd1b80911c14ae76e8b9860fc.tar.gz
fpsensor: Add API to check FP sensor encryption status.
Add EC command for the host to query FP sensor encryption status. Currently it's just FP TPM seed has been set or not. Add unit test for this command. Also add ectool command for querying encryption status. BRANCH=nocturne BUG=chromium:952275 TEST=ran unittests TEST=tested enrollment, matching and multifinger on DUT nocturne. TEST=tested querying sensor encryption status using ectool. Change-Id: I07d1e471ead85a517105b38d1ddd793c3046ce8f Signed-off-by: Yicheng Li <yichengli@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1633272 Reviewed-by: Nicolas Norvez <norvez@chromium.org>
Diffstat (limited to 'util')
-rw-r--r--util/ectool.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/util/ectool.c b/util/ectool.c
index f306e47cc5..76f3c2cc18 100644
--- a/util/ectool.c
+++ b/util/ectool.c
@@ -133,6 +133,8 @@ const char help_str[] =
" Reads from EC flash to a file\n"
" flashwrite <offset> <infile>\n"
" Writes to EC flash from a file\n"
+ " fpencstatus\n"
+ " Prints status of Fingerprint sensor encryption engine\n"
" fpframe\n"
" Retrieve the finger image as a PGM image\n"
" fpinfo\n"
@@ -1657,6 +1659,31 @@ int cmd_fp_info(int argc, char *argv[])
return 0;
}
+static void print_fp_enc_flags(const char *desc, uint32_t flags)
+{
+ printf("%s 0x%08x", desc, flags);
+ if (flags & FP_ENC_STATUS_SEED_SET)
+ printf(" FPTPM_seed_set");
+ printf("\n");
+}
+
+int cmd_fp_enc_status(int argc, char *argv[])
+{
+ int rv;
+ struct ec_response_fp_encryption_status resp = { 0 };
+
+ rv = ec_command(EC_CMD_FP_ENC_STATUS, 0, NULL, 0, &resp, sizeof(resp));
+ if (rv < 0) {
+ printf("Get FP sensor encryption status failed.\n");
+ } else {
+ print_fp_enc_flags("FPMCU encryption status:", resp.status);
+ print_fp_enc_flags("Valid flags: ",
+ resp.valid_flags);
+ rv = 0;
+ }
+ return rv;
+}
+
int cmd_fp_frame(int argc, char *argv[])
{
struct ec_response_fp_info r;
@@ -8660,6 +8687,7 @@ const struct command commands[] = {
{"flashspiinfo", cmd_flash_spi_info},
{"flashpd", cmd_flash_pd},
{"forcelidopen", cmd_force_lid_open},
+ {"fpencstatus", cmd_fp_enc_status},
{"fpframe", cmd_fp_frame},
{"fpinfo", cmd_fp_info},
{"fpmode", cmd_fp_mode},