diff options
author | Firas Sammoura <fsammoura@google.com> | 2023-03-14 02:53:11 +0000 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2023-03-15 02:18:07 +0000 |
commit | b68720a8a6492445555253308fbcae7ab53ecea1 (patch) | |
tree | 0810b3cc35177f80da044dfbbf6ec4eb1c96f38c | |
parent | b2c893485fc5017a4a440c4832e4a7fc17359af0 (diff) | |
download | chrome-ec-b68720a8a6492445555253308fbcae7ab53ecea1.tar.gz |
util: Use libec for FP_ENCRYPTION_STATUS
BRANCH=none
BUG=b:144959033
TEST=rm -rf build && make BOARD=host utils
Change-Id: Iade517026ef7c36846a5ce58629777ee9746db0f
Signed-off-by: Firas Sammoura <fsammoura@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4336841
Reviewed-by: Tom Hughes <tomhughes@chromium.org>
-rw-r--r-- | util/ectool.cc | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/util/ectool.cc b/util/ectool.cc index 57b37f6fd4..240760a9cf 100644 --- a/util/ectool.cc +++ b/util/ectool.cc @@ -38,6 +38,7 @@ #include <libec/add_entropy_command.h> #include <libec/ec_panicinfo.h> +#include <libec/fingerprint/fp_encryption_status_command.h> #include <libec/rand_num_command.h> /* Maximum flash size (16 MB, conservative) */ @@ -2460,17 +2461,21 @@ out: 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; + ec::FpEncryptionStatusCommand fp_encryptionstatus_command; + + if (!fp_encryptionstatus_command.Run(comm_get_fd())) { + int rv = -EECRESULT - fp_encryptionstatus_command.Result(); + fprintf(stderr, + "FP Encryption Status returned with errors: %d\n", rv); + return rv; } + print_fp_enc_flags("FPMCU encryption status:", + fp_encryptionstatus_command.GetStatus()); + print_fp_enc_flags("Valid flags: ", + fp_encryptionstatus_command.GetValidFlags()); + rv = 0; + return rv; } |