summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>2015-03-17 12:53:08 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2015-03-18 08:44:01 +0100
commitbf2cdf4084721de533ad0957f2ca3002cfa89cf1 (patch)
treea358626a9403842394904dfb0f2ad477202f2059 /crypto
parente693622467bf16f39afd792ee1e78ea9e2fed26f (diff)
downloadbarebox-bf2cdf4084721de533ad0957f2ca3002cfa89cf1.tar.gz
barebox-bf2cdf4084721de533ad0957f2ca3002cfa89cf1.tar.xz
crypto: digest: digest_file_window: check every digest_xxx return
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'crypto')
-rw-r--r--crypto/digest.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/crypto/digest.c b/crypto/digest.c
index c06089db5a..2228ec7eb5 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)