Skip to content

Commit

Permalink
Add fuzzer for code in "Sha256.h".
Browse files Browse the repository at this point in the history
  • Loading branch information
fancycode committed Apr 2, 2019
1 parent bb83b19 commit 7e1a6b7
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions filters_fuzzer.cc
Expand Up @@ -30,6 +30,7 @@
#include "Aes.h"
#include "Bra.h"
#include "Delta.h"
#include "Sha256.h"
#include "XzCrc64.h"

class FilterFuzzer {
Expand Down Expand Up @@ -251,6 +252,21 @@ class AesFuzzer : public EncodeDecodeFuzzer {
}
};

class Sha256Fuzzer : public FilterFuzzer {
public:
Sha256Fuzzer(const uint8_t *data, size_t size) : FilterFuzzer(data, size) {}

void RunFuzzer() override {
Byte digest[SHA256_DIGEST_SIZE];
Sha256_Init(&sha256_);
Sha256_Update(&sha256_, data_, size_);
Sha256_Final(&sha256_, digest);
}

private:
CSha256 sha256_;
};

extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
if (!size) {
return 0;
Expand Down

0 comments on commit 7e1a6b7

Please sign in to comment.