From: Krzysztof Halasa <khc@pm.waw.pl>
To: barebox@lists.infradead.org
Subject: [PATCH] Fix SHA224 to produce 28 bytes of hash (instead of 32).
Date: Thu, 07 Jun 2012 15:05:11 +0200 [thread overview]
Message-ID: <m362b3l1bs.fsf@intrepid.localdomain> (raw)
This fixes a panic in sha224sum.
Signed-off-by: Krzysztof Hałasa <khc@pm.waw.pl>
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@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
reply other threads:[~2012-06-07 13:09 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m362b3l1bs.fsf@intrepid.localdomain \
--to=khc@pm.waw.pl \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox