kex: Reformat ssh_send_kex

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Norbert Pocs <npocs@redhat.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Jakub Jelen
2023-03-14 09:49:24 +01:00
parent cf1c67ddb4
commit cef34a78ef

View File

@@ -836,7 +836,8 @@ int ssh_kex_select_methods (ssh_session session)
/* this function only sends the predefined set of kex methods */
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);
ssh_string str = NULL;
int i;
@@ -861,10 +862,12 @@ int ssh_send_kex(ssh_session session, int server_kex)
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;
}
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;
}
SSH_STRING_FREE(str);
@@ -879,12 +882,14 @@ int ssh_send_kex(ssh_session session, int server_kex)
goto error;
}
if (ssh_packet_send(session) == SSH_ERROR) {
rc = ssh_packet_send(session);
if (rc == SSH_ERROR) {
return -1;
}
SSH_LOG(SSH_LOG_PACKET, "SSH_MSG_KEXINIT sent");
return 0;
error:
ssh_buffer_reinit(session->out_buffer);
ssh_buffer_reinit(session->out_hashbuf);