decompress_unxz: newer version, one which can unpack SHA-256 protected files

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>
This commit is contained in:
Denys Vlasenko
2010-06-01 14:41:39 +02:00
parent 11bcf4b224
commit 716f3f612e
7 changed files with 157 additions and 71 deletions

View File

@@ -10,10 +10,10 @@
#ifndef XZ_STREAM_H
#define XZ_STREAM_H
#if defined(__KERNEL__) && !defined(XZ_INTERNAL_CRC32)
#if defined(__KERNEL__) && !XZ_INTERNAL_CRC32
# include <linux/crc32.h>
# undef crc32
# define xz_crc32(crc32_table, buf, size, crc) \
# define xz_crc32(buf, size, crc) \
(~crc32_le(~(uint32_t)(crc), buf, size))
#endif
@@ -43,4 +43,15 @@ typedef uint64_t vli_type;
/* 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