comparison packet.c @ 1348:5c2899e35b63 fuzz

fuzz harness
author Matt Johnston <matt@ucc.asn.au>
date Sat, 13 May 2017 22:50:54 +0800
parents b28624698130
children 08f4fa4dc6a0
comparison
equal deleted inserted replaced
1347:b28624698130 1348:5c2899e35b63
34 #include "service.h" 34 #include "service.h"
35 #include "auth.h" 35 #include "auth.h"
36 #include "channel.h" 36 #include "channel.h"
37 #include "netio.h" 37 #include "netio.h"
38 #include "runopts.h" 38 #include "runopts.h"
39 #include "fuzz.h"
39 40
40 static int read_packet_init(void); 41 static int read_packet_init(void);
41 static void make_mac(unsigned int seqno, const struct key_context_directional * key_state, 42 static void make_mac(unsigned int seqno, const struct key_context_directional * key_state,
42 buffer * clear_buf, unsigned int clear_len, 43 buffer * clear_buf, unsigned int clear_len,
43 unsigned char *output_mac); 44 unsigned char *output_mac);
76 packet_queue_to_iovec(&ses.writequeue, iov, &iov_count); 77 packet_queue_to_iovec(&ses.writequeue, iov, &iov_count);
77 /* This may return EAGAIN. The main loop sometimes 78 /* This may return EAGAIN. The main loop sometimes
78 calls write_packet() without bothering to test with select() since 79 calls write_packet() without bothering to test with select() since
79 it's likely to be necessary */ 80 it's likely to be necessary */
80 #ifdef DROPBEAR_FUZZ 81 #ifdef DROPBEAR_FUZZ
81 if (opts.fuzz.fuzzing) { 82 if (fuzz.fuzzing) {
82 // pretend to write one packet at a time 83 // pretend to write one packet at a time
83 // TODO(fuzz): randomise amount written based on the fuzz input 84 // TODO(fuzz): randomise amount written based on the fuzz input
84 written = iov[0].iov_len; 85 written = iov[0].iov_len;
85 } 86 }
86 else 87 else