mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-11 10:40:27 +09:00
kex: Reformat ssh_send_kex
Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Norbert Pocs <npocs@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
13
src/kex.c
13
src/kex.c
@@ -861,7 +861,8 @@ int ssh_kex_select_methods (ssh_session session)
|
|||||||
/* this function only sends the predefined set of kex methods */
|
/* this function only sends the predefined set of kex methods */
|
||||||
int ssh_send_kex(ssh_session session, int server_kex)
|
int ssh_send_kex(ssh_session session, int server_kex)
|
||||||
{
|
{
|
||||||
struct ssh_kex_struct *kex = (server_kex ? &session->next_crypto->server_kex :
|
struct ssh_kex_struct *kex = (server_kex ?
|
||||||
|
&session->next_crypto->server_kex :
|
||||||
&session->next_crypto->client_kex);
|
&session->next_crypto->client_kex);
|
||||||
ssh_string str = NULL;
|
ssh_string str = NULL;
|
||||||
int i;
|
int i;
|
||||||
@@ -886,10 +887,12 @@ int ssh_send_kex(ssh_session session, int server_kex)
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ssh_buffer_add_ssh_string(session->out_hashbuf, str) < 0) {
|
rc = ssh_buffer_add_ssh_string(session->out_hashbuf, str);
|
||||||
|
if (rc < 0) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
if (ssh_buffer_add_ssh_string(session->out_buffer, str) < 0) {
|
rc = ssh_buffer_add_ssh_string(session->out_buffer, str);
|
||||||
|
if (rc < 0) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
SSH_STRING_FREE(str);
|
SSH_STRING_FREE(str);
|
||||||
@@ -904,12 +907,14 @@ int ssh_send_kex(ssh_session session, int server_kex)
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ssh_packet_send(session) == SSH_ERROR) {
|
rc = ssh_packet_send(session);
|
||||||
|
if (rc == SSH_ERROR) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
SSH_LOG(SSH_LOG_PACKET, "SSH_MSG_KEXINIT sent");
|
SSH_LOG(SSH_LOG_PACKET, "SSH_MSG_KEXINIT sent");
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
ssh_buffer_reinit(session->out_buffer);
|
ssh_buffer_reinit(session->out_buffer);
|
||||||
ssh_buffer_reinit(session->out_hashbuf);
|
ssh_buffer_reinit(session->out_hashbuf);
|
||||||
|
|||||||
Reference in New Issue
Block a user