kex: Add simple DES support for SSHv1.

This commit is contained in:
Dmitriy Kuznetsov
2012-09-07 12:19:43 +02:00
committed by Andreas Schneider
parent a3f83e7274
commit 320951f42f
7 changed files with 94 additions and 11 deletions

View File

@@ -228,18 +228,18 @@ error:
return rc;
}
static int crypt_set_algorithms1(ssh_session session) {
static int crypt_set_algorithms1(ssh_session session, enum ssh_des_e des_type) {
int i = 0;
struct ssh_cipher_struct *ssh_ciphertab=ssh_get_ciphertab();
/* right now, we force 3des-cbc to be taken */
while (ssh_ciphertab[i].name && strcmp(ssh_ciphertab[i].name,
"3des-cbc-ssh1")) {
des_type == SSH_DES ? "des-cbc-ssh1" : "3des-cbc-ssh1")) {
i++;
}
if (ssh_ciphertab[i].name == NULL) {
ssh_set_error(session, SSH_FATAL, "cipher 3des-cbc-ssh1 not found!");
ssh_set_error(session, SSH_FATAL, "cipher 3des-cbc-ssh1 or des-cbc-ssh1 not found!");
return SSH_ERROR;
}
@@ -258,8 +258,8 @@ static int crypt_set_algorithms1(ssh_session session) {
return SSH_OK;
}
int crypt_set_algorithms(ssh_session session) {
return (session->version == 1) ? crypt_set_algorithms1(session) :
int crypt_set_algorithms(ssh_session session, enum ssh_des_e des_type) {
return (session->version == 1) ? crypt_set_algorithms1(session, des_type) :
crypt_set_algorithms2(session);
}