check.h File Reference

Internal API to different integrity check functions. More...

`#include "common.h"`

## Data Structures

struct | lzma_sha256_state
| State for the internal SHA-256 implementation. More...
struct | lzma_check_state
| Structure to hold internal state of the check being calculated. More...

## Macros

#define | HAVE_INTERNAL_SHA256 1
#define | LZMA_CHECK_BEST LZMA_CHECK_CRC32

## Functions

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...
void | lzma_sha256_init (lzma_check_state *check)
| Prepare SHA-256 state for new input. More...
void | lzma_sha256_update (const uint8_t *buf, size_t size, lzma_check_state *check)
| Update the SHA-256 hash state. More...
void | lzma_sha256_finish (lzma_check_state *check)
| Finish the SHA-256 calculation and store the result to check->buffer.u8. More...

## Variables

const uint32_t | lzma_crc32_table [8][256]
const uint64_t | lzma_crc64_table [4][256]

## Detailed Description

Internal API to different integrity check functions.

## Function Documentation

## 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
| ) |  |

Update the check state.

References check, LZMA_CHECK_CRC32, LZMA_CHECK_CRC64, LZMA_CHECK_SHA256, lzma_crc32(), lzma_crc64(), and lzma_sha256_update().

## 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().

## lzma_sha256_init()

void lzma_sha256_init | ( | lzma_check_state * | check | ) |

Prepare SHA-256 state for new input.

References check.

Referenced by lzma_check_init().

## lzma_sha256_update()

void lzma_sha256_update | ( | const uint8_t * | buf,
|  | size_t | size,
|  | lzma_check_state * | check
| ) |  |

Update the SHA-256 hash state.

References check.

Referenced by lzma_check_update().

## lzma_sha256_finish()

void lzma_sha256_finish | ( | lzma_check_state * | check | ) |

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

References check.

## Variable Documentation

## lzma_crc32_table

const uint32_t lzma_crc32_table[8][256]

extern

lzma_crc32_table[0] is needed by LZ encoder so we need to keep the array two-dimensional.