summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Axboe <axboe@fb.com>2015-01-16 21:12:53 +0100
committerMohamad Ayyash <mkayyash@google.com>2015-03-06 17:58:14 -0800
commitf795c8195eab217a834638cd4b2be609453872e8 (patch)
tree08b8cd56ad49813157293511ee95235bca9c4d7f
parentd1a44b2fae5053c957cbde69144ba2ff342a7040 (diff)
downloadfio-f795c8195eab217a834638cd4b2be609453872e8.tar.gz
sha256: fix verify failure
After the checksumming update, it's required that we call the _final() to get consistent checksums between data generation and data verification. Seems to only affect sha256, but we should do it for sha1 and md5 too. Fixes: f99d67f932ab Signed-off-by: Jens Axboe <axboe@fb.com>
-rw-r--r--verify.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/verify.c b/verify.c
index 260fa2ae..b6793d7d 100644
--- a/verify.c
+++ b/verify.c
@@ -472,6 +472,7 @@ static int verify_io_u_sha256(struct verify_header *hdr, struct vcont *vc)
fio_sha256_init(&sha256_ctx);
fio_sha256_update(&sha256_ctx, p, hdr->len - hdr_size(hdr));
+ fio_sha256_final(&sha256_ctx);
if (!memcmp(vh->sha256, sha256_ctx.buf, sizeof(sha256)))
return 0;
@@ -497,6 +498,7 @@ static int verify_io_u_sha1(struct verify_header *hdr, struct vcont *vc)
fio_sha1_init(&sha1_ctx);
fio_sha1_update(&sha1_ctx, p, hdr->len - hdr_size(hdr));
+ fio_sha1_final(&sha1_ctx);
if (!memcmp(vh->sha1, sha1_ctx.H, sizeof(sha1)))
return 0;
@@ -627,6 +629,7 @@ static int verify_io_u_md5(struct verify_header *hdr, struct vcont *vc)
fio_md5_init(&md5_ctx);
fio_md5_update(&md5_ctx, p, hdr->len - hdr_size(hdr));
+ fio_md5_final(&md5_ctx);
if (!memcmp(vh->md5_digest, md5_ctx.hash, sizeof(hash)))
return 0;
@@ -893,6 +896,7 @@ static void fill_sha256(struct verify_header *hdr, void *p, unsigned int len)
fio_sha256_init(&sha256_ctx);
fio_sha256_update(&sha256_ctx, p, len);
+ fio_sha256_final(&sha256_ctx);
}
static void fill_sha1(struct verify_header *hdr, void *p, unsigned int len)
@@ -904,6 +908,7 @@ static void fill_sha1(struct verify_header *hdr, void *p, unsigned int len)
fio_sha1_init(&sha1_ctx);
fio_sha1_update(&sha1_ctx, p, len);
+ fio_sha1_final(&sha1_ctx);
}
static void fill_crc7(struct verify_header *hdr, void *p, unsigned int len)
@@ -950,6 +955,7 @@ static void fill_md5(struct verify_header *hdr, void *p, unsigned int len)
fio_md5_init(&md5_ctx);
fio_md5_update(&md5_ctx, p, len);
+ fio_md5_final(&md5_ctx);
}
static void populate_hdr(struct thread_data *td, struct io_u *io_u,