[OpenAFS] Fwd: Bug#415952: openafs-client: klog fails with an "bus access error" for password longer then 8 symbols.

Marcus Watts mdw@spam.ifs.umich.edu
Fri, 22 Jun 2007 14:36:55 -0400


Russ Allbery <rra@stanford.edu> sent:
...
> > So, key_schedule in stock 1.4.4 is defined this way:
> > typedef struct des_ks_struct { des_cblock _; } des_key_schedule[16];
> > That is, an array of 16 blocks of 8 characters.  The C compiler will
> > indeed only give that character alignment, so a problem is quite possible.
> > A relatively simple fix is to instead do this:
> > typedef struct des_ks_struct { int _[8/sizeof(int)]; } des_key_schedule[16];
> > which will give it exactly the same size but require int alignment, which
> > is what is required.  This should compile and work without errors; the
> > fieldname itself is never used.
> 
> This loses if we ever get an int larger than 8 bytes, right?  (Not that
> I'm expecting that soon... maybe DES will be gone by then.)
...

The reason to have "int _[8/sizeof(int)]" is so that it doesn't lose
if sizeof(int) changes -- provide it remains a power of 2 less than 8.
Nearly all current machines use 4 including all the popular 64-bit
machines where 8 could in theory be justified.  I think it is safe
to assume DES will be long gone by the time this is a problem.
It is possible all of us will be long gone as well.

... While I think this is safe, I'm pretty sure there are parts
of the rest of the des library that will need work if sizeof(int) != 4.
But now hardly seems the time to panic over this.

				-Marcus Watts