linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Question about the syncookie_secret[] in syncookies.c
@ 2006-01-17 14:10 openbsd shen
  2006-01-17 14:24 ` Steve Graegert
  0 siblings, 1 reply; 2+ messages in thread
From: openbsd shen @ 2006-01-17 14:10 UTC (permalink / raw)
  To: linux-c-programming

In /usr/src/linux/net/ipv4/syncookies.c, there are 2 lines:

static __u32 syncookie_secret[2][16-3+SHA_DIGEST_WORDS];
#define SHA_DIGEST_WORDS 5

As we know 16-3+5 = 18, why not use syncookie_secret[2][18] directly ?

Thanks

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

* Re: Question about the syncookie_secret[] in syncookies.c
  2006-01-17 14:10 Question about the syncookie_secret[] in syncookies.c openbsd shen
@ 2006-01-17 14:24 ` Steve Graegert
  0 siblings, 0 replies; 2+ messages in thread
From: Steve Graegert @ 2006-01-17 14:24 UTC (permalink / raw)
  To: linux-c-programming

On 1/17/06, openbsd shen <openbsd.shen@gmail.com> wrote:
> In /usr/src/linux/net/ipv4/syncookies.c, there are 2 lines:
>
> static __u32 syncookie_secret[2][16-3+SHA_DIGEST_WORDS];
> #define SHA_DIGEST_WORDS 5
>
> As we know 16-3+5 = 18, why not use syncookie_secret[2][18] directly ?

Because it is good practice to define constants, which are used in
multiple places, only once (here: SHA_DIGEST_WORDS is defined in
<linux/cryptohash.h>) .  It eases maintenance of code significantly.

	\Steve

--

Steve Graegert <graegerts@gmail.com>
Software Consultant {C/C++ && Java && .NET}
Office: +49 9131 7123988
Mobile: +49 1520 9289212

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

end of thread, other threads:[~2006-01-17 14:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-17 14:10 Question about the syncookie_secret[] in syncookies.c openbsd shen
2006-01-17 14:24 ` Steve Graegert

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).