Functions

/tmp/buildd/xz-utils-5.0.0/src/liblzma/check/check.c File Reference

Single API to access different integrity checks. More...

#include "check.h"

Functions

lzma_bool lzma_check_is_supported (lzma_check type)
 Test if the given Check ID is supported.
uint32_t lzma_check_size (lzma_check type)
 Get the size of the Check field with the given Check ID.
void lzma_check_init (lzma_check_state *check, lzma_check type)
 Initialize *check depending on type.
void lzma_check_update (lzma_check_state *check, lzma_check type, const uint8_t *buf, size_t size)
 Update the check state.
void lzma_check_finish (lzma_check_state *check, lzma_check type)
 Finish the check calculation and store the result to check->buffer.u8.

Detailed Description

Single API to access different integrity checks.


Function Documentation

lzma_bool lzma_check_is_supported ( lzma_check  check  )  const

Test if the given Check ID is supported.

Return true if the given Check ID is supported by this liblzma build. Otherwise false is returned. It is safe to call this with a value that is not in the range [0, 15]; in that case the return value is always false.

You can assume that LZMA_CHECK_NONE and LZMA_CHECK_CRC32 are always supported (even if liblzma is built with limited features).

References LZMA_CHECK_ID_MAX.

uint32_t lzma_check_size ( lzma_check  check  )  const

Get the size of the Check field with the given Check ID.

Although not all Check IDs have a check algorithm associated, the size of every Check is already frozen. This function returns the size (in bytes) of the Check field with the specified Check ID. The values are: { 0, 4, 4, 4, 8, 8, 8, 16, 16, 16, 32, 32, 32, 64, 64, 64 }

If the argument is not in the range [0, 15], UINT32_MAX is returned.

References LZMA_CHECK_ID_MAX.

Referenced by lzma_block_buffer_encode(), lzma_block_compressed_size(), lzma_block_unpadded_size(), lzma_index_hash_decode(), parse_block_header(), and parse_check_value().

void lzma_check_init ( lzma_check_state check,
lzma_check  type 
)

Initialize *check depending on type.

Returns:
LZMA_OK on success. LZMA_UNSUPPORTED_CHECK if the type is not supported by the current version or build of liblzma. LZMA_PROG_ERROR if type > LZMA_CHECK_ID_MAX.

References LZMA_CHECK_CRC32, LZMA_CHECK_CRC64, LZMA_CHECK_NONE, LZMA_CHECK_SHA256, lzma_sha256_init(), and lzma_check_state::state.

Referenced by lzma_block_buffer_encode(), and lzma_index_hash_init().

void lzma_check_update ( lzma_check_state check,
lzma_check  type,
const uint8_t *  buf,
size_t  size 
)
void lzma_check_finish ( lzma_check_state check,
lzma_check  type 
)

Finish the check calculation and store the result to check->buffer.u8.

References lzma_check_state::buffer, LZMA_CHECK_CRC32, LZMA_CHECK_CRC64, LZMA_CHECK_SHA256, lzma_sha256_finish(), and lzma_check_state::state.

Referenced by lzma_block_buffer_encode(), and lzma_index_hash_decode().