pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/pkgtools/digest/files Fix a bug in the SHA512 implemen...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/2621354f5e9c
branches:  trunk
changeset: 542236:2621354f5e9c
user:      joerg <joerg%pkgsrc.org@localhost>
date:      Fri May 09 16:19:57 2008 +0000

description:
Fix a bug in the SHA512 implementation that would be triggered if the
last block has exactly the length of a short fragment. This happened
incidently with two files in the NetBSD 4.0 release.

diffstat:

 pkgtools/digest/files/sha2.c |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diffs (12 lines):

diff -r dbcbde44d372 -r 2621354f5e9c pkgtools/digest/files/sha2.c
--- a/pkgtools/digest/files/sha2.c      Fri May 09 15:00:32 2008 +0000
+++ b/pkgtools/digest/files/sha2.c      Fri May 09 16:19:57 2008 +0000
@@ -814,7 +814,7 @@
                /* Begin padding with a 1 bit: */
                context->buffer[usedspace++] = 0x80;
 
-               if (usedspace < SHA512_SHORT_BLOCK_LENGTH) {
+               if (usedspace <= SHA512_SHORT_BLOCK_LENGTH) {
                        /* Set-up for the last transform: */
                        MEMSET_BZERO(&context->buffer[usedspace], SHA512_SHORT_BLOCK_LENGTH - usedspace);
                } else {



Home | Main Index | Thread Index | Old Index