X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=client_common.c;h=c55db47bf457ffbf1c40b79d098116a33d5e8a83;hp=15dc90f1c2b95ad4b8165e208e8f25f1c6a6e010;hb=037059c8a25ce134af1eaa6c3fa8ac96b9f7e0b6;hpb=aa7830ccfd0503d96da56d1e92f97013cc788124 diff --git a/client_common.c b/client_common.c index 15dc90f1..c55db47b 100644 --- a/client_common.c +++ b/client_common.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1997-2010 Andre Noll + * Copyright (C) 1997-2011 Andre Noll * * Licensed under the GPL v2. For licencing details see COPYING. */ @@ -9,7 +9,6 @@ #include #include #include -#include #include "para.h" #include "error.h" @@ -42,6 +41,8 @@ void client_close(struct client_task *ct) return; if (ct->rc4c.fd >= 0) close(ct->rc4c.fd); + stream_cipher_free(ct->rc4c.recv); + stream_cipher_free(ct->rc4c.send); free(ct->user); free(ct->config_file); free(ct->key_file); @@ -188,15 +189,15 @@ static void client_post_select(struct sched *s, struct task *t) if (ret < 0 || n == 0) goto out; PARA_INFO_LOG("<-- [challenge] (%zu bytes)\n", n); - ret = para_decrypt_buffer(ct->key_file, crypt_buf, + ret = priv_decrypt(ct->key_file, crypt_buf, (unsigned char *)buf, n); if (ret < 0) goto out; sha1_hash((char *)crypt_buf, CHALLENGE_SIZE, challenge_sha1); - RC4_set_key(&ct->rc4c.send_key, RC4_KEY_LEN, - crypt_buf + CHALLENGE_SIZE); - RC4_set_key(&ct->rc4c.recv_key, RC4_KEY_LEN, - crypt_buf + CHALLENGE_SIZE + RC4_KEY_LEN); + ct->rc4c.send = stream_cipher_new(crypt_buf + CHALLENGE_SIZE, + RC4_KEY_LEN); + ct->rc4c.recv = stream_cipher_new(crypt_buf + CHALLENGE_SIZE + + RC4_KEY_LEN, RC4_KEY_LEN); hash_to_asc(challenge_sha1, buf); PARA_INFO_LOG("--> %s\n", buf); ret = send_bin_buffer(ct->rc4c.fd, (char *)challenge_sha1,