summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2021-01-29 11:03:35 +1100
committerDamien Miller <djm@mindrot.org>2021-01-29 11:03:35 +1100
commitbe5f0048ea2aaeddd27be7dcca23aaad345fa16c (patch)
tree927658aa358ecca145d3cdd8135bfcf54b45f868
parent3d59e88c0e42182c3749b446ccd9027933c84be4 (diff)
support for running kex fuzzer with null cipher
-rw-r--r--regress/misc/fuzz-harness/kex_fuzz.cc21
1 files changed, 17 insertions, 4 deletions
diff --git a/regress/misc/fuzz-harness/kex_fuzz.cc b/regress/misc/fuzz-harness/kex_fuzz.cc
index 68ed892c..0c89bdd3 100644
--- a/regress/misc/fuzz-harness/kex_fuzz.cc
+++ b/regress/misc/fuzz-harness/kex_fuzz.cc
@@ -21,7 +21,7 @@ extern "C" {
#include "log.h"
// Define if you want to generate traces.
-// #define STANDALONE 1
+/* #define STANDALONE 1 */
#define PRIV_RSA \
"-----BEGIN OPENSSH PRIVATE KEY-----\n"\
@@ -269,11 +269,21 @@ do_kex_with_key(struct shared_state *st, struct test_state *ts,
pubkey = get_pubkey(st, keytype);
privkey = get_privkey(st, keytype);
keyname = xstrdup(sshkey_ssh_name(privkey));
- debug_f("%s %s clobber %s %zu", kex, keyname,
- ts->cin == NULL ? "server" : "client",
- ts->cin == NULL ? sshbuf_len(ts->sin) : sshbuf_len(ts->cin));
+ if (ts->cin != NULL) {
+ debug_f("%s %s clobber client %zu", kex, keyname,
+ sshbuf_len(ts->cin));
+ } else if (ts->sin != NULL) {
+ debug_f("%s %s clobber server %zu", kex, keyname,
+ sshbuf_len(ts->sin));
+ } else
+ debug_f("%s %s noclobber", kex, keyname);
+
for (i = 0; i < PROPOSAL_MAX; i++) {
ccp = proposal[i];
+#ifdef CIPHER_NONE_AVAIL
+ if (i == PROPOSAL_ENC_ALGS_CTOS || i == PROPOSAL_ENC_ALGS_STOC)
+ ccp = "none";
+#endif
if (i == PROPOSAL_SERVER_HOST_KEY_ALGS)
ccp = keyname;
else if (i == PROPOSAL_KEX_ALGS && kex != NULL)
@@ -396,12 +406,15 @@ int main(void)
"curve25519-sha256@libssh.org",
"ecdh-sha2-nistp256",
"diffie-hellman-group1-sha1",
+ "diffie-hellman-group-exchange-sha1",
NULL,
};
int i, j;
char *path;
FILE *f;
+ log_init("kex_fuzz", SYSLOG_LEVEL_DEBUG3, SYSLOG_FACILITY_AUTH, 1);
+
if (st == NULL) {
st = (struct shared_state *)xcalloc(1, sizeof(*st));
prepare_keys(st);