X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=crypt.c;h=7161e626119b5052689b03f161117c53004f6729;hp=207ad5db4e9f264091076d404adb06e12b95e8e4;hb=65b6448b8eb6f7442ba64affff58c388306a9159;hpb=6f24630aa6d5ea343f0f0626b356d03fa36f890e diff --git a/crypt.c b/crypt.c index 207ad5db..7161e626 100644 --- a/crypt.c +++ b/crypt.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005-2011 Andre Noll + * Copyright (C) 2005-2012 Andre Noll * * Licensed under the GPL v2. For licencing details see COPYING. */ @@ -7,7 +7,6 @@ /** \file crypt.c Openssl-based encryption/decryption routines. */ #include -#include #include #include #include @@ -299,7 +298,7 @@ int sc_send_bin_buffer(struct stream_cipher_context *scc, char *buf, memcpy(remainder, buf + l1, len - l1); RC4(&scc->send->key, len - l1, remainder, tmp + l1); } - ret = write_all(scc->fd, (char *)tmp, &len); + ret = write_all(scc->fd, (char *)tmp, len); free(tmp); return ret; } @@ -307,7 +306,7 @@ int sc_send_bin_buffer(struct stream_cipher_context *scc, char *buf, int sc_recv_bin_buffer(struct stream_cipher_context *scc, char *buf, size_t size) { - unsigned char *tmp = para_malloc(size); + unsigned char *tmp = para_malloc(ROUND_UP(size, RC4_ALIGN)); ssize_t ret = recv(scc->fd, tmp, size, 0); if (ret > 0)