diff options
Diffstat (limited to 'regress/unittests/sshkey/test_fuzz.c')
-rw-r--r-- | regress/unittests/sshkey/test_fuzz.c | 45 |
1 files changed, 1 insertions, 44 deletions
diff --git a/regress/unittests/sshkey/test_fuzz.c b/regress/unittests/sshkey/test_fuzz.c index 1f414e0ac..6706045d5 100644 --- a/regress/unittests/sshkey/test_fuzz.c +++ b/regress/unittests/sshkey/test_fuzz.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: test_fuzz.c,v 1.6 2015/12/07 02:20:46 djm Exp $ */ | 1 | /* $OpenBSD: test_fuzz.c,v 1.7 2017/04/30 23:33:48 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Fuzz tests for key parsing | 3 | * Fuzz tests for key parsing |
4 | * | 4 | * |
@@ -104,49 +104,6 @@ sshkey_fuzz_tests(void) | |||
104 | struct fuzz *fuzz; | 104 | struct fuzz *fuzz; |
105 | int r; | 105 | int r; |
106 | 106 | ||
107 | #ifdef WITH_SSH1 | ||
108 | TEST_START("fuzz RSA1 private"); | ||
109 | buf = load_file("rsa1_1"); | ||
110 | fuzz = fuzz_begin(FUZZ_1_BIT_FLIP | FUZZ_1_BYTE_FLIP | | ||
111 | FUZZ_TRUNCATE_START | FUZZ_TRUNCATE_END, | ||
112 | sshbuf_mutable_ptr(buf), sshbuf_len(buf)); | ||
113 | ASSERT_INT_EQ(sshkey_parse_private_fileblob(buf, "", &k1, NULL), 0); | ||
114 | sshkey_free(k1); | ||
115 | sshbuf_free(buf); | ||
116 | ASSERT_PTR_NE(fuzzed = sshbuf_new(), NULL); | ||
117 | TEST_ONERROR(onerror, fuzz); | ||
118 | for(; !fuzz_done(fuzz); fuzz_next(fuzz)) { | ||
119 | r = sshbuf_put(fuzzed, fuzz_ptr(fuzz), fuzz_len(fuzz)); | ||
120 | ASSERT_INT_EQ(r, 0); | ||
121 | if (sshkey_parse_private_fileblob(fuzzed, "", &k1, NULL) == 0) | ||
122 | sshkey_free(k1); | ||
123 | sshbuf_reset(fuzzed); | ||
124 | } | ||
125 | sshbuf_free(fuzzed); | ||
126 | fuzz_cleanup(fuzz); | ||
127 | TEST_DONE(); | ||
128 | |||
129 | TEST_START("fuzz RSA1 public"); | ||
130 | buf = load_file("rsa1_1_pw"); | ||
131 | fuzz = fuzz_begin(FUZZ_1_BIT_FLIP | FUZZ_1_BYTE_FLIP | | ||
132 | FUZZ_TRUNCATE_START | FUZZ_TRUNCATE_END, | ||
133 | sshbuf_mutable_ptr(buf), sshbuf_len(buf)); | ||
134 | ASSERT_INT_EQ(sshkey_parse_public_rsa1_fileblob(buf, &k1, NULL), 0); | ||
135 | sshkey_free(k1); | ||
136 | sshbuf_free(buf); | ||
137 | ASSERT_PTR_NE(fuzzed = sshbuf_new(), NULL); | ||
138 | TEST_ONERROR(onerror, fuzz); | ||
139 | for(; !fuzz_done(fuzz); fuzz_next(fuzz)) { | ||
140 | r = sshbuf_put(fuzzed, fuzz_ptr(fuzz), fuzz_len(fuzz)); | ||
141 | ASSERT_INT_EQ(r, 0); | ||
142 | if (sshkey_parse_public_rsa1_fileblob(fuzzed, &k1, NULL) == 0) | ||
143 | sshkey_free(k1); | ||
144 | sshbuf_reset(fuzzed); | ||
145 | } | ||
146 | sshbuf_free(fuzzed); | ||
147 | fuzz_cleanup(fuzz); | ||
148 | TEST_DONE(); | ||
149 | #endif | ||
150 | 107 | ||
151 | TEST_START("fuzz RSA private"); | 108 | TEST_START("fuzz RSA private"); |
152 | buf = load_file("rsa_1"); | 109 | buf = load_file("rsa_1"); |