<trclass="memdesc:a8cbf4d8059c4b36e8ab5e18fec057b52"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Verifies the integrity of an AaruFormat image file. <br/></td></tr>
<pclass="definition">Definition at line <aclass="el"href="verify_8c_source.html#l00028">28</a> of file <aclass="el"href="verify_8c_source.html">verify.c</a>.</p>
<pclass="reference">Referenced by <aclass="el"href="verify_8c_source.html#l00130">aaruf_verify_image()</a>.</p>
<p>Verifies the integrity of an AaruFormat image file. </p>
<p>Checks the integrity of all blocks and deduplication tables in the image by validating CRC64 checksums for each indexed block. This function performs comprehensive verification of data blocks, DDT v1 and v2 tables, tracks blocks, and other structural components. It reads blocks in chunks to optimize memory usage during verification and supports version-specific CRC endianness handling.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">context</td><td>Pointer to the aaruformat context.</td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>Returns one of the following status codes: </dd></dl>
<dlclass="retval"><dt>Return values</dt><dd>
<tableclass="retval">
<tr><tdclass="paramname">AARUF_STATUS_OK</td><td>(0) Successfully verified image integrity. This is returned when:<ul>
<li>All indexed blocks are successfully read and processed</li>
<li>All CRC64 checksums match their expected values</li>
<li>Index verification passes for the detected index version</li>
<li>All block headers are readable and valid</li>
<li>Memory allocation for verification buffer succeeds</li>
</ul>
</td></tr>
<tr><tdclass="paramname">AARUF_ERROR_NOT_AARUFORMAT</td><td>(-1) The context is invalid. This occurs when:<ul>
<li>The context parameter is NULL</li>
<li>The context magic number doesn't match AARU_MAGIC (invalid context type)</li>
</ul>
</td></tr>
<tr><tdclass="paramname">AARUF_ERROR_CANNOT_READ_HEADER</td><td>(-6) Failed to read critical headers. This occurs when:<ul>
<li>Cannot read the index signature from the image stream</li>
<li>Verifies only blocks that have CRC checksums (skips blocks without checksums)</li>
<li>Unknown block types are logged but don't cause verification failure</li>
</ul>
</dd>
<dd>
Block Types Verified:<ul>
<li>DataBlock: Verifies compressed data CRC64 against block header</li>
<li>DeDuplicationTable (v1): Verifies DDT data CRC64 with version-specific endianness</li>
<li>DeDuplicationTable2 (v2): Verifies DDT data CRC64 (no endianness conversion)</li>
<li>TracksBlock: Verifies track entries CRC64 with version-specific endianness</li>
<li>Other block types are ignored during verification</li>
</ul>
</dd>
<dd>
Performance Considerations:<ul>
<li>Uses chunked reading to minimize memory footprint during verification</li>
<li>Processes blocks sequentially to maintain good disk access patterns</li>
<li>CRC64 contexts are created and destroyed for each block to prevent memory leaks</li>
</ul>
</dd></dl>
<dlclass="section warning"><dt>Warning</dt><dd>This function performs read-only verification and does not modify the image. It requires the image to be properly opened with a valid context.</dd>
<dd>
Verification failure indicates data corruption or tampering. Images that fail verification should not be trusted for data recovery operations.</dd>
<dd>
The function allocates a 1MB buffer for verification. Ensure sufficient memory is available before calling this function on resource-constrained systems. </dd></dl>
<pclass="definition">Definition at line <aclass="el"href="verify_8c_source.html#l00130">130</a> of file <aclass="el"href="verify_8c_source.html">verify.c</a>.</p>
<pclass="definition">Definition at line <aclass="el"href="verify_8c_source.html#l00030">30</a> of file <aclass="el"href="verify_8c_source.html">verify.c</a>.</p>
<pclass="reference">References <aclass="el"href="crc64_8c_source.html#l00055">aaruf_crc64_update()</a>, <aclass="el"href="errors_8h_source.html#l00046">AARUF_ERROR_CANNOT_READ_BLOCK</a>, <aclass="el"href="errors_8h_source.html#l00075">AARUF_STATUS_OK</a>, and <aclass="el"href="log_8h_source.html#l00040">FATAL</a>.</p>
<pclass="reference">Referenced by <aclass="el"href="verify_8c_source.html#l00130">aaruf_verify_image()</a>.</p>
</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<divid="page-nav"class="page-nav-panel">
<divid="page-nav-resize-handle"></div>
<divid="page-nav-tree">
<divid="page-nav-contents">
</div><!-- page-nav-contents -->
</div><!-- page-nav-tree -->
</div><!-- page-nav -->
</div><!-- container -->
<!-- start footer part -->
<divid="nav-path"class="navpath"><!-- id is needed for treeview function! -->
<liclass="footer">Generated by <ahref="https://www.doxygen.org/index.html"><imgclass="footer"src="doxygen.svg"width="104"height="31"alt="doxygen"/></a> 1.14.0 </li>