summaryrefslogtreecommitdiff
path: root/packet.c
diff options
context:
space:
mode:
Diffstat (limited to 'packet.c')
-rw-r--r--packet.c29
1 files changed, 5 insertions, 24 deletions
diff --git a/packet.c b/packet.c
index 6dfd492a1..9c2a4f86e 100644
--- a/packet.c
+++ b/packet.c
@@ -15,7 +15,7 @@ with the other side. This same code is used both on client and server side.
15*/ 15*/
16 16
17#include "includes.h" 17#include "includes.h"
18RCSID("$Id: packet.c,v 1.2 1999/11/08 05:15:55 damien Exp $"); 18RCSID("$Id: packet.c,v 1.3 1999/11/16 02:37:16 damien Exp $");
19 19
20#include "xmalloc.h" 20#include "xmalloc.h"
21#include "buffer.h" 21#include "buffer.h"
@@ -236,30 +236,11 @@ packet_decrypt(CipherContext *cc, void *dest, void *src,
236 236
237void 237void
238packet_set_encryption_key(const unsigned char *key, unsigned int keylen, 238packet_set_encryption_key(const unsigned char *key, unsigned int keylen,
239 int cipher, int is_client) 239 int cipher)
240{ 240{
241 cipher_type = cipher; 241 /* All other ciphers use the same key in both directions for now. */
242 if (cipher == SSH_CIPHER_RC4) 242 cipher_set_key(&receive_context, cipher, key, keylen, 0);
243 { 243 cipher_set_key(&send_context, cipher, key, keylen, 1);
244 if (is_client)
245 { /* In client: use first half for receiving, second for sending. */
246 cipher_set_key(&receive_context, cipher, key, keylen / 2, 0);
247 cipher_set_key(&send_context, cipher, key + keylen / 2,
248 keylen / 2, 1);
249 }
250 else
251 { /* In server: use first half for sending, second for receiving. */
252 cipher_set_key(&receive_context, cipher, key + keylen / 2,
253 keylen / 2, 0);
254 cipher_set_key(&send_context, cipher, key, keylen / 2, 1);
255 }
256 }
257 else
258 {
259 /* All other ciphers use the same key in both directions for now. */
260 cipher_set_key(&receive_context, cipher, key, keylen, 0);
261 cipher_set_key(&send_context, cipher, key, keylen, 1);
262 }
263} 244}
264 245
265/* Starts constructing a packet to send. */ 246/* Starts constructing a packet to send. */