Skip to contentSkip to conversation

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

PATCH New Krzysztof Halasa 1 participant 1 message Jun 7, 2012 Crypto API

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix SHA224 to produce 28 bytes of hash (instead of 32).

This fixes a panic in sha224sum.

crypto/sha2.c +2 -1
index 3096efe..afbe0c3 100644
@@ -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 {
Signature · 6 lines
Krzysztof Halasa

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox