[PATCH] Fix SHA224 to produce 28 bytes of hash (instead of 32).

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

 



This fixes a panic in sha224sum.

Signed-off-by: Krzysztof Hałasa <khc@xxxxxxxxx>

diff --git a/crypto/sha2.c b/crypto/sha2.c
index 3096efe..afbe0c3 100644
--- a/crypto/sha2.c
+++ b/crypto/sha2.c
@@ -274,7 +274,8 @@ static void sha2_finish(sha2_context * ctx, uint8_t digest[32])
 	PUT_UINT32_BE(ctx->state[4], digest, 16);
 	PUT_UINT32_BE(ctx->state[5], digest, 20);
 	PUT_UINT32_BE(ctx->state[6], digest, 24);
-	PUT_UINT32_BE(ctx->state[7], digest, 28);
+	if (!ctx->is224)
+		PUT_UINT32_BE(ctx->state[7], digest, 28);
 }
 
 struct sha2 {

-- 
Krzysztof Halasa

_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux