diff --git a/drivers/cube/cubelinux_store.rs b/drivers/cube/cubelinux_store.rs index 78c053d51..786bb48e6 100644 --- a/drivers/cube/cubelinux_store.rs +++ b/drivers/cube/cubelinux_store.rs @@ -325,12 +325,12 @@ fn digest(image: &[u8]) -> Line { let mut count: u64 = 0; let mut value_bytes: u64 = 0; let mut errors: u64 = 0; - let mut off = layout.image_off - + if header.version == VERSION_V1 { - HEADER_LEN_V1 - } else { - HEADER_LEN_V2 - }; + let header_len = if header.version == VERSION_V1 { + HEADER_LEN_V1 + } else { + HEADER_LEN_V2 + } as u64; + let mut off = layout.image_off + header_len as usize; let mut remaining = header.record_count; let end = layout.image_off + end; @@ -388,7 +388,11 @@ fn digest(image: &[u8]) -> Line { "digest version={} curve={} bytes={} records={} value_bytes={} fnv1a64={:016x} errors={}", header.version, header.curve, - image.len(), + // `bytes` is a property of the store, not of how it was read: the header plus the + // records, whatever padding the reader happened to see. Reporting what was read made + // the same records disagree between a file and a device — and the gates compare this + // line, so it has to mean the same thing on both sides. + header_len + count * RECORD_FIXED as u64 + value_bytes, count, value_bytes, h,