X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Farcfour.c;h=95f8204f4ecb438ce4f52aa3995d8245966f8ad4;hb=bf57161d3867968ecf2a4d666062c41d5a1fbddd;hp=61b851127c9d6aa7382d338c4edf8cfabb163762;hpb=13083d5caa5989dab4238adce19a2fa55efc4201;p=gnulib.git diff --git a/lib/arcfour.c b/lib/arcfour.c index 61b851127..95f8204f4 100644 --- a/lib/arcfour.c +++ b/lib/arcfour.c @@ -1,5 +1,6 @@ /* arcfour.c --- The arcfour stream cipher - * Copyright (C) 2000, 2001, 2002, 2003, 2005 Free Software Foundation, Inc. + * Copyright (C) 2000, 2001, 2002, 2003, 2005, 2006 Free Software + * Foundation, Inc. * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published @@ -26,9 +27,7 @@ * ISBN 0-471-11709-9. Pages 397 ff. */ -#ifdef HAVE_CONFIG_H -# include -#endif +#include #include "arcfour.h" @@ -36,16 +35,16 @@ void arcfour_stream (arcfour_context * context, const char *inbuf, char *outbuf, size_t length) { - size_t i = context->idx_i; - size_t j = context->idx_j; + uint8_t i = context->idx_i; + uint8_t j = context->idx_j; char *sbox = context->sbox; for (; length > 0; length--) { char t; - i = (i + 1) % ARCFOUR_SBOX_SIZE; - j = (j + sbox[i]) % ARCFOUR_SBOX_SIZE; + i++; + j += sbox[i]; t = sbox[i]; sbox[i] = sbox[j]; sbox[j] = t;