summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Fuzzer/test
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2015-05-14 22:41:49 +0000
committerKostya Serebryany <kcc@google.com>2015-05-14 22:41:49 +0000
commit96eab65d81db648d30c819dfa86e3af9c29e0566 (patch)
tree1def4806c4f7e511b665d7ce5ebaec6a35521d4d /llvm/lib/Fuzzer/test
parent11e7da97a0f35fdd6f33283ea860f3036dcb39ab (diff)
downloadbcm5719-llvm-96eab65d81db648d30c819dfa86e3af9c29e0566.tar.gz
bcm5719-llvm-96eab65d81db648d30c819dfa86e3af9c29e0566.zip
[lib/Fuzzer] Add SHA1 implementation from public domain.
Summary: This adds a SHA1 implementation taken from public domain code. The change is trivial, but as it involves third-party code I'd like a second pair of eyes before commit. LibFuzzer can not use SHA1 from openssl because openssl may not be available and because we may be fuzzing openssl itself. Using sha1sum via a pipe is too slow. Test Plan: n/a Reviewers: chandlerc Reviewed By: chandlerc Subscribers: majnemer, llvm-commits Differential Revision: http://reviews.llvm.org/D9733 llvm-svn: 237400
Diffstat (limited to 'llvm/lib/Fuzzer/test')
-rw-r--r--llvm/lib/Fuzzer/test/FuzzerUnittest.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/Fuzzer/test/FuzzerUnittest.cpp b/llvm/lib/Fuzzer/test/FuzzerUnittest.cpp
index e337ca851bf..7b429b722b6 100644
--- a/llvm/lib/Fuzzer/test/FuzzerUnittest.cpp
+++ b/llvm/lib/Fuzzer/test/FuzzerUnittest.cpp
@@ -60,3 +60,11 @@ TEST(Fuzzer, CrossOver) {
EXPECT_EQ(ExpectedUnitsWitThisLength, FoundUnits);
}
}
+
+TEST(Fuzzer, Hash) {
+ uint8_t A[] = {'a', 'b', 'c'};
+ fuzzer::Unit U(A, A + sizeof(A));
+ EXPECT_EQ("a9993e364706816aba3e25717850c26c9cd0d89d", fuzzer::Hash(U));
+ U.push_back('d');
+ EXPECT_EQ("81fe8bfe87576c3ecb22426f8e57847382917acf", fuzzer::Hash(U));
+}
OpenPOWER on IntegriCloud