diff --git a/libtransmission/rc4.c b/libtransmission/rc4.c deleted file mode 100644 index 040e6f93d..000000000 --- a/libtransmission/rc4.c +++ /dev/null @@ -1,77 +0,0 @@ -#include -#include -#include -#include -#include "rc4.h" - -struct tr_rc4_s -{ - uint8_t x; - uint8_t y; - uint8_t state[256]; -}; - -static void -swapByte( uint8_t* a, uint8_t* b ) -{ - const uint8_t tmp = *a; - *a = *b; - *b = tmp; -} - -tr_rc4_t * -tr_rc4New ( const uint8_t * key, - int keylen ) -{ - uint8_t index1 = 0; - uint8_t index2 = 0; - uint8_t * state; - int i; - tr_rc4_t * ret = calloc( 1, sizeof(tr_rc4_t) ); - - /* initialize the state array */ - state = ret->state; - for( i=0; i<256; ++i ) - state[i] = (uint8_t)i; - - ret->x = 0; - ret->y = 0; - for( i=0; i<256; ++i ) - { - index2 = (key[index1] + state[i] + index2) % 256; - swapByte (state+i, state+index2); - index1 = (index1 + 1) % keylen; - } - - return ret; -} - -void -tr_rc4Free( tr_rc4_t * rc4 ) -{ - free( rc4 ); -} - -void -tr_rc4Step( tr_rc4_t * key, - uint8_t * buf, - int buflen ) -{ - uint8_t x = key->x; - uint8_t y = key->y; - uint8_t * state = key->state; - uint8_t xorIndex; - int i; - - for( i=0; ix = x; - key->y = y; -} diff --git a/libtransmission/rc4.h b/libtransmission/rc4.h deleted file mode 100644 index 18b8b9c49..000000000 --- a/libtransmission/rc4.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef TR_RC4_H -#define TR_RC4_H - -typedef struct tr_rc4_s tr_rc4_t; - -tr_rc4_t * tr_rc4New ( const uint8_t * key, - int keylen ); - -void tr_rc4Step ( tr_rc4_t * rc4, - uint8_t * buf, - int buflen ); - -void tr_rc4Free ( tr_rc4_t * rc4 ); - -#endif diff --git a/mk/lib.mk b/mk/lib.mk index 89d03e209..a7ddbeea8 100644 --- a/mk/lib.mk +++ b/mk/lib.mk @@ -5,7 +5,7 @@ include ../mk/common.mk SRCS = bencode.c choking.c clients.c completion.c fastresume.c fdlimit.c \ http.c inout.c ipcparse.c makemeta.c metainfo.c natpmp.c net.c \ - peer.c platform.c ratecontrol.c rc4.c sha1.c shared.c strlcat.c \ + peer.c platform.c ratecontrol.c sha1.c shared.c strlcat.c \ strlcpy.c torrent.c tracker.c transmission.c upnp.c utils.c xml.c OBJS = $(SRCS:%.c=%.o)