Blame SOURCES/sha-digest-calc.patch
|
|
e97af7 |
From e4f08157b6693b956fe9c7c987bc3eeac1abb2cc Mon Sep 17 00:00:00 2001
|
|
|
e97af7 |
From: Tim Shearer <timtimminz@gmail.com>
|
|
|
e97af7 |
Date: Tue, 2 Aug 2022 08:48:32 -0400
|
|
|
e97af7 |
Subject: [PATCH] Fix incorrect SHA384/512 digest calculation.
|
|
|
e97af7 |
|
|
|
e97af7 |
Resolves an issue where certain message sizes result in an incorrect
|
|
|
e97af7 |
checksum. Specifically, when:
|
|
|
e97af7 |
(n*8) mod 1024 == 896
|
|
|
e97af7 |
where n is the file size in bytes.
|
|
|
e97af7 |
---
|
|
|
e97af7 |
lib/util/sha2.c | 2 +-
|
|
|
e97af7 |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
e97af7 |
|
|
|
e97af7 |
diff --git a/lib/util/sha2.c b/lib/util/sha2.c
|
|
|
e97af7 |
index b7a28cca8..f769f77f2 100644
|
|
|
e97af7 |
--- a/lib/util/sha2.c
|
|
|
e97af7 |
+++ b/lib/util/sha2.c
|
|
|
e97af7 |
@@ -490,7 +490,7 @@ SHA512Pad(SHA2_CTX *ctx)
|
|
|
e97af7 |
SHA512Update(ctx, (uint8_t *)"\200", 1);
|
|
|
e97af7 |
|
|
|
e97af7 |
/* Pad message such that the resulting length modulo 1024 is 896. */
|
|
|
e97af7 |
- while ((ctx->count[0] & 1008) != 896)
|
|
|
e97af7 |
+ while ((ctx->count[0] & 1016) != 896)
|
|
|
e97af7 |
SHA512Update(ctx, (uint8_t *)"\0", 1);
|
|
|
e97af7 |
|
|
|
e97af7 |
/* Append length of message in bits and do final SHA512Transform(). */
|