diff options
Diffstat (limited to 'regress/unittests/sshbuf')
-rw-r--r-- | regress/unittests/sshbuf/Makefile | 5 | ||||
-rw-r--r-- | regress/unittests/sshbuf/test_sshbuf_fuzz.c | 9 | ||||
-rw-r--r-- | regress/unittests/sshbuf/test_sshbuf_getput_fuzz.c | 12 |
3 files changed, 17 insertions, 9 deletions
diff --git a/regress/unittests/sshbuf/Makefile b/regress/unittests/sshbuf/Makefile index 81d4f27a6..0e8e9fd10 100644 --- a/regress/unittests/sshbuf/Makefile +++ b/regress/unittests/sshbuf/Makefile | |||
@@ -1,4 +1,4 @@ | |||
1 | # $OpenBSD: Makefile,v 1.6 2017/12/21 00:41:22 djm Exp $ | 1 | # $OpenBSD: Makefile,v 1.7 2018/10/17 23:28:05 djm Exp $ |
2 | 2 | ||
3 | .include <bsd.regress.mk> | 3 | .include <bsd.regress.mk> |
4 | 4 | ||
@@ -17,6 +17,5 @@ SRCS+=sshbuf-getput-basic.c sshbuf-getput-crypto.c sshbuf-misc.c sshbuf.c | |||
17 | SRCS+=atomicio.c | 17 | SRCS+=atomicio.c |
18 | 18 | ||
19 | run-regress-${PROG}: ${PROG} | 19 | run-regress-${PROG}: ${PROG} |
20 | env ${TEST_ENV} ./${PROG} | 20 | env ${TEST_ENV} ./${PROG} ${UNITTEST_ARGS} |
21 | |||
22 | 21 | ||
diff --git a/regress/unittests/sshbuf/test_sshbuf_fuzz.c b/regress/unittests/sshbuf/test_sshbuf_fuzz.c index c52376b53..e236c82f9 100644 --- a/regress/unittests/sshbuf/test_sshbuf_fuzz.c +++ b/regress/unittests/sshbuf/test_sshbuf_fuzz.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: test_sshbuf_fuzz.c,v 1.1 2014/04/30 05:32:00 djm Exp $ */ | 1 | /* $OpenBSD: test_sshbuf_fuzz.c,v 1.2 2018/10/17 23:28:05 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Regress test for sshbuf.h buffer API | 3 | * Regress test for sshbuf.h buffer API |
4 | * | 4 | * |
@@ -30,10 +30,15 @@ sshbuf_fuzz_tests(void) | |||
30 | { | 30 | { |
31 | struct sshbuf *p1; | 31 | struct sshbuf *p1; |
32 | u_char *dp; | 32 | u_char *dp; |
33 | size_t sz, sz2, i; | 33 | size_t sz, sz2, i, ntests = NUM_FUZZ_TESTS; |
34 | u_int32_t r; | 34 | u_int32_t r; |
35 | int ret; | 35 | int ret; |
36 | 36 | ||
37 | if (test_is_fast()) | ||
38 | ntests >>= 2; | ||
39 | if (test_is_slow()) | ||
40 | ntests <<= 2; | ||
41 | |||
37 | /* NB. uses sshbuf internals */ | 42 | /* NB. uses sshbuf internals */ |
38 | TEST_START("fuzz alloc/dealloc"); | 43 | TEST_START("fuzz alloc/dealloc"); |
39 | p1 = sshbuf_new(); | 44 | p1 = sshbuf_new(); |
diff --git a/regress/unittests/sshbuf/test_sshbuf_getput_fuzz.c b/regress/unittests/sshbuf/test_sshbuf_getput_fuzz.c index c6b5c29d1..7c7cb2bfd 100644 --- a/regress/unittests/sshbuf/test_sshbuf_getput_fuzz.c +++ b/regress/unittests/sshbuf/test_sshbuf_getput_fuzz.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: test_sshbuf_getput_fuzz.c,v 1.2 2014/05/02 02:54:00 djm Exp $ */ | 1 | /* $OpenBSD: test_sshbuf_getput_fuzz.c,v 1.3 2018/10/17 23:28:05 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Regress test for sshbuf.h buffer API | 3 | * Regress test for sshbuf.h buffer API |
4 | * | 4 | * |
@@ -115,11 +115,15 @@ sshbuf_getput_fuzz_tests(void) | |||
115 | 0x55, 0x0f, 0x69, 0xd8, 0x0e, 0xc2, 0x3c, 0xd4, | 115 | 0x55, 0x0f, 0x69, 0xd8, 0x0e, 0xc2, 0x3c, 0xd4, |
116 | }; | 116 | }; |
117 | struct fuzz *fuzz; | 117 | struct fuzz *fuzz; |
118 | u_int fuzzers = FUZZ_1_BIT_FLIP | FUZZ_2_BIT_FLIP | | ||
119 | FUZZ_1_BYTE_FLIP | FUZZ_2_BYTE_FLIP | | ||
120 | FUZZ_TRUNCATE_START | FUZZ_TRUNCATE_END; | ||
121 | |||
122 | if (test_is_fast()) | ||
123 | fuzzers &= ~(FUZZ_2_BYTE_FLIP|FUZZ_2_BIT_FLIP); | ||
118 | 124 | ||
119 | TEST_START("fuzz blob parsing"); | 125 | TEST_START("fuzz blob parsing"); |
120 | fuzz = fuzz_begin(FUZZ_1_BIT_FLIP | FUZZ_2_BIT_FLIP | | 126 | fuzz = fuzz_begin(fuzzers, blob, sizeof(blob)); |
121 | FUZZ_1_BYTE_FLIP | FUZZ_2_BYTE_FLIP | | ||
122 | FUZZ_TRUNCATE_START | FUZZ_TRUNCATE_END, blob, sizeof(blob)); | ||
123 | TEST_ONERROR(onerror, fuzz); | 127 | TEST_ONERROR(onerror, fuzz); |
124 | for(; !fuzz_done(fuzz); fuzz_next(fuzz)) | 128 | for(; !fuzz_done(fuzz); fuzz_next(fuzz)) |
125 | attempt_parse_blob(blob, sizeof(blob)); | 129 | attempt_parse_blob(blob, sizeof(blob)); |