public inbox for linux-tegra@vger.kernel.org
 help / color / mirror / Atom feed
From: Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
To: swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org
Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Subject: [cbootimage PATCH 2/2] crypto: produce consistent hash for zero-length data
Date: Fri, 23 Aug 2013 12:56:02 -0600	[thread overview]
Message-ID: <1377284162-7700-2-git-send-email-swarren@wwwdotorg.org> (raw)
In-Reply-To: <1377284162-7700-1-git-send-email-swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>

From: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>

In real-world use-cases, hashing zero-length data likely never happens.
However, it is relevant when testing cbootimage with a dummy zero-length
bootloader binary, e.g.:

touch u-boot.bin
cbootimage -t30 ../tamonten-ng/tegra30.img.cfg tegra30-tec-ng.img

In this scenario, it's useful to create a consistent hash, so that one
can compare the resultant images before and after applying patches, to
check for regressions.

Signed-off-by: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
---
 src/crypto.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/crypto.c b/src/crypto.c
index 88de357..9741785 100644
--- a/src/crypto.c
+++ b/src/crypto.c
@@ -183,6 +183,9 @@ sign_objext(
 	if (enable_debug_crypto)
 		print_vector("K1", KEY_LENGTH, k1);
 
+	if (!num_aes_blocks)
+		memset(dst, 0, 4 * NVAES_STATECOLS);
+
 	/* compute the AES-CMAC value */
 	for (i = 0; i < num_aes_blocks; i++) {
 		/* Apply the chain data */
-- 
1.8.1.5

  parent reply	other threads:[~2013-08-23 18:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-23 18:56 [cbootimage PATCH 1/2] autogen.sh: allow spaced in configure arguments Stephen Warren
     [not found] ` <1377284162-7700-1-git-send-email-swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-08-23 18:56   ` Stephen Warren [this message]
     [not found]     ` <1377284162-7700-2-git-send-email-swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-08-26  8:01       ` [cbootimage PATCH 2/2] crypto: produce consistent hash for zero-length data Thierry Reding
2013-08-26  7:52   ` [cbootimage PATCH 1/2] autogen.sh: allow spaced in configure arguments Thierry Reding
2013-08-26 20:20     ` Stephen Warren

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=1377284162-7700-2-git-send-email-swarren@wwwdotorg.org \
    --to=swarren-3lzwwm7+weoh9zmkesr00q@public.gmane.org \
    --cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.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