Lines Matching defs:kex

88 #include "kex.h"
237 (ssh->kex = kex_new()) == NULL ||
261 kex_free(ssh->kex);
286 (ssh->kex != NULL && ssh->kex->done == 0);
349 kex_free(ssh->kex);
350 ssh->kex = NULL;
737 kex_free(ssh->kex);
738 ssh->kex = NULL;
946 if (ssh->kex && ssh->kex->newkeys[mode]) {
947 kex_free_newkeys(ssh->kex->newkeys[mode]);
948 ssh->kex->newkeys[mode] = NULL;
991 /* move newkeys from kex to state */
992 if ((state->newkeys[mode] = ssh->kex->newkeys[mode]) == NULL)
994 ssh->kex->newkeys[mode] = NULL;
1302 if ((ssh->kex->flags & KEX_INITIAL) != 0) {
1315 if (type == SSH2_MSG_NEWKEYS && ssh->kex->kex_strict) {
1527 if (ssh->kex)
1713 if ((ssh->kex->flags & KEX_INITIAL) != 0) {
1784 if (*typep == SSH2_MSG_NEWKEYS && ssh->kex->kex_strict) {
1839 if (ssh->kex != NULL &&
1840 (ssh->kex->flags & KEX_INITIAL) && ssh->kex->kex_strict)
2023 if (ssh->kex && ssh->kex->failed_choice) {
2028 ssh->kex->failed_choice);
2307 ssh->kex->server = 1; /* XXX unify? */
2345 /* turn kex into a blob for packet state serialization */
2347 kex_to_blob(struct sshbuf *m, struct kex *kex)
2351 if ((r = sshbuf_put_u32(m, kex->we_need)) != 0 ||
2352 (r = sshbuf_put_cstring(m, kex->hostkey_alg)) != 0 ||
2353 (r = sshbuf_put_u32(m, kex->hostkey_type)) != 0 ||
2354 (r = sshbuf_put_u32(m, kex->hostkey_nid)) != 0 ||
2355 (r = sshbuf_put_u32(m, kex->kex_type)) != 0 ||
2356 (r = sshbuf_put_u32(m, kex->kex_strict)) != 0 ||
2357 (r = sshbuf_put_stringb(m, kex->my)) != 0 ||
2358 (r = sshbuf_put_stringb(m, kex->peer)) != 0 ||
2359 (r = sshbuf_put_stringb(m, kex->client_version)) != 0 ||
2360 (r = sshbuf_put_stringb(m, kex->server_version)) != 0 ||
2361 (r = sshbuf_put_stringb(m, kex->session_id)) != 0 ||
2362 (r = sshbuf_put_u32(m, kex->flags)) != 0)
2418 if ((r = kex_to_blob(m, ssh->kex)) != 0 ||
2496 ssh->kex->newkeys[mode] = newkey;
2505 /* restore kex from blob for packet state de-serialization */
2507 kex_from_blob(struct sshbuf *m, struct kex **kexp)
2509 struct kex *kex;
2512 if ((kex = kex_new()) == NULL)
2514 if ((r = sshbuf_get_u32(m, &kex->we_need)) != 0 ||
2515 (r = sshbuf_get_cstring(m, &kex->hostkey_alg, NULL)) != 0 ||
2516 (r = sshbuf_get_u32(m, (u_int *)&kex->hostkey_type)) != 0 ||
2517 (r = sshbuf_get_u32(m, (u_int *)&kex->hostkey_nid)) != 0 ||
2518 (r = sshbuf_get_u32(m, &kex->kex_type)) != 0 ||
2519 (r = sshbuf_get_u32(m, &kex->kex_strict)) != 0 ||
2520 (r = sshbuf_get_stringb(m, kex->my)) != 0 ||
2521 (r = sshbuf_get_stringb(m, kex->peer)) != 0 ||
2522 (r = sshbuf_get_stringb(m, kex->client_version)) != 0 ||
2523 (r = sshbuf_get_stringb(m, kex->server_version)) != 0 ||
2524 (r = sshbuf_get_stringb(m, kex->session_id)) != 0 ||
2525 (r = sshbuf_get_u32(m, &kex->flags)) != 0)
2527 kex->server = 1;
2528 kex->done = 1;
2532 kex_free(kex);
2537 *kexp = kex;
2554 if ((r = kex_from_blob(m, &ssh->kex)) != 0 ||
2779 if (ssh->kex)