Mercurial > dropbear
comparison packet.c @ 1408:27e65d3aed5f fuzz
fix checkmac always failing pre-kex
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Sun, 11 Jun 2017 21:39:40 +0800 |
parents | 08f4fa4dc6a0 |
children | 5916af64acd4 |
comparison
equal
deleted
inserted
replaced
1386:f0990c284663 | 1408:27e65d3aed5f |
---|---|
370 buf_setpos(ses.readbuf, 0); | 370 buf_setpos(ses.readbuf, 0); |
371 make_mac(ses.recvseq, &ses.keys->recv, ses.readbuf, contents_len, mac_bytes); | 371 make_mac(ses.recvseq, &ses.keys->recv, ses.readbuf, contents_len, mac_bytes); |
372 | 372 |
373 #ifdef DROPBEAR_FUZZ | 373 #ifdef DROPBEAR_FUZZ |
374 if (fuzz.fuzzing) { | 374 if (fuzz.fuzzing) { |
375 // fail 1 in 1000 times to test error path | 375 // fail 1 in 2000 times to test error path. |
376 // note that mac_bytes is all zero prior to kex, so don't test ==0 ! | |
376 unsigned int value = *((unsigned int*)&mac_bytes); | 377 unsigned int value = *((unsigned int*)&mac_bytes); |
377 if (value % 1000 == 0) { | 378 if (value % 2000 == 99) { |
378 return DROPBEAR_FAILURE; | 379 return DROPBEAR_FAILURE; |
379 } | 380 } |
380 return DROPBEAR_SUCCESS; | 381 return DROPBEAR_SUCCESS; |
381 } | 382 } |
382 #endif | 383 #endif |