1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-14 09:37:34 -05:00

Add the CRC32 compensation attack detector that all other SSH

clients have had for ages and I forgot about. Of course I've got the
version with the buffer overflow fixed!

[originally from svn r1535]
This commit is contained in:
Simon Tatham
2002-01-08 11:57:32 +00:00
parent 349e2ce9e2
commit d237773599
10 changed files with 183 additions and 11 deletions

View File

@ -211,9 +211,8 @@ int main(void)
}
#endif
unsigned long crc32(const void *buf, size_t len)
unsigned long crc32_update(unsigned long crcword, const void *buf, size_t len)
{
unsigned long crcword = 0L;
const unsigned char *p = (const unsigned char *) buf;
while (len--) {
unsigned long newbyte = *p++;
@ -222,3 +221,8 @@ unsigned long crc32(const void *buf, size_t len)
}
return crcword;
}
unsigned long crc32(const void *buf, size_t len)
{
return crc32_update(0L, buf, len);
}