From 320951f42ff5def186da70d2e52457b7c1d06f50 Mon Sep 17 00:00:00 2001 From: Dmitriy Kuznetsov Date: Fri, 7 Sep 2012 12:19:43 +0200 Subject: kex: Add simple DES support for SSHv1. --- src/kex1.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/kex1.c') diff --git a/src/kex1.c b/src/kex1.c index d0ce5c7..b11cf00 100644 --- a/src/kex1.c +++ b/src/kex1.c @@ -312,6 +312,8 @@ SSH_PACKET_CALLBACK(ssh_packet_publickey1){ ssh_string enc_session = NULL; uint16_t bits; int ko; + uint32_t support_3DES = 0; + uint32_t support_DES = 0; enter_function(); (void)type; (void)user; @@ -397,7 +399,10 @@ SSH_PACKET_CALLBACK(ssh_packet_publickey1){ /* now, we must choose an encryption algo */ /* hardcode 3des */ - if (!(supported_ciphers_mask & (1 << SSH_CIPHER_3DES))) { + // + support_3DES = (supported_ciphers_mask & (1<out_buffer, SSH_CMSG_SESSION_KEY) < 0) { goto error; } - if (buffer_add_u8(session->out_buffer, SSH_CIPHER_3DES) < 0) { + if (buffer_add_u8(session->out_buffer, support_3DES ? SSH_CIPHER_3DES : SSH_CIPHER_DES) < 0) { goto error; } if (buffer_add_data(session->out_buffer, session->next_crypto->server_kex.cookie, 8) < 0) { @@ -440,8 +445,8 @@ SSH_PACKET_CALLBACK(ssh_packet_publickey1){ } /* we can set encryption */ - if (crypt_set_algorithms(session)) { - goto error; + if(crypt_set_algorithms(session, support_3DES ? SSH_3DES : SSH_DES)){ + goto error; } session->current_crypto = session->next_crypto; -- cgit