Question about the syncookie_secret[] in syncookies.c
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
Quoted 6 lines · openbsd shen
In
/usr/src/linux/net/ipv4/syncookies.c, there are 2 lines:static
__u32syncookie_secret[2][16-3+SHA_DIGEST_WORDS]; #defineSHA_DIGEST_WORDS5As 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 <[email protected]>
Software Consultant {C/C++ && Java && .NET}
Office: +49 9131 7123988
Mobile: +49 1520 9289212