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.
This commit is contained in:
joerg 2008-05-09 16:19:57 +00:00
parent 647e9d137e
commit 9502292e69

View file

@ -814,7 +814,7 @@ void SHA512_Last(SHA512_CTX* context) {
/* 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 {