- ERROR("Failed to read integrity table (size = %zu, "
- " offset = %"PRIu64")",
- (size_t)res_entry->size, res_entry->offset);
- ret = WIMLIB_ERR_READ;
- goto out_free_table;
- }
-
- table->size = le32_to_cpu(table->size);
- table->num_entries = le32_to_cpu(table->num_entries);
- table->chunk_size = le32_to_cpu(table->chunk_size);
-
- if (table->size != res_entry->size) {
- ERROR("Inconsistent integrity table sizes: Table header says "
- "%u bytes but resource entry says %u bytes",
- table->size, (unsigned)res_entry->size);
- ret = WIMLIB_ERR_INVALID_INTEGRITY_TABLE;
- goto out_free_table;
- }
-
- DEBUG("table->size = %u, table->num_entries = %u, "
- "table->chunk_size = %u",
- table->size, table->num_entries, table->chunk_size);
-
- expected_size = (u64)table->num_entries * SHA1_HASH_SIZE + 12;
-
- if (table->size != expected_size) {
- ERROR("Integrity table is %u bytes, but expected %"PRIu64" "
- "bytes to hold %u entries",
- table->size, expected_size, table->num_entries);
- ret = WIMLIB_ERR_INVALID_INTEGRITY_TABLE;
- goto out_free_table;
- }
-
- if (table->chunk_size == 0) {
- ERROR("Cannot use integrity chunk size of 0");
- ret = WIMLIB_ERR_INVALID_INTEGRITY_TABLE;
- goto out_free_table;