21 #if !(defined(HAVE_CC_SHA256_INIT) \
22 || defined(HAVE_SHA256_INIT) \
23 || defined(HAVE_SHA256INIT))
24 # define HAVE_INTERNAL_SHA256 1
27 #if defined(HAVE_INTERNAL_SHA256)
29 #elif defined(HAVE_COMMONCRYPTO_COMMONDIGEST_H)
30 # include <CommonCrypto/CommonDigest.h>
31 #elif defined(HAVE_SHA256_H)
32 # include <sys/types.h>
34 #elif defined(HAVE_SHA2_H)
35 # include <sys/types.h>
39 #if defined(HAVE_INTERNAL_SHA256)
48 #elif defined(HAVE_CC_SHA256_CTX)
50 #elif defined(HAVE_SHA256_CTX)
52 #elif defined(HAVE_SHA2_CTX)
56 #if defined(HAVE_INTERNAL_SHA256)
58 #elif defined(HAVE_CC_SHA256_INIT)
59 # define LZMA_SHA256FUNC(x) CC_SHA256_ ## x
60 #elif defined(HAVE_SHA256_INIT)
61 # define LZMA_SHA256FUNC(x) SHA256_ ## x
62 #elif defined(HAVE_SHA256INIT)
63 # define LZMA_SHA256FUNC(x) SHA256 ## x
68 #if defined(HAVE_CHECK_SHA256)
69 # define LZMA_CHECK_BEST LZMA_CHECK_SHA256
70 #elif defined(HAVE_CHECK_CRC64)
71 # define LZMA_CHECK_BEST LZMA_CHECK_CRC64
73 # define LZMA_CHECK_BEST LZMA_CHECK_CRC32
125 #ifndef LZMA_SHA256FUNC
143 LZMA_SHA256FUNC(
Init)(&
check->state.sha256);
150 #if defined(HAVE_CC_SHA256_INIT) && SIZE_MAX > UINT32_MAX
160 LZMA_SHA256FUNC(Update)(&
check->state.sha256,
buf,
size);
167 LZMA_SHA256FUNC(Final)(
check->buffer.u8, &
check->state.sha256);
lzma_check
Type of the integrity check (Check ID)
void lzma_sha256_update(const uint8_t *buf, size_t size, lzma_check_state *check)
Update the SHA-256 hash state.
const uint64_t lzma_crc64_table[4][256]
void lzma_sha256_init(lzma_check_state *check)
Prepare SHA-256 state for new input.
void lzma_check_finish(lzma_check_state *check, lzma_check type)
Finish the check calculation and store the result to check->buffer.u8.
const uint32_t lzma_crc32_table[8][256]
void lzma_sha256_finish(lzma_check_state *check)
Finish the SHA-256 calculation and store the result to check->buffer.u8.
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_init(lzma_check_state *check, lzma_check type)
Initialize *check depending on type.
void lzma_crc32_init(void)
int Init(const char *driverPath)
Structure to hold internal state of the check being calculated.
State for the internal SHA-256 implementation.
uint64_t size
Size of the message excluding padding.