X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=command.c;h=2c9d29dfca3c6202d61e222a1934b9d21e1357bf;hp=688a039f60fcfa820ee37916d739abfa80760a76;hb=037059c8a25ce134af1eaa6c3fa8ac96b9f7e0b6;hpb=d09716570fc81b71d6ad3d5f543b5f8acf1a5e33 diff --git a/command.c b/command.c index 688a039f..2c9d29df 100644 --- a/command.c +++ b/command.c @@ -11,7 +11,6 @@ #include #include #include -#include #include #include @@ -809,10 +808,10 @@ __noreturn void handle_connect(int fd, const char *peername) /* auth successful */ alarm(0); PARA_INFO_LOG("good auth for %s\n", u->name); - /* init rc4 keys with the second part of the random buffer */ - RC4_set_key(&rc4c.recv_key, RC4_KEY_LEN, rand_buf + CHALLENGE_SIZE); - RC4_set_key(&rc4c.send_key, RC4_KEY_LEN, rand_buf + CHALLENGE_SIZE - + RC4_KEY_LEN); + /* init stream cipher keys with the second part of the random buffer */ + rc4c.recv = stream_cipher_new(rand_buf + CHALLENGE_SIZE, RC4_KEY_LEN); + rc4c.send = stream_cipher_new(rand_buf + CHALLENGE_SIZE + RC4_KEY_LEN, + RC4_KEY_LEN); ret = rc4_send_buffer(&rc4c, PROCEED_MSG); if (ret < 0) goto net_err; @@ -849,6 +848,8 @@ net_err: PARA_NOTICE_LOG("%s\n", para_strerror(-ret)); out: free(command); + stream_cipher_free(rc4c.recv); + stream_cipher_free(rc4c.send); mutex_lock(mmd_mutex); if (cmd && (cmd->perms & AFS_WRITE) && ret >= 0) mmd->events++;