xz.h revision 0578287ba49f36d031f6d61bb53f5b54f56c65a3
15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/* 25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * XZ decompressor 35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Authors: Lasse Collin <lasse.collin@tukaani.org> 55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Igor Pavlov <http://7-zip.org/> 65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 7c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) * This file has been put into the public domain. 85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * You can do whatever you want with this file. 95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef XZ_H 125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define XZ_H 135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifdef __KERNEL__ 15868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)# include <linux/stddef.h> 16868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)# include <linux/types.h> 17c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)#else 18868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)# include <stddef.h> 195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)# include <stdint.h> 205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif 215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifdef __cplusplus 235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)extern "C" { 245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif 255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/* In Linux, this is used to make extern functions static when needed. */ 275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef XZ_EXTERN 28eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch# define XZ_EXTERN extern 295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif 305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/** 325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * enum xz_mode - Operation mode 33eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch * 34eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch * @XZ_SINGLE: Single-call mode. This uses less RAM than 35eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch * than multi-call modes, because the LZMA2 365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * dictionary doesn't need to be allocated as 375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * part of the decoder state. All required data 385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * structures are allocated at initialization, 395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * so xz_dec_run() cannot return XZ_MEM_ERROR. 405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @XZ_PREALLOC: Multi-call mode with preallocated LZMA2 415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * dictionary buffer. All data structures are 425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * allocated at initialization, so xz_dec_run() 435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * cannot return XZ_MEM_ERROR. 445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @XZ_DYNALLOC: Multi-call mode. The LZMA2 dictionary is 455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * allocated once the required size has been 465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * parsed from the stream headers. If the 475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * allocation fails, xz_dec_run() will return 485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * XZ_MEM_ERROR. 495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * It is possible to enable support only for a subset of the above 515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * modes at compile time by defining XZ_DEC_SINGLE, XZ_DEC_PREALLOC, 525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * or XZ_DEC_DYNALLOC. The xz_dec kernel module is always compiled 535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * with support for all operation modes, but the preboot code may 545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * be built with fewer features to minimize code size. 555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)enum xz_mode { 575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) XZ_SINGLE, 585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) XZ_PREALLOC, 595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) XZ_DYNALLOC 605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}; 615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/** 635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * enum xz_ret - Return codes 645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @XZ_OK: Everything is OK so far. More input or more 655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * output space is required to continue. This 665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * return code is possible only in multi-call mode 675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * (XZ_PREALLOC or XZ_DYNALLOC). 685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @XZ_STREAM_END: Operation finished successfully. 695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @XZ_UNSUPPORTED_CHECK: Integrity check type is not supported. Decoding 705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * is still possible in multi-call mode by simply 715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * calling xz_dec_run() again. 725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Note that this return value is used only if 73eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch * XZ_DEC_ANY_CHECK was defined at build time, 745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * which is not used in the kernel. Unsupported 755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * check types return XZ_OPTIONS_ERROR if 765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * XZ_DEC_ANY_CHECK was not defined at build time. 775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @XZ_MEM_ERROR: Allocating memory failed. This return code is 785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * possible only if the decoder was initialized 795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * with XZ_DYNALLOC. The amount of memory that was 805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * tried to be allocated was no more than the 815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * dict_max argument given to xz_dec_init(). 825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @XZ_MEMLIMIT_ERROR: A bigger LZMA2 dictionary would be needed than 835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * allowed by the dict_max argument given to 845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * xz_dec_init(). This return value is possible 855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * only in multi-call mode (XZ_PREALLOC or 865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * XZ_DYNALLOC); the single-call mode (XZ_SINGLE) 875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * ignores the dict_max argument. 885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @XZ_FORMAT_ERROR: File format was not recognized (wrong magic 895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * bytes). 905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @XZ_OPTIONS_ERROR: This implementation doesn't support the requested 915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * compression options. In the decoder this means 925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * that the header CRC32 matches, but the header 935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * itself specifies something that we don't support. 945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @XZ_DATA_ERROR: Compressed data is corrupt. 955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @XZ_BUF_ERROR: Cannot make any progress. Details are slightly 965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * different between multi-call and single-call 975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * mode; more information below. 985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * In multi-call mode, XZ_BUF_ERROR is returned when two consecutive calls 1005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * to XZ code cannot consume any input and cannot produce any new output. 1015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * This happens when there is no new input available, or the output buffer 1025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * is full while at least one output byte is still pending. Assuming your 1035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * code is not buggy, you can get this error only when decoding a compressed 1045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * stream that is truncated or otherwise corrupt. 105eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch * 1065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * In single-call mode, XZ_BUF_ERROR is returned only when the output buffer 1075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * is too small or the compressed input is corrupt in a way that makes the 1085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * decoder produce more output than the caller expected. When it is 1095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * (relatively) clear that the compressed input is truncated, XZ_DATA_ERROR 1105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * is used instead of XZ_BUF_ERROR. 1115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) */ 1125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)enum xz_ret { 1135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) XZ_OK, 1145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) XZ_STREAM_END, 1155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) XZ_UNSUPPORTED_CHECK, 1165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) XZ_MEM_ERROR, 1175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) XZ_MEMLIMIT_ERROR, 1185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) XZ_FORMAT_ERROR, 1195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) XZ_OPTIONS_ERROR, 1205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) XZ_DATA_ERROR, 1215d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) XZ_BUF_ERROR 1225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}; 1235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/** 1255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * struct xz_buf - Passing input and output buffers to XZ code 1265d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * @in: Beginning of the input buffer. This may be NULL if and only 1275d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * if in_pos is equal to in_size. 1285d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * @in_pos: Current position in the input buffer. This must not exceed 1295d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * in_size. 1305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @in_size: Size of the input buffer 1315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @out: Beginning of the output buffer. This may be NULL if and only 1325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * if out_pos is equal to out_size. 1335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @out_pos: Current position in the output buffer. This must not exceed 1345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * out_size. 1355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * @out_size: Size of the output buffer 1365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * 1375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) * Only the contents of the output buffer from out[out_pos] onward, and 1385d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) * the variables in_pos and out_pos are modified by the XZ code. 1395d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) */ 1405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)struct xz_buf { 1415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) const uint8_t *in; 1425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) size_t in_pos; 1435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) size_t in_size; 1445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) uint8_t *out; 1465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) size_t out_pos; 1475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) size_t out_size; 1485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}; 1495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 150/** 151 * struct xz_dec - Opaque type to hold the XZ decoder state 152 */ 153struct xz_dec; 154 155/** 156 * xz_dec_init() - Allocate and initialize a XZ decoder state 157 * @mode: Operation mode 158 * @dict_max: Maximum size of the LZMA2 dictionary (history buffer) for 159 * multi-call decoding. This is ignored in single-call mode 160 * (mode == XZ_SINGLE). LZMA2 dictionary is always 2^n bytes 161 * or 2^n + 2^(n-1) bytes (the latter sizes are less common 162 * in practice), so other values for dict_max don't make sense. 163 * In the kernel, dictionary sizes of 64 KiB, 128 KiB, 256 KiB, 164 * 512 KiB, and 1 MiB are probably the only reasonable values, 165 * except for kernel and initramfs images where a bigger 166 * dictionary can be fine and useful. 167 * 168 * Single-call mode (XZ_SINGLE): xz_dec_run() decodes the whole stream at 169 * once. The caller must provide enough output space or the decoding will 170 * fail. The output space is used as the dictionary buffer, which is why 171 * there is no need to allocate the dictionary as part of the decoder's 172 * internal state. 173 * 174 * Because the output buffer is used as the workspace, streams encoded using 175 * a big dictionary are not a problem in single-call mode. It is enough that 176 * the output buffer is big enough to hold the actual uncompressed data; it 177 * can be smaller than the dictionary size stored in the stream headers. 178 * 179 * Multi-call mode with preallocated dictionary (XZ_PREALLOC): dict_max bytes 180 * of memory is preallocated for the LZMA2 dictionary. This way there is no 181 * risk that xz_dec_run() could run out of memory, since xz_dec_run() will 182 * never allocate any memory. Instead, if the preallocated dictionary is too 183 * small for decoding the given input stream, xz_dec_run() will return 184 * XZ_MEMLIMIT_ERROR. Thus, it is important to know what kind of data will be 185 * decoded to avoid allocating excessive amount of memory for the dictionary. 186 * 187 * Multi-call mode with dynamically allocated dictionary (XZ_DYNALLOC): 188 * dict_max specifies the maximum allowed dictionary size that xz_dec_run() 189 * may allocate once it has parsed the dictionary size from the stream 190 * headers. This way excessive allocations can be avoided while still 191 * limiting the maximum memory usage to a sane value to prevent running the 192 * system out of memory when decompressing streams from untrusted sources. 193 * 194 * On success, xz_dec_init() returns a pointer to struct xz_dec, which is 195 * ready to be used with xz_dec_run(). If memory allocation fails, 196 * xz_dec_init() returns NULL. 197 */ 198XZ_EXTERN struct xz_dec *xz_dec_init(enum xz_mode mode, uint32_t dict_max); 199 200/** 201 * xz_dec_run() - Run the XZ decoder 202 * @s: Decoder state allocated using xz_dec_init() 203 * @b: Input and output buffers 204 * 205 * The possible return values depend on build options and operation mode. 206 * See enum xz_ret for details. 207 * 208 * Note that if an error occurs in single-call mode (return value is not 209 * XZ_STREAM_END), b->in_pos and b->out_pos are not modified and the 210 * contents of the output buffer from b->out[b->out_pos] onward are 211 * undefined. This is true even after XZ_BUF_ERROR, because with some filter 212 * chains, there may be a second pass over the output buffer, and this pass 213 * cannot be properly done if the output buffer is truncated. Thus, you 214 * cannot give the single-call decoder a too small buffer and then expect to 215 * get that amount valid data from the beginning of the stream. You must use 216 * the multi-call decoder if you don't want to uncompress the whole stream. 217 */ 218XZ_EXTERN enum xz_ret xz_dec_run(struct xz_dec *s, struct xz_buf *b); 219 220/** 221 * xz_dec_reset() - Reset an already allocated decoder state 222 * @s: Decoder state allocated using xz_dec_init() 223 * 224 * This function can be used to reset the multi-call decoder state without 225 * freeing and reallocating memory with xz_dec_end() and xz_dec_init(). 226 * 227 * In single-call mode, xz_dec_reset() is always called in the beginning of 228 * xz_dec_run(). Thus, explicit call to xz_dec_reset() is useful only in 229 * multi-call mode. 230 */ 231XZ_EXTERN void xz_dec_reset(struct xz_dec *s); 232 233/** 234 * xz_dec_end() - Free the memory allocated for the decoder state 235 * @s: Decoder state allocated using xz_dec_init(). If s is NULL, 236 * this function does nothing. 237 */ 238XZ_EXTERN void xz_dec_end(struct xz_dec *s); 239 240/* 241 * Standalone build (userspace build or in-kernel build for boot time use) 242 * needs a CRC32 implementation. For normal in-kernel use, kernel's own 243 * CRC32 module is used instead, and users of this module don't need to 244 * care about the functions below. 245 */ 246#ifndef XZ_INTERNAL_CRC32 247# ifdef __KERNEL__ 248# define XZ_INTERNAL_CRC32 0 249# else 250# define XZ_INTERNAL_CRC32 1 251# endif 252#endif 253 254/* 255 * If CRC64 support has been enabled with XZ_USE_CRC64, a CRC64 256 * implementation is needed too. 257 */ 258#ifndef XZ_USE_CRC64 259# undef XZ_INTERNAL_CRC64 260# define XZ_INTERNAL_CRC64 0 261#endif 262#ifndef XZ_INTERNAL_CRC64 263# ifdef __KERNEL__ 264# error Using CRC64 in the kernel has not been implemented. 265# else 266# define XZ_INTERNAL_CRC64 1 267# endif 268#endif 269 270#if XZ_INTERNAL_CRC32 271/* 272 * This must be called before any other xz_* function to initialize 273 * the CRC32 lookup table. 274 */ 275XZ_EXTERN void xz_crc32_init(void); 276 277/* 278 * Update CRC32 value using the polynomial from IEEE-802.3. To start a new 279 * calculation, the third argument must be zero. To continue the calculation, 280 * the previously returned value is passed as the third argument. 281 */ 282XZ_EXTERN uint32_t xz_crc32(const uint8_t *buf, size_t size, uint32_t crc); 283#endif 284 285#if XZ_INTERNAL_CRC64 286/* 287 * This must be called before any other xz_* function (except xz_crc32_init()) 288 * to initialize the CRC64 lookup table. 289 */ 290XZ_EXTERN void xz_crc64_init(void); 291 292/* 293 * Update CRC64 value using the polynomial from ECMA-182. To start a new 294 * calculation, the third argument must be zero. To continue the calculation, 295 * the previously returned value is passed as the third argument. 296 */ 297XZ_EXTERN uint64_t xz_crc64(const uint8_t *buf, size_t size, uint64_t crc); 298#endif 299 300#ifdef __cplusplus 301} 302#endif 303 304#endif 305