mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-08-25 12:37:29 +00:00
Use lzma-rust2 for xz and lzma compression and decompression
This commit is contained in:
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -4,9 +4,6 @@
|
||||
[submodule "lz4"]
|
||||
path = native/src/external/lz4
|
||||
url = https://github.com/lz4/lz4.git
|
||||
[submodule "xz"]
|
||||
path = native/src/external/xz
|
||||
url = https://github.com/xz-mirror/xz.git
|
||||
[submodule "libcxx"]
|
||||
path = native/src/external/libcxx
|
||||
url = https://github.com/topjohnwu/libcxx.git
|
||||
|
@@ -81,7 +81,6 @@ include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := magiskboot
|
||||
LOCAL_STATIC_LIBRARIES := \
|
||||
libbase \
|
||||
liblzma \
|
||||
liblz4 \
|
||||
libboot-rs
|
||||
|
||||
|
121
native/src/Cargo.lock
generated
121
native/src/Cargo.lock
generated
@@ -98,6 +98,15 @@ version = "2.9.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967"
|
||||
|
||||
[[package]]
|
||||
name = "block-buffer"
|
||||
version = "0.10.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71"
|
||||
dependencies = [
|
||||
"generic-array",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "block-buffer"
|
||||
version = "0.11.0-rc.4"
|
||||
@@ -234,6 +243,21 @@ dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crc"
|
||||
version = "3.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9710d3b3739c2e349eb44fe848ad0b7c8cb1e42bd87ee49371df2f7acaf3e675"
|
||||
dependencies = [
|
||||
"crc-catalog",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crc-catalog"
|
||||
version = "2.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5"
|
||||
|
||||
[[package]]
|
||||
name = "crc32fast"
|
||||
version = "1.5.0"
|
||||
@@ -257,6 +281,16 @@ dependencies = [
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crypto-common"
|
||||
version = "0.1.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3"
|
||||
dependencies = [
|
||||
"generic-array",
|
||||
"typenum",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crypto-common"
|
||||
version = "0.2.0-rc.3"
|
||||
@@ -356,15 +390,25 @@ dependencies = [
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "digest"
|
||||
version = "0.10.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
|
||||
dependencies = [
|
||||
"block-buffer 0.10.4",
|
||||
"crypto-common 0.1.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "digest"
|
||||
version = "0.11.0-rc.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "460dd7f37e4950526b54a5a6b1f41b6c8e763c58eb9a8fc8fc05ba5c2f44ca7b"
|
||||
dependencies = [
|
||||
"block-buffer",
|
||||
"block-buffer 0.11.0-rc.4",
|
||||
"const-oid",
|
||||
"crypto-common",
|
||||
"crypto-common 0.2.0-rc.3",
|
||||
"subtle",
|
||||
]
|
||||
|
||||
@@ -375,7 +419,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "112839e868b3376c2066506d42331023165d687a7ed38b2ed77f28763d9a7742"
|
||||
dependencies = [
|
||||
"der",
|
||||
"digest",
|
||||
"digest 0.11.0-rc.0",
|
||||
"elliptic-curve",
|
||||
"rfc6979",
|
||||
"signature",
|
||||
@@ -391,7 +435,7 @@ checksum = "c28ecec37eea07ab976cea93c7ce8b36d561cf161f6767925c1edc51024b0ad3"
|
||||
dependencies = [
|
||||
"base16ct",
|
||||
"crypto-bigint",
|
||||
"digest",
|
||||
"digest 0.11.0-rc.0",
|
||||
"ff",
|
||||
"group",
|
||||
"hybrid-array",
|
||||
@@ -442,6 +486,16 @@ version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2"
|
||||
|
||||
[[package]]
|
||||
name = "generic-array"
|
||||
version = "0.14.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a"
|
||||
dependencies = [
|
||||
"typenum",
|
||||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.3.3"
|
||||
@@ -471,7 +525,7 @@ version = "0.13.0-rc.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8dc6a2fcc35ab09136c6df2cdf9ca49790701420a3a6b5db0987dddbabc79b21"
|
||||
dependencies = [
|
||||
"digest",
|
||||
"digest 0.11.0-rc.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -534,10 +588,13 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lzma-sys"
|
||||
version = "0.1.20"
|
||||
name = "lzma-rust2"
|
||||
version = "0.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fb31493965215fc8d0956b8dd58f2609e17ea89487a5cb2619e1d60b8b71328f"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"crc",
|
||||
"sha2 0.10.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -569,10 +626,11 @@ dependencies = [
|
||||
"cxx",
|
||||
"cxx-gen",
|
||||
"der",
|
||||
"digest",
|
||||
"digest 0.11.0-rc.0",
|
||||
"fdt",
|
||||
"flate2",
|
||||
"lz4",
|
||||
"lzma-rust2",
|
||||
"num-traits",
|
||||
"p256",
|
||||
"p384",
|
||||
@@ -581,10 +639,9 @@ dependencies = [
|
||||
"quick-protobuf",
|
||||
"rsa",
|
||||
"sha1",
|
||||
"sha2",
|
||||
"sha2 0.11.0-rc.0",
|
||||
"size",
|
||||
"x509-cert",
|
||||
"xz2",
|
||||
"zopfli",
|
||||
]
|
||||
|
||||
@@ -669,7 +726,7 @@ dependencies = [
|
||||
"elliptic-curve",
|
||||
"primefield",
|
||||
"primeorder",
|
||||
"sha2",
|
||||
"sha2 0.11.0-rc.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -682,7 +739,7 @@ dependencies = [
|
||||
"elliptic-curve",
|
||||
"primefield",
|
||||
"primeorder",
|
||||
"sha2",
|
||||
"sha2 0.11.0-rc.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -697,7 +754,7 @@ dependencies = [
|
||||
"primefield",
|
||||
"primeorder",
|
||||
"rand_core",
|
||||
"sha2",
|
||||
"sha2 0.11.0-rc.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -820,11 +877,11 @@ dependencies = [
|
||||
"const-oid",
|
||||
"crypto-bigint",
|
||||
"crypto-primes",
|
||||
"digest",
|
||||
"digest 0.11.0-rc.0",
|
||||
"pkcs1",
|
||||
"pkcs8",
|
||||
"rand_core",
|
||||
"sha2",
|
||||
"sha2 0.11.0-rc.0",
|
||||
"signature",
|
||||
"spki",
|
||||
"subtle",
|
||||
@@ -894,7 +951,18 @@ checksum = "6f9318facddf9ac32a33527066936837e189b3f23ced6edc1603720ead5e2b3d"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"cpufeatures",
|
||||
"digest",
|
||||
"digest 0.11.0-rc.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sha2"
|
||||
version = "0.10.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"cpufeatures",
|
||||
"digest 0.10.7",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -905,7 +973,7 @@ checksum = "aa1d2e6b3cc4e43a8258a9a3b17aa5dfd2cc5186c7024bba8a64aa65b2c71a59"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"cpufeatures",
|
||||
"digest",
|
||||
"digest 0.11.0-rc.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -920,7 +988,7 @@ version = "3.0.0-rc.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4835c3b5ecb10171941a4998a95a3a76ecac1c5ae8e6954f2ad030acd1c7e8ab"
|
||||
dependencies = [
|
||||
"digest",
|
||||
"digest 0.11.0-rc.0",
|
||||
"rand_core",
|
||||
]
|
||||
|
||||
@@ -1043,6 +1111,12 @@ version = "0.2.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853"
|
||||
|
||||
[[package]]
|
||||
name = "version_check"
|
||||
version = "0.9.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
|
||||
|
||||
[[package]]
|
||||
name = "wasi"
|
||||
version = "0.14.2+wasi-0.2.4"
|
||||
@@ -1155,15 +1229,6 @@ dependencies = [
|
||||
"tls_codec",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "xz2"
|
||||
version = "0.1.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "388c44dc09d76f1536602ead6d325eb532f5c122f17782bd57fb47baeeb767e2"
|
||||
dependencies = [
|
||||
"lzma-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zeroize"
|
||||
version = "1.8.1"
|
||||
|
@@ -31,7 +31,7 @@ flate2 = { version = "1.1.2", default-features = false }
|
||||
bzip2 = { version = "0.6.0" }
|
||||
zopfli = "0.8.2"
|
||||
lz4 = "1.28.1"
|
||||
xz2 = "0.1.7"
|
||||
lzma-rust2 = { version = "0.10", default-features = false, features = ["xz", "std", "encoder", "optimization"]}
|
||||
|
||||
# Rust crypto crates are tied together
|
||||
sha1 = "0.11.0-rc.0"
|
||||
@@ -48,7 +48,6 @@ der = "0.8.0-rc.7"
|
||||
pb-rs = { git = "https://github.com/tafia/quick-protobuf.git" }
|
||||
quick-protobuf = { git = "https://github.com/tafia/quick-protobuf.git" }
|
||||
lz4-sys = { path = "external/lz4-sys" }
|
||||
lzma-sys = { path = "external/lzma-sys" }
|
||||
|
||||
[profile.dev]
|
||||
opt-level = "z"
|
||||
|
@@ -33,5 +33,5 @@ num-traits = { workspace = true }
|
||||
flate2 = { workspace = true, features = ["zlib-rs"] }
|
||||
bzip2 = { workspace = true }
|
||||
lz4 = { workspace = true }
|
||||
xz2 = { workspace = true }
|
||||
lzma-rust2 = { workspace = true }
|
||||
zopfli = { workspace = true, features = ["gzip"] }
|
||||
|
@@ -9,6 +9,7 @@ use lz4::{
|
||||
BlockMode, BlockSize, ContentChecksum, Decoder as LZ4FrameDecoder, Encoder as LZ4FrameEncoder,
|
||||
EncoderBuilder as LZ4FrameEncoderBuilder, block::CompressionMode, liblz4::BlockChecksum,
|
||||
};
|
||||
use lzma_rust2::{CheckType, LZMAOptions, LZMAReader, LZMAWriter, XZOptions, XZReader, XZWriter};
|
||||
use std::cmp::min;
|
||||
use std::fmt::Write as FmtWrite;
|
||||
use std::fs::File;
|
||||
@@ -17,11 +18,6 @@ use std::mem::ManuallyDrop;
|
||||
use std::num::NonZeroU64;
|
||||
use std::ops::DerefMut;
|
||||
use std::os::fd::{FromRawFd, RawFd};
|
||||
use xz2::{
|
||||
read::XzDecoder,
|
||||
stream::{Check as LzmaCheck, Filters as LzmaFilters, LzmaOptions, Stream as LzmaStream},
|
||||
write::XzEncoder,
|
||||
};
|
||||
use zopfli::{BlockType, GzipEncoder as ZopFliEncoder, Options as ZopfliOptions};
|
||||
|
||||
pub trait WriteFinish<W: Write>: Write {
|
||||
@@ -40,7 +36,7 @@ macro_rules! finish_impl {
|
||||
)*}
|
||||
}
|
||||
|
||||
finish_impl!(GzEncoder<W>, BzEncoder<W>, XzEncoder<W>);
|
||||
finish_impl!(GzEncoder<W>, BzEncoder<W>, XZWriter<W>, LZMAWriter<W>);
|
||||
|
||||
impl<W: Write> WriteFinish<W> for BufWriter<ZopFliEncoder<W>> {
|
||||
fn finish(self: Box<Self>) -> std::io::Result<W> {
|
||||
@@ -219,16 +215,12 @@ impl<R: Read> Read for LZ4BlockDecoder<R> {
|
||||
pub fn get_encoder<'a, W: Write + 'a>(format: FileFormat, w: W) -> Box<dyn WriteFinish<W> + 'a> {
|
||||
match format {
|
||||
FileFormat::XZ => {
|
||||
let opt = LzmaOptions::new_preset(9).unwrap();
|
||||
let stream =
|
||||
LzmaStream::new_stream_encoder(LzmaFilters::new().lzma2(&opt), LzmaCheck::Crc32)
|
||||
.unwrap();
|
||||
Box::new(XzEncoder::new_stream(w, stream))
|
||||
let mut opt = XZOptions::with_preset(9);
|
||||
opt.set_check_sum_type(CheckType::Crc32);
|
||||
Box::new(XZWriter::new(w, opt).unwrap())
|
||||
}
|
||||
FileFormat::LZMA => {
|
||||
let opt = LzmaOptions::new_preset(9).unwrap();
|
||||
let stream = LzmaStream::new_lzma_encoder(&opt).unwrap();
|
||||
Box::new(XzEncoder::new_stream(w, stream))
|
||||
Box::new(LZMAWriter::new_use_header(w, &LZMAOptions::with_preset(9), None).unwrap())
|
||||
}
|
||||
FileFormat::BZIP2 => Box::new(BzEncoder::new(w, BzCompression::best())),
|
||||
FileFormat::LZ4 => {
|
||||
@@ -261,10 +253,8 @@ pub fn get_encoder<'a, W: Write + 'a>(format: FileFormat, w: W) -> Box<dyn Write
|
||||
|
||||
pub fn get_decoder<'a, R: Read + 'a>(format: FileFormat, r: R) -> Box<dyn Read + 'a> {
|
||||
match format {
|
||||
FileFormat::XZ | FileFormat::LZMA => {
|
||||
let stream = LzmaStream::new_auto_decoder(u64::MAX, 0).unwrap();
|
||||
Box::new(XzDecoder::new_stream(r, stream))
|
||||
}
|
||||
FileFormat::XZ => Box::new(XZReader::new(r, true)),
|
||||
FileFormat::LZMA => Box::new(LZMAReader::new_mem_limit(r, u32::MAX, None).unwrap()),
|
||||
FileFormat::BZIP2 => Box::new(BzDecoder::new(r)),
|
||||
FileFormat::LZ4 => Box::new(LZ4FrameDecoder::new(r).unwrap()),
|
||||
FileFormat::LZ4_LG | FileFormat::LZ4_LEGACY => Box::new(LZ4BlockDecoder::new(r)),
|
||||
|
100
native/src/external/Android.mk
vendored
100
native/src/external/Android.mk
vendored
@@ -23,106 +23,6 @@ LOCAL_SRC_FILES := \
|
||||
lz4/lib/xxhash.c
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
||||
# liblzma.a
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := liblzma
|
||||
LOCAL_C_INCLUDES := \
|
||||
$(LOCAL_PATH)/xz_config \
|
||||
$(LOCAL_PATH)/xz/src/common \
|
||||
$(LOCAL_PATH)/xz/src/liblzma/api \
|
||||
$(LOCAL_PATH)/xz/src/liblzma/check \
|
||||
$(LOCAL_PATH)/xz/src/liblzma/common \
|
||||
$(LOCAL_PATH)/xz/src/liblzma/delta \
|
||||
$(LOCAL_PATH)/xz/src/liblzma/lz \
|
||||
$(LOCAL_PATH)/xz/src/liblzma/lzma \
|
||||
$(LOCAL_PATH)/xz/src/liblzma/rangecoder \
|
||||
$(LOCAL_PATH)/xz/src/liblzma/simple \
|
||||
$(LOCAL_PATH)/xz/src/liblzma
|
||||
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/xz/src/liblzma/api
|
||||
LOCAL_SRC_FILES := \
|
||||
xz/src/common/tuklib_cpucores.c \
|
||||
xz/src/common/tuklib_exit.c \
|
||||
xz/src/common/tuklib_mbstr_fw.c \
|
||||
xz/src/common/tuklib_mbstr_width.c \
|
||||
xz/src/common/tuklib_open_stdxxx.c \
|
||||
xz/src/common/tuklib_physmem.c \
|
||||
xz/src/common/tuklib_progname.c \
|
||||
xz/src/liblzma/check/check.c \
|
||||
xz/src/liblzma/check/crc32_fast.c \
|
||||
xz/src/liblzma/check/crc32_table.c \
|
||||
xz/src/liblzma/check/crc64_fast.c \
|
||||
xz/src/liblzma/check/crc64_table.c \
|
||||
xz/src/liblzma/check/sha256.c \
|
||||
xz/src/liblzma/common/alone_decoder.c \
|
||||
xz/src/liblzma/common/alone_encoder.c \
|
||||
xz/src/liblzma/common/auto_decoder.c \
|
||||
xz/src/liblzma/common/block_buffer_decoder.c \
|
||||
xz/src/liblzma/common/block_buffer_encoder.c \
|
||||
xz/src/liblzma/common/block_decoder.c \
|
||||
xz/src/liblzma/common/block_encoder.c \
|
||||
xz/src/liblzma/common/block_header_decoder.c \
|
||||
xz/src/liblzma/common/block_header_encoder.c \
|
||||
xz/src/liblzma/common/block_util.c \
|
||||
xz/src/liblzma/common/common.c \
|
||||
xz/src/liblzma/common/easy_buffer_encoder.c \
|
||||
xz/src/liblzma/common/easy_decoder_memusage.c \
|
||||
xz/src/liblzma/common/easy_encoder.c \
|
||||
xz/src/liblzma/common/easy_encoder_memusage.c \
|
||||
xz/src/liblzma/common/easy_preset.c \
|
||||
xz/src/liblzma/common/filter_buffer_decoder.c \
|
||||
xz/src/liblzma/common/filter_buffer_encoder.c \
|
||||
xz/src/liblzma/common/filter_common.c \
|
||||
xz/src/liblzma/common/filter_decoder.c \
|
||||
xz/src/liblzma/common/filter_encoder.c \
|
||||
xz/src/liblzma/common/filter_flags_decoder.c \
|
||||
xz/src/liblzma/common/filter_flags_encoder.c \
|
||||
xz/src/liblzma/common/hardware_cputhreads.c \
|
||||
xz/src/liblzma/common/hardware_physmem.c \
|
||||
xz/src/liblzma/common/index.c \
|
||||
xz/src/liblzma/common/index_decoder.c \
|
||||
xz/src/liblzma/common/index_encoder.c \
|
||||
xz/src/liblzma/common/index_hash.c \
|
||||
xz/src/liblzma/common/outqueue.c \
|
||||
xz/src/liblzma/common/stream_buffer_decoder.c \
|
||||
xz/src/liblzma/common/stream_buffer_encoder.c \
|
||||
xz/src/liblzma/common/stream_decoder.c \
|
||||
xz/src/liblzma/common/stream_encoder.c \
|
||||
xz/src/liblzma/common/stream_encoder_mt.c \
|
||||
xz/src/liblzma/common/stream_flags_common.c \
|
||||
xz/src/liblzma/common/stream_flags_decoder.c \
|
||||
xz/src/liblzma/common/stream_flags_encoder.c \
|
||||
xz/src/liblzma/common/vli_decoder.c \
|
||||
xz/src/liblzma/common/vli_encoder.c \
|
||||
xz/src/liblzma/common/vli_size.c \
|
||||
xz/src/liblzma/delta/delta_common.c \
|
||||
xz/src/liblzma/delta/delta_decoder.c \
|
||||
xz/src/liblzma/delta/delta_encoder.c \
|
||||
xz/src/liblzma/lz/lz_decoder.c \
|
||||
xz/src/liblzma/lz/lz_encoder.c \
|
||||
xz/src/liblzma/lz/lz_encoder_mf.c \
|
||||
xz/src/liblzma/lzma/fastpos_table.c \
|
||||
xz/src/liblzma/lzma/fastpos_tablegen.c \
|
||||
xz/src/liblzma/lzma/lzma2_decoder.c \
|
||||
xz/src/liblzma/lzma/lzma2_encoder.c \
|
||||
xz/src/liblzma/lzma/lzma_decoder.c \
|
||||
xz/src/liblzma/lzma/lzma_encoder.c \
|
||||
xz/src/liblzma/lzma/lzma_encoder_optimum_fast.c \
|
||||
xz/src/liblzma/lzma/lzma_encoder_optimum_normal.c \
|
||||
xz/src/liblzma/lzma/lzma_encoder_presets.c \
|
||||
xz/src/liblzma/rangecoder/price_table.c \
|
||||
xz/src/liblzma/rangecoder/price_tablegen.c \
|
||||
xz/src/liblzma/simple/arm.c \
|
||||
xz/src/liblzma/simple/armthumb.c \
|
||||
xz/src/liblzma/simple/ia64.c \
|
||||
xz/src/liblzma/simple/powerpc.c \
|
||||
xz/src/liblzma/simple/simple_coder.c \
|
||||
xz/src/liblzma/simple/simple_decoder.c \
|
||||
xz/src/liblzma/simple/simple_encoder.c \
|
||||
xz/src/liblzma/simple/sparc.c \
|
||||
xz/src/liblzma/simple/x86.c
|
||||
LOCAL_CFLAGS := -DHAVE_CONFIG_H -Wno-implicit-function-declaration
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
||||
SE_PATH := $(LOCAL_PATH)/selinux
|
||||
|
||||
# libsepol.a
|
||||
|
22
native/src/external/lzma-sys/Cargo.toml
vendored
22
native/src/external/lzma-sys/Cargo.toml
vendored
@@ -1,22 +0,0 @@
|
||||
[package]
|
||||
name = "lzma-sys"
|
||||
version = "0.1.20"
|
||||
authors = ["Alex Crichton <alex@alexcrichton.com>"]
|
||||
license = "MIT/Apache-2.0"
|
||||
repository = "https://github.com/alexcrichton/xz2-rs"
|
||||
homepage = "https://github.com/alexcrichton/xz2-rs"
|
||||
documentation = "https://docs.rs/lzma-sys"
|
||||
description = """
|
||||
Raw bindings to liblzma which contains an implementation of LZMA and xz stream
|
||||
encoding/decoding.
|
||||
|
||||
High level Rust bindings are available in the `xz2` crate.
|
||||
"""
|
||||
categories = ["external-ffi-bindings"]
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
libc = "0.2.51"
|
||||
|
||||
[features]
|
||||
static = []
|
359
native/src/external/lzma-sys/src/lib.rs
vendored
359
native/src/external/lzma-sys/src/lib.rs
vendored
@@ -1,359 +0,0 @@
|
||||
#![allow(bad_style)]
|
||||
#![doc(html_root_url = "https://docs.rs/lzma-sys/0.1")]
|
||||
|
||||
use libc::{c_char, c_uchar, c_void, size_t};
|
||||
use std::u64;
|
||||
|
||||
#[cfg(target_env = "msvc")]
|
||||
#[doc(hidden)]
|
||||
pub type __enum_ty = libc::c_int;
|
||||
#[cfg(not(target_env = "msvc"))]
|
||||
#[doc(hidden)]
|
||||
pub type __enum_ty = libc::c_uint;
|
||||
pub type lzma_bool = c_uchar;
|
||||
pub type lzma_ret = __enum_ty;
|
||||
pub type lzma_action = __enum_ty;
|
||||
type lzma_reserved_enum = __enum_ty;
|
||||
pub type lzma_check = __enum_ty;
|
||||
pub type lzma_vli = u64;
|
||||
pub type lzma_mode = __enum_ty;
|
||||
pub type lzma_match_finder = __enum_ty;
|
||||
|
||||
pub const LZMA_OK: lzma_ret = 0;
|
||||
pub const LZMA_STREAM_END: lzma_ret = 1;
|
||||
pub const LZMA_NO_CHECK: lzma_ret = 2;
|
||||
pub const LZMA_UNSUPPORTED_CHECK: lzma_ret = 3;
|
||||
pub const LZMA_GET_CHECK: lzma_ret = 4;
|
||||
pub const LZMA_MEM_ERROR: lzma_ret = 5;
|
||||
pub const LZMA_MEMLIMIT_ERROR: lzma_ret = 6;
|
||||
pub const LZMA_FORMAT_ERROR: lzma_ret = 7;
|
||||
pub const LZMA_OPTIONS_ERROR: lzma_ret = 8;
|
||||
pub const LZMA_DATA_ERROR: lzma_ret = 9;
|
||||
pub const LZMA_BUF_ERROR: lzma_ret = 10;
|
||||
pub const LZMA_PROG_ERROR: lzma_ret = 11;
|
||||
|
||||
pub const LZMA_RUN: lzma_action = 0;
|
||||
pub const LZMA_SYNC_FLUSH: lzma_action = 1;
|
||||
pub const LZMA_FULL_FLUSH: lzma_action = 2;
|
||||
pub const LZMA_FULL_BARRIER: lzma_action = 4;
|
||||
pub const LZMA_FINISH: lzma_action = 3;
|
||||
|
||||
pub const LZMA_CHECK_NONE: lzma_check = 0;
|
||||
pub const LZMA_CHECK_CRC32: lzma_check = 1;
|
||||
pub const LZMA_CHECK_CRC64: lzma_check = 4;
|
||||
pub const LZMA_CHECK_SHA256: lzma_check = 10;
|
||||
|
||||
pub const LZMA_MODE_FAST: lzma_mode = 1;
|
||||
pub const LZMA_MODE_NORMAL: lzma_mode = 2;
|
||||
|
||||
pub const LZMA_MF_HC3: lzma_match_finder = 0x03;
|
||||
pub const LZMA_MF_HC4: lzma_match_finder = 0x04;
|
||||
pub const LZMA_MF_BT2: lzma_match_finder = 0x12;
|
||||
pub const LZMA_MF_BT3: lzma_match_finder = 0x13;
|
||||
pub const LZMA_MF_BT4: lzma_match_finder = 0x14;
|
||||
|
||||
pub const LZMA_TELL_NO_CHECK: u32 = 0x01;
|
||||
pub const LZMA_TELL_UNSUPPORTED_CHECK: u32 = 0x02;
|
||||
pub const LZMA_TELL_ANY_CHECK: u32 = 0x04;
|
||||
pub const LZMA_IGNORE_CHECK: u32 = 0x10;
|
||||
pub const LZMA_CONCATENATED: u32 = 0x08;
|
||||
|
||||
pub const LZMA_PRESET_DEFAULT: u32 = 6;
|
||||
pub const LZMA_PRESET_LEVEL_MASK: u32 = 0x1f;
|
||||
pub const LZMA_PRESET_EXTREME: u32 = 1 << 31;
|
||||
|
||||
pub const LZMA_DICT_SIZE_MIN: u32 = 4096;
|
||||
pub const LZMA_DICT_SIZE_DEFAULT: u32 = 1 << 23;
|
||||
|
||||
pub const LZMA_LCLP_MIN: u32 = 0;
|
||||
pub const LZMA_LCLP_MAX: u32 = 4;
|
||||
pub const LZMA_LC_DEFAULT: u32 = 3;
|
||||
|
||||
pub const LZMA_LP_DEFAULT: u32 = 0;
|
||||
|
||||
pub const LZMA_PB_MIN: u32 = 0;
|
||||
pub const LZMA_PB_MAX: u32 = 4;
|
||||
pub const LZMA_PB_DEFAULT: u32 = 2;
|
||||
|
||||
pub const LZMA_BACKWARD_SIZE_MIN: lzma_vli = 4;
|
||||
pub const LZMA_BACKWARD_SIZE_MAX: lzma_vli = 1 << 34;
|
||||
|
||||
pub const LZMA_VLI_MAX: lzma_vli = u64::MAX / 2;
|
||||
pub const LZMA_VLI_UNKNOWN: lzma_vli = u64::MAX;
|
||||
pub const LZMA_VLI_BYTES_MAX: usize = 9;
|
||||
|
||||
pub const LZMA_FILTER_X86: lzma_vli = 0x04;
|
||||
pub const LZMA_FILTER_POWERPC: lzma_vli = 0x05;
|
||||
pub const LZMA_FILTER_IA64: lzma_vli = 0x06;
|
||||
pub const LZMA_FILTER_ARM: lzma_vli = 0x07;
|
||||
pub const LZMA_FILTER_ARMTHUMB: lzma_vli = 0x08;
|
||||
pub const LZMA_FILTER_SPARC: lzma_vli = 0x09;
|
||||
pub const LZMA_FILTER_LZMA1: lzma_vli = 0x4000000000000001;
|
||||
pub const LZMA_FILTER_LZMA2: lzma_vli = 0x21;
|
||||
|
||||
#[repr(C)]
|
||||
pub struct lzma_allocator {
|
||||
pub alloc: Option<extern "C" fn(*mut c_void, size_t, size_t) -> *mut c_void>,
|
||||
pub free: Option<extern "C" fn(*mut c_void, *mut c_void)>,
|
||||
pub opaque: *mut c_void,
|
||||
}
|
||||
|
||||
pub enum lzma_internal {}
|
||||
|
||||
#[repr(C)]
|
||||
pub struct lzma_stream {
|
||||
pub next_in: *const u8,
|
||||
pub avail_in: size_t,
|
||||
pub total_in: u64,
|
||||
pub next_out: *mut u8,
|
||||
pub avail_out: size_t,
|
||||
pub total_out: u64,
|
||||
pub allocator: *const lzma_allocator,
|
||||
|
||||
internal: *mut lzma_internal,
|
||||
reserved_ptr1: *mut c_void,
|
||||
reserved_ptr2: *mut c_void,
|
||||
reserved_ptr3: *mut c_void,
|
||||
reserved_ptr4: *mut c_void,
|
||||
reserved_int1: u64,
|
||||
reserved_int2: u64,
|
||||
reserved_int3: size_t,
|
||||
reserved_int4: size_t,
|
||||
reserved_enum1: lzma_reserved_enum,
|
||||
reserved_enum2: lzma_reserved_enum,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
pub struct lzma_filter {
|
||||
pub id: lzma_vli,
|
||||
pub options: *mut c_void,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
pub struct lzma_mt {
|
||||
pub flags: u32,
|
||||
pub threads: u32,
|
||||
pub block_size: u64,
|
||||
pub timeout: u32,
|
||||
pub preset: u32,
|
||||
pub filters: *const lzma_filter,
|
||||
pub check: lzma_check,
|
||||
|
||||
reserved_enum1: lzma_reserved_enum,
|
||||
reserved_enum2: lzma_reserved_enum,
|
||||
reserved_enum3: lzma_reserved_enum,
|
||||
reserved_int1: u32,
|
||||
reserved_int2: u32,
|
||||
reserved_int3: u32,
|
||||
reserved_int4: u32,
|
||||
reserved_int5: u64,
|
||||
reserved_int6: u64,
|
||||
reserved_int7: u64,
|
||||
reserved_int8: u64,
|
||||
reserved_ptr1: *mut c_void,
|
||||
reserved_ptr2: *mut c_void,
|
||||
reserved_ptr3: *mut c_void,
|
||||
reserved_ptr4: *mut c_void,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct lzma_options_lzma {
|
||||
pub dict_size: u32,
|
||||
pub preset_dict: *const u8,
|
||||
pub preset_dict_size: u32,
|
||||
pub lc: u32,
|
||||
pub lp: u32,
|
||||
pub pb: u32,
|
||||
pub mode: lzma_mode,
|
||||
pub nice_len: u32,
|
||||
pub mf: lzma_match_finder,
|
||||
pub depth: u32,
|
||||
|
||||
reserved_int1: u32,
|
||||
reserved_int2: u32,
|
||||
reserved_int3: u32,
|
||||
reserved_int4: u32,
|
||||
reserved_int5: u32,
|
||||
reserved_int6: u32,
|
||||
reserved_int7: u32,
|
||||
reserved_int8: u32,
|
||||
reserved_enum1: lzma_reserved_enum,
|
||||
reserved_enum2: lzma_reserved_enum,
|
||||
reserved_enum3: lzma_reserved_enum,
|
||||
reserved_enum4: lzma_reserved_enum,
|
||||
reserved_ptr1: *mut c_void,
|
||||
reserved_ptr2: *mut c_void,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
pub struct lzma_stream_flags {
|
||||
pub version: u32,
|
||||
pub backward_size: lzma_vli,
|
||||
pub check: lzma_check,
|
||||
|
||||
reserved_enum1: lzma_reserved_enum,
|
||||
reserved_enum2: lzma_reserved_enum,
|
||||
reserved_enum3: lzma_reserved_enum,
|
||||
reserved_enum4: lzma_reserved_enum,
|
||||
reserved_bool1: lzma_bool,
|
||||
reserved_bool2: lzma_bool,
|
||||
reserved_bool3: lzma_bool,
|
||||
reserved_bool4: lzma_bool,
|
||||
reserved_bool5: lzma_bool,
|
||||
reserved_bool6: lzma_bool,
|
||||
reserved_bool7: lzma_bool,
|
||||
reserved_bool8: lzma_bool,
|
||||
reserved_int1: u32,
|
||||
reserved_int2: u32,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
pub struct lzma_options_bcj {
|
||||
pub start_offset: u32,
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
pub fn lzma_code(strm: *mut lzma_stream, action: lzma_action) -> lzma_ret;
|
||||
pub fn lzma_end(strm: *mut lzma_stream);
|
||||
pub fn lzma_get_progress(strm: *mut lzma_stream, progress_in: *mut u64, progress_out: *mut u64);
|
||||
pub fn lzma_memusage(strm: *const lzma_stream) -> u64;
|
||||
pub fn lzma_memlimit_get(strm: *const lzma_stream) -> u64;
|
||||
pub fn lzma_memlimit_set(strm: *mut lzma_stream, memlimit: u64) -> lzma_ret;
|
||||
|
||||
pub fn lzma_easy_encoder_memusage(preset: u32) -> u64;
|
||||
pub fn lzma_easy_decoder_memusage(preset: u32) -> u64;
|
||||
pub fn lzma_easy_encoder(strm: *mut lzma_stream, preset: u32, check: lzma_check) -> lzma_ret;
|
||||
pub fn lzma_easy_buffer_encode(
|
||||
preset: u32,
|
||||
check: lzma_check,
|
||||
allocator: *const lzma_allocator,
|
||||
input: *const u8,
|
||||
in_size: size_t,
|
||||
out: *mut u8,
|
||||
out_pos: *mut size_t,
|
||||
out_size: size_t,
|
||||
) -> lzma_ret;
|
||||
|
||||
pub fn lzma_stream_encoder(
|
||||
strm: *mut lzma_stream,
|
||||
filters: *const lzma_filter,
|
||||
check: lzma_check,
|
||||
) -> lzma_ret;
|
||||
pub fn lzma_stream_encoder_mt_memusage(options: *const lzma_mt) -> u64;
|
||||
pub fn lzma_stream_encoder_mt(strm: *mut lzma_stream, options: *const lzma_mt) -> lzma_ret;
|
||||
|
||||
pub fn lzma_alone_encoder(
|
||||
strm: *mut lzma_stream,
|
||||
options: *const lzma_options_lzma,
|
||||
) -> lzma_ret;
|
||||
|
||||
pub fn lzma_stream_buffer_bound(uncompressed_size: size_t) -> size_t;
|
||||
pub fn lzma_stream_buffer_encode(
|
||||
filters: *mut lzma_filter,
|
||||
check: lzma_check,
|
||||
allocator: *const lzma_allocator,
|
||||
input: *const u8,
|
||||
in_size: size_t,
|
||||
out: *mut u8,
|
||||
out_pos: *mut size_t,
|
||||
out_size: size_t,
|
||||
) -> lzma_ret;
|
||||
|
||||
pub fn lzma_stream_decoder(strm: *mut lzma_stream, memlimit: u64, flags: u32) -> lzma_ret;
|
||||
pub fn lzma_auto_decoder(strm: *mut lzma_stream, memlimit: u64, flags: u32) -> lzma_ret;
|
||||
pub fn lzma_alone_decoder(strm: *mut lzma_stream, memlimit: u64) -> lzma_ret;
|
||||
pub fn lzma_stream_buffer_decode(
|
||||
memlimit: *mut u64,
|
||||
flags: u32,
|
||||
allocator: *const lzma_allocator,
|
||||
input: *const u8,
|
||||
in_pos: *mut size_t,
|
||||
in_size: size_t,
|
||||
out: *mut u8,
|
||||
out_pos: *mut size_t,
|
||||
out_size: size_t,
|
||||
) -> lzma_ret;
|
||||
|
||||
pub fn lzma_check_is_supported(check: lzma_check) -> lzma_bool;
|
||||
pub fn lzma_check_size(check: lzma_check) -> u32;
|
||||
|
||||
pub fn lzma_crc32(buf: *const u8, size: size_t, crc: u32) -> u32;
|
||||
pub fn lzma_crc64(buf: *const u8, size: size_t, crc: u64) -> u64;
|
||||
pub fn lzma_get_check(strm: *const lzma_stream) -> lzma_check;
|
||||
|
||||
pub fn lzma_filter_encoder_is_supported(id: lzma_vli) -> lzma_bool;
|
||||
pub fn lzma_filter_decoder_is_supported(id: lzma_vli) -> lzma_bool;
|
||||
pub fn lzma_filters_copy(
|
||||
src: *const lzma_filter,
|
||||
dest: *mut lzma_filter,
|
||||
allocator: *const lzma_allocator,
|
||||
) -> lzma_ret;
|
||||
pub fn lzma_raw_encoder_memusage(filters: *const lzma_filter) -> u64;
|
||||
pub fn lzma_raw_decoder_memusage(filters: *const lzma_filter) -> u64;
|
||||
pub fn lzma_raw_encoder(strm: *mut lzma_stream, filters: *const lzma_filter) -> lzma_ret;
|
||||
pub fn lzma_raw_decoder(strm: *mut lzma_stream, filters: *const lzma_filter) -> lzma_ret;
|
||||
pub fn lzma_filters_update(strm: *mut lzma_stream, filters: *const lzma_filter) -> lzma_ret;
|
||||
pub fn lzma_raw_buffer_encode(
|
||||
filters: *const lzma_filter,
|
||||
allocator: *const lzma_allocator,
|
||||
input: *const u8,
|
||||
in_size: size_t,
|
||||
out: *mut u8,
|
||||
out_pos: *mut size_t,
|
||||
out_size: size_t,
|
||||
) -> lzma_ret;
|
||||
pub fn lzma_raw_buffer_decode(
|
||||
filters: *const lzma_filter,
|
||||
allocator: *const lzma_allocator,
|
||||
input: *const u8,
|
||||
in_pos: *mut size_t,
|
||||
in_size: size_t,
|
||||
out: *mut u8,
|
||||
out_pos: *mut size_t,
|
||||
out_size: size_t,
|
||||
) -> lzma_ret;
|
||||
pub fn lzma_properties_size(size: *mut u32, filter: *const lzma_filter) -> lzma_ret;
|
||||
pub fn lzma_properties_encode(filter: *const lzma_filter, props: *mut u8) -> lzma_ret;
|
||||
pub fn lzma_properties_decode(
|
||||
filter: *mut lzma_filter,
|
||||
allocator: *const lzma_allocator,
|
||||
props: *const u8,
|
||||
props_size: size_t,
|
||||
) -> lzma_ret;
|
||||
pub fn lzma_physmem() -> u64;
|
||||
pub fn lzma_cputhreads() -> u32;
|
||||
|
||||
pub fn lzma_stream_header_encode(options: *const lzma_stream_flags, out: *mut u8) -> lzma_ret;
|
||||
pub fn lzma_stream_footer_encode(options: *const lzma_stream_flags, out: *mut u8) -> lzma_ret;
|
||||
pub fn lzma_stream_header_decode(options: *mut lzma_stream_flags, input: *const u8)
|
||||
-> lzma_ret;
|
||||
pub fn lzma_stream_footer_decode(options: *mut lzma_stream_flags, input: *const u8)
|
||||
-> lzma_ret;
|
||||
pub fn lzma_stream_flags_compare(
|
||||
a: *const lzma_stream_flags,
|
||||
b: *const lzma_stream_flags,
|
||||
) -> lzma_ret;
|
||||
|
||||
pub fn lzma_version_number() -> u32;
|
||||
pub fn lzma_version_string() -> *const c_char;
|
||||
|
||||
pub fn lzma_vli_encode(
|
||||
vli: lzma_vli,
|
||||
vli_pos: *mut size_t,
|
||||
out: *mut u8,
|
||||
out_pos: *mut size_t,
|
||||
out_size: size_t,
|
||||
) -> lzma_ret;
|
||||
pub fn lzma_vli_decode(
|
||||
vli: *mut lzma_vli,
|
||||
vli_pos: *mut size_t,
|
||||
input: *const u8,
|
||||
in_pos: *mut size_t,
|
||||
in_size: size_t,
|
||||
) -> lzma_ret;
|
||||
pub fn lzma_vli_size(vli: lzma_vli) -> u32;
|
||||
|
||||
pub fn lzma_lzma_preset(options: *mut lzma_options_lzma, preset: u32) -> lzma_bool;
|
||||
pub fn lzma_mf_is_supported(mf: lzma_match_finder) -> lzma_bool;
|
||||
}
|
1
native/src/external/xz
vendored
1
native/src/external/xz
vendored
Submodule native/src/external/xz deleted from 2327a461e1
Reference in New Issue
Block a user