Use of encrypt (3C)

Jim Mayer mayer at rochester.UUCP
Wed Jan 11 05:38:44 AEST 1984


There is a bug in the encrypt/setkey stuff under 4.1c.  The problem is
that the "E table" is initialized only in the crypt routine.  If
encrypt/setkey are used independently of crypt the "E table" is left
undefined.  You can use the routines if you call "crypt" first, but the
encryption will be done with a non standard table.  To fix the problem,
move the initialization "for" loop into "setkey".  You will also have
to move the declaration of the "e" and "E" arrays up above the "setkey"
definition (otherwise they are undefined).  The following stuff is a
"diff" between the old and new versions.

					-- Jim Mayer (rochester!mayer)

23a24,38
>  * The E bit-selection table.
>  */
> static	char	E[48];
> static	char	e[] = {
> 	32, 1, 2, 3, 4, 5,
	...
> 	28,29,30,31,32, 1,
> };
> 
> /*
104a120,125
> 	 *	Remember to initialize the E table first!
> 	 */
> 	for(i=0;i<48;i++)
> 		E[i] = e[i];
> 
> 	/*
144,158d164
<  * The E bit-selection table.
<  */
< static	char	E[48];
< static	char	e[] = {
< 	32, 1, 2, 3, 4, 5,
	...
< 	28,29,30,31,32, 1,
< };
< 
< /*
344,346d349
< 
< 	for(i=0;i<48;i++)
< 		E[i] = e[i];



More information about the Comp.unix.wizards mailing list