mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: barebox@lists.infradead.org
Subject: [PATCH 1/9] crypto: digest: digest_file_window: check every digest_xxx return
Date: Tue, 17 Mar 2015 12:53:08 +0100	[thread overview]
Message-ID: <1426593196-12509-1-git-send-email-plagnioj@jcrosoft.com> (raw)
In-Reply-To: <20150317114923.GQ26127@ns203013.ovh.net>

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 crypto/digest.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/crypto/digest.c b/crypto/digest.c
index c06089d..2228ec7 100644
--- a/crypto/digest.c
+++ b/crypto/digest.c
@@ -128,7 +128,9 @@ int digest_file_window(struct digest *d, const char *filename,
 	if (key)
 		digest_set_key(d, key, keylen);
 
-	digest_init(d);
+	ret = digest_init(d);
+	if (ret)
+		return ret;
 
 	fd = open(filename, O_RDONLY);
 	if (fd < 0) {
@@ -172,12 +174,14 @@ int digest_file_window(struct digest *d, const char *filename,
 			goto out_free;
 		}
 
-		digest_update(d, buf, now);
+		ret = digest_update(d, buf, now);
+		if (ret)
+			goto out_free;
 		size -= now;
 		len += now;
 	}
 
-	digest_final(d, hash);
+	ret = digest_final(d, hash);
 
 out_free:
 	if (flags)
-- 
2.1.4


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

  reply	other threads:[~2015-03-17 11:53 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-17 11:49 [PATCH 0/9 v4] prepare for rsa support Jean-Christophe PLAGNIOL-VILLARD
2015-03-17 11:53 ` Jean-Christophe PLAGNIOL-VILLARD [this message]
2015-03-17 11:53   ` [PATCH 2/9] crypto: digest: digest_file_window/digest_file/digest_file_by_name drop key params Jean-Christophe PLAGNIOL-VILLARD
2015-03-17 11:53   ` [PATCH 3/9] digest: add verify callback Jean-Christophe PLAGNIOL-VILLARD
2015-03-17 11:53   ` [PATCH 4/9] digest: add digest callback Jean-Christophe PLAGNIOL-VILLARD
2015-03-17 11:53   ` [PATCH 5/9] crypto: hmac: use digest_digest and check the return of every digest_xxx Jean-Christophe PLAGNIOL-VILLARD
2015-03-17 11:53   ` [PATCH 6/9] crypto: add pbkdf2 hmac key generator Jean-Christophe PLAGNIOL-VILLARD
2015-03-17 11:53   ` [PATCH 7/9] command: allow runtime usage Jean-Christophe PLAGNIOL-VILLARD
2015-03-17 11:53   ` [PATCH 8/9] command: rename digest.c to hashsum.c Jean-Christophe PLAGNIOL-VILLARD
2015-03-17 11:53   ` [PATCH 9/9] command: add generic digest command Jean-Christophe PLAGNIOL-VILLARD
2015-03-17 12:54 ` [PATCH 0/9 v4] prepare for rsa support Jan Lübbe
2015-03-18  7:44 ` Sascha Hauer

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=1426593196-12509-1-git-send-email-plagnioj@jcrosoft.com \
    --to=plagnioj@jcrosoft.com \
    --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