diff options
author | Maksim Denisov <denisov.maksim@huawei.com> | 2024-07-12 11:35:56 +0200 |
---|---|---|
committer | Maksim Denisov <denisov.maksim@huawei.com> | 2024-07-22 17:01:13 +0200 |
commit | f7cd59d7578739849d1b11cd18255c6682007bd4 (patch) | |
tree | d26488af49417c2daca97812a4ae9d62184f401d | |
parent | 96b4474027c9dba57bb943d84e67be402175ccc8 (diff) | |
download | justbuild-f7cd59d7578739849d1b11cd18255c6682007bd4.tar.gz |
Use a fixed HashFunction in install_cas
...to calculate the empty compatible hash.
-rw-r--r-- | src/buildtool/main/install_cas.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/buildtool/main/install_cas.cpp b/src/buildtool/main/install_cas.cpp index 8af7a2df..3c460200 100644 --- a/src/buildtool/main/install_cas.cpp +++ b/src/buildtool/main/install_cas.cpp @@ -32,7 +32,10 @@ namespace { [[nodiscard]] auto InvalidSizeString(std::string const& size_str, std::string const& hash, bool has_remote) noexcept -> bool { - static auto const kEmptyHash = HashFunction::Instance().ComputeBlobHash(""); + // Only in compatible mode the size is checked, so an empty SHA256 hash is + // needed. + static auto const kEmptyHash = + HashFunction{HashFunction::JustHash::Compatible}.ComputeBlobHash(""); return Compatibility::IsCompatible() and // native mode is fine (size_str == "0" or size_str.empty()) and // not "0" or "" is fine kEmptyHash.HexString() != hash and // empty hash is fine |