mirror of
https://github.com/sheumann/hush.git
synced 2024-12-26 10:32:02 +00:00
716f3f612e
function old new delta check_sizes - 16 +16 crc32_table - 4 +4 index_update 47 40 -7 crc32_validate 110 93 -17 dec_vli 197 165 -32 unpack_xz_stream 4284 4014 -270 ------------------------------------------------------------------------------ (add/remove: 2/0 grow/shrink: 0/4 up/down: 20/-326) Total: -306 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
58 lines
1.2 KiB
C
58 lines
1.2 KiB
C
/*
|
|
* Definitions for handling the .xz file format
|
|
*
|
|
* Author: Lasse Collin <lasse.collin@tukaani.org>
|
|
*
|
|
* This file has been put into the public domain.
|
|
* You can do whatever you want with this file.
|
|
*/
|
|
|
|
#ifndef XZ_STREAM_H
|
|
#define XZ_STREAM_H
|
|
|
|
#if defined(__KERNEL__) && !XZ_INTERNAL_CRC32
|
|
# include <linux/crc32.h>
|
|
# undef crc32
|
|
# define xz_crc32(buf, size, crc) \
|
|
(~crc32_le(~(uint32_t)(crc), buf, size))
|
|
#endif
|
|
|
|
/*
|
|
* See the .xz file format specification at
|
|
* http://tukaani.org/xz/xz-file-format.txt
|
|
* to understand the container format.
|
|
*/
|
|
|
|
#define STREAM_HEADER_SIZE 12
|
|
|
|
#define HEADER_MAGIC "\3757zXZ\0"
|
|
#define HEADER_MAGIC_SIZE 6
|
|
|
|
#define FOOTER_MAGIC "YZ"
|
|
#define FOOTER_MAGIC_SIZE 2
|
|
|
|
/*
|
|
* Variable-length integer can hold a 63-bit unsigned integer, or a special
|
|
* value to indicate that the value is unknown.
|
|
*/
|
|
typedef uint64_t vli_type;
|
|
|
|
#define VLI_MAX ((vli_type)-1 / 2)
|
|
#define VLI_UNKNOWN ((vli_type)-1)
|
|
|
|
/* Maximum encoded size of a VLI */
|
|
#define VLI_BYTES_MAX (sizeof(vli_type) * 8 / 7)
|
|
|
|
/* Integrity Check types */
|
|
enum xz_check {
|
|
XZ_CHECK_NONE = 0,
|
|
XZ_CHECK_CRC32 = 1,
|
|
XZ_CHECK_CRC64 = 4,
|
|
XZ_CHECK_SHA256 = 10
|
|
};
|
|
|
|
/* Maximum possible Check ID */
|
|
#define XZ_CHECK_MAX 15
|
|
|
|
#endif
|