xref: /freebsd/contrib/libder/tests/fuzzers.h (revision 35c0a8c449fd2b7f75029ebed5e10852240f0865)
1 /*-
2  * Copyright (c) 2024 Kyle Evans <kevans@FreeBSD.org>
3  *
4  * SPDX-License-Identifier: BSD-2-Clause
5  */
6 
7 #pragma once
8 
9 #include <stdint.h>
10 
11 enum stream_type {
12 	STREAM_FD = 0,		/* read_fd() type */
13 	STREAM_FILE = 1,	/* read_file() type */
14 	STREAM_PLAIN = 2,
15 
16 	STREAM_END
17 } __attribute__((packed));
18 
19 enum stream_buffer {
20 	BUFFER_NONE = 0,
21 	BUFFER_FULL = 1,
22 
23 	BUFFER_END,
24 } __attribute__((packed));
25 
26 struct fuzz_params {
27 	enum stream_type	 type;
28 	enum stream_buffer	 buftype;
29 
30 #define	PARAM_PAD_START	_pad0
31 	uint8_t			 strict;
32 	uint8_t			 _pad0[5];
33 
34 	/* Give me plenty of padding. */
35 	uint64_t		 padding[3];
36 };
37 
38 _Static_assert(sizeof(struct fuzz_params) == 32,
39     "fuzz_params ABI broken, will invalidate CORPUS");
40 
41