libaaruformat 1.0
Aaru Data Preservation Suite - Format Library
Loading...
Searching...
No Matches
crc64.c File Reference
#include <stdlib.h>
#include <aaruformat.h>
#include "log.h"

Go to the source code of this file.

Functions

crc64_ctxaaruf_crc64_init (void)
 Initializes a CRC64 context.
int aaruf_crc64_update (crc64_ctx *ctx, const uint8_t *data, uint32_t len)
 Updates the CRC64 context with new data.
void aaruf_crc64_slicing (uint64_t *previous_crc, const uint8_t *data, uint32_t len)
 Updates a CRC64 value using the slicing-by-8 algorithm.
int aaruf_crc64_final (crc64_ctx *ctx, uint64_t *crc)
 Computes the final CRC64 value from the context.
void aaruf_crc64_free (crc64_ctx *ctx)
 Frees a CRC64 context.
uint64_t aaruf_crc64_data (const uint8_t *data, const uint32_t len)

Function Documentation

◆ aaruf_crc64_data()

◆ aaruf_crc64_final()

int aaruf_crc64_final ( crc64_ctx * ctx,
uint64_t * crc )

Computes the final CRC64 value from the context.

Parameters
ctxPointer to the CRC64 context.
crcPointer to store the resulting CRC64 value.
Returns
0 on success, -1 on error.

Definition at line 141 of file crc64.c.

References AARU_CALL, AARU_EXPORT, crc64_ctx::crc, and CRC64_ECMA_SEED.

Referenced by aaruf_close_current_block(), aaruf_crc64_data(), aaruf_verify_image(), decode_ddt_multi_level_v2(), process_ddt_v2(), set_ddt_multi_level_v2(), verify_index_v2(), verify_index_v3(), write_cached_secondary_ddt(), write_index_block(), and write_primary_ddt().

◆ aaruf_crc64_free()

void aaruf_crc64_free ( crc64_ctx * ctx)

Frees a CRC64 context.

Parameters
ctxPointer to the CRC64 context to free.

Definition at line 155 of file crc64.c.

References AARU_CALL, and AARU_EXPORT.

Referenced by aaruf_close_current_block(), aaruf_crc64_data(), aaruf_verify_image(), verify_index_v2(), and verify_index_v3().

◆ aaruf_crc64_init()

crc64_ctx * aaruf_crc64_init ( void )

Initializes a CRC64 context.

Allocates and initializes a CRC64 context for checksum calculations.

Returns
Pointer to the initialized crc64_ctx structure, or NULL on failure.

Definition at line 32 of file crc64.c.

References AARU_CALL, AARU_EXPORT, crc64_ctx::crc, CRC64_ECMA_SEED, and TRACE.

Referenced by aaruf_close_current_block(), aaruf_crc64_data(), aaruf_verify_image(), decode_ddt_multi_level_v2(), process_ddt_v2(), set_ddt_multi_level_v2(), verify_index_v2(), verify_index_v3(), write_cached_secondary_ddt(), write_index_block(), and write_primary_ddt().

◆ aaruf_crc64_slicing()

void aaruf_crc64_slicing ( uint64_t * previous_crc,
const uint8_t * data,
uint32_t len )

Updates a CRC64 value using the slicing-by-8 algorithm.

Parameters
previous_crcPointer to the previous CRC64 value (input/output).
dataPointer to the data buffer.
lenLength of the data buffer in bytes.

Definition at line 102 of file crc64.c.

References AARU_CALL, AARU_EXPORT, and crc64_table.

Referenced by aaruf_crc64_update().

◆ aaruf_crc64_update()

int aaruf_crc64_update ( crc64_ctx * ctx,
const uint8_t * data,
uint32_t len )

Updates the CRC64 context with new data.

Processes the given data buffer and updates the CRC64 value in the context.

Parameters
ctxPointer to the CRC64 context.
dataPointer to the data buffer.
lenLength of the data buffer.
Returns
0 on success, or -1 on error.

Definition at line 55 of file crc64.c.

References AARU_CALL, AARU_EXPORT, aaruf_crc64_slicing(), crc64_ctx::crc, and TRACE.

Referenced by aaruf_close_current_block(), aaruf_crc64_data(), decode_ddt_multi_level_v2(), process_ddt_v2(), set_ddt_multi_level_v2(), update_crc64_from_stream(), verify_index_v2(), verify_index_v3(), write_cached_secondary_ddt(), write_index_block(), and write_primary_ddt().