XZ Utils 5.4.1
Functions
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. More...
 
uint32_t lzma_check_size (lzma_check type)
 Get the size of the Check field with the given Check ID. More...
 
void lzma_check_init (lzma_check_state *check, lzma_check type)
 Initialize *check depending on type. More...
 
void lzma_check_update (lzma_check_state *check, lzma_check type, const uint8_t *buf, size_t size)
 Update the check state. More...
 
void lzma_check_finish (lzma_check_state *check, lzma_check type)
 Finish the check calculation and store the result to check->buffer.u8. More...
 

Detailed Description

Single API to access different integrity checks.

Function Documentation

◆ lzma_check_is_supported()

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.

◆ lzma_check_size()

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 comp_blk_size(), lzma_block_compressed_size(), and parse_check_value().

◆ lzma_check_init()

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 check, LZMA_CHECK_CRC32, LZMA_CHECK_CRC64, LZMA_CHECK_NONE, LZMA_CHECK_SHA256, and lzma_sha256_init().

◆ lzma_check_update()

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

◆ lzma_check_finish()

void lzma_check_finish ( lzma_check_state check,
lzma_check  type 
)

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

References check, and LZMA_CHECK_CRC32.

Referenced by lzma_index_hash_decode().