1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 05:17:34 +00:00

Meta: Add fuzzer for Poly1305

This commit is contained in:
stelar7 2022-04-07 10:21:51 +02:00 committed by Ali Mohammad Pur
parent c237991222
commit ce08fae13b
2 changed files with 24 additions and 0 deletions

View 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;
}