Lines Matching defs:ssh
68 static int kex_choose_conf(struct ssh *);
247 kex_reset_dispatch(struct ssh *ssh)
249 ssh_dispatch_range(ssh, SSH2_MSG_TRANSPORT_MIN,
251 ssh_dispatch_set(ssh, SSH2_MSG_KEXINIT, &kex_input_kexinit);
255 kex_send_newkeys(struct ssh *ssh)
259 kex_reset_dispatch(ssh);
260 if ((r = sshpkt_start(ssh, SSH2_MSG_NEWKEYS)) != 0 ||
261 (r = sshpkt_send(ssh)) != 0)
265 ssh_dispatch_set(ssh, SSH2_MSG_NEWKEYS, &kex_input_newkeys);
272 struct ssh *ssh = ctxt;
273 struct kex *kex = ssh->kex;
277 ssh_dispatch_set(ssh, SSH2_MSG_NEWKEYS, &kex_protocol_error);
278 if ((r = sshpkt_get_end(ssh)) != 0)
290 kex_send_kexinit(struct ssh *ssh)
293 struct kex *kex = ssh->kex;
309 if ((r = sshpkt_start(ssh, SSH2_MSG_KEXINIT)) != 0 ||
310 (r = sshpkt_putb(ssh, kex->my)) != 0 ||
311 (r = sshpkt_send(ssh)) != 0)
322 struct ssh *ssh = ctxt;
323 struct kex *kex = ssh->kex;
333 ptr = sshpkt_ptr(ssh, &dlen);
339 if ((r = sshpkt_get_u8(ssh, NULL)) != 0)
342 if ((r = sshpkt_get_string(ssh, NULL, NULL)) != 0)
354 if ((r = sshpkt_get_u8(ssh, NULL)) != 0 || /* first_kex_follows */
355 (r = sshpkt_get_u32(ssh, NULL)) != 0 || /* reserved */
356 (r = sshpkt_get_end(ssh)) != 0)
360 if ((r = kex_send_kexinit(ssh)) != 0)
362 if ((r = kex_choose_conf(ssh)) != 0)
366 return (kex->kex[kex->kex_type])(ssh);
372 kex_new(struct ssh *ssh, char *proposal[PROPOSAL_MAX], struct kex **kexp)
388 kex_reset_dispatch(ssh);
454 kex_setup(struct ssh *ssh, char *proposal[PROPOSAL_MAX])
458 if ((r = kex_new(ssh, proposal, &ssh->kex)) != 0)
460 if ((r = kex_send_kexinit(ssh)) != 0) { /* we start */
461 kex_free(ssh->kex);
462 ssh->kex = NULL;
488 choose_mac(struct ssh *ssh, struct sshmac *mac, char *client, char *server)
497 if (ssh->compat & SSH_BUG_HMAC)
582 kex_choose_conf(struct ssh *ssh)
584 struct kex *kex = ssh->kex;
633 (r = choose_mac(ssh, &newkeys->mac, cprop[nmac],
668 !(ssh->compat & SSH_BUG_FIRSTKEX))
669 ssh->dispatch_skip_packets = 1;
678 derive_key(struct ssh *ssh, int id, u_int need, u_char *hash, u_int hashlen,
681 struct kex *kex = ssh->kex;
743 kex_derive_keys(struct ssh *ssh, u_char *hash, u_int hashlen,
746 struct kex *kex = ssh->kex;
752 if ((r = derive_key(ssh, 'A'+i, kex->we_need, hash, hashlen,
771 kex_derive_keys_bn(struct ssh *ssh, u_char *hash, u_int hashlen,
780 r = kex_derive_keys(ssh, hash, hashlen, shared_secret);