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. |
Single API to access different integrity checks.
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.
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 | |||
) |
Update the check state.
References LZMA_CHECK_CRC32, LZMA_CHECK_CRC64, LZMA_CHECK_SHA256, lzma_crc32(), lzma_crc64(), lzma_sha256_update(), and lzma_check_state::state.
Referenced by hash_append(), and lzma_block_buffer_encode().
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().