Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package dd_rescue for openSUSE:Factory checked in at 2024-11-07 16:24:16 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/dd_rescue (Old) and /work/SRC/openSUSE:Factory/.dd_rescue.new.2020 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "dd_rescue" Thu Nov 7 16:24:16 2024 rev:63 rq:1221796 version:1.99.17 Changes: -------- --- /work/SRC/openSUSE:Factory/dd_rescue/dd_rescue.changes 2024-10-01 17:11:25.324737011 +0200 +++ /work/SRC/openSUSE:Factory/.dd_rescue.new.2020/dd_rescue.changes 2024-11-07 16:24:27.298326505 +0100 @@ -1,0 +2,11 @@ +Sat Nov 2 20:13:16 CET 2024 - [email protected] + +- Update to dd_rescue-1.99.17: + * Plugin libddr_lzma.so: LZMA2/xz de/compression from Dmitrii + Ivanov. Covering the other end of the spectrum of LZO, with + high compression ratios at high CPU cost for compression. + (Decompression is cheap for both.) + * Code review and streamlining for dd_rescue integration by + Kurt Garloff. + +------------------------------------------------------------------- Old: ---- dd_rescue-1.99.16.tar.bz2 dd_rescue-1.99.16.tar.bz2.asc New: ---- dd_rescue-1.99.17.tar.bz2 dd_rescue-1.99.17.tar.bz2.asc ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ dd_rescue.spec ++++++ --- /var/tmp/diff_new_pack.XopDTk/_old 2024-11-07 16:24:27.838348942 +0100 +++ /var/tmp/diff_new_pack.XopDTk/_new 2024-11-07 16:24:27.842349108 +0100 @@ -21,7 +21,7 @@ %define _lto_cflags %{nil} %endif Name: dd_rescue -Version: 1.99.16 +Version: 1.99.17 Release: 0 Summary: Data copying in the presence of I/O Errors License: GPL-2.0-only OR GPL-3.0-only @@ -41,6 +41,7 @@ BuildRequires: lzop BuildRequires: pkgconfig BuildRequires: python3-base +BuildRequires: xz-devel Requires: bc Recommends: dd_rescue-crypt Recommends: dd_rescue-lzo @@ -110,6 +111,26 @@ though more will have to be done to feel confident about feeding untrusted data to the decompressor; the plugin is still young and might expose bugs. +%package lzma +Summary: LZMA (xz) de/compression plugin for dd_rescue +Group: System/Base +Requires: dd_rescue = %{version} + +%description lzma +This plugin allows you do de/compress files during recovery copying +with dd_rescue using the lzma compression algorithm. The lzma algorithm +is fairly slow when compressing, but achieves a good compression ratio. +Decompression is much faster. + +This plugin is still new and may not be very mature yet. It may be +a bad idea to feed it with untrusted data, especially when running +with elevated privileges. + +Authors: +-------- + Dmitrii Ivanov <[email protected]> + Kurt Garloff <[email protected]> + %prep %autosetup -p1 @@ -156,9 +177,13 @@ %files crypt %{_mandir}/man1/ddr_crypt.1%{?ext_man} %{_libdir}/libddr_crypt.so +%doc CRYPT_TODO PADDING %files lzo %{_libdir}/libddr_lzo.so %{_mandir}/man1/ddr_lzo.1%{?ext_man} -%doc CRYPT_TODO PADDING + +%files lzma +%{_libdir}/libddr_lzma.so +%{_mandir}/man1/ddr_lzma.1%{?ext_man} ++++++ dd_rescue-1.99.16.tar.bz2 -> dd_rescue-1.99.17.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dd_rescue-1.99.16/Makefile new/dd_rescue-1.99.17/Makefile --- old/dd_rescue-1.99.16/Makefile 2024-09-29 21:04:20.000000000 +0200 +++ new/dd_rescue-1.99.17/Makefile 2024-11-02 15:23:02.498493811 +0100 @@ -1,8 +1,7 @@ -# Makefile for dd_rescue # (c) [email protected], 99/10/09, GNU GPL # (c) [email protected], 2010 -- 2021, GNU GPL v2 or v3 -VERSION = 1.99.16 +VERSION = 1.99.17 DESTDIR = SRCDIR ?= . @@ -59,6 +58,13 @@ HAVE_LZO=0 endif +ifeq ($(shell grep 'HAVE_LZMA_H 1' config.h >/dev/null 2>&1 && echo 1), 1) + LIBTARGETS += libddr_lzma.so + HAVE_LZMA=1 +else + HAVE_LZMA=0 +endif + ifeq ($(shell grep 'HAVE_LIBCRYPTO 1' config.h >/dev/null 2>&1 && echo 1), 1) OTHTARGETS += pbkdf2 AES_OSSL_PO = aes_ossl.po @@ -197,8 +203,8 @@ AES_ARM64_O = aes_arm32.o AES_ARM64_PO = aes_arm32.po CFLAGS += -DHAVE_AES_ARM64 - ARCHFLAGS += -mfpu=crypto-neon-fp-armv8 - SHAFLAGS = -mfpu=crypto-neon-fp-armv8 + ARCHFLAGS += -mfpu=crypto-neon-fp-armv8 #-march=armv8 + SHAFLAGS += -mfpu=crypto-neon-fp-armv8 else ifeq (armv6,$(MACH)) OBJECTS2 = find_nonzero_arm.o @@ -339,6 +345,9 @@ libddr_crypt.so: libddr_crypt.po aes.po aes_c.po $(AESNI_PO) $(AES_ARM64_PO) $(AES_OSSL_PO) pbkdf2.po sha256.po $(SHAPOBJ) pbkdf_ossl.po md5.po checksum_file.po secmem.po random.po $(POBJECTS2) $(CC) -shared -o $@ $^ $(CRYPTOLIB) $(EXTRA_LDFLAGS) +libddr_lzma.so: libddr_lzma.po + $(CC) -shared -o $@ $^ -llzma + # More special compiler flags find_nonzero.o: $(SRCDIR)/find_nonzero.c $(CC) $(CFLAGS_OPT) $(PIE) -c $< $(SSE) @@ -491,10 +500,10 @@ $(CC) $(CFLAGS) $(PIC) -O3 -march=armv8-a+crypto -c $< -o $@ aes_arm32.o: $(SRCDIR)/aes_arm32.c - $(CC) $(CFLAGS) $(PIE) -O3 -march=armv7-a -mfpu=crypto-neon-fp-armv8 -c $< + $(CC) $(CFLAGS) $(PIE) -O3 $(SHAFLAGS) -c $< aes_arm32.po: $(SRCDIR)/aes_arm32.c - $(CC) $(CFLAGS) $(PIC) -O3 -march=armv7-a -mfpu=crypto-neon-fp-armv8 -c $< -o $@ + $(CC) $(CFLAGS) $(PIC) -O3 $(SHAFLAGS) -c $< -o $@ aes_c.o: $(SRCDIR)/aes_c.c $(CC) $(CFLAGS) $(PIE) $(FULL_UNROLL) -O3 -c $< @@ -529,8 +538,8 @@ $(INSTALL) $(INSTALLFLAGS) $(INSTASROOT) -m 755 $(LIBTARGETS) $(INSTALLLIBDIR) ln -sf libddr_hash.so $(INSTALLLIBDIR)/libddr_MD5.so mkdir -p $(MANDIR)/man1 - $(INSTALL) $(INSTASROOT) -m 644 dd_rescue.1 ddr_lzo.1 ddr_crypt.1 $(MANDIR)/man1/ - gzip -9f $(MANDIR)/man1/dd_rescue.1 $(MANDIR)/man1/ddr_lzo.1 $(MANDIR)/man1/ddr_crypt.1 + $(INSTALL) $(INSTASROOT) -m 644 dd_rescue.1 ddr_lzo.1 ddr_crypt.1 ddr_lzma.1 $(MANDIR)/man1/ + gzip -9f $(MANDIR)/man1/dd_rescue.1 $(MANDIR)/man1/ddr_lzo.1 $(MANDIR)/man1/ddr_crypt.1 $(MANDIR)/man1/ddr_lzma.1 check: $(TARGETS) find_nonzero md5 sha1 sha256 sha512 fmt_no @echo "make check ... Pass VG=\"valgrind --options\" to use with valgrind" @@ -601,6 +610,8 @@ if test $(HAVE_LZO) = 1; then $(MAKE) check_lzo_algos; fi #if test $(HAVE_LZO) = 1; then $(MAKE) check_lzo_test; fi if test $(HAVE_LZO) = 1; then $(MAKE) check_lzo_fuzz; fi + # Tests for libddr_lzma.so + if test $(HAVE_LZMA) = 1; then $(MAKE) check_lzma; fi # Tests for libddr_null $(VG) ./dd_rescue -L ./libddr_null.so=debug dd_rescue /dev/null # Hash tests with set_xattr and chk_xattr @@ -747,7 +758,7 @@ check_crypt: $(TARGETS) test_aes # TODO: Move previous cases into script ... - HAVE_LZO=$(HAVE_LZO) HAVE_OPENSSL=$(HAVE_OPENSSL) HAVE_AES=$(HAVE_AES) ./test_crypt.sh + HAVE_LZMA=$(HAVE_LZMA) HAVE_LZO=$(HAVE_LZO) HAVE_OPENSSL=$(HAVE_OPENSSL) HAVE_AES=$(HAVE_AES) ./test_crypt.sh # Holes (all) # Reverse (CTR, ECB) # Chain with lzo, hash (all) @@ -804,4 +815,24 @@ # Cleanup rm -f dd_rescue2 dd_rescue.dec dd_rescue.enc - +check_lzma: $(TARGETS) + @echo "make check ... Pass VG=\"valgrind --options\" to use with valgrind" + $(VG) ./dd_rescue -L ./libddr_lzma.so dd_rescue dd_rescue.xz + $(VG) ./dd_rescue -L ./libddr_lzma.so dd_rescue.xz dd_rescue_d + cmp dd_rescue dd_rescue_d + ./dd_rescue -Z /dev/urandom -m16M first_test.txt + $(VG) ./dd_rescue -L ./libddr_lzma.so first_test.txt first_test.txt.xz + $(VG) ./dd_rescue -L ./libddr_lzma.so first_test.txt.xz first_test_d.txt + cmp first_test.txt first_test_d.txt + ./dd_rescue -Z /dev/urandom -m64M second_test.txt + $(VG) ./dd_rescue -L ./libddr_lzma.so second_test.txt second_test.txt.xz + $(VG) ./dd_rescue -L ./libddr_lzma.so second_test.txt.xz second_test_d.txt + cmp second_test.txt second_test_d.txt + rm -f dd_rescue_d dd_rescue.xz *_test.txt.xz *_test_d.txt + $(VG) ./dd_rescue -L ./libddr_lzma.so=mt first_test.txt first_test.txt.xz + $(VG) ./dd_rescue -L ./libddr_lzma.so=mt first_test.txt.xz first_test_d.txt + cmp first_test.txt first_test_d.txt + $(VG) ./dd_rescue -L ./libddr_lzma.so=mt second_test.txt second_test.txt.xz + $(VG) ./dd_rescue -L ./libddr_lzma.so=mt second_test.txt.xz second_test_d.txt + cmp second_test.txt second_test_d.txt + rm -f *_test.* *_test_d.* diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dd_rescue-1.99.16/Makefile.android.arm32 new/dd_rescue-1.99.17/Makefile.android.arm32 --- old/dd_rescue-1.99.16/Makefile.android.arm32 2024-09-17 11:06:57.000000000 +0200 +++ new/dd_rescue-1.99.17/Makefile.android.arm32 2024-09-30 09:44:48.536970007 +0200 @@ -19,10 +19,10 @@ #.PHONY: dd_rescue find_nonzero fmt_no fiemap file_zblock default: config.h crtbegin_so.o $(DEPS) - $(MAKE) $(MAKEFLAGS) -f Makefile PATH=$(CBIN):$(PATH) CC="$(CC) $(CFLG)" LD="$(CC) -L $(LIBD)" MACH=armv6 IGNORE_TARGET=1 EXTRA_LDFLAGS="$(ATTR)" LDPIE="" NO_ALIGNED_ALLOC=1 $@ + $(MAKE) $(MAKEFLAGS) -f Makefile PATH=$(CBIN):$(PATH) CC="$(CC) $(CFLG)" LD="$(CC) -L $(LIBD)" MACH=armv6 IGNORE_TARGET=1 EXTRA_LDFLAGS="$(ATTR)" LDPIE="" NO_ALIGNED_ALLOC=1 SHAFLAGS="-mfloat-abi=softfp" $@ all test check strip lib static libfalloc test_aes find_nonzero sha512 sha256 sha1 md5 fiemap file_zblock: config.h crtbegin_so.o $(DEPS) - $(MAKE) $(MAKEFLAGS) -f Makefile PATH=$(CBIN):$(PATH) CC="$(CC) $(CFLG)" LD="$(CC) -L $(LIBD)" MACH=armv6 IGNORE_TARGET=1 EXTRA_LDFLAGS="$(ATTR)" LDPIE="" NO_ALIGNED_ALLOC=1 $@ + $(MAKE) $(MAKEFLAGS) -f Makefile PATH=$(CBIN):$(PATH) CC="$(CC) $(CFLG)" LD="$(CC) -L $(LIBD)" MACH=armv6 IGNORE_TARGET=1 EXTRA_LDFLAGS="$(ATTR)" LDPIE="" NO_ALIGNED_ALLOC=1 SHAFLAGS="-mfloat-abi=softfp" $@ crtbegin_so.o: $(LIBD)/crtbegin_so.o ln -sf $(LIBD)/crtbegin_dynamic.o . diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dd_rescue-1.99.16/Makefile.android.arm32abi28 new/dd_rescue-1.99.17/Makefile.android.arm32abi28 --- old/dd_rescue-1.99.16/Makefile.android.arm32abi28 2024-08-22 20:09:20.000000000 +0200 +++ new/dd_rescue-1.99.17/Makefile.android.arm32abi28 2024-09-30 10:45:25.375280845 +0200 @@ -18,7 +18,7 @@ .PHONY: config libfalloc libfalloc-static libfalloc-dl nolib nocolor static strip all clean check test default: config.h $(DEPS) - $(MAKE) $(MAKEFLAGS) -f Makefile PATH=$(CBIN):$(PATH) CC="$(CC) $(CFLG)" LD="$(CC) -L $(LIBD)" MACH=armv7 EXTRA_LDFLAGS="$(ATTR)" $@ + $(MAKE) $(MAKEFLAGS) -f Makefile PATH=$(CBIN):$(PATH) CC="$(CC) $(CFLG)" LD="$(CC) -L $(LIBD)" MACH=armv7 EXTRA_LDFLAGS="$(ATTR)" SHAFLAGS="-march=armv8 -mfloat-abi=softfp -mfpu=crypto-neon-fp-armv8" $@ crtbegin_so.o: $(LIBD)/crtbegin_so.o ln -sf $(LIBD)/crtbegin_dynamic.o . @@ -41,7 +41,7 @@ $(MAKE) -f Makefile.android.arm32abi28 config.h dd_rescue libfalloc libfalloc-static libfalloc-dl nolib nocolor static strip all test_aes test find_nonzero check: config.h $(DEPS) - $(MAKE) $(MAKEFLAGS) -f Makefile PATH=$(CBIN):$(PATH) CC="$(CC) $(CFLG)" LD="$(CC) -L $(LIBD)" MACH=armv7 EXTRA_LDFLAGS="$(ATTR)" $@ + $(MAKE) $(MAKEFLAGS) -f Makefile PATH=$(CBIN):$(PATH) CC="$(CC) $(CFLG)" LD="$(CC) -L $(LIBD)" MACH=armv7 EXTRA_LDFLAGS="$(ATTR)" SHAFLAGS="-march=armv8 -mfloat-abi=softfp -mfpu=crypto-neon-fp-armv8" $@ clean: $(MAKE) -f Makefile PATH=$(CBIN):$(PATH) CC="$(CC) $(CFLG)" LD="$(CC) -L $(LIBD)" MACH=armv7 $@ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dd_rescue-1.99.16/Makefile.android.arm32pie new/dd_rescue-1.99.17/Makefile.android.arm32pie --- old/dd_rescue-1.99.16/Makefile.android.arm32pie 2024-09-17 11:06:57.000000000 +0200 +++ new/dd_rescue-1.99.17/Makefile.android.arm32pie 2024-09-30 09:47:13.096347679 +0200 @@ -18,7 +18,7 @@ .PHONY: config libfalloc libfalloc-static libfalloc-dl nolib nocolor static strip all clean check test default: config.h $(DEPS) - $(MAKE) $(MAKEFLAGS) -f Makefile PATH=$(CBIN):$(PATH) CC="$(CC) $(CFLG)" LD="$(CC) -L $(LIBD)" MACH=armv7 IGNORE_TARGET=1 EXTRA_LDFLAGS="$(ATTR)" NO_ALIGNED_ALLOC=1 $@ + $(MAKE) $(MAKEFLAGS) -f Makefile PATH=$(CBIN):$(PATH) CC="$(CC) $(CFLG)" LD="$(CC) -L $(LIBD)" MACH=armv7 IGNORE_TARGET=1 EXTRA_LDFLAGS="$(ATTR)" NO_ALIGNED_ALLOC=1 SHAFLAGS="-mfloat-abi=softfp" $@ config.h: crtbegin_so.o config.h.in configure PATH=$(CBIN):$(PATH) CC="$(CC) $(CFLG)" LD="$(CC) -L $(LIBD)" ./configure --host x86-64-linux-gnu @@ -41,7 +41,7 @@ $(MAKE) -f Makefile.android.arm32pie config.h dd_rescue libfalloc libfalloc-static libfalloc-dl nolib nocolor static strip check test find_nonzero test_aes all: config.h $(DEPS) - $(MAKE) $(MAKEFLAGS) -f Makefile PATH=$(CBIN):$(PATH) CC="$(CC) $(CFLG)" LD="$(CC) -L $(LIBD)" MACH=armv7 IGNORE_TARGET=1 EXTRA_LDFLAGS="$(ATTR)" NO_ALIGNED_ALLOC=1 $@ + $(MAKE) $(MAKEFLAGS) -f Makefile PATH=$(CBIN):$(PATH) CC="$(CC) $(CFLG)" LD="$(CC) -L $(LIBD)" MACH=armv7 IGNORE_TARGET=1 EXTRA_LDFLAGS="$(ATTR)" NO_ALIGNED_ALLOC=1 SHAFLAGS="-mfloat-abi=softfp" $@ clean: $(MAKE) -f Makefile PATH=$(CBIN):$(PATH) CC="$(CC) $(CFLG)" LD="$(CC) -L $(LIBD)" MACH=armv7 IGNORE_TARGET=1 $@ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dd_rescue-1.99.16/REL-ID new/dd_rescue-1.99.17/REL-ID --- old/dd_rescue-1.99.16/REL-ID 2024-09-29 23:20:09.000000000 +0200 +++ new/dd_rescue-1.99.17/REL-ID 2024-11-02 17:00:33.645478257 +0100 @@ -1 +1 @@ -DD_RESCUE_1_99_16 +DD_RESCUE_1_99_17 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dd_rescue-1.99.16/archdep.c new/dd_rescue-1.99.17/archdep.c --- old/dd_rescue-1.99.16/archdep.c 2024-09-29 22:39:36.000000000 +0200 +++ new/dd_rescue-1.99.17/archdep.c 2024-10-01 09:23:11.341019113 +0200 @@ -181,11 +181,17 @@ void probe_arm8crypto_32() { asm volatile( +#if defined(__clang__) || (defined(__GNUC__) && __GNUC__ >= 5) + " .arch armv8-a \n" +#endif " .fpu crypto-neon-fp-armv8 \n" " veor q0, q0, q0 \n" " veor q1, q1, q1 \n" +#if defined(__clang__) || (defined(__GNUC__) && __GNUC__ >= 5) " aese.8 q1, q0 \n" +#else " //.word 0xffb02300 \n" +#endif " //.word 0xf3b02300 \n" : : @@ -195,12 +201,18 @@ void probe_arm8sha_32() { asm volatile( +#if defined(__clang__) || (defined(__GNUC__) && __GNUC__ >= 5) + " .arch armv8-a \n" +#endif " .fpu crypto-neon-fp-armv8 \n" " veor q0, q0, q0 \n" " veor q1, q1, q1 \n" " veor q12, q12, q12 \n" +#if defined(__clang__) || (defined(__GNUC__) && __GNUC__ >= 5) " sha256h.32 q0, q1, q12 \n" +#else " //.word 0xff020c68 \n" +#endif " //.word 0xf3020c68 \n" : : diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dd_rescue-1.99.16/configure.ac new/dd_rescue-1.99.17/configure.ac --- old/dd_rescue-1.99.16/configure.ac 2024-09-21 22:19:30.000000000 +0200 +++ new/dd_rescue-1.99.17/configure.ac 2024-11-02 15:36:25.609524433 +0100 @@ -12,9 +12,11 @@ #AC_PROG_INSTALL #CFLAGS="$CFLAGS -DHAVE_CONFIG_H" #CFLAGS="$CFLAGS -D_LARGEFILE64_SOURCE=1" -AC_CHECK_HEADERS([fallocate.h dlfcn.h unistd.h libgen.h sys/xattr.h attr/xattr.h sys/acl.h sys/ioctl.h endian.h linux/fs.h linux/fiemap.h stdint.h lzo/lzo1x.h openssl/evp.h linux/random.h sys/random.h malloc.h sched.h sys/statvfs.h sys/resource.h sys/endian.h linux/swab.h sys/user.h fcntl.h sys/reg.h]) +AC_CHECK_HEADERS([fallocate.h dlfcn.h unistd.h libgen.h sys/xattr.h attr/xattr.h sys/acl.h sys/ioctl.h endian.h linux/fs.h linux/fiemap.h stdint.h lzo/lzo1x.h lzma.h openssl/evp.h linux/random.h sys/random.h malloc.h sched.h sys/statvfs.h sys/resource.h sys/endian.h linux/swab.h sys/user.h fcntl.h sys/reg.h arm_acle.h]) AC_CHECK_FUNCS([ffs ffsl basename splice getopt_long pread posix_fadvise htonl htobe64 feof_unlocked getline getentropy getrandom posix_memalign valloc sched_yield fstatvfs getrlimit aligned_alloc]) AC_CHECK_LIB(dl,dlsym) +AC_CHECK_LIB(lzma,lzma_easy_encoder) +#AC_CHECK_LIB(lzma,init_lzma_stream) AC_CHECK_LIB(fallocate,linux_fallocate64) AC_CHECK_LIB(lzo2,lzo1x_1_compress) AC_CHECK_LIB(crypto,EVP_aes_192_ctr) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dd_rescue-1.99.16/dd_rescue.1 new/dd_rescue-1.99.17/dd_rescue.1 --- old/dd_rescue-1.99.16/dd_rescue.1 2024-09-29 20:40:35.000000000 +0200 +++ new/dd_rescue-1.99.17/dd_rescue.1 2024-11-02 15:23:02.498493811 +0100 @@ -784,6 +784,12 @@ .BR ddr_crypt (1) man page for more details. . +. SS ddr_lzma +The xz de/compression plugin. Support most of popular options from xz util. +See the +.BR ddr_lzma (1) +max page for more details. +. .SH EXIT STATUS On successful completion, .B dd_rescue diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dd_rescue-1.99.16/ddr_lzma.1 new/dd_rescue-1.99.17/ddr_lzma.1 --- old/dd_rescue-1.99.16/ddr_lzma.1 1970-01-01 01:00:00.000000000 +0100 +++ new/dd_rescue-1.99.17/ddr_lzma.1 2024-11-02 17:00:26.801315194 +0100 @@ -0,0 +1,165 @@ +.TH ddr_lzma 1 "2024-03-10" "Dmitrii Ivanov" "XZ de/compression plugin for dd_rescue" +. +.SH NAME +ddr_lzma \- Data de/compression plugin for dd_rescue +. +.SH SYNOPSIS +.na +.nh +.B -L /path/to/libddr_lzma.so[=option[:option[:...]]] +.br +.B -L lzma=[=option[:option[:...]]] +. +.SH DESCRIPTION +.SS About +XZ is an archiving format that uses the LZMA2 compression algorithm, +also known as Lempel-Ziv-Markov chain algorithm. LZMA2 has fixed +some quirks of the highly successful LZMA algo which provides high +compression ratios and is known for its superior decompression speeds. +It's optimized for much better compression ratios at the cost of +compression speed compared to e.g. LZO. It's lowest preset levels +tend to beat highest gzip and lowest bzip2 levels for both +compression ratio and speed. +.PP +This plugin has been written for +.B dd_rescue +and uses the plugin interface from it. See the +.BR dd_rescue(1) +man page for more information on +.B dd_rescue. +. +.SH OPTIONS +Options are passed using +.B dd_rescue +option passing syntax: The name of the plugin (lzma) is optionally +followed by an equal sign (=) and options are separated by a colon (:). +the +.B lzma +plugin also allows most of common options from xz util with some additional ones. +See the EXAMPLES section below. +. +.SS Compression or decompression +The lzma dd_rescue plugin (subsequently referred to as just ddr_lzma which +reflects the variable parts of the filename libddr_lzma.so) choses +compression or decompression mode automatically +if one of the input/output files has an [lt]xz suffix; otherwise +you may specify +.B z +or +.B d +parameters on the command line for compression and decompression respectively. +.P +The parameter +.B mt +will tell ddr_lzma to do de/compression in multithreded mode. This +might speed up processing of data by using all cores of the CPU. +If the number of cores can not be detected, only one will be used. +You can also pass +.B mt=N +to explicitly specify the number of threads to be used. +.br +Note that liblzma prior to 5.2.0 does not support multithreaded compression, +while liblzma prior to 5.4.0 does not support multihreaded decompression. +This parameter will be ignored then. +.P +The plugin also supports the parameter +.B bench[mark] +; if it's specified, +it will output some information about CPU usage. +.P +If you only want to make an integrity check of the xz-compressed file, +you can use +.B test +; if data is corrupted, you will get a message in the console about it. +Instead of test you can use just t. +.P +Pass +.B check=XXX +where XXX can be one of next integrity checksum algos: CRC32, CRC64, SHA256, NONE. +If NONE is specified, the integrity checksum will not be calculated while compressing +By default CRC32 will be calculated by the plugin. +.P +Also if you want to limit memory usage when decoding, use next param: +.B memlimit=XXX +, where XXX is memory limit for decoding. The usual suffices k, M, G are +supported. Values below 1M or above the machine's memory size will be +rejected. +. +.SS Compression presets +The parameter +.B preset=X , +selects the compression ratio, where X can be an integer from 0 to 9 +inclusively. The default value is 5. The effect +on compression speed and ratio is significant, see the xz documentation. +Note that decompression speed is always very good with lzma, even +without multithreading. +You can append an e to the preset level to use more CPU (but not more +memory), trying to compress the data better. This corresponds to the +--extreme flag in xz. Use levels 0,1,2 if you want compression levels +better than highest gzip (or low bzip2) with better speed. +Multithreading further speeds things up, though you need to test it +on your system, see below. Use the lzo plugin for highest CPU speed +and lowest memory with very modest compression. +. +.SH BUGS/LIMITATIONS +.SS Maturity +The plugin is new as of dd_rescue 1.99.17. Do not yet rely on data +saved with ddr_lzma as the only backup for valuable data. +The options may also still change in the future. +After the events around xz/liblzma in March 2024, some additional +reviews should be done on this code before passing untrusted compressed +files to it. +.P +Compressed data is more sensitive to data corruption than plain data. +Note that the checksums in the xz file format do NOT allow to correct +for errors, because next bytes depends on previous ones. Checksums +just allow a rather reliable detection of data corruption. +.P +Unlike ddr_lzo, no work has been invested to cleanly deal with holes +(sparse files) or to (partially) recover from corrputed compressed data. +liblzma may recover in some cases, but don't count on it. +.P +When using multithreading, you may hit bugs. Missing function symbols +on decoder initialization, memlimit for the decoder always set to 1 byte +might be issues you hit (depends on the system which you use). +Test the mt option before relying on it. +. +.SH EXAMPLES +.TP +.BI dd_rescue\ -L\ lzma=z:preset=9\ infile\ outfile +compresses data from +.IR infile +into +.IR outfile +with compression preset == 9. +.TP +.BI dd_rescue\ -L\ lzma=d:mt:memlimit=1234\ infile\ infile2 +will decompress +.IR infile +to +.IR infile2 +in multithreding mode with memory limit equal to 1234 Megabytes. +.TP +.BI dd_rescue\ -L\ lzma\ infile.xz\ outfile +will decompress infile.xz into outfile. +. +.SH SEE ALSO +.BR dd_rescue (1) +.BR liblzma\ documentation +. +.SH AUTHOR +Dmitrii Ivanov <[email protected]> +. +.SH CREDITS +The liblzma library and algorithm has been written by +The Tukaani Project +.br +https://xz.tukaani.org/xz-utils/ +.br +. +.SH COPYRIGHT +This plugin is under the same license as dd_rescue: The GNU General +Public License (GPL) v2 or v3 - at your option. +. +.SH HISTORY +ddr_lzma plugin was first introduced with dd_rescue 1.99 (Nov 2024). diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dd_rescue-1.99.16/ddr_lzo.1 new/dd_rescue-1.99.17/ddr_lzo.1 --- old/dd_rescue-1.99.16/ddr_lzo.1 2015-04-15 12:06:08.000000000 +0200 +++ new/dd_rescue-1.99.17/ddr_lzo.1 2024-11-02 16:23:06.880004216 +0100 @@ -82,6 +82,10 @@ decompression and ensures compatibility with lzop. For higher compression you might want to chose lzo1x_999, which is very slow but lzop compatible or lzo2a_999, which is twice as fast, but not compatible with lzop. +Note that it's better to use other compression algorithms (e.g. lzma with +a low preset) if you are interested in good compression, so there's rarely +a reason to change the default algo, as you can get marginal gains only in +exchange for signifiantly higher CPU and memory ocnsumption with LZO. . .SS Debugging The diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dd_rescue-1.99.16/libddr_hash.c new/dd_rescue-1.99.17/libddr_hash.c --- old/dd_rescue-1.99.16/libddr_hash.c 2024-08-22 19:41:01.000000000 +0200 +++ new/dd_rescue-1.99.17/libddr_hash.c 2024-11-02 15:23:02.502493906 +0100 @@ -107,10 +107,12 @@ res = strtod(ptr, &es); switch (*es) { + case 's': case 'b': res *= 512; break; case 'k': res *= 1024; break; case 'M': res *= 1024*1024; break; case 'G': res *= 1024*1024*1024; break; + case 'T': res *= 1024*1024*1024*1024ULL; break; case ' ': case '\0': break; default: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dd_rescue-1.99.16/libddr_lzma.c new/dd_rescue-1.99.17/libddr_lzma.c --- old/dd_rescue-1.99.16/libddr_lzma.c 1970-01-01 01:00:00.000000000 +0100 +++ new/dd_rescue-1.99.17/libddr_lzma.c 2024-11-02 15:25:22.973822533 +0100 @@ -0,0 +1,360 @@ +/* libddr_lzma.c + * + * plugin for dd_rescue, doing compression and decompression for xz archives. + * + * (c) Dmitrii Ivanov <[email protected]>, 2023 + * License: GNU GPLv2 or v3 + */ +#include "ddr_plugin.h" +#include "ddr_ctrl.h" +#include <sys/stat.h> +#include <signal.h> +#include <errno.h> +#include <string.h> +#include <stdio.h> +#include <stdlib.h> +#include <stdbool.h> +#include <time.h> +#ifdef HAVE_LZMA_H // Avoid breaking on dependency generation +#include <lzma.h> +#endif + +#define CHUNK_SIZE 32768 + +/* fwd decl */ +extern ddr_plugin_t ddr_plug; + +enum compmode { + AUTO=0, + TEST, + COMPRESS, + DECOMPRESS +}; + +typedef struct _lzma_state { + enum compmode mode; + lzma_check type; + uint32_t preset; + uint64_t memlimit; + uint64_t max_memlimit; + unsigned char *output; + size_t buf_len; + lzma_stream strm; + uint32_t mt; + bool do_bench; + clock_t cpu; +} lzma_state; + +#define FPLOG(lvl, fmt, args...) \ + plug_log(ddr_plug.logger, stderr, lvl, fmt, ##args) + +const char* lzma_help = "LZMA plugin which is doing compression/decompression for xz archives.\n" + " Parameters:\n" + " z|compr[ess] - compress input file;\n" + " d|decom[press] - decompress input file;\n" + " test - check archive integrity;\n" + " check=CRC32/CRC64/SHA256/NONE - select checksum to calculate on compression, CRC32 by default;\n" + " preset=0...9 - compression preset, default is 5;\n" + " memlimit=N - memory limit for decompression (integer, suffices supported);\n" + " bench - measure and output CPU time spent on (de)compression.\n"; + +static loff_t readint(const char* const ptr) +{ + char *es; double res; + + res = strtod(ptr, &es); + switch (*es) { + case 's': + case 'b': res *= 512; break; + case 'k': res *= 1024; break; + case 'M': res *= 1024*1024; break; + case 'G': res *= 1024*1024*1024; break; + case 'T': res *= 1024*1024*1024*1024ULL; break; + case ' ': + case '\0': break; + default: + FPLOG(WARN, "suffix %c ignored!\n", *es); + } + return (loff_t)res; +} + +lzma_ret init_lzma_stream(lzma_state* state) +{ + if (!lzma_check_is_supported(state->type)) { + FPLOG(FATAL, "This type of integrity check is not supported by liblzma yet!\n"); + return LZMA_UNSUPPORTED_CHECK; + } +#if LZMA_VERSION_MAJOR > 5 || (LZMA_VERSION == 5 && LZMA_VERSION_MAJOR >= 2) + if (state->mt == -1) + state->mt = lzma_cputhreads(); +#else + state->mt = 0; +#endif + + if (state->mode == COMPRESS) { +#if LZMA_VERSION_MAJOR > 5 || (LZMA_VERSION == 5 && LZMA_VERSION_MAJOR >= 2) + if (state->mt) { + lzma_mt options = { + .threads=state->mt, + .block_size=0, + .timeout=0, + .preset=state->preset, + .filters=NULL, + .check=state->type + }; + return lzma_stream_encoder_mt(&(state->strm), &options); + } +#endif + return lzma_easy_encoder(&(state->strm), state->preset, state->type); + } + + uint32_t flags = LZMA_CONCATENATED | LZMA_TELL_UNSUPPORTED_CHECK; + // Multithreaded decompression starts with 5.4.0 (ignore 5.3.3 here) +#if LZMA_VERSION_MAJOR > 5 || (LZMA_VERSION == 5 && LZMA_VERSION_MAJOR >= 4) + if (state->mt) { + lzma_mt options = { + .flags=flags, + .threads=state->mt, + .timeout=0, + .filters=NULL, + .memlimit_threading=state->max_memlimit / 4 + }; + return lzma_stream_decoder_mt(&(state->strm), &options); + } +#endif + return lzma_auto_decoder(&(state->strm), state->max_memlimit / 4, flags); +} + +int lzma_plug_init(void **stat, char* param, int seq, const opt_t *opt) +{ + lzma_state *state = (lzma_state *)malloc(sizeof(lzma_state)); + if (!state) { + FPLOG(FATAL, "allocation of %zd bytes failed: %s\n", sizeof(lzma_state), strerror(errno)); + return -1; + } + *stat = (void *)state; + memset(state, 0, sizeof(lzma_state)); + + lzma_stream strm = LZMA_STREAM_INIT; + state->type = LZMA_CHECK_CRC32; + state->preset = 5; + state->strm = strm; + //state->mt = 0; + state->max_memlimit = lzma_physmem()*15/16; + state->max_memlimit -= state->max_memlimit%65536; + + while (param) { + char* next = strchr(param, ':'); + if (next) + *next++ = 0; + + size_t length = strlen(param); + if (!strcmp(param, "help")) { + FPLOG(INFO, "%s", lzma_help); + } else if (!strcmp(param, "z") || (length >= 5 && !memcmp(param, "compr", 5))) { + state->mode = COMPRESS; + } else if (!strcmp(param, "d") || (length >= 5 && !memcmp(param, "decom", 5))) { + state->mode = DECOMPRESS; + } else if (!strcmp(param, "mt")) { + state->mt = -1; + } else if (length > 3 && !memcmp(param, "mt=", 3)) { + char *eptr; state->mt = strtol(param+3, &eptr, 10); + } else if (!strcmp(param, "bench")) { + state->do_bench = true; + } else if (!strcmp(param, "test") || !strcmp(param, "t")) { + state->mode = TEST; + } else if (length >= 9 && !memcmp(param, "memlimit=", 9)) { + state->memlimit = readint(param+9); + + if (state->memlimit < 1024*1024 || state->memlimit > state->max_memlimit) { + FPLOG(FATAL, "Unreasonable memlimit param value: %zd MiB (use value b/w 1 and %zd MiB)\n", + state->memlimit/(1024*1024), state->max_memlimit/(1024*1024)); + return -1; + } + + } else if ((length == 8 || length == 9) && !memcmp(param, "preset=", 7)){ + state->preset = param[7] - '0'; + if (state->preset < 0 || state->preset > 9 || (length > 8 && param[8] != 'e')) { + FPLOG(FATAL, "plugin doesn't understand encoding preset %s\n", param+7); + return -1; + } + if (length == 9 && param[8] == 'e') + state->preset |= LZMA_PRESET_EXTREME; + + } else if (length > 6 && !memcmp(param, "check=", 6)) { + if (!strcmp(param + 6, "CRC32")) { + state->type = LZMA_CHECK_CRC32; + } else if (!strcmp(param + 6, "CRC64")) { + state->type = LZMA_CHECK_CRC64; + } else if (!strcmp(param + 6, "SHA256")) { + state->type = LZMA_CHECK_SHA256; + } else if (!strcmp(param + 6, "NONE")) { + state->type = LZMA_CHECK_NONE; + } else { + FPLOG(FATAL, "plugin doesn't understand integrity check type!\n"); + return -1; + } + } else { + FPLOG(FATAL, "plugin doesn't understand param %s\n", param); + return -1; + } + param = next; + } + return 0; +} + +int lzma_plug_release(void **stat) +{ + if (!stat || !*stat) + return -1; + + lzma_state *state = (lzma_state *)*stat; + if (state->output) + free(state->output); + + free(*stat); + return 0; +} + +int lzma_open(const opt_t *opt, int ilnchg, int olnchg, int ichg, int ochg, + unsigned int totslack_pre, unsigned int totslack_post, + const fstate_t *fst, void **stat) +{ + lzma_state *state = (lzma_state*)*stat; + + if (state->mode == TEST && strcmp(opt->iname + strlen(opt->iname) - 2, "xz") != 0) { + FPLOG(FATAL, "integrity check can be provided only for xz archives!\n"); + return -1; + } + + if (state->mode == AUTO) { + if (!strcmp(opt->iname + strlen(opt->iname) - 2, "xz")) + state->mode = DECOMPRESS; + else if (!strcmp(opt->iname + strlen(opt->iname) - 4, "lzma")) + state->mode = DECOMPRESS; + else if (!strcmp(opt->oname + strlen(opt->oname) - 2, "xz")) + state->mode = COMPRESS; + else if (!strcmp(opt->oname + strlen(opt->oname) - 4, "lzma")) + state->mode = COMPRESS; + else { + FPLOG(FATAL, "can't determine compression/decompression from filenames (and not set)!\n"); + return -1; + } + } + + if (init_lzma_stream(state) != LZMA_OK) { + FPLOG(FATAL, "failed to initialize lzma library!"); + return -1; + } + + lzma_memlimit_set(&(state->strm), + !state->memlimit ? state->max_memlimit / 4 : state->memlimit); + + return 0; +} + +#ifndef MIN +# define MIN(a,b) ((a)<(b)? (a): (b)) +#endif + +unsigned char* lzma_algo(unsigned char *bf, lzma_state *state, int eof, fstate_t *fst, int *towr) +{ + uint8_t output_bf[CHUNK_SIZE + 1]; + state->buf_len = state->buf_len ? state->buf_len : CHUNK_SIZE * 2; + if (state->output == NULL) + state->output = (unsigned char *)malloc(state->buf_len); + + size_t curr_pos = 0; + if (state->output) { + state->strm.next_in = bf; + state->strm.avail_in = *towr; + + lzma_action action = eof ? LZMA_FINISH : LZMA_RUN; + + int ret_xz = 0; + do { + state->strm.next_out = output_bf; + state->strm.avail_out = CHUNK_SIZE; + + ret_xz = lzma_code(&(state->strm), action); + + if (ret_xz != LZMA_OK && ret_xz != LZMA_STREAM_END && ret_xz != LZMA_MEMLIMIT_ERROR) { + FPLOG(FATAL, "(de)compression failed with code: %d\n", ret_xz); + raise(SIGQUIT); + break; + } else if (ret_xz == LZMA_MEMLIMIT_ERROR) { + uint64_t curr_memlimit = lzma_memlimit_get(&(state->strm)); + + if (!state->memlimit && curr_memlimit < state->max_memlimit) { + lzma_memlimit_set(&(state->strm), MIN(state->max_memlimit, 2*curr_memlimit)); + } else { + FPLOG(FATAL, "lzma plugin exceeded memory limit!\n"); + raise(SIGQUIT); + break; + } + } else { + if (state->buf_len - CHUNK_SIZE - 1 < curr_pos) { + state->buf_len *= 2; + state->output = (unsigned char *)realloc(state->output, state->buf_len); + + if (!state->output) { + FPLOG(FATAL, "failed to realloc %zd bytes for output buffer!\n", state->buf_len); + raise(SIGQUIT); + break; + } + } + + memcpy(state->output + curr_pos, output_bf, CHUNK_SIZE); + curr_pos += CHUNK_SIZE - state->strm.avail_out; + } + } while (state->strm.avail_out != CHUNK_SIZE && ret_xz != LZMA_STREAM_END); + } else { + FPLOG(FATAL, "failed to alloc %zd bytes for output buffer!\n", state->buf_len); + //*towr = 0; + raise(SIGQUIT); + } + + if (state->mode == TEST) + *towr = 0; + else + *towr = curr_pos; + return state->output; +} + +unsigned char* lzma_blk_cb(fstate_t *fst, unsigned char* bf, + int *towr, int eof, int *recall, void **stat) +{ + lzma_state *state = (lzma_state*)*stat; + + unsigned char* ptr = 0; /* Silence gcc */ + clock_t t1 = 0; + if (state->do_bench) + t1 = clock(); + + ptr = lzma_algo(bf, state, eof, fst, towr); + + if (state->do_bench) + state->cpu += clock() - t1; + + return ptr; +} + +int lzma_close(loff_t ooff, void **stat) +{ + lzma_state *state = (lzma_state *)*stat; + if (state->do_bench && state->cpu / (CLOCKS_PER_SEC / 100) > 0) + FPLOG(INFO, "%.2fs CPU time\n", (double)state->cpu / CLOCKS_PER_SEC); + + lzma_end(&(state->strm)); + return 0; +} + +ddr_plugin_t ddr_plug = { + .name = "lzma", + .handles_sparse = 0, + .init_callback = lzma_plug_init, + .open_callback = lzma_open, + .block_callback = lzma_blk_cb, + .close_callback = lzma_close, + .release_callback = lzma_plug_release, +}; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dd_rescue-1.99.16/libddr_lzo.c new/dd_rescue-1.99.17/libddr_lzo.c --- old/dd_rescue-1.99.16/libddr_lzo.c 2024-08-22 19:41:01.000000000 +0200 +++ new/dd_rescue-1.99.17/libddr_lzo.c 2024-11-02 16:23:06.884004311 +0100 @@ -27,7 +27,7 @@ #include <netinet/in.h> #include <sys/stat.h> #include <signal.h> -#ifdef HAVE_LZO_LZO1X_H +#ifdef HAVE_LZO_LZO1X_H // avoid breaking on dependency generation #include <lzo/lzo1x.h> #include <lzo/lzo1y.h> #include <lzo/lzo1f.h> @@ -409,13 +409,15 @@ char* next = strchr(param, ':'); if (next) *next++ = 0; + size_t length = strlen(param); + if (!strcmp(param, "help")) FPLOG(INFO, "%s", lzo_help); - else if (!memcmp(param, "compr", 5)) + else if (length >= 5 && !memcmp(param, "compr", 5)) state->mode = COMPRESS; - else if (!memcmp(param, "decom", 5)) + else if (length >= 5 && !memcmp(param, "decom", 5)) state->mode = DECOMPRESS; - else if (!memcmp(param, "bench", 5)) + else if (length >= 5 && !memcmp(param, "bench", 5)) state->do_bench = 1; else if (!strcmp(param, "search")) state->do_search = 1; @@ -423,17 +425,17 @@ state->debug = 1; else if (!strcmp(param, "crc32")) state->flags = (state->flags | F_H_CRC32 | F_CRC32_C | F_CRC32_D) & ~(F_ADLER32_C | F_ADLER32_D); - else if (!memcmp(param, "opt", 3)) + else if (length >= 3 && !memcmp(param, "opt", 3)) state->do_opt = 1; - else if (!memcmp(param, "nodisc", 6)) + else if (length >= 6 && !memcmp(param, "nodisc", 6)) state->nodiscard = 1; - else if (!memcmp(param, "algo=", 5)) + else if (length >= 5 && !memcmp(param, "algo=", 5)) err += choose_alg(param+5, state); - else if (!memcmp(param, "alg=", 4)) + else if (length >= 4 && !memcmp(param, "alg=", 4)) err += choose_alg(param+4, state); - else if (!memcmp(param, "algorithm=", 10)) + else if (length >= 10 && !memcmp(param, "algorithm=", 10)) err += choose_alg(param+10, state); - else if (!memcmp(param, "flags=", 6)) { + else if (length >= 6 && !memcmp(param, "flags=", 6)) { state->flags = strtol(param+6, NULL, 0); /* TODO Sanity check for flags ... */ //FPLOG(INFO, "Flags: %08x\n", state->flags); @@ -1383,8 +1385,8 @@ state->nr_realloc, state->dbuflen/1024, state->nr_memmove, state->nr_cheapmemmove); } - /* Only output if it took us more than 0.05s, otherwise it's completely meaningless */ - if (state->do_bench && state->cpu/(CLOCKS_PER_SEC/20) > 0) + /* Only output if it took us more than 0.01s, otherwise it's completely meaningless */ + if (state->do_bench && state->cpu/(CLOCKS_PER_SEC/100) > 0) FPLOG(INFO, "%.2fs CPU time, %.1fMiB/s\n", (double)state->cpu/CLOCKS_PER_SEC, state->unc_ln/1024 / (state->cpu/(CLOCKS_PER_SEC/1024.0))); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dd_rescue-1.99.16/sha256.c new/dd_rescue-1.99.17/sha256.c --- old/dd_rescue-1.99.16/sha256.c 2024-09-29 22:27:21.000000000 +0200 +++ new/dd_rescue-1.99.17/sha256.c 2024-09-30 10:51:04.859353481 +0200 @@ -173,9 +173,19 @@ void __sha256_64_sha(const uint8_t* data, hash_t* ctx); #endif -#ifdef __ARM_FEATURE_CRYPTO +#if defined(__arm__) || defined(__aarch64__) +//#ifdef __ARM_FEATURE_CRYPTO +#if defined(HAVE_AES_ARM64) && (defined(__clang__) || (defined(__GNUC__) && __GNUC__ >= 5)) +#ifdef GEN_DEP +// Avoid preprocessor errors when generating dependencies +#define __ARM_FP __ARM_SOFTFP +#define __ARM_NEON 1 +#define __ARM_NEON__ 1 +#endif #include <arm_neon.h> +#ifdef HAVE_ARM_ACLE_H #include <arm_acle.h> +#endif /* Code copied and slightly adapted from https://github.com/noloader/SHA-Intrinsics */ static inline void __sha256_64_sha(const uint8_t* data, hash_t* ctx) @@ -338,6 +348,9 @@ vst1q_u32(&ctx->sha256_h[4], STATE1); } #define have_sha have_arm8sha +#else +#warning Compiling ARM without sha support +#endif #endif #ifdef have_sha
