aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2017-08-24 17:43:01 +0200
committerAndreas Schneider <asn@cryptomilk.org>2017-08-24 18:01:41 +0200
commit6803c2f86d5a8f419d854dbffb78c10fda611ed2 (patch)
tree637bb1b4f8fc6943a4725d114579c4a49b2375e3
parent316ee071cf4bd06a8cdeeaac417e137be0a3af0e (diff)
downloadlibssh-6803c2f86d5a8f419d854dbffb78c10fda611ed2.tar.gz
libssh-6803c2f86d5a8f419d854dbffb78c10fda611ed2.tar.xz
libssh-6803c2f86d5a8f419d854dbffb78c10fda611ed2.zip
kex: Use ssh_kex_types_e in ssh_verify_existing_algo()
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
-rw-r--r--include/libssh/kex.h2
-rw-r--r--src/kex.c8
2 files changed, 7 insertions, 3 deletions
diff --git a/include/libssh/kex.h b/include/libssh/kex.h
index 3b70ec72..e38fafff 100644
--- a/include/libssh/kex.h
+++ b/include/libssh/kex.h
@@ -40,7 +40,7 @@ int ssh_send_kex(ssh_session session, int server_kex);
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);
-int ssh_verify_existing_algo(int algo, const char *name);
+int ssh_verify_existing_algo(enum ssh_kex_types_e algo, const char *name);
char *ssh_keep_known_algos(enum ssh_kex_types_e algo, const char *list);
char **ssh_space_tokenize(const char *chain);
int ssh_get_kex1(ssh_session session);
diff --git a/src/kex.c b/src/kex.c
index 196f1b5e..9c60fbd5 100644
--- a/src/kex.c
+++ b/src/kex.c
@@ -721,10 +721,14 @@ error:
}
/* returns 1 if at least one of the name algos is in the default algorithms table */
-int ssh_verify_existing_algo(int algo, const char *name){
+int ssh_verify_existing_algo(enum ssh_kex_types_e algo, const char *name)
+{
char *ptr;
- if(algo>9 || algo <0)
+
+ if (algo > SSH_LANG_S_C) {
return -1;
+ }
+
ptr=ssh_find_matching(supported_methods[algo],name);
if(ptr){
free(ptr);