From 685a2bc66e77978104039b8173a6039a80d8b733 Mon Sep 17 00:00:00 2001 From: Andre Date: Mon, 12 Jun 2006 03:26:08 +0200 Subject: [PATCH] move rc4_send_key and rc4_recv_key to struct private_client_data --- client.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/client.c b/client.c index dba99a28..b77a2f68 100644 --- a/client.c +++ b/client.c @@ -38,6 +38,9 @@ struct private_client_data { char *config_file; char *key_file; char *user; + RC4_KEY rc4_recv_key; + RC4_KEY rc4_send_key; + char *in_buf; size_t *in_loaded; char *out_buf; @@ -116,19 +119,18 @@ out: return ret; } -static RC4_KEY rc4_recv_key; -static RC4_KEY rc4_send_key; -static unsigned char rc4_buf[2 * RC4_KEY_LEN]; - -static void rc4_send(unsigned long len, const unsigned char *indata, unsigned char *outdata) +static void rc4_send(unsigned long len, const unsigned char *indata, + unsigned char *outdata) { - RC4(&rc4_send_key, len, indata, outdata); + RC4(&pcd->rc4_send_key, len, indata, outdata); } -static void rc4_recv(unsigned long len, const unsigned char *indata, unsigned char *outdata) +static void rc4_recv(unsigned long len, const unsigned char *indata, + unsigned char *outdata) { - RC4(&rc4_recv_key, len, indata, outdata); + RC4(&pcd->rc4_recv_key, len, indata, outdata); } + void (*crypt_function_recv)(unsigned long len, const unsigned char *indata, unsigned char *outdata); void (*crypt_function_send)(unsigned long len, const unsigned char *indata, unsigned char *outdata); @@ -174,6 +176,7 @@ int main(int argc, char *argv[]) char buf[8192]; char *auth_str; long unsigned challenge_nr; + unsigned char rc4_buf[2 * RC4_KEY_LEN] = ""; ret = client_parse_config(argc, argv, &pcd); if (ret < 0) @@ -264,8 +267,8 @@ int main(int argc, char *argv[]) numbytes - PROCEED_MSG_LEN - 1); if (ret < 0) goto out; - RC4_set_key(&rc4_send_key, RC4_KEY_LEN, rc4_buf); - RC4_set_key(&rc4_recv_key, RC4_KEY_LEN, rc4_buf + RC4_KEY_LEN); + RC4_set_key(&pcd->rc4_send_key, RC4_KEY_LEN, rc4_buf); + RC4_set_key(&pcd->rc4_recv_key, RC4_KEY_LEN, rc4_buf + RC4_KEY_LEN); PARA_INFO_LOG("rc4 encrytion activated: %x:%x:%x:%x\n", rc4_buf[0], rc4_buf[1], rc4_buf[2], rc4_buf[3]); crypt_function_recv = rc4_recv; -- 2.39.5