- Changed ARC4 to use seperate input/output buffer

diff --git a/library/arc4.c b/library/arc4.c
index 5e70311..b87053e 100644
--- a/library/arc4.c
+++ b/library/arc4.c
@@ -63,7 +63,8 @@
 /*
  * ARC4 cipher function
  */
-int arc4_crypt( arc4_context *ctx, unsigned char *buf, int buflen )
+int arc4_crypt( arc4_context *ctx, int length, const unsigned char *input,
+                unsigned char *output )
 {
     int i, x, y, a, b;
     unsigned char *m;
@@ -72,7 +73,7 @@
     y = ctx->y;
     m = ctx->m;
 
-    for( i = 0; i < buflen; i++ )
+    for( i = 0; i < length; i++ )
     {
         x = ( x + 1 ) & 0xFF; a = m[x];
         y = ( y + a ) & 0xFF; b = m[y];
@@ -80,8 +81,8 @@
         m[x] = (unsigned char) b;
         m[y] = (unsigned char) a;
 
-        buf[i] = (unsigned char)
-            ( buf[i] ^ m[(unsigned char)( a + b )] );
+        output[i] = (unsigned char)
+            ( input[i] ^ m[(unsigned char)( a + b )] );
     }
 
     ctx->x = x;
@@ -127,7 +128,8 @@
 int arc4_self_test( int verbose )
 {
     int i;
-    unsigned char buf[8];
+    unsigned char ibuf[8];
+    unsigned char obuf[8];
     arc4_context ctx;
 
     for( i = 0; i < 3; i++ )
@@ -135,12 +137,12 @@
         if( verbose != 0 )
             printf( "  ARC4 test #%d: ", i + 1 );
 
-        memcpy( buf, arc4_test_pt[i], 8 );
+        memcpy( ibuf, arc4_test_pt[i], 8 );
 
         arc4_setup( &ctx, (unsigned char *) arc4_test_key[i], 8 );
-        arc4_crypt( &ctx, buf, 8 );
+        arc4_crypt( &ctx, 8, ibuf, obuf );
 
-        if( memcmp( buf, arc4_test_ct[i], 8 ) != 0 )
+        if( memcmp( obuf, arc4_test_ct[i], 8 ) != 0 )
         {
             if( verbose != 0 )
                 printf( "failed\n" );
diff --git a/library/ssl_tls.c b/library/ssl_tls.c
index 03975d2..7335513 100644
--- a/library/ssl_tls.c
+++ b/library/ssl_tls.c
@@ -531,7 +531,8 @@
                        ssl->out_msg, ssl->out_msglen );
 
         arc4_crypt( (arc4_context *) ssl->ctx_enc,
-                    ssl->out_msg, ssl->out_msglen );
+                    ssl->out_msglen, ssl->out_msg,
+                    ssl->out_msg );
 #else
         return( POLARSSL_ERR_SSL_FEATURE_UNAVAILABLE );
 #endif
@@ -618,7 +619,8 @@
 #if defined(POLARSSL_ARC4_C)
         padlen = 0;
         arc4_crypt( (arc4_context *) ssl->ctx_dec,
-                    ssl->in_msg, ssl->in_msglen );
+                    ssl->in_msglen, ssl->in_msg,
+                    ssl->in_msg );
 #else
         return( POLARSSL_ERR_SSL_FEATURE_UNAVAILABLE );
 #endif