Configire: take multi-block modules into build loop.
[openssl.git] / crypto / rc4 / rc4_enc.c
index 35dbc7c..8c4fc6c 100644 (file)
  * Date: Wed, 14 Sep 1994 06:35:31 GMT
  */
 
-void RC4(RC4_KEY *key, unsigned long len, unsigned char *indata,
+void RC4(RC4_KEY *key, size_t len, const unsigned char *indata,
             unsigned char *outdata)
        {
         register RC4_INT *d;
         register RC4_INT x,y,tx,ty;
-       int i;
+       size_t i;
         
         x=key->x;     
         y=key->y;     
@@ -120,8 +120,8 @@ void RC4(RC4_KEY *key, unsigned long len, unsigned char *indata,
                        (RC4_CHUNK)d[(tx+ty)&0xff]\
                        )
 
-       if ( ( ((unsigned long)indata  & (sizeof(RC4_CHUNK)-1)) | 
-              ((unsigned long)outdata & (sizeof(RC4_CHUNK)-1)) ) == 0 )
+       if ( ( ((size_t)indata  & (sizeof(RC4_CHUNK)-1)) | 
+              ((size_t)outdata & (sizeof(RC4_CHUNK)-1)) ) == 0 )
                {
                RC4_CHUNK ichunk,otp;
                const union { long one; char little; } is_endian = {1};
@@ -157,7 +157,7 @@ void RC4(RC4_KEY *key, unsigned long len, unsigned char *indata,
                if (!is_endian.little)
                        {       /* BIG-ENDIAN CASE */
 # define BESHFT(c)     (((sizeof(RC4_CHUNK)-(c)-1)*8)&(sizeof(RC4_CHUNK)*8-1))
-                       for (;len&-sizeof(RC4_CHUNK);len-=sizeof(RC4_CHUNK))
+                       for (;len&(0-sizeof(RC4_CHUNK));len-=sizeof(RC4_CHUNK))
                                {
                                ichunk  = *(RC4_CHUNK *)indata;
                                otp  = RC4_STEP<<BESHFT(0);
@@ -210,7 +210,7 @@ void RC4(RC4_KEY *key, unsigned long len, unsigned char *indata,
                else
                        {       /* LITTLE-ENDIAN CASE */
 # define LESHFT(c)     (((c)*8)&(sizeof(RC4_CHUNK)*8-1))
-                       for (;len&-sizeof(RC4_CHUNK);len-=sizeof(RC4_CHUNK))
+                       for (;len&(0-sizeof(RC4_CHUNK));len-=sizeof(RC4_CHUNK))
                                {
                                ichunk  = *(RC4_CHUNK *)indata;
                                otp  = RC4_STEP;
@@ -276,7 +276,7 @@ void RC4(RC4_KEY *key, unsigned long len, unsigned char *indata,
 #define RC4_LOOP(a,b,i)        LOOP(a[i],b[i])
 #endif
 
-       i=(int)(len>>3L);
+       i=len>>3;
        if (i)
                {
                for (;;)
@@ -296,7 +296,7 @@ void RC4(RC4_KEY *key, unsigned long len, unsigned char *indata,
                        if (--i == 0) break;
                        }
                }
-       i=(int)len&0x07;
+       i=len&0x07;
        if (i)
                {
                for (;;)