ladybird/Meta/Lagom/Fuzzers/FuzzPoly1305.cpp
2022-04-08 14:02:02 +04:30

24 lines
526 B
C++

/*
* 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;
}