OSDN Git Service

verity: Fix the broken 'build_verity_tree -A'.
authorTao Bao <tbao@google.com>
Sat, 23 Sep 2017 05:09:32 +0000 (22:09 -0700)
committerTao Bao <tbao@google.com>
Sat, 23 Sep 2017 05:38:00 +0000 (22:38 -0700)
commit88d51357dc38642e709216ec2217b18e92884b35
tree3f612e62acf6e12db07a27bb19f460e037534fd5
parent1db7fa615d40c8eebd4fb844d8bef526b925822b
verity: Fix the broken 'build_verity_tree -A'.

Commit 6eb049322c26431961fb69168a113bfd27016ab3 introduced a bug in
checking if there's any passed-in salt string (via '-A <salt>' or '-a
<salt>'). "salt.data()" should be "salt.empty()", which otherwise may
or may not be nullptr even if salt is empty. This CL fixes the issue.

This CL also removes the duplicate variable 'salt_size', which can be
fully covered by salt.size().

Test: m build_verity_tree;
Test: `build_verity_tree system.img verity.img` gives random root hash
      and salt string across runs.
Test: `build_verity_tree -A <hex string> system.img verity.img` gives
      identical results across runs.
Test: `build_verity_tree -a <string> system.img verity.img` gives
      identical results across runs.
Change-Id: I377e42fc48c0f703dc33d813466f6ef60514bbe5
verity/build_verity_tree.cpp