[PATCH 10/10] digest: digest_file_window: check every digest_xxx return
Jean-Christophe PLAGNIOL-VILLARD
plagnioj at jcrosoft.com
Mon Mar 16 03:15:45 PDT 2015
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj at jcrosoft.com>
---
crypto/digest.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/crypto/digest.c b/crypto/digest.c
index c261f7e..ee1a321 100644
--- a/crypto/digest.c
+++ b/crypto/digest.c
@@ -178,7 +178,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) {
@@ -222,7 +224,9 @@ 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;
}
@@ -230,7 +234,7 @@ int digest_file_window(struct digest *d, const char *filename,
if (sig)
ret = digest_verify(d, sig);
else
- digest_final(d, hash);
+ ret = digest_final(d, hash);
out_free:
if (flags)
--
2.1.4
More information about the barebox
mailing list