[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
sha512_process_bytes doesn't like odd sized buffers
From: |
J. Scott Edwards |
Subject: |
sha512_process_bytes doesn't like odd sized buffers |
Date: |
Sat, 15 Mar 2008 03:04:00 -0600 |
Hello,
I have been using the md5.c, sha1.c, sha256.c functions in a program
of mine for some time. I just started using the sha512.c functions in
the same program and I have discovered that it gets unhappy if I send
it buffers of 244 bytes, it works fine if I send it buffers of 256. I
believe I have found the bug, it is in the line:
"sha512_process_block (ctx->buffer, ctx->buflen & ~63, ctx);". If I
change the 63 to 127 it seems to work for 244 bytes as well. I have
included a patch below if that is useful:
--- sha512.c.~1.1.~ 2008-03-11 12:26:09.000000000 -0600
+++ sha512.c 2008-03-15 02:46:55.000000000 -0600
@@ -352,7 +352,7 @@
if (ctx->buflen > 128)
{
- sha512_process_block (ctx->buffer, ctx->buflen & ~63, ctx);
+ sha512_process_block (ctx->buffer, ctx->buflen & ~127, ctx);
ctx->buflen &= 127;
/* The regions in the following copy operation cannot overlap. */
Thanks!
-Scott
- sha512_process_bytes doesn't like odd sized buffers,
J. Scott Edwards <=