/* Do the banner and key exchange */ int ssh_accept(SSH_SESSION *session) { if (ssh_send_banner(session, 1) < 0) { return -1; } session->alive = 1; session->clientbanner = ssh_get_banner(session); if (session->clientbanner == NULL) { return -1; } if (server_set_kex(session) < 0) { return -1; } if (ssh_send_kex(session, 1) < 0) { return -1; } if (ssh_get_kex(session,1) < 0) { return -1; } ssh_list_kex(session, &session->client_kex); crypt_set_algorithms_server(session); if (dh_handshake_server(session) < 0) { return -1; } session->connected = 1; return 0; }
/* do the banner and key exchange */ int ssh_accept(SSH_SESSION *session){ // ssh_send_banner(session,1); FIXME BAD HACK -- common ssh_crypto_init(); // session->clientbanner=ssh_banner_get(session);FIXME BAD HACK -- common server_set_kex(session); ssh_send_kex(session,1); if(ssh_get_kex(session,1)) return -1; ssh_list_kex(&session->client_kex); crypt_set_algorithms_server(session); if(dh_handshake_server(session)) return -1; session->connected=1; return 0; }
/** @internal * @brief parse an incoming SSH_MSG_KEXDH_INIT packet and complete * key exchange **/ static int ssh_server_kexdh_init(ssh_session session, ssh_buffer packet){ ssh_string e; e = buffer_get_ssh_string(packet); if (e == NULL) { ssh_set_error(session, SSH_FATAL, "No e number in client request"); return -1; } if (dh_import_e(session, e) < 0) { ssh_set_error(session, SSH_FATAL, "Cannot import e number"); session->session_state=SSH_SESSION_STATE_ERROR; } else { session->dh_handshake_state=DH_STATE_INIT_SENT; dh_handshake_server(session); } ssh_string_free(e); return SSH_OK; }