/src/serenity/Meta/Lagom/Fuzzers/FuzzPoly1305.cpp
Line | Count | Source |
1 | | /* |
2 | | * Copyright (c) 2022, stelar7 <dudedbz@gmail.com> |
3 | | * |
4 | | * SPDX-License-Identifier: BSD-2-Clause |
5 | | */ |
6 | | |
7 | | #include <AK/Format.h> |
8 | | #include <LibCrypto/Authentication/Poly1305.h> |
9 | | #include <stddef.h> |
10 | | #include <stdint.h> |
11 | | |
12 | | extern "C" int LLVMFuzzerTestOneInput(uint8_t const* data, size_t size) |
13 | 85 | { |
14 | 85 | AK::set_debug_enabled(false); |
15 | | |
16 | 85 | if (size < 32) |
17 | 8 | return 0; |
18 | | |
19 | 77 | auto initial = ReadonlyBytes { data, 32 }; |
20 | 77 | auto message = ReadonlyBytes { data + 32, size - 32 }; |
21 | | |
22 | 77 | Crypto::Authentication::Poly1305 mac(initial); |
23 | 77 | mac.update(message); |
24 | 77 | (void)mac.digest(); |
25 | 77 | return 0; |
26 | 85 | } |