From 2e0822abc954e80d695583cf1d8f0bec0e591c7d Mon Sep 17 00:00:00 2001 From: Dmitrii Okunev Date: Mon, 29 Jan 2024 17:16:07 +0000 Subject: [PATCH] pcr0tool: Minor improvements * List commands alphabetically. * Use log.Fatalf instead of panic --- cmd/pcr0tool/commands/pcrread/command.go | 2 +- cmd/pcr0tool/main.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/pcr0tool/commands/pcrread/command.go b/cmd/pcr0tool/commands/pcrread/command.go index 5bf2ab08..7fa16396 100644 --- a/cmd/pcr0tool/commands/pcrread/command.go +++ b/cmd/pcr0tool/commands/pcrread/command.go @@ -71,7 +71,7 @@ func (cmd Command) Execute(ctx context.Context, args []string) { } } if hashAlgo == tpm2.AlgUnknown { - panic(fmt.Errorf("algo '%s' is unknown", *cmd.hashAlgo)) + log.Fatalf("algo '%s' is unknown", *cmd.hashAlgo) } pcr, err := tpm.ReadPCRFromTPM(pcr.ID(pcrIndex), hashAlgo) assertNoError(err) diff --git a/cmd/pcr0tool/main.go b/cmd/pcr0tool/main.go index db854830..2228ebf6 100644 --- a/cmd/pcr0tool/main.go +++ b/cmd/pcr0tool/main.go @@ -32,9 +32,9 @@ var knownCommands = map[string]commands.Command{ "display_fwinfo": &displayfwinfo.Command{}, "dump_fit": &dumpfit.Command{}, "dump_registers": &dumpregisters.Command{}, + "pcrread": &pcrread.Command{}, "printnodes": &printnodes.Command{}, "validate_security": &validatesecurity.Command{}, - "pcrread": &pcrread.Command{}, "sum": &sum.Command{}, }