Lines Matching refs:kex

78 #include "kex.h"
268 (ssh->state->rekeying || (ssh->kex != NULL && ssh->kex->done == 0));
987 /* move newkeys from kex to state */
988 if ((state->newkeys[mode] = ssh->kex->newkeys[mode]) == NULL)
990 ssh->kex->newkeys[mode] = NULL;
1053 if (ssh->kex == NULL || ssh_packet_is_rekeying(ssh))
2073 if (ssh && ssh->kex && ssh->kex->failed_choice) {
2077 ssh->kex->failed_choice);
2434 /* turn kex into a blob for packet state serialization */
2436 kex_to_blob(struct sshbuf *m, struct kex *kex)
2440 if ((r = sshbuf_put_string(m, kex->session_id,
2441 kex->session_id_len)) != 0 ||
2442 (r = sshbuf_put_u32(m, kex->we_need)) != 0 ||
2443 (r = sshbuf_put_u32(m, kex->hostkey_type)) != 0 ||
2444 (r = sshbuf_put_u32(m, kex->kex_type)) != 0 ||
2445 (r = sshbuf_put_stringb(m, kex->my)) != 0 ||
2446 (r = sshbuf_put_stringb(m, kex->peer)) != 0 ||
2447 (r = sshbuf_put_u32(m, kex->flags)) != 0 ||
2448 (r = sshbuf_put_cstring(m, kex->client_version_string)) != 0 ||
2449 (r = sshbuf_put_cstring(m, kex->server_version_string)) != 0)
2525 if ((r = kex_to_blob(m, ssh->kex)) != 0 ||
2623 ssh->kex->newkeys[mode] = newkey;
2632 /* restore kex from blob for packet state de-serialization */
2634 kex_from_blob(struct sshbuf *m, struct kex **kexp)
2636 struct kex *kex;
2639 if ((kex = calloc(1, sizeof(struct kex))) == NULL ||
2640 (kex->my = sshbuf_new()) == NULL ||
2641 (kex->peer = sshbuf_new()) == NULL) {
2645 if ((r = sshbuf_get_string(m, &kex->session_id, &kex->session_id_len)) != 0 ||
2646 (r = sshbuf_get_u32(m, &kex->we_need)) != 0 ||
2647 (r = sshbuf_get_u32(m, (u_int *)&kex->hostkey_type)) != 0 ||
2648 (r = sshbuf_get_u32(m, &kex->kex_type)) != 0 ||
2649 (r = sshbuf_get_stringb(m, kex->my)) != 0 ||
2650 (r = sshbuf_get_stringb(m, kex->peer)) != 0 ||
2651 (r = sshbuf_get_u32(m, &kex->flags)) != 0 ||
2652 (r = sshbuf_get_cstring(m, &kex->client_version_string, NULL)) != 0 ||
2653 (r = sshbuf_get_cstring(m, &kex->server_version_string, NULL)) != 0)
2655 kex->server = 1;
2656 kex->done = 1;
2660 if (kex != NULL) {
2661 sshbuf_free(kex->my);
2662 sshbuf_free(kex->peer);
2663 free(kex);
2668 *kexp = kex;
2704 if ((r = kex_from_blob(m, &ssh->kex)) != 0 ||