X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=command.c;h=9098ad3c21d257c02b90e7a5ca1eee8c3d6b1759;hp=531c776a3249e6d555c6570746c1e6036e125f7d;hb=27638103f249ffbe9768603b9baff199950fd9f6;hpb=f3ebfd3dcb117f1c4a91c2c9f08d8ed710ee3907 diff --git a/command.c b/command.c index 531c776a..9098ad3c 100644 --- a/command.c +++ b/command.c @@ -32,10 +32,6 @@ #include "daemon.h" #include "string.h" -void (*crypt_function_recv)(unsigned long len, const unsigned char *indata, - unsigned char *outdata) = NULL; -void (*crypt_function_send)(unsigned long len, const unsigned char *indata, - unsigned char *outdata) = NULL; static RC4_KEY rc4_recv_key; static RC4_KEY rc4_send_key; static unsigned char rc4_buf[2 * RC4_KEY_LEN]; @@ -1073,12 +1069,14 @@ static void init_rc4_keys(void) RC4_set_key(&rc4_send_key, RC4_KEY_LEN, rc4_buf + RC4_KEY_LEN); } -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, __a_unused void *private_data) { RC4(&rc4_recv_key, len, indata, outdata); } -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, __a_unused void *private_data) { RC4(&rc4_send_key, len, indata, outdata); } @@ -1171,11 +1169,8 @@ int handle_connect(int fd, struct sockaddr_in *addr) ret = send_bin_buffer(fd, buf, numbytes); if (ret < 0) goto err_out; - if (use_rc4) { - crypt_function_recv = rc4_recv; - crypt_function_send = rc4_send; - PARA_INFO_LOG("%s", "rc4 encryption activated\n"); - } + if (use_rc4) + enable_crypt(fd, rc4_recv, rc4_send, NULL); /* read command */ while ((numbytes = recv_buffer(fd, buf, sizeof(buf))) > 0) { // PARA_INFO_LOG("recvd: %s (%d)\n", buf, numbytes);