Fix SHA224 to produce 28 bytes of hash (instead of 32).
PATCH 1/1 Fix SHA224 to produce 28 bytes of hash (instead of 32).
This fixes a panic in sha224sum.
Signed-off-by Krzysztof Hałasa <[email protected]>
crypto/sha2.c +2 -1
@@ -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