Mercurial > hg > octave-lyh > gnulib-hg
changeset 6423:4e611c25a13f
Fix arcfour module.
author | Simon Josefsson <simon@josefsson.org> |
---|---|
date | Sat, 22 Oct 2005 16:45:57 +0000 |
parents | 833177ba48f0 |
children | 2a4ec3c897cc |
files | ChangeLog lib/ChangeLog lib/arcfour.c lib/arcfour.h modules/arcfour |
diffstat | 5 files changed, 17 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2005-10-22 Simon Josefsson <jas@extundo.com> + + * modules/arcfour (Depends-on): Need stdint. + 2005-10-21 Bruno Haible <bruno@clisp.org> * gnulib-tool (func_import, func_create_testdir): Add quoting to last
--- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,9 @@ +2005-10-22 Simon Josefsson <jas@extundo.com> + + * arcfour.h, arcfour.c: Use fixed size indices in the + arcfour_context struct (simplify test vector testing in GNU + Shishi). + 2005-10-22 Simon Josefsson <jas@extundo.com> * md4.c, md4.c: Simplify buffer handling visavi alignment,
--- a/lib/arcfour.c +++ b/lib/arcfour.c @@ -36,16 +36,16 @@ 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;
--- a/lib/arcfour.h +++ b/lib/arcfour.h @@ -25,13 +25,14 @@ # define ARCFOUR_H # include <stddef.h> +# include <stdint.h> #define ARCFOUR_SBOX_SIZE 256 typedef struct { - size_t idx_i, idx_j; char sbox[ARCFOUR_SBOX_SIZE]; + uint8_t idx_i, idx_j; } arcfour_context; /* Apply ARCFOUR stream to INBUF placing the result in OUTBUF, both of