123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- #ifndef DROPBEAR_FUZZ_H
- #define DROPBEAR_FUZZ_H
- #include "config.h"
- #if DROPBEAR_FUZZ
- #include "includes.h"
- #include "buffer.h"
- #include "algo.h"
- #include "netio.h"
- #include "fuzz-wrapfd.h"
- void fuzz_common_setup(void);
- void fuzz_svr_setup(void);
- void fuzz_cli_setup(void);
- void fuzz_early_setup(void) __attribute__((constructor));
- int fuzz_set_input(const uint8_t *Data, size_t Size);
- int fuzz_run_server(const uint8_t *Data, size_t Size, int skip_kexmaths, int postauth);
- int fuzz_run_client(const uint8_t *Data, size_t Size, int skip_kexmaths);
- const void* fuzz_get_algo(const algo_type *algos, const char* name);
- void fuzz_kex_fakealgos(void);
- int fuzz_checkpubkey_line(buffer* line, int line_num, char* filename,
- const char* algo, unsigned int algolen,
- const unsigned char* keyblob, unsigned int keybloblen);
- extern const char * const * fuzz_signkey_names;
- void fuzz_seed(const unsigned char* dat, unsigned int len);
- void fuzz_svr_hook_preloop(void);
- int fuzz_dropbear_listen(const char* address, const char* port,
- int *socks, unsigned int sockcount, char **errstring, int *maxfd);
- void fuzz_get_socket_address(int fd, char **local_host, char **local_port,
- char **remote_host, char **remote_port, int host_lookup);
- void fuzz_fake_send_kexdh_reply(void);
- int fuzz_spawn_command(int *ret_writefd, int *ret_readfd, int *ret_errfd, pid_t *ret_pid);
- void fuzz_dump(const unsigned char* data, size_t len);
- #ifndef FUZZ_SKIP_WRAP
- #define select(nfds, readfds, writefds, exceptfds, timeout) \
- wrapfd_select(nfds, readfds, writefds, exceptfds, timeout)
- #define write(fd, buf, count) wrapfd_write(fd, buf, count)
- #define read(fd, buf, count) wrapfd_read(fd, buf, count)
- #define close(fd) wrapfd_close(fd)
- #define kill(pid, sig) fuzz_kill(pid, sig)
- #endif
- struct dropbear_fuzz_options {
- int fuzzing;
-
- buffer *input;
- struct dropbear_cipher recv_cipher;
- struct dropbear_hash recv_mac;
- int wrapfds;
-
- int skip_kexmaths;
-
- int svr_postauth;
-
- int do_jmp;
- sigjmp_buf jmp;
-
-
- int dumping;
-
- int recv_dumpfd;
-
- FILE *fake_stderr;
- };
- extern struct dropbear_fuzz_options fuzz;
- #ifndef FUZZ_NO_REPLACE_STDERR
- #ifdef stderr
- #undef stderr
- #endif
- #define stderr (fuzz.fake_stderr)
- #endif
- struct passwd* fuzz_getpwuid(uid_t uid);
- struct passwd* fuzz_getpwnam(const char *login);
- #ifndef FUZZ_NO_REPLACE_GETPW
- #define getpwnam(x) fuzz_getpwnam(x)
- #define getpwuid(x) fuzz_getpwuid(x)
- #endif
- #endif
- #endif
|