The io_write() interceptor. * * If the fuzzer-generated Act 2 packet was invalid, this should be called * exactly once, when the initiator is writing out its Act 1 packet. Otherwise, * if the Act 2 packet was valid, this should be called a second time, when the * initiator is writing out its Act 3 packet. */
| 24 | * if the Act 2 packet was valid, this should be called a second time, when the |
| 25 | * initiator is writing out its Act 3 packet. */ |
| 26 | static struct io_plan * |
| 27 | test_write(struct io_conn *conn, const void *data, size_t len, |
| 28 | struct io_plan *(*next)(struct io_conn *, struct handshake *), |
| 29 | struct handshake *h) |
| 30 | { |
| 31 | ++write_count; |
| 32 | if (write_count == 1) { |
| 33 | /* Initiator is sending the Act 1 packet. Check that it is |
| 34 | * initialized and discard it. */ |
| 35 | assert(len == ACT_ONE_SIZE); |
| 36 | memcheck(data, len); |
| 37 | |
| 38 | return next(conn, h); |
| 39 | } |
| 40 | assert(write_count == 2 && "too many calls to io_write()"); |
| 41 | |
| 42 | /* Act 2 packet validation succeeded. Initiator is sending the Act 3 |
| 43 | * packet. Check that it is initialized. */ |
| 44 | assert(len == ACT_THREE_SIZE); |
| 45 | memcheck(data, len); |
| 46 | |
| 47 | return handshake_failed(conn, h); |
| 48 | } |
| 49 | |
| 50 | /* The io_read() interceptor. |
| 51 | * |