mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-22 04:25:13 +00:00
Meta: Add fuzzer for Poly1305
This commit is contained in:
parent
c237991222
commit
ce08fae13b
Notes:
sideshowbarker
2024-07-17 14:16:55 +09:00
Author: https://github.com/stelar7 Commit: https://github.com/SerenityOS/serenity/commit/ce08fae13b Pull-request: https://github.com/SerenityOS/serenity/pull/13549 Reviewed-by: https://github.com/alimpfard
2 changed files with 24 additions and 0 deletions
|
@ -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)
|
||||
|
|
23
Meta/Lagom/Fuzzers/FuzzPoly1305.cpp
Normal file
23
Meta/Lagom/Fuzzers/FuzzPoly1305.cpp
Normal file
|
@ -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;
|
||||
}
|
Loading…
Add table
Reference in a new issue