summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjoerg <joerg@pkgsrc.org>2008-05-09 16:19:57 +0000
committerjoerg <joerg@pkgsrc.org>2008-05-09 16:19:57 +0000
commit9502292e691cf52d4e3bb05ba99a23396fe04e11 (patch)
tree6a61c177c38d64c4d59b7526cdca4249b940a0d8
parent647e9d137e64ad1967811d94ba808413ed09f25a (diff)
downloadpkgsrc-9502292e691cf52d4e3bb05ba99a23396fe04e11.tar.gz
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.
-rw-r--r--pkgtools/digest/files/sha2.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/pkgtools/digest/files/sha2.c b/pkgtools/digest/files/sha2.c
index 1fe804fb778..972a24fbbd3 100644
--- a/pkgtools/digest/files/sha2.c
+++ b/pkgtools/digest/files/sha2.c
@@ -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 {