Lines Matching refs:ts

76 run_kex(struct test_state *ts, struct ssh *client, struct ssh *server)  in run_kex()  argument
82 if (ts->sin != NULL) { in run_kex()
83 if ((r = ssh_input_append(server, sshbuf_ptr(ts->sin), in run_kex()
84 sshbuf_len(ts->sin))) != 0) { in run_kex()
88 sshbuf_reset(ts->sin); in run_kex()
90 if (ts->cin != NULL) { in run_kex()
91 if ((r = ssh_input_append(client, sshbuf_ptr(ts->cin), in run_kex()
92 sshbuf_len(ts->cin))) != 0) { in run_kex()
96 sshbuf_reset(ts->cin); in run_kex()
102 ts->smsgs, ts->cin != NULL, &sn)) != 0) { in run_kex()
108 ts->cmsgs, ts->sin != NULL, &cn)) != 0) { in run_kex()
175 do_kex_with_key(struct shared_state *st, struct test_state *ts, in do_kex_with_key() argument
186 ts->cin = ts->sin = NULL; in do_kex_with_key()
187 if (ts->c_template != NULL && in do_kex_with_key()
188 (ts->cin = sshbuf_fromb(ts->c_template)) == NULL) in do_kex_with_key()
190 if (ts->s_template != NULL && in do_kex_with_key()
191 (ts->sin = sshbuf_fromb(ts->s_template)) == NULL) in do_kex_with_key()
197 if (ts->cin != NULL) { in do_kex_with_key()
199 sshbuf_len(ts->cin)); in do_kex_with_key()
200 } else if (ts->sin != NULL) { in do_kex_with_key()
202 sshbuf_len(ts->sin)); in do_kex_with_key()
235 if ((r = run_kex(ts, client, server)) != 0) { in do_kex_with_key()
243 sshbuf_free(ts->sin); in do_kex_with_key()
244 sshbuf_free(ts->cin); in do_kex_with_key()
327 struct test_state *ts; in main() local
350 ts = (struct test_state *)xcalloc(1, sizeof(*ts)); in main()
351 ts->smsgs = sshbuf_new(); in main()
352 ts->cmsgs = sshbuf_new(); in main()
353 do_kex_with_key(st, ts, kextypes[j], keytypes[i]); in main()
359 if (fwrite(sshbuf_ptr(ts->smsgs), 1, in main()
360 sshbuf_len(ts->smsgs), f) != sshbuf_len(ts->smsgs)) in main()
370 if (fwrite(sshbuf_ptr(ts->cmsgs), 1, in main()
371 sshbuf_len(ts->cmsgs), f) != sshbuf_len(ts->cmsgs)) in main()
376 sshbuf_free(ts->smsgs); in main()
377 sshbuf_free(ts->cmsgs); in main()
378 free(ts); in main()
399 do_kex(struct shared_state *st, struct test_state *ts, const char *kex) in do_kex() argument
401 do_kex_with_key(st, ts, kex, KEY_RSA); in do_kex()
402 do_kex_with_key(st, ts, kex, KEY_DSA); in do_kex()
403 do_kex_with_key(st, ts, kex, KEY_ECDSA); in do_kex()
404 do_kex_with_key(st, ts, kex, KEY_ED25519); in do_kex()
408 kex_tests(struct shared_state *st, struct test_state *ts) in kex_tests() argument
410 do_kex(st, ts, "sntrup761x25519-sha512@openssh.com"); in kex_tests()
411 do_kex(st, ts, "curve25519-sha256@libssh.org"); in kex_tests()
412 do_kex(st, ts, "ecdh-sha2-nistp256"); in kex_tests()
413 do_kex(st, ts, "diffie-hellman-group1-sha1"); in kex_tests()
414 do_kex(st, ts, "diffie-hellman-group-exchange-sha1"); in kex_tests()
420 struct test_state *ts; in LLVMFuzzerTestOneInput() local
437 ts = (struct test_state *)xcalloc(1, sizeof(*ts)); in LLVMFuzzerTestOneInput()
438 if ((ts->s_template = sshbuf_new()) == NULL || in LLVMFuzzerTestOneInput()
439 sshbuf_put(ts->s_template, data, size) != 0 || in LLVMFuzzerTestOneInput()
440 sshbuf_put(ts->s_template, crbuf, sizeof(crbuf)) != 0 || in LLVMFuzzerTestOneInput()
441 sshbuf_put(ts->s_template, zbuf, sizeof(zbuf)) != 0) in LLVMFuzzerTestOneInput()
443 kex_tests(st, ts); in LLVMFuzzerTestOneInput()
444 sshbuf_free(ts->s_template); in LLVMFuzzerTestOneInput()
445 free(ts); in LLVMFuzzerTestOneInput()
447 ts = (struct test_state *)xcalloc(1, sizeof(*ts)); in LLVMFuzzerTestOneInput()
448 if ((ts->c_template = sshbuf_new()) == NULL || in LLVMFuzzerTestOneInput()
449 sshbuf_put(ts->c_template, data, size) != 0 || in LLVMFuzzerTestOneInput()
450 sshbuf_put(ts->c_template, crbuf, sizeof(crbuf)) != 0 || in LLVMFuzzerTestOneInput()
451 sshbuf_put(ts->c_template, zbuf, sizeof(zbuf)) != 0) in LLVMFuzzerTestOneInput()
453 kex_tests(st, ts); in LLVMFuzzerTestOneInput()
454 sshbuf_free(ts->c_template); in LLVMFuzzerTestOneInput()
455 free(ts); in LLVMFuzzerTestOneInput()