1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-12-15 18:32:26 +03:00

CVE-2023-1667:kex: Remove needless function argument

The information if the session is client or server session is already part of
the session structure so this argument only duplicated information.

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:
Jakub Jelen
2023-03-13 15:11:25 +01:00
committed by Andreas Schneider
parent 4fb6bccf22
commit 1c85acb6e6
4 changed files with 8 additions and 8 deletions

View File

@@ -37,7 +37,7 @@ extern "C" {
SSH_PACKET_CALLBACK(ssh_packet_kexinit); SSH_PACKET_CALLBACK(ssh_packet_kexinit);
int ssh_send_kex(ssh_session session, int server_kex); int ssh_send_kex(ssh_session session);
void ssh_list_kex(struct ssh_kex_struct *kex); void ssh_list_kex(struct ssh_kex_struct *kex);
int ssh_set_client_kex(ssh_session session); int ssh_set_client_kex(ssh_session session);
int ssh_kex_select_methods(ssh_session session); int ssh_kex_select_methods(ssh_session session);

View File

@@ -424,7 +424,7 @@ static void ssh_client_connection_callback(ssh_session session)
if (rc != SSH_OK) { if (rc != SSH_OK) {
goto error; goto error;
} }
rc = ssh_send_kex(session, 0); rc = ssh_send_kex(session);
if (rc < 0) { if (rc < 0) {
goto error; goto error;
} }
@@ -443,7 +443,7 @@ static void ssh_client_connection_callback(ssh_session session)
if (rc != SSH_OK) { if (rc != SSH_OK) {
goto error; goto error;
} }
rc = ssh_send_kex(session, 0); rc = ssh_send_kex(session);
if (rc < 0) { if (rc < 0) {
goto error; goto error;
} }

View File

@@ -865,9 +865,9 @@ 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)
{ {
struct ssh_kex_struct *kex = (server_kex ? struct ssh_kex_struct *kex = (session->server ?
&session->next_crypto->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;
@@ -969,7 +969,7 @@ int ssh_send_rekex(ssh_session session)
} }
session->dh_handshake_state = DH_STATE_INIT; session->dh_handshake_state = DH_STATE_INIT;
rc = ssh_send_kex(session, session->server); rc = ssh_send_kex(session);
if (rc < 0) { if (rc < 0) {
SSH_LOG(SSH_LOG_PACKET, "Failed to send kex"); SSH_LOG(SSH_LOG_PACKET, "Failed to send kex");
return rc; return rc;

View File

@@ -356,7 +356,7 @@ static void ssh_server_connection_callback(ssh_session session)
ssh_packet_set_default_callbacks(session); ssh_packet_set_default_callbacks(session);
set_status(session, 0.5f); set_status(session, 0.5f);
session->session_state = SSH_SESSION_STATE_INITIAL_KEX; session->session_state = SSH_SESSION_STATE_INITIAL_KEX;
rc = ssh_send_kex(session, 1); rc = ssh_send_kex(session);
if (rc < 0) { if (rc < 0) {
goto error; goto error;
} }
@@ -372,7 +372,7 @@ static void ssh_server_connection_callback(ssh_session session)
goto error; goto error;
} }
/* We are in a rekeying, so we need to send the server kex */ /* We are in a rekeying, so we need to send the server kex */
rc = ssh_send_kex(session, 1); rc = ssh_send_kex(session);
if (rc < 0) { if (rc < 0) {
goto error; goto error;
} }