mbox series

[0/2] cmd: hash: correct parameter count check

Message ID 20241102100836.103005-1-heinrich.schuchardt@canonical.com
Headers show
Series cmd: hash: correct parameter count check | expand

Message

Heinrich Schuchardt Nov. 2, 2024, 10:08 a.m. UTC
Since commit 348ea878508d ("cmd: hash: fix param count check") the hash
command cannot be used without the optional variable name parameter if
CONFIG_HASH_VERIFY=y. 'hash sha1 $loadaddr $filesize' returns
CMD_RET_USAGE.

The minimum number of arguments is four no matter if verification is
enabled or not.

Fix the parameter check.

Provide a unit test.

Heinrich Schuchardt (2):
  cmd: hash: correct parameter count check
  test: unit test for hash command

 cmd/hash.c        |   2 +-
 test/cmd/Makefile |   1 +
 test/cmd/hash.c   | 101 ++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 103 insertions(+), 1 deletion(-)
 create mode 100644 test/cmd/hash.c