summaryrefslogtreecommitdiff
path: root/regress/unittests/sshbuf/test_sshbuf_getput_fuzz.c
diff options
context:
space:
mode:
Diffstat (limited to 'regress/unittests/sshbuf/test_sshbuf_getput_fuzz.c')
-rw-r--r--regress/unittests/sshbuf/test_sshbuf_getput_fuzz.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/regress/unittests/sshbuf/test_sshbuf_getput_fuzz.c b/regress/unittests/sshbuf/test_sshbuf_getput_fuzz.c
index c6b5c29d1..ca06bfb00 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.4 2019/01/21 12:29:35 djm Exp $ */
2/* 2/*
3 * Regress test for sshbuf.h buffer API 3 * Regress test for sshbuf.h buffer API
4 * 4 *
@@ -54,11 +54,8 @@ attempt_parse_blob(u_char *blob, size_t len)
54 bzero(s, l); 54 bzero(s, l);
55 free(s); 55 free(s);
56 } 56 }
57 bn = BN_new(); 57 bn = NULL;
58 sshbuf_get_bignum1(p1, bn); 58 sshbuf_get_bignum2(p1, &bn);
59 BN_clear_free(bn);
60 bn = BN_new();
61 sshbuf_get_bignum2(p1, bn);
62 BN_clear_free(bn); 59 BN_clear_free(bn);
63#if defined(OPENSSL_HAS_ECC) && defined(OPENSSL_HAS_NISTP256) 60#if defined(OPENSSL_HAS_ECC) && defined(OPENSSL_HAS_NISTP256)
64 eck = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1); 61 eck = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1);
@@ -92,10 +89,6 @@ sshbuf_getput_fuzz_tests(void)
92 /* string */ 89 /* string */
93 0x00, 0x00, 0x00, 0x09, 90 0x00, 0x00, 0x00, 0x09,
94 'O', ' ', 'G', 'o', 'r', 'g', 'o', 'n', '!', 91 'O', ' ', 'G', 'o', 'r', 'g', 'o', 'n', '!',
95 /* bignum1 */
96 0x79,
97 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
98 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
99 /* bignum2 */ 92 /* bignum2 */
100 0x00, 0x00, 0x00, 0x14, 93 0x00, 0x00, 0x00, 0x14,
101 0x00, 94 0x00,
@@ -115,11 +108,15 @@ sshbuf_getput_fuzz_tests(void)
115 0x55, 0x0f, 0x69, 0xd8, 0x0e, 0xc2, 0x3c, 0xd4, 108 0x55, 0x0f, 0x69, 0xd8, 0x0e, 0xc2, 0x3c, 0xd4,
116 }; 109 };
117 struct fuzz *fuzz; 110 struct fuzz *fuzz;
111 u_int fuzzers = FUZZ_1_BIT_FLIP | FUZZ_2_BIT_FLIP |
112 FUZZ_1_BYTE_FLIP | FUZZ_2_BYTE_FLIP |
113 FUZZ_TRUNCATE_START | FUZZ_TRUNCATE_END;
114
115 if (test_is_fast())
116 fuzzers &= ~(FUZZ_2_BYTE_FLIP|FUZZ_2_BIT_FLIP);
118 117
119 TEST_START("fuzz blob parsing"); 118 TEST_START("fuzz blob parsing");
120 fuzz = fuzz_begin(FUZZ_1_BIT_FLIP | FUZZ_2_BIT_FLIP | 119 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); 120 TEST_ONERROR(onerror, fuzz);
124 for(; !fuzz_done(fuzz); fuzz_next(fuzz)) 121 for(; !fuzz_done(fuzz); fuzz_next(fuzz))
125 attempt_parse_blob(blob, sizeof(blob)); 122 attempt_parse_blob(blob, sizeof(blob));