mirror of
https://github.com/PowerShell/openssh-portable.git
synced 2025-07-08 14:34:50 +02:00
upstream commit
make the signature fuzzing test much more rigorous: ensure that the fuzzed input cases do not match the original (using new fuzz_matches_original() function) and check that the verification fails in each case
This commit is contained in:
parent
80603c0daa
commit
589e69fd82
@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: test_fuzz.c,v 1.1 2014/06/24 01:14:18 djm Exp $ */
|
/* $OpenBSD: test_fuzz.c,v 1.2 2015/01/18 19:53:58 djm Exp $ */
|
||||||
/*
|
/*
|
||||||
* Fuzz tests for key parsing
|
* Fuzz tests for key parsing
|
||||||
*
|
*
|
||||||
@ -87,8 +87,11 @@ sig_fuzz(struct sshkey *k)
|
|||||||
free(sig);
|
free(sig);
|
||||||
TEST_ONERROR(onerror, fuzz);
|
TEST_ONERROR(onerror, fuzz);
|
||||||
for(; !fuzz_done(fuzz); fuzz_next(fuzz)) {
|
for(; !fuzz_done(fuzz); fuzz_next(fuzz)) {
|
||||||
sshkey_verify(k, fuzz_ptr(fuzz), fuzz_len(fuzz),
|
/* Ensure 1-bit difference at least */
|
||||||
c, sizeof(c), 0);
|
if (fuzz_matches_original(fuzz))
|
||||||
|
continue;
|
||||||
|
ASSERT_INT_NE(sshkey_verify(k, fuzz_ptr(fuzz), fuzz_len(fuzz),
|
||||||
|
c, sizeof(c), 0), 0);
|
||||||
}
|
}
|
||||||
fuzz_cleanup(fuzz);
|
fuzz_cleanup(fuzz);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user