1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-08-07 08:02:55 +03:00

kex: Use getter functions to access kex arrays.

This should fix the build on OpenIndiana.
This commit is contained in:
Andreas Schneider
2012-10-12 17:43:32 +02:00
parent 82711acd39
commit 95ab34696b
4 changed files with 25 additions and 10 deletions

View File

@@ -89,7 +89,7 @@ static const char *default_methods[] = {
};
/* NOTE: This is a fixed API and the index is defined by ssh_kex_types_e */
const char *supported_methods[] = {
static const char *supported_methods[] = {
KEY_EXCHANGE,
HOSTKEYS,
AES BLOWFISH DES,
@@ -104,7 +104,7 @@ const char *supported_methods[] = {
};
/* descriptions of the key exchange packet */
const char *ssh_kex_nums[] = {
static const char *ssh_kex_descriptions[] = {
"kex algos",
"server host key algo",
"encryption client->server",
@@ -204,6 +204,22 @@ char **space_tokenize(const char *chain){
return tokens;
}
const char *ssh_kex_get_supported_method(uint32_t algo) {
if (algo >= KEX_METHODS_SIZE) {
return NULL;
}
return supported_methods[algo];
}
const char *ssh_kex_get_description(uint32_t algo) {
if (algo >= KEX_METHODS_SIZE) {
return NULL;
}
return ssh_kex_descriptions[algo];
}
/* find_matching gets 2 parameters : a list of available objects (available_d), separated by colons,*/
/* and a list of preferred objects (preferred_d) */
/* it will return a strduped pointer on the first preferred object found in the available objects list */
@@ -344,7 +360,7 @@ void ssh_list_kex(ssh_session session, struct ssh_kex_struct *kex) {
continue;
}
ssh_log(session, SSH_LOG_FUNCTIONS, "%s: %s",
ssh_kex_nums[i], kex->methods[i]);
ssh_kex_descriptions[i], kex->methods[i]);
}
}
@@ -385,7 +401,7 @@ int ssh_kex_select_methods (ssh_session session){
session->next_crypto->kex_methods[i]=ssh_find_matching(server->methods[i],client->methods[i]);
if(session->next_crypto->kex_methods[i] == NULL && i < SSH_LANG_C_S){
ssh_set_error(session,SSH_FATAL,"kex error : no match for method %s: server [%s], client [%s]",
ssh_kex_nums[i],server->methods[i],client->methods[i]);
ssh_kex_descriptions[i],server->methods[i],client->methods[i]);
goto error;
} else if ((i >= SSH_LANG_C_S) && (session->next_crypto->kex_methods[i] == NULL)) {
/* we can safely do that for languages */