1 ///////////////////////////////////////////////////////////////////////////////
4 /// \brief Prototypes for different check functions
6 // This code has been put into the public domain.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 ///////////////////////////////////////////////////////////////////////////////
20 // Index hashing used to verify the Index with O(1) memory usage needs
21 // a good hash function.
22 #if defined(HAVE_CHECK_SHA256)
23 # define LZMA_CHECK_BEST LZMA_CHECK_SHA256
24 #elif defined(HAVE_CHECK_CRC64)
25 # define LZMA_CHECK_BEST LZMA_CHECK_CRC64
27 # define LZMA_CHECK_BEST LZMA_CHECK_CRC32
35 /// Size of the message excluding padding
41 /// \note This is not in the public API because this structure will
44 // FIXME Guarantee 8-byte alignment
46 /// Buffer to hold the final result; this is also used as a temporary
47 /// buffer in SHA256. Note that this buffer must be 8-byte aligned.
50 /// Check-specific data
59 /// Size of the message excluding padding
68 extern uint32_t lzma_crc32_table[8][256];
69 extern uint64_t lzma_crc64_table[4][256];
71 extern const uint32_t lzma_crc32_table[8][256];
72 extern const uint64_t lzma_crc64_table[4][256];
77 /// \brief Initializes *check depending on type
79 /// \return LZMA_OK on success. LZMA_UNSUPPORTED_CHECK if the type is not
80 /// supported by the current version or build of liblzma.
81 /// LZMA_PROG_ERROR if type > LZMA_CHECK_ID_MAX.
83 extern lzma_ret lzma_check_init(lzma_check *check, lzma_check_type type);
85 /// \brief Updates *check
87 extern void lzma_check_update(lzma_check *check, lzma_check_type type,
88 const uint8_t *buf, size_t size);
90 /// \brief Finishes *check
92 extern void lzma_check_finish(lzma_check *check, lzma_check_type type);
96 /// \brief Compare two checks
98 /// \return false if the checks are identical; true if they differ.
100 extern bool lzma_check_compare(
101 lzma_check *check1, lzma_check *check2, lzma_check_type type);
107 extern void lzma_crc32_init(void);
112 extern void lzma_crc64_init(void);
117 extern void lzma_sha256_init(lzma_check *check);
119 extern void lzma_sha256_update(
120 const uint8_t *buf, size_t size, lzma_check *check);
122 extern void lzma_sha256_finish(lzma_check *check);