bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: arcfour


From: Bruno Haible
Subject: Re: arcfour
Date: Fri, 14 Oct 2005 20:47:39 +0200
User-agent: KMail/1.5

Paul Eggert wrote:
> > +#define ARCFOUR_SBOX_SIZE 256
> > +
> > +typedef struct
> > +{
> > +  size_t idx_i, idx_j;
> > +  char sbox[ARCFOUR_SBOX_SIZE];
> > +} arcfour_context;
>
> Why must these be in arcfour.h?  Shouldn't all this private to
> arcfour.c?
>
> You can replace the above lines with 'struct arcfour_context;' and
> then move them into arcfour.c (replacing 'arcfour_context' with
> 'struct arcfour_context' everywhere).

It is needed in arcfour.h so that the user of this module can allocate
a variable of type 'arcfour_context' on the stack. Or if the struct
contents is made private, at least sizeof(arcfour_context) must be made
available through a variable 'const size_t arcfour_context_size'; but
then the allocation of such a context on the stack needs alloca().

Bruno





reply via email to

[Prev in Thread] Current Thread [Next in Thread]