|
libaaruformat 1.0
Aaru Data Preservation Suite - Format Library
|
#include <aaruformat.h>#include <inttypes.h>#include <stdio.h>#include <stdlib.h>#include "internal.h"#include "log.h"#include "utarray.h"Go to the source code of this file.
Macros | |
| #define | VERIFY_SIZE 1048576 |
Functions | |
| static int32_t | update_crc64_from_stream (FILE *stream, const uint64_t total_length, void *buffer, size_t buffer_size, crc64_ctx *crc_ctx, const char *label) |
| int32_t | aaruf_verify_image (void *context) |
| Verifies the integrity of an AaruFormat image file. | |
| #define VERIFY_SIZE 1048576 |
Definition at line 28 of file verify.c.
Referenced by aaruf_verify_image().
| int32_t aaruf_verify_image | ( | void * | context | ) |
Verifies the integrity of an AaruFormat image file.
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.
| context | Pointer to the aaruformat context. |
| AARUF_STATUS_OK | (0) Successfully verified image integrity. This is returned when:
|
| AARUF_ERROR_NOT_AARUFORMAT | (-1) The context is invalid. This occurs when:
|
| AARUF_ERROR_CANNOT_READ_HEADER | (-6) Failed to read critical headers. This occurs when:
|
| AARUF_ERROR_CANNOT_READ_INDEX | (-4) Index processing or validation failed. This occurs when:
|
| AARUF_ERROR_NOT_ENOUGH_MEMORY | (-9) Memory allocation failed. This occurs when:
|
| AARUF_ERROR_CANNOT_READ_BLOCK | (-7) Block reading failed. This occurs when:
|
| AARUF_ERROR_INVALID_BLOCK_CRC | (-18) CRC verification failed. This occurs when:
|
Definition at line 130 of file verify.c.
References AARU_CALL, AARU_EXPORT, AARU_MAGIC, aaruf_crc64_final(), aaruf_crc64_free(), aaruf_crc64_init(), AARUF_ERROR_CANNOT_READ_BLOCK, AARUF_ERROR_CANNOT_READ_HEADER, AARUF_ERROR_CANNOT_READ_INDEX, AARUF_ERROR_INVALID_BLOCK_CRC, AARUF_ERROR_NOT_AARUFORMAT, AARUF_ERROR_NOT_ENOUGH_MEMORY, AARUF_STATUS_OK, AARUF_VERSION_V1, IndexEntry::blockType, bswap_64, BlockHeader::cmpCrc64, DdtHeader2::cmpCrc64, DdtHeader::cmpCrc64, BlockHeader::cmpLength, DdtHeader2::cmpLength, DdtHeader::cmpLength, BlockHeader::compression, DdtHeader2::compression, DdtHeader::compression, TracksHeader::crc64, DataBlock, DeDuplicationTable, DeDuplicationTable2, TracksHeader::entries, FATAL, aaruformat_context::header, AaruHeaderV2::imageMajorVersion, aaruformat_context::imageStream, IndexBlock, IndexBlock2, IndexBlock3, AaruHeaderV2::indexOffset, Lzma, LZMA_PROPERTIES_LENGTH, LzmaClauniaSubchannelTransform, aaruformat_context::magic, IndexEntry::offset, process_index_v1(), process_index_v2(), process_index_v3(), TRACE, TracksBlock, update_crc64_from_stream(), verify_index_v1(), verify_index_v2(), verify_index_v3(), and VERIFY_SIZE.
|
static |
Definition at line 30 of file verify.c.
References aaruf_crc64_update(), AARUF_ERROR_CANNOT_READ_BLOCK, AARUF_STATUS_OK, and FATAL.
Referenced by aaruf_verify_image().