1 /*
2 * SAE fuzzer
3 * Copyright (c) 2020, Jouni Malinen <j@w1.fi>
4 *
5 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
7 */
8
9 #include "utils/includes.h"
10
11 #include "utils/common.h"
12 #include "common/sae.h"
13 #include "../fuzzer-common.h"
14
15
LLVMFuzzerTestOneInput(const uint8_t * data,size_t size)16 int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
17 {
18 struct sae_data sae;
19 u16 res;
20 const u8 *token = NULL;
21 size_t token_len = 0;
22 int groups[] = { 19, 0 };
23
24 wpa_fuzzer_set_debug_level();
25
26 if (os_program_init())
27 return 0;
28
29 os_memset(&sae, 0, sizeof(sae));
30 res = sae_parse_commit(&sae, data, size, &token, &token_len, groups, 0,
31 NULL);
32 wpa_printf(MSG_DEBUG, "sae_parse_commit(0): %u", res);
33 sae_clear_data(&sae);
34 res = sae_parse_commit(&sae, data, size, &token, &token_len, groups, 1,
35 NULL);
36 wpa_printf(MSG_DEBUG, "sae_parse_commit(1): %u", res);
37 sae_clear_data(&sae);
38 os_program_deinit();
39
40 return 0;
41 }
42