mirror of
https://github.com/clearml/dropbear
synced 2025-02-12 07:25:30 +00:00
Add some more variation to fuzzer random number generation
This commit is contained in:
parent
f37def57b0
commit
cb252296c5
@ -150,10 +150,11 @@ static void write_urandom()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if DROPBEAR_FUZZ
|
#if DROPBEAR_FUZZ
|
||||||
void fuzz_seed(void) {
|
void fuzz_seed(const unsigned char* dat, unsigned int len) {
|
||||||
hash_state hs;
|
hash_state hs;
|
||||||
sha1_init(&hs);
|
sha1_init(&hs);
|
||||||
sha1_process(&hs, "fuzzfuzzfuzz", strlen("fuzzfuzzfuzz"));
|
sha1_process(&hs, "fuzzfuzzfuzz", strlen("fuzzfuzzfuzz"));
|
||||||
|
sha1_process(&hs, dat, len);
|
||||||
sha1_done(&hs, hashpool);
|
sha1_done(&hs, hashpool);
|
||||||
|
|
||||||
counter = 0;
|
counter = 0;
|
||||||
|
2
fuzz.h
2
fuzz.h
@ -29,7 +29,7 @@ int fuzz_checkpubkey_line(buffer* line, int line_num, char* filename,
|
|||||||
const char* algo, unsigned int algolen,
|
const char* algo, unsigned int algolen,
|
||||||
const unsigned char* keyblob, unsigned int keybloblen);
|
const unsigned char* keyblob, unsigned int keybloblen);
|
||||||
extern const char * const * fuzz_signkey_names;
|
extern const char * const * fuzz_signkey_names;
|
||||||
void fuzz_seed(void);
|
void fuzz_seed(const unsigned char* dat, unsigned int len);
|
||||||
|
|
||||||
// helpers
|
// helpers
|
||||||
void fuzz_get_socket_address(int fd, char **local_host, char **local_port,
|
void fuzz_get_socket_address(int fd, char **local_host, char **local_port,
|
||||||
|
@ -25,7 +25,7 @@ void fuzz_common_setup(void) {
|
|||||||
fuzz.input = m_malloc(sizeof(buffer));
|
fuzz.input = m_malloc(sizeof(buffer));
|
||||||
_dropbear_log = fuzz_dropbear_log;
|
_dropbear_log = fuzz_dropbear_log;
|
||||||
crypto_init();
|
crypto_init();
|
||||||
fuzz_seed();
|
fuzz_seed("start", 5);
|
||||||
/* let any messages get flushed */
|
/* let any messages get flushed */
|
||||||
setlinebuf(stdout);
|
setlinebuf(stdout);
|
||||||
}
|
}
|
||||||
@ -42,7 +42,7 @@ int fuzz_set_input(const uint8_t *Data, size_t Size) {
|
|||||||
memset(&cli_ses, 0x0, sizeof(cli_ses));
|
memset(&cli_ses, 0x0, sizeof(cli_ses));
|
||||||
wrapfd_setup(fuzz.input);
|
wrapfd_setup(fuzz.input);
|
||||||
|
|
||||||
fuzz_seed();
|
fuzz_seed(fuzz.input->data, MIN(fuzz.input->len, 16));
|
||||||
|
|
||||||
return DROPBEAR_SUCCESS;
|
return DROPBEAR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user