The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
* [pups] Re: v7 crypt(3)
@ 2002-09-28  4:57 Dennis Ritchie
  0 siblings, 0 replies; 3+ messages in thread
From: Dennis Ritchie @ 2002-09-28  4:57 UTC (permalink / raw)


Following up Toomey's and Davidson's notes
(didn't see Garcia's):

It does appear that the early-distributed v7 didn't
require = in initializers.  A slightly later version
of the original 11 C compiler did; the lines Davidson quoted,

	if (o!=ASSIGN)
		peeksym = o;

were replaced by

		if (o!=ASSIGN) {
			error("Declaration syntax");
			peeksym = o;
		}

bringing it into conformity with K&R1, which
did require the =.

Incidentally, if anyone wants to try the v7 crypt(3),
the 'encrypt' routine has an implicit, and unwarranted,
assumption that the L and R arrays are adjacent in storage
and thus that L can be oversubscripted to access R.
This was fixed at some (surprisingly late) point too.

	Dennis




^ permalink raw reply	[flat|nested] 3+ messages in thread

* [pups] Re: v7 crypt(3)
  2002-09-21  0:17 ` Warren Toomey
@ 2002-09-21  1:11   ` Michael Davidson
  0 siblings, 0 replies; 3+ messages in thread
From: Michael Davidson @ 2002-09-21  1:11 UTC (permalink / raw)


Warren Toomey wrote:

>>
>>
>>static	char	PC1_D[] {
>>	63,55,47,39,31,23,15,
>>	 7,62,54,46,38,30,22,
>>	14, 6,61,53,45,37,29,
>>	21,13, 5,28,20,12, 4,
>>};
>>
>>That wasn't legal syntax, was it?  There should be an '='
>>between [] and {, as in the rest of the file, no?
>>
>
>I just tried to compile the code with the V7 compiler and it complained.
>Maybe it was legal in V6 and they used the .o file from there and didn't
>recompile it.
>
Actually I'm surprised that the V7 compiler would complain about this.

I seem to recall that there was still quite a lot of code in V7
(including the compiler itself) which didn't have an '=' before
the initialiser.

I don't have a V7 system to hand right now, but looking at the
compiler source appears to confirm that the '=' was still optional.

In extdef() at around line 69 of c02.c there is:

	if (o!=ASSIGN)
		peeksym = o;

... at this point in the code we have just processed an external
definition which is not a function and which is not followed by
either a comma or a semicolon and are about to attempt to parse
what follows as an initialiser. If the next symbol is '=' the
compiler swallows it, otherwise it pushes it back and continues
with parsing the initialiser.

So it certainly *looks* as if the V7 compiler didn't require the '='.

Perhaps you were using pcc?





^ permalink raw reply	[flat|nested] 3+ messages in thread

* [pups] Re: v7 crypt(3)
       [not found] <200209201731.g8KHVh176034@pop2.nwbl.wi.voyager.net>
@ 2002-09-21  0:17 ` Warren Toomey
  2002-09-21  1:11   ` Michael Davidson
  0 siblings, 1 reply; 3+ messages in thread
From: Warren Toomey @ 2002-09-21  0:17 UTC (permalink / raw)


In article by A. P. Garcia:
> Warren,
> 
> I've been looking at the Henry_Spencer_v7 tar, and something
> is puzzling me.  lines 49-54 of /usr/src/libc/gen/crypt.c are
> the following:
> 
> static	char	PC1_D[] {
> 	63,55,47,39,31,23,15,
> 	 7,62,54,46,38,30,22,
> 	14, 6,61,53,45,37,29,
> 	21,13, 5,28,20,12, 4,
> };
> 
> That wasn't legal syntax, was it?  There should be an '='
> between [] and {, as in the rest of the file, no?

I just tried to compile the code with the V7 compiler and it complained.
Maybe it was legal in V6 and they used the .o file from there and didn't
recompile it.

I think Dennis is on the list, maybe he can answer the intruiging question!
 
> Btw, it's neat to look at this code alongside the DES standard: 
> http://csrc.nist.gov/publications/fips/fips46-3/fips46-3.pdf
> Phil Garcia

Yes, it certainly is.

Thanks Phil.
	Warren



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-09-28  4:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-28  4:57 [pups] Re: v7 crypt(3) Dennis Ritchie
     [not found] <200209201731.g8KHVh176034@pop2.nwbl.wi.voyager.net>
2002-09-21  0:17 ` Warren Toomey
2002-09-21  1:11   ` Michael Davidson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).