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_ctx * | aaruf_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()

uint64_t aaruf_crc64_data | ( | const uint8_t * | data,
|  | const uint32_t | len )

Definition at line 160 of file crc64.c.

References AARU_CALL, AARU_EXPORT, aaruf_crc64_final(), aaruf_crc64_free(), aaruf_crc64_init(), and aaruf_crc64_update().

Referenced by aaruf_close_current_block(), aaruf_get_dumphw(), aaruf_set_dumphw(), aaruf_set_tracks(), process_data_block(), process_dumphw_block(), process_tape_files_block(), process_tape_partitions_block(), process_tracks_block(), set_ddt_multi_level_v2(), verify_index_v1(), write_cached_secondary_ddt(), write_dumphw_block(), write_dvd_long_sector_blocks(), write_dvd_title_key_decrypted_block(), write_media_tags(), write_mode2_subheaders_block(), write_sector_prefix(), write_sector_prefix_ddt(), write_sector_subchannel(), write_sector_suffix(), write_sector_suffix_ddt(), write_single_level_ddt(), write_tape_file_block(), and write_tape_partition_block().

## ◆ aaruf_crc64_final()

int aaruf_crc64_final | ( | crc64_ctx * | ctx,
|  | uint64_t * | crc )

Computes the final CRC64 value from the context.

Parameters

  ctx | Pointer to the CRC64 context.
  crc | Pointer 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

  ctx | Pointer 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_crc | Pointer to the previous CRC64 value (input/output).
  data | Pointer to the data buffer.
  len | Length 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

  ctx | Pointer to the CRC64 context.
  data | Pointer to the data buffer.
  len | Length 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().