Dawn: Fix Sha3 Update and add more unittest
This CL fix a bug in Sha3 Update to ensure the result is correct, and
add more testing vector from NIST CAVP which use much longer and
non-repeating inputs.
Bug: 402772741
Change-Id: I0978c946b7b78f256b35ca0666ed53193e7a0b0f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/233254
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@microsoft.com>
diff --git a/src/dawn/common/Sha3.cpp b/src/dawn/common/Sha3.cpp
index fe1cbbd..fd15e81 100644
--- a/src/dawn/common/Sha3.cpp
+++ b/src/dawn/common/Sha3.cpp
@@ -272,13 +272,15 @@
template <size_t OutputLength>
void Sha3<OutputLength>::Update(const void* data, size_t size) {
uint8_t* stateAsString = reinterpret_cast<uint8_t*>(&mState);
+ const uint8_t* dataAsBytes = static_cast<const uint8_t*>(data);
while (size > 0) {
DAWN_ASSERT(mOffsetInState < kByteRate);
size_t toProcess = std::min(size, kByteRate - mOffsetInState);
- memxorpy(stateAsString + mOffsetInState, data, toProcess);
+ memxorpy(stateAsString + mOffsetInState, dataAsBytes, toProcess);
size -= toProcess;
+ dataAsBytes += toProcess;
mOffsetInState += toProcess;
if (mOffsetInState == kByteRate) {
diff --git a/src/dawn/common/Sha3.h b/src/dawn/common/Sha3.h
index c3650b9..f54f056 100644
--- a/src/dawn/common/Sha3.h
+++ b/src/dawn/common/Sha3.h
@@ -62,6 +62,11 @@
static_assert(BitOutputLength == 224 || BitOutputLength == 256 || BitOutputLength == 384 ||
BitOutputLength == 512);
static constexpr size_t kByteCapacity = kByteOutputLength * 2;
+ // The byte rate of performing Keccak.
+ // * Sha3-224: 144 bytes
+ // * Sha3-256: 136 bytes
+ // * Sha3-384: 104 bytes
+ // * Sha3-512: 72 bytes
static constexpr size_t kByteRate = 1600 / 8 - kByteCapacity;
Sha3State mState = {};
diff --git a/src/dawn/tests/unittests/Sha3Tests.cpp b/src/dawn/tests/unittests/Sha3Tests.cpp
index 51f0af3..af1fbe1 100644
--- a/src/dawn/tests/unittests/Sha3Tests.cpp
+++ b/src/dawn/tests/unittests/Sha3Tests.cpp
@@ -25,13 +25,16 @@
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#include <variant>
+#include <vector>
+
#include "dawn/common/Sha3.h"
#include "gtest/gtest.h"
namespace dawn {
namespace {
-// All test vectors are taken from
+// Below test vectors are taken from
// https://csrc.nist.gov/projects/cryptographic-standards-and-guidelines/example-values
// Check that the internal Keccak function computes the correct update for the state.
@@ -67,6 +70,13 @@
}
}
+template <size_t N>
+void ExpectOutput(const std::array<uint8_t, N>& actual, const std::array<uint8_t, N>& expected) {
+ for (size_t i = 0; i < N; i++) {
+ EXPECT_EQ(actual[i], expected[i]);
+ }
+}
+
// Check that the correct values are computed in all by all the hash functions on the 1600 bit test
// vectors for each SHA3 version. (we don't use the other ones because they are not byte aligned).
TEST(Sha3, AllSizesOn1600BitTestVector) {
@@ -85,9 +95,7 @@
0xF9, 0xBB, 0xC2, 0xA1, 0xCB, 0x7E, 0x11, 0xE0};
Sha3_224::Output sha224Actual = Sha3_224::Hash(&message, sizeof(message));
- for (size_t i = 0; i < sha224Actual.size(); i++) {
- EXPECT_EQ(sha224Actual[i], sha224Expected[i]);
- }
+ ExpectOutput(sha224Actual, sha224Expected);
Sha3_256::Output sha256Expected = {0x79, 0xF3, 0x8A, 0xDE, 0xC5, 0xC2, 0x03, 0x07,
0xA9, 0x8E, 0xF7, 0x6E, 0x83, 0x24, 0xAF, 0xBF,
@@ -95,9 +103,7 @@
0xC6, 0x5F, 0xA1, 0xBD, 0x9D, 0xE3, 0x17, 0x87};
Sha3_256::Output sha256Actual = Sha3_256::Hash(&message, sizeof(message));
- for (size_t i = 0; i < sha256Actual.size(); i++) {
- EXPECT_EQ(sha256Actual[i], sha256Expected[i]);
- }
+ ExpectOutput(sha256Actual, sha256Expected);
Sha3_384::Output sha384Expected = {0x18, 0x81, 0xDE, 0x2C, 0xA7, 0xE4, 0x1E, 0xF9, 0x5D, 0xC4,
0x73, 0x2B, 0x8F, 0x5F, 0x00, 0x2B, 0x18, 0x9C, 0xC1, 0xE4,
@@ -106,9 +112,7 @@
0x9F, 0x2D, 0x70, 0x50, 0xDD, 0x47, 0x3E, 0x8F};
Sha3_384::Output sha384Actual = Sha3_384::Hash(&message, sizeof(message));
- for (size_t i = 0; i < sha384Actual.size(); i++) {
- EXPECT_EQ(sha384Actual[i], sha384Expected[i]);
- }
+ ExpectOutput(sha384Actual, sha384Expected);
Sha3_512::Output sha512Expected = {
0xE7, 0x6D, 0xFA, 0xD2, 0x20, 0x84, 0xA8, 0xB1, 0x46, 0x7F, 0xCF, 0x2F, 0xFA,
@@ -118,9 +122,7 @@
0xA1, 0xA4, 0xA8, 0x41, 0x6D, 0xF6, 0x54, 0x5A, 0x1C, 0xE8, 0xBA, 0x00};
Sha3_512::Output sha512Actual = Sha3_512::Hash(&message, sizeof(message));
- for (size_t i = 0; i < sha512Actual.size(); i++) {
- EXPECT_EQ(sha512Actual[i], sha512Expected[i]);
- }
+ ExpectOutput(sha512Actual, sha512Expected);
}
// Check that the correct values are computed by various non-1600 sizes for one of the variants
@@ -132,9 +134,7 @@
0xB1, 0xAB, 0xD4, 0x59, 0x7F, 0x9A, 0x1B, 0x07, 0x8E, 0x3F, 0x5B, 0x5A, 0x6B, 0xC7};
Sha3_224::Output sha224Actual = Sha3_224::Hash(nullptr, 0);
- for (size_t i = 0; i < sha224Actual.size(); i++) {
- EXPECT_EQ(sha224Actual[i], sha224Expected[i]);
- }
+ ExpectOutput(sha224Actual, sha224Expected);
}
// Test any amount of data that doesn't require any Keccak other than the final one.
@@ -147,9 +147,7 @@
0xE5, 0xA9, 0xF2, 0x2F, 0xC4, 0x9B, 0x86, 0x01, 0xC6, 0xCD, 0xAB, 0xE2, 0x3E, 0x0D};
Sha3_224::Output sha224Actual = Sha3_224::Hash(&data, sizeof(data));
- for (size_t i = 0; i < sha224Actual.size(); i++) {
- EXPECT_EQ(sha224Actual[i], sha224Expected[i]);
- }
+ ExpectOutput(sha224Actual, sha224Expected);
}
// Test a "long" message that requires many internal Keccaks
@@ -162,9 +160,7 @@
0x5A, 0x59, 0x39, 0x6F, 0xD2, 0xEB, 0xBF, 0xB4, 0xCB, 0x2E, 0x9F, 0xBA, 0x2F, 0x67};
Sha3_224::Output sha224Actual = Sha3_224::Hash(&data, sizeof(data));
- for (size_t i = 0; i < sha224Actual.size(); i++) {
- EXPECT_EQ(sha224Actual[i], sha224Expected[i]);
- }
+ ExpectOutput(sha224Actual, sha224Expected);
}
}
@@ -185,8 +181,441 @@
sha.Update(&data[offset], sizeof(data) - offset);
Sha3_224::Output sha224Actual = sha.Finalize();
- for (size_t i = 0; i < sha224Actual.size(); i++) {
- EXPECT_EQ(sha224Actual[i], sha224Expected[i]);
+ ExpectOutput(sha224Actual, sha224Expected);
+ }
+}
+
+enum class HasherType {
+ Sha3_224,
+ Sha3_256,
+ Sha3_384,
+ Sha3_512,
+};
+
+// Helper class to provide uniform interface for all Sha3 variants.
+class Sha3Proxy {
+ public:
+ explicit Sha3Proxy(HasherType type) : mType(type) {
+ switch (type) {
+ case HasherType::Sha3_224:
+ mHasher = Sha3_224();
+ break;
+ case HasherType::Sha3_256:
+ mHasher = Sha3_256();
+ break;
+ case HasherType::Sha3_384:
+ mHasher = Sha3_384();
+ break;
+ case HasherType::Sha3_512:
+ mHasher = Sha3_512();
+ break;
+ default:
+ // Unreachable
+ []() { ASSERT_TRUE(false); }();
+ break;
+ }
+ }
+
+ size_t OutputByteSize() const {
+ switch (mType) {
+ case HasherType::Sha3_224:
+ return 224 / 8;
+ case HasherType::Sha3_256:
+ return 256 / 8;
+ case HasherType::Sha3_384:
+ return 384 / 8;
+ case HasherType::Sha3_512:
+ return 512 / 8;
+ default:
+ // Unreachable
+ []() { ASSERT_TRUE(false); }();
+ break;
+ }
+ }
+
+ std::vector<uint8_t> Hash(const void* data, size_t size) {
+ switch (mType) {
+ case HasherType::Sha3_224:
+ return HashImpl<224>(data, size);
+ case HasherType::Sha3_256:
+ return HashImpl<256>(data, size);
+ case HasherType::Sha3_384:
+ return HashImpl<384>(data, size);
+ case HasherType::Sha3_512:
+ return HashImpl<512>(data, size);
+ default:
+ // Unreachable
+ []() { ASSERT_TRUE(false); }();
+ break;
+ }
+ }
+
+ void Update(const void* data, size_t size) {
+ switch (mType) {
+ case HasherType::Sha3_224:
+ return UpdateImpl<224>(data, size);
+ case HasherType::Sha3_256:
+ return UpdateImpl<256>(data, size);
+ case HasherType::Sha3_384:
+ return UpdateImpl<384>(data, size);
+ case HasherType::Sha3_512:
+ return UpdateImpl<512>(data, size);
+ default:
+ // Unreachable
+ ASSERT_TRUE(false);
+ break;
+ }
+ }
+ std::vector<uint8_t> Finalize() {
+ switch (mType) {
+ case HasherType::Sha3_224:
+ return FinalizeImpl<224>();
+ case HasherType::Sha3_256:
+ return FinalizeImpl<256>();
+ case HasherType::Sha3_384:
+ return FinalizeImpl<384>();
+ case HasherType::Sha3_512:
+ return FinalizeImpl<512>();
+ default:
+ // Unreachable
+ []() { ASSERT_TRUE(false); }();
+ break;
+ }
+ }
+
+ private:
+ const HasherType mType;
+ std::variant<Sha3_224, Sha3_256, Sha3_384, Sha3_512> mHasher;
+
+ template <size_t N>
+ std::vector<uint8_t> HashImpl(const void* data, size_t size) {
+ auto& hasher = std::get<Sha3<N>>(mHasher);
+ auto resultArray = hasher.Hash(data, size);
+ std::vector<uint8_t> resultVector;
+ static_assert(resultArray.size() == N / 8);
+ resultVector.reserve(N / 8);
+ for (size_t i = 0; i < N / 8; i++) {
+ resultVector.push_back(resultArray[i]);
+ }
+ return resultVector;
+ }
+
+ template <size_t N>
+ void UpdateImpl(const void* data, size_t size) {
+ auto& hasher = std::get<Sha3<N>>(mHasher);
+ hasher.Update(data, size);
+ }
+
+ template <size_t N>
+ std::vector<uint8_t> FinalizeImpl() {
+ auto& hasher = std::get<Sha3<N>>(mHasher);
+ auto resultArray = hasher.Finalize();
+ std::vector<uint8_t> resultVector;
+ static_assert(resultArray.size() == N / 8);
+ resultVector.reserve(N / 8);
+ for (size_t i = 0; i < N / 8; i++) {
+ resultVector.push_back(resultArray[i]);
+ }
+ return resultVector;
+ }
+};
+
+struct Sha3LongMessageTestingVector {
+ HasherType type;
+ const size_t inputByteSize;
+ const std::vector<uint8_t> input;
+ const std::initializer_list<uint8_t> expectedOutput;
+};
+
+using Sha3LongMessageTestingVectors = std::initializer_list<Sha3LongMessageTestingVector>;
+
+// Below testing vectors are from FIPS 202 SHA-3 Hash Function Test Vectors for Hashing
+// Byte-Oriented Messages, NIST CAVP.
+// https://csrc.nist.gov/Projects/Cryptographic-Algorithm-Validation-Program/Secure-Hashing
+// https://csrc.nist.gov/CSRC/media/Projects/Cryptographic-Algorithm-Validation-Program/documents/sha3/sha-3bytetestvectors.zip
+// These testing vectors are much longer than the byte rate of performing Keccak, and avoid using
+// trivially repeating bytes pattern which might be unable to detect wrong input reading.
+Sha3LongMessageTestingVectors longMessageTestingVectors{
+ // From SHA3_224LongMsg.rsp
+ Sha3LongMessageTestingVector{
+ HasherType::Sha3_224,
+ 5792 / 8,
+ {0xa6, 0x3e, 0xbf, 0x8f, 0x97, 0xc6, 0x52, 0x92, 0x98, 0xe4, 0xd4, 0xb5, 0x73, 0xca, 0x01,
+ 0xd6, 0x5d, 0x67, 0x58, 0x83, 0x7b, 0xde, 0xc4, 0x0f, 0xa4, 0x36, 0x7c, 0xe5, 0x69, 0x53,
+ 0x28, 0x1d, 0x52, 0x25, 0x45, 0x4d, 0x6b, 0x1f, 0xca, 0xa2, 0xff, 0xeb, 0x0c, 0x2f, 0xa4,
+ 0x5c, 0xdf, 0x84, 0x77, 0xa4, 0xfe, 0x83, 0xa9, 0xc7, 0xad, 0x6f, 0x3b, 0x4f, 0x9c, 0x46,
+ 0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 0xf3, 0x1f,
+ 0x18, 0xfb, 0xb4, 0x5f, 0x89, 0xa7, 0xdb, 0xee, 0x27, 0xed, 0x46, 0x2d}},
+};
+
+void ExpectOutput(const std::vector<uint8_t>& actual,
+ const std::initializer_list<uint8_t>& expected) {
+ ASSERT_EQ(actual.size(), expected.size());
+ size_t i = 0;
+ for (auto expectedElem : expected) {
+ EXPECT_EQ(actual[i], expectedElem);
+ i++;
+ }
+}
+
+// Check that hashing the long non-trivial message produces the expected output
+TEST(Sha3, LongMessage) {
+ for (const auto& test : longMessageTestingVectors) {
+ ASSERT_EQ(test.input.size(), test.inputByteSize);
+ Sha3Proxy sha3(test.type);
+ ASSERT_EQ(test.expectedOutput.size(), sha3.OutputByteSize());
+ auto result = sha3.Hash(test.input.data(), test.input.size());
+ ExpectOutput(result, test.expectedOutput);
+ }
+}
+
+// Check that using Update at any byte boundary produces the same result
+TEST(Sha3, LongMessageUpdate) {
+ for (const auto& test : longMessageTestingVectors) {
+ ASSERT_EQ(test.input.size(), test.inputByteSize);
+ for (size_t offset = 0; offset <= test.inputByteSize; offset++) {
+ Sha3Proxy sha3(test.type);
+ ASSERT_EQ(test.expectedOutput.size(), sha3.OutputByteSize());
+ sha3.Update(test.input.data(), offset);
+ sha3.Update(test.input.data() + offset, test.inputByteSize - offset);
+ auto result = sha3.Finalize();
+ ExpectOutput(result, test.expectedOutput);
}
}
}