+static int verify_io_u_sha1(struct verify_header *hdr, struct io_u *io_u,
+ unsigned int header_num)
+{
+ void *p = io_u_verify_off(hdr, io_u, header_num);
+ struct vhdr_sha1 *vh = hdr_priv(hdr);
+ uint32_t sha1[5];
+ struct sha1_ctx sha1_ctx = {
+ .H = sha1,
+ };
+
+ dprint(FD_VERIFY, "sha1 verify io_u %p, len %u\n", io_u, hdr->len);
+
+ sha1_init(&sha1_ctx);
+ sha1_update(&sha1_ctx, p, hdr->len - hdr_size(hdr));
+
+ if (memcmp(vh->sha1, sha1_ctx.H, sizeof(sha1))) {
+ log_err("sha1: verify failed at %llu/%u\n",
+ io_u->offset + header_num * hdr->len, hdr->len);
+ hexdump(vh->sha1, sizeof(vh->sha1));
+ hexdump(sha1_ctx.H, sizeof(sha1));
+ return EILSEQ;
+ }
+
+ return 0;
+}
+