aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelen <jjelen@redhat.com>2023-03-13 15:11:25 +0100
committerAndreas Schneider <asn@cryptomilk.org>2023-05-04 13:40:37 +0200
commitabcf9699aadf93eec8a580df7ef32f91a0e21de2 (patch)
treef3d0f201e8d70e0018b2d87fb651846ebaf8cdf2
parent6887a5bb20b2903c784336d15518271c7a451c51 (diff)
downloadlibssh-abcf9699aadf93eec8a580df7ef32f91a0e21de2.tar.gz
libssh-abcf9699aadf93eec8a580df7ef32f91a0e21de2.tar.xz
libssh-abcf9699aadf93eec8a580df7ef32f91a0e21de2.zip
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: Andrew Bartlett <abartlet@samba.org>
-rw-r--r--include/libssh/kex.h2
-rw-r--r--src/client.c4
-rw-r--r--src/kex.c6
-rw-r--r--src/server.c4
4 files changed, 8 insertions, 8 deletions
diff --git a/include/libssh/kex.h b/include/libssh/kex.h
index 3a1f4a6f..2ace69b6 100644
--- a/include/libssh/kex.h
+++ b/include/libssh/kex.h
@@ -33,7 +33,7 @@ struct ssh_kex_struct {
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);
int ssh_set_client_kex(ssh_session session);
int ssh_kex_select_methods(ssh_session session);
diff --git a/src/client.c b/src/client.c
index 12f478ec..18acae70 100644
--- a/src/client.c
+++ b/src/client.c
@@ -420,7 +420,7 @@ static void ssh_client_connection_callback(ssh_session session)
if (rc != SSH_OK) {
goto error;
}
- rc = ssh_send_kex(session, 0);
+ rc = ssh_send_kex(session);
if (rc < 0) {
goto error;
}
@@ -439,7 +439,7 @@ static void ssh_client_connection_callback(ssh_session session)
if (rc != SSH_OK) {
goto error;
}
- rc = ssh_send_kex(session, 0);
+ rc = ssh_send_kex(session);
if (rc < 0) {
goto error;
}
diff --git a/src/kex.c b/src/kex.c
index f3f67763..6977d95b 100644
--- a/src/kex.c
+++ b/src/kex.c
@@ -845,9 +845,9 @@ 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)
+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->client_kex);
ssh_string str = NULL;
@@ -949,7 +949,7 @@ int ssh_send_rekex(ssh_session session)
}
session->dh_handshake_state = DH_STATE_INIT;
- rc = ssh_send_kex(session, session->server);
+ rc = ssh_send_kex(session);
if (rc < 0) {
SSH_LOG(SSH_LOG_PACKET, "Failed to send kex");
return rc;
diff --git a/src/server.c b/src/server.c
index b1125b03..10cfc782 100644
--- a/src/server.c
+++ b/src/server.c
@@ -368,7 +368,7 @@ static void ssh_server_connection_callback(ssh_session session)
ssh_packet_set_default_callbacks(session);
set_status(session, 0.5f);
session->session_state = SSH_SESSION_STATE_INITIAL_KEX;
- if (ssh_send_kex(session, 1) < 0) {
+ if (ssh_send_kex(session) < 0) {
goto error;
}
break;
@@ -381,7 +381,7 @@ static void ssh_server_connection_callback(ssh_session session)
if (server_set_kex(session) == SSH_ERROR)
goto error;
/* We are in a rekeying, so we need to send the server kex */
- if (ssh_send_kex(session, 1) < 0)
+ if (ssh_send_kex(session) < 0)
goto error;
}
ssh_list_kex(&session->next_crypto->client_kex); // log client kex