mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 09:51:57 -05:00
Lagom/Fuzzers: Add fuzzers for all current hashing functions
Namely MD5, SHA1, SHA256, SHA384 and SHA512.
This commit is contained in:
parent
4dc63896de
commit
f29036dc98
6 changed files with 85 additions and 0 deletions
|
@ -26,6 +26,7 @@ add_simple_fuzzer(FuzzGzipCompression)
|
|||
add_simple_fuzzer(FuzzGzipDecompression)
|
||||
add_simple_fuzzer(FuzzICOLoader)
|
||||
add_simple_fuzzer(FuzzJPGLoader)
|
||||
add_simple_fuzzer(FuzzMD5)
|
||||
add_simple_fuzzer(FuzzPNGLoader)
|
||||
add_simple_fuzzer(FuzzPBMLoader)
|
||||
add_simple_fuzzer(FuzzPGMLoader)
|
||||
|
@ -39,6 +40,10 @@ add_simple_fuzzer(FuzzLatin2Decoder)
|
|||
add_simple_fuzzer(FuzzMarkdown)
|
||||
add_simple_fuzzer(FuzzRegexECMA262)
|
||||
add_simple_fuzzer(FuzzRegexPosixExtended)
|
||||
add_simple_fuzzer(FuzzSHA1)
|
||||
add_simple_fuzzer(FuzzSHA256)
|
||||
add_simple_fuzzer(FuzzSHA384)
|
||||
add_simple_fuzzer(FuzzSHA512)
|
||||
add_simple_fuzzer(FuzzShell)
|
||||
add_simple_fuzzer(FuzzSQLParser)
|
||||
add_simple_fuzzer(FuzzTTF)
|
||||
|
|
16
Meta/Lagom/Fuzzers/FuzzMD5.cpp
Normal file
16
Meta/Lagom/Fuzzers/FuzzMD5.cpp
Normal file
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
* Copyright (c) 2021, Luke Wilde <lukew@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibCrypto/Hash/MD5.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
|
||||
{
|
||||
auto buffer = ByteBuffer::copy(data, size);
|
||||
Crypto::Hash::MD5::hash(buffer);
|
||||
return 0;
|
||||
}
|
16
Meta/Lagom/Fuzzers/FuzzSHA1.cpp
Normal file
16
Meta/Lagom/Fuzzers/FuzzSHA1.cpp
Normal file
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
* Copyright (c) 2021, Luke Wilde <lukew@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibCrypto/Hash/SHA1.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
|
||||
{
|
||||
auto buffer = ByteBuffer::copy(data, size);
|
||||
Crypto::Hash::SHA1::hash(buffer);
|
||||
return 0;
|
||||
}
|
16
Meta/Lagom/Fuzzers/FuzzSHA256.cpp
Normal file
16
Meta/Lagom/Fuzzers/FuzzSHA256.cpp
Normal file
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
* Copyright (c) 2021, Luke Wilde <lukew@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibCrypto/Hash/SHA2.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
|
||||
{
|
||||
auto buffer = ByteBuffer::copy(data, size);
|
||||
Crypto::Hash::SHA256::hash(buffer);
|
||||
return 0;
|
||||
}
|
16
Meta/Lagom/Fuzzers/FuzzSHA384.cpp
Normal file
16
Meta/Lagom/Fuzzers/FuzzSHA384.cpp
Normal file
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
* Copyright (c) 2021, Luke Wilde <lukew@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibCrypto/Hash/SHA2.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
|
||||
{
|
||||
auto buffer = ByteBuffer::copy(data, size);
|
||||
Crypto::Hash::SHA384::hash(buffer);
|
||||
return 0;
|
||||
}
|
16
Meta/Lagom/Fuzzers/FuzzSHA512.cpp
Normal file
16
Meta/Lagom/Fuzzers/FuzzSHA512.cpp
Normal file
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
* Copyright (c) 2021, Luke Wilde <lukew@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibCrypto/Hash/SHA2.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
|
||||
{
|
||||
auto buffer = ByteBuffer::copy(data, size);
|
||||
Crypto::Hash::SHA512::hash(buffer);
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Reference in a new issue