diff options
author | stelar7 <dudedbz@gmail.com> | 2022-04-07 10:21:51 +0200 |
---|---|---|
committer | Ali Mohammad Pur <Ali.mpfard@gmail.com> | 2022-04-08 14:02:02 +0430 |
commit | ce08fae13bb649824f1b6023ae5bb15b8e131a59 (patch) | |
tree | e2796c493aab62235832c5beab776b24013da87c /Meta/Lagom/Fuzzers | |
parent | c2379912227bb6b64cf2ef2a252f87e452c9e8d4 (diff) | |
download | serenity-ce08fae13bb649824f1b6023ae5bb15b8e131a59.zip |
Meta: Add fuzzer for Poly1305
Diffstat (limited to 'Meta/Lagom/Fuzzers')
-rw-r--r-- | Meta/Lagom/Fuzzers/CMakeLists.txt | 1 | ||||
-rw-r--r-- | Meta/Lagom/Fuzzers/FuzzPoly1305.cpp | 23 |
2 files changed, 24 insertions, 0 deletions
diff --git a/Meta/Lagom/Fuzzers/CMakeLists.txt b/Meta/Lagom/Fuzzers/CMakeLists.txt index 5c2d965f78..cbff945cd4 100644 --- a/Meta/Lagom/Fuzzers/CMakeLists.txt +++ b/Meta/Lagom/Fuzzers/CMakeLists.txt @@ -36,6 +36,7 @@ add_simple_fuzzer(FuzzPEM LagomCrypto) add_simple_fuzzer(FuzzPNGLoader LagomGfx) add_simple_fuzzer(FuzzPBMLoader LagomGfx) add_simple_fuzzer(FuzzPGMLoader LagomGfx) +add_simple_fuzzer(FuzzPoly1305 LagomCrypto) add_simple_fuzzer(FuzzPPMLoader LagomGfx) add_simple_fuzzer(FuzzPDF LagomPDF) add_simple_fuzzer(FuzzQOILoader LagomGfx) diff --git a/Meta/Lagom/Fuzzers/FuzzPoly1305.cpp b/Meta/Lagom/Fuzzers/FuzzPoly1305.cpp new file mode 100644 index 0000000000..c9b06af162 --- /dev/null +++ b/Meta/Lagom/Fuzzers/FuzzPoly1305.cpp @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2022, stelar7 <dudedbz@gmail.com> + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#include <LibCrypto/Authentication/Poly1305.h> +#include <stddef.h> +#include <stdint.h> + +extern "C" int LLVMFuzzerTestOneInput(uint8_t const* data, size_t size) +{ + if (size < 32) + return 0; + + auto initial = ReadonlyBytes { data, 32 }; + auto message = ReadonlyBytes { data + 32, size - 32 }; + + Crypto::Authentication::Poly1305 mac(initial); + mac.update(message); + (void)mac.digest(); + return 0; +} |