Hello community, here is the log from the commit of package dd_rescue for openSUSE:Factory checked in at 2017-09-13 21:33:57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/dd_rescue (Old) and /work/SRC/openSUSE:Factory/.dd_rescue.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "dd_rescue" Wed Sep 13 21:33:57 2017 rev:35 rq:523255 version:1.99.6 Changes: -------- --- /work/SRC/openSUSE:Factory/dd_rescue/dd_rescue.changes 2017-08-17 11:49:26.880618912 +0200 +++ /work/SRC/openSUSE:Factory/.dd_rescue.new/dd_rescue.changes 2017-09-13 21:34:01.858993699 +0200 @@ -1,0 +2,13 @@ +Mon Sep 4 23:25:28 CEST 2017 - k...@garloff.de + +- libddr_hash-round-down-static.diff: Mark inline function static. + +------------------------------------------------------------------- +Fri Aug 25 15:19:24 CEST 2017 - k...@garloff.de + +- Update to dd_rescue-1.99.6: + * Merge previous SSE2 detection patch from Michael Matz. + * Support calculating and validating checksums in the S3 + multipart format. + +------------------------------------------------------------------- Old: ---- dd_rescue-1.99.5.tar.bz2 dd_rescue-1.99.5.tar.bz2.asc dd_rescue-i586-sse2.diff New: ---- dd_rescue-1.99.6.tar.bz2 dd_rescue-1.99.6.tar.bz2.asc libddr_hash-round-down-static.diff ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ dd_rescue.spec ++++++ --- /var/tmp/diff_new_pack.52iTHK/_old 2017-09-13 21:34:02.550896350 +0200 +++ /var/tmp/diff_new_pack.52iTHK/_new 2017-09-13 21:34:02.554895788 +0200 @@ -17,7 +17,7 @@ Name: dd_rescue -Version: 1.99.5 +Version: 1.99.6 Release: 0 Summary: Data copying in the presence of I/O Errors License: GPL-2.0 or GPL-3.0 @@ -27,7 +27,7 @@ Source1: http://garloff.de/kurt/linux/ddrescue/%{name}-%{version}.tar.bz2.asc Source2: %{name}.keyring Source99: %{name}.changes -Patch0: dd_rescue-i586-sse2.diff +Patch1: libddr_hash-round-down-static.diff BuildRequires: autoconf BuildRequires: libattr-devel BuildRequires: libfallocate-devel @@ -113,7 +113,7 @@ %prep %setup -q -%patch0 +%patch1 -p0 # Remove build time references so build-compare can do its work FAKE_BUILDTIME=$(LC_ALL=C date -u -r %{SOURCE99} '+%%H:%%M') ++++++ dd_rescue-1.99.5.tar.bz2 -> dd_rescue-1.99.6.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dd_rescue-1.99.5/Make-Android new/dd_rescue-1.99.6/Make-Android --- old/dd_rescue-1.99.5/Make-Android 2016-01-03 00:51:39.971852898 +0100 +++ new/dd_rescue-1.99.6/Make-Android 2017-08-25 12:24:46.175489934 +0200 @@ -5,7 +5,7 @@ { mkdir -p $2 make clean - make -f $1 config; make -f $1 all -j4 + make -f $1 config && make -f $1 all -j4 || exit for name in $FILES; do mv $name $2/; done } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dd_rescue-1.99.5/Makefile new/dd_rescue-1.99.6/Makefile --- old/dd_rescue-1.99.5/Makefile 2016-12-29 16:43:18.242332645 +0100 +++ new/dd_rescue-1.99.6/Makefile 2017-08-25 12:45:44.096453332 +0200 @@ -2,9 +2,10 @@ # (c) garl...@suse.de, 99/10/09, GNU GPL # (c) k...@garloff.de, 2010 -- 2015, GNU GPL v2 or v3 -VERSION = 1.99.5 +VERSION = 1.99.6 DESTDIR = +SRCDIR = . CC = gcc RPM_OPT_FLAGS = -Os -Wall -g -D_FORTIFY_SOURCE=2 @@ -25,8 +26,8 @@ #TARGETS = libfalloc-dl OTHTARGETS = find_nonzero fiemap file_zblock fmt_no md5 sha256 sha512 sha224 sha384 sha1 test_aes OBJECTS = random.o frandom.o fmt_no.o find_nonzero.o -FNZ_HEADERS = find_nonzero.h archdep.h ffs.h -DDR_HEADERS = config.h random.h frandom.h list.h fmt_no.h find_nonzero.h archdep.h ffs.h fstrim.h ddr_plugin.h ddr_ctrl.h splice.h fallocate64.h pread64.h +FNZ_HEADERS = $(SRCDIR)/find_nonzero.h $(SRCDIR)/archdep.h $(SRCDIR)/ffs.h +DDR_HEADERS = config.h $(SRCDIR)/random.h $(SRCDIR)/frandom.h $(SRCDIR)/list.h $(SRCDIR)/fmt_no.h $(SRCDIR)/find_nonzero.h $(SRCDIR)/archdep.h $(SRCDIR)/ffs.h $(SRCDIR)/fstrim.h $(SRCDIR)/ddr_plugin.h $(SRCDIR)/ddr_ctrl.h $(SRCDIR)/splice.h $(SRCDIR)/fallocate64.h $(SRCDIR)/pread64.h DOCDIR = $(prefix)/share/doc/packages INSTASROOT = -o root -g root LIB = lib @@ -39,6 +40,7 @@ PIE = -fPIE LDPIE = -pie RDYNAMIC = -rdynamic +MAKE := $(MAKE) -f $(SRCDIR)/Makefile LZOP = $(shell type -p lzop || type -P true) HAVE_SHA256SUM = $(shell type -p sha256sum >/dev/null && echo 1 || echo 0) @@ -167,23 +169,29 @@ all: $(TARGETS) $(OTHTARGETS) -config.h: configure config.h.in - ./configure +#Makefile: +# test -e Makefile || ln -s $(SRCDIR)/Makefile . -configure: configure.in - autoconf +config.h: $(SRCDIR)/configure $(SRCDIR)/config.h.in + $(SRCDIR)/configure + test -e test_crypt.sh || ln -s $(SRCDIR)/test_crypt.sh . + test -e test_lzo_fuzz.sh || ln -s $(SRCDIR)/test_lzo_fuzz.sh . + test -e calchmac.py || ln -s $(SRCDIR)/calchmac.py . -config.h.in: configure.in - autoheader +$(SRCDIR)/configure: $(SRCDIR)/configure.in + cd $(SRCDIR) && autoconf + +$(SRCDIR)/config.h.in: $(SRCDIR)/configure.in + cd $(SRCDIR) && autoheader # The headers for x86 intrinsics cause breakage while preprocessing # for dependency generation :-( Workaround ... DEP_SSE = -D__AES__ -D__SSE4_1__ -D__SSSE3__ -D__SSE3__ -D__SSE2__ -D__SSE__ -D__MMX__ # Automated dependency generation -.dep: Makefile config.h *.h *.c - #$(CC) $(CFLAGS) -DGEN_DEP $(ARCHFLAGS) -MM *.c >.dep - $(CC) $(CFLAGS) -DGEN_DEP $(DEP_SSE) -MM *.c >.dep +.dep: $(SRCDIR)/Makefile config.h $(SRCDIR)/*.h $(SRCDIR)/*.c + #$(CC) $(CFLAGS) -DGEN_DEP $(ARCHFLAGS) -MM $(SRCDIR)/*.c >.dep + $(CC) $(CFLAGS) -DGEN_DEP $(DEP_SSE) -MM $(SRCDIR)/*.c >.dep sed 's/\.o:/\.po:/' <.dep >.dep2 cat .dep2 >> .dep rm .dep2 @@ -195,36 +203,36 @@ make .dep # These need optimization -frandom.o: +frandom.o: $(SRCDIR)/frandom.c config.h $(CC) $(CFLAGS_OPT) $(PIE) -c $< -fmt_no.o: +fmt_no.o: $(SRCDIR)/fmt_no.c $(CC) $(CFLAGS_OPT) $(PIE) -c $< -md5.po: +md5.po: $(SRCDIR)/md5.c $(CC) $(CFLAGS_OPT) $(PIC) -o $@ -c $< -sha256.po: +sha256.po: $(SRCDIR)/sha256.c $(CC) $(CFLAGS_OPT) $(PIC) -o $@ -c $< -sha512.po: +sha512.po: $(SRCDIR)/sha512.c $(CC) $(CFLAGS_OPT) $(PIC) -o $@ -c $< -sha1.po: +sha1.po: $(SRCDIR)/sha1.c $(CC) $(CFLAGS_OPT) $(PIC) -o $@ -c $< # Default rules -%.o: +%.o: $(SRCDIR)/%.c config.h $(CC) $(CFLAGS) $(DEFINES) $(PIE) -c $< -%.po: +%.po: $(SRCDIR)/%.c config.h $(CC) $(CFLAGS) $(DEFINES) $(PIC) -o $@ -c $< -%.s: +%.s: $(SRCDIR)/%.c config.h $(CC) $(CFLAGS) $(DEFINES) $(PIE) -S $< # Use stack protector for libddr_lzo ... -libddr_lzo.po: +libddr_lzo.po: $(SRCDIR)/libddr_lzo.c config.h $(CC) $(CFLAGS) $(PIC) -fstack-protector -o $@ -c $< # The plugins @@ -244,79 +252,79 @@ $(CC) -shared -o $@ $^ $(CRYPTOLIB) $(EXTRA_LDFLAGS) # More special compiler flags -find_nonzero.o: +find_nonzero.o: $(SRCDIR)/find_nonzero.c $(CC) $(CFLAGS_OPT) $(PIE) -c $< $(SSE) -find_nonzero_avx.o: +find_nonzero_avx.o: $(SRCDIR)/find_nonzero_avx.c $(CC) $(CFLAGS_OPT) $(PIE) -mavx2 -c $< -find_nonzero_sse2.o: +find_nonzero_sse2.o: $(SRCDIR)/find_nonzero_sse2.c $(CC) $(CFLAGS_OPT) $(PIE) -msse2 -c $< -find_nonzero_arm.o: +find_nonzero_arm.o: $(SRCDIR)/find_nonzero_arm.c $(CC) $(CFLAGS_OPT) $(PIE) -c $< -find_nonzero_arm.po: +find_nonzero_arm.po: $(SRCDIR)/find_nonzero_arm.c $(CC) $(CFLAGS_OPT) $(PIC) -o $@ -c $< -find_nonzero_arm64.o: +find_nonzero_arm64.o: $(SRCDIR)/find_nonzero_arm64.c $(CC) $(CFLAGS_OPT) -march=armv8-a+crypto $(PIE) -c $< -find_nonzero_arm64.po: +find_nonzero_arm64.po: $(SRCDIR)/find_nonzero_arm64.c $(CC) $(CFLAGS_OPT) -march=armv8-a+crypto $(PIC) -o $@ -c $< -find_nonzero_main.o: find_nonzero.c config.h $(FNZ_HEADERS) +find_nonzero_main.o: $(SRCDIR)/find_nonzero.c config.h $(FNZ_HEADERS) $(CC) $(CFLAGS_OPT) $(PIE) -o $@ -c $< -DTEST -ffs_sse42.o: +ffs_sse42.o: $(SRCDIR)/ffs_sse42.c $(CC) $(CFLAGS_OPT) $(PIE) -msse4.2 -c $< -ffs_sse42.po: +ffs_sse42.po: $(SRCDIR)/ffs_sse42.c $(CC) $(CFLAGS_OPT) $(PIC) -msse4.2 -o $@ -c $< ifeq ($(HAVE_RDRND),1) -rdrand.o: +rdrand.o: $(SRCDIR)/rdrand.c $(CC) $(CFLAGS) $(PIE) -mrdrnd -maes -c $< -rdrand.po: +rdrand.po: $(SRCDIR)/rdrand.c $(CC) $(CFLAGS) $(PIC) -mrdrnd -maes -o $@ -c $< else -rdrand.o: +rdrand.o: $(SRCDIR)/rdrand.c $(CC) $(CFLAGS) $(PIE) -maes -c $< -rdrand.po: +rdrand.po: $(SRCDIR)/rdrand.c $(CC) $(CFLAGS) $(PIC) -maes -o $@ -c $< endif # TODO: Build binaries from .o file, so we can save some special rules ... # Special dd_rescue variants -libfalloc: dd_rescue.c $(DDR_HEADERS) $(OBJECTS) $(OBJECTS2) +libfalloc: $(SRCDIR)/dd_rescue.c $(DDR_HEADERS) $(OBJECTS) $(OBJECTS2) $(CC) $(CFLAGS) $(PIE) $(LDPIE) -DNO_LIBDL $(DEFINES) $< $(OUT) $(OBJECTS) $(OBJECTS2) -lfallocate $(EXTRA_LDFLAGS) $(RDYNAMIC) -libfalloc-static: dd_rescue.c $(DDR_HEADERS) $(OBJECTS) $(OBJECTS2) +libfalloc-static: $(SRCDIR)/dd_rescue.c $(DDR_HEADERS) $(OBJECTS) $(OBJECTS2) $(CC) $(CFLAGS) $(PIE) $(LDPIE) -DNO_LIBDL $(DEFINES) $< $(OUT) $(OBJECTS) $(OBJECTS2) $(LIBDIR)/libfallocate.a $(EXTRA_LDFLAGS) $(RDYNAMIC) # This is the default built -dd_rescue: dd_rescue.c $(DDR_HEADERS) $(OBJECTS) $(OBJECTS2) +dd_rescue: $(SRCDIR)/dd_rescue.c $(DDR_HEADERS) $(OBJECTS) $(OBJECTS2) $(CC) $(CFLAGS) $(PIE) $(LDPIE) $(DEFINES) $< $(OUT) $(OBJECTS) $(OBJECTS2) -ldl $(EXTRA_LDFLAGS) $(RDYNAMIC) # Test programs -md5: md5.c md5.h hash.h config.h +md5: $(SRCDIR)/md5.c $(SRCDIR)/md5.h $(SRCDIR)/hash.h config.h $(CC) $(CFLAGS_OPT) $(PIE) $(LDPIE) -DMD5_MAIN -o $@ $< -sha256: sha256.c sha256.h hash.h config.h +sha256: $(SRCDIR)/sha256.c $(SRCDIR)/sha256.h $(SRCDIR)/hash.h config.h $(CC) $(CFLAGS_OPT) $(PIE) $(LDPIE) -DSHA256_MAIN -o $@ $< sha224: sha256 ln -sf sha256 sha224 -sha512: sha512.c sha512.h hash.h config.h +sha512: $(SRCDIR)/sha512.c $(SRCDIR)/sha512.h $(SRCDIR)/hash.h config.h $(CC) $(CFLAGS_OPT) $(PIE) $(LDPIE) -DSHA512_MAIN -o $@ $< sha384: sha512 ln -sf sha512 sha384 -sha1: sha1.c sha1.h hash.h config.h +sha1: $(SRCDIR)/sha1.c $(SRCDIR)/sha1.h $(SRCDIR)/hash.h config.h $(CC) $(CFLAGS_OPT) $(PIE) $(LDPIE) -DSHA1_MAIN -o $@ $< fuzz_lzo: fuzz_lzo.o @@ -325,13 +333,13 @@ # More dd_rescue variants libfalloc-dl: dd_rescue -nolib: dd_rescue.c $(DDR_HEADERS) $(OBJECTS) $(OBJECTS2) +nolib: $(SRCDIR)/dd_rescue.c $(DDR_HEADERS) $(OBJECTS) $(OBJECTS2) $(CC) $(CFLAGS) -DNO_LIBDL -DNO_LIBFALLOCATE $(DEFINES) $< $(OUT) $(OBJECTS) $(OBJECTS2) -nocolor: dd_rescue.c $(DDR_HEADERS) $(OBJECTS) $(OBJECTS2) +nocolor: $(SRCDIR)/dd_rescue.c $(DDR_HEADERS) $(OBJECTS) $(OBJECTS2) $(CC) $(CFLAGS) -DNO_COLORS=1 $(DEFINES) $< $(OUT) $(OBJECTS) $(OBJECTS2) $(EXTRA_LDFLAGS) $(RDYNAMIC) -static: dd_rescue.c $(DDR_HEADERS) $(OBJECTS) +static: $(SRCDIR)/dd_rescue.c $(DDR_HEADERS) $(OBJECTS) $(CC) $(CFLAGS) -DNO_LIBDL -DNO_LIBFALLOCATE -static $(DEFINES) $< $(OUT) $(OBJECTS) $(OBJECTS2) $(EXTRA_LDFLAGS) # Special pseudo targets @@ -348,48 +356,48 @@ find_nonzero: find_nonzero_main.o $(OBJECTS2) $(CC) $(CFLAGS_OPT) $(PIE) $(LDPIE) -o $@ $^ -fmt_no: fmt_no.c fmt_no.h +fmt_no: $(SRCDIR)/fmt_no.c $(SRCDIR)/fmt_no.h $(CC) $(CFLAGS) $(PIE) $(LDPIE) -o $@ $< -DTEST -file_zblock: file_zblock.c $(FNZ_HEADERS) config.h find_nonzero.o $(OBJECTS2) +file_zblock: $(SRCDIR)/file_zblock.c $(FNZ_HEADERS) config.h find_nonzero.o $(OBJECTS2) $(CC) $(CFLAGS) $(PIE) $(LDPIE) -o $@ $< find_nonzero.o $(OBJECTS2) -fiemap: fiemap.c fiemap.h fstrim.h config.h fstrim.o +fiemap: $(SRCDIR)/fiemap.c $(SRCDIR)/fiemap.h $(SRCDIR)/fstrim.h config.h fstrim.o $(CC) $(CFLAGS) $(PIE) $(LDPIE) -DTEST_FIEMAP -o $@ $< fstrim.o -pbkdf2: ossl_pbkdf2.c +pbkdf2: $(SRCDIR)/ossl_pbkdf2.c $(CC) $(CFLAGS) $(PIE) $(LDPIE) -o $@ $< $(CRYPTOLIB) -test_aes: test_aes.c $(AESNI_O) $(AES_ARM64_O) aes_c.o secmem.o sha256.o $(AES_OSSL_O) aes.o aesni.h aes_arm64.h config.h +test_aes: $(SRCDIR)/test_aes.c $(AESNI_O) $(AES_ARM64_O) aes_c.o secmem.o sha256.o $(AES_OSSL_O) aes.o $(SRCDIR)/aesni.h $(SRCDIR)/aes_arm64.h config.h $(CC) $(CFLAGS) $(PIE) $(LDPIE) $(DEF) -o $@ $< $(AESNI_O) $(AES_ARM64_O) aes_c.o secmem.o sha256.o $(AES_OSSL_O) aes.o $(CRYPTOLIB) # Special optimized versions -aesni.o: +aesni.o: $(SRCDIR)/aesni.c $(CC) $(CFLAGS) $(PIE) -O3 -maes -msse4.1 -c $< -aesni.po: +aesni.po: $(SRCDIR)/aesni.c $(CC) $(CFLAGS) $(PIC) -O3 -maes -msse4.1 -c $< -o $@ -aes_arm64.o: +aes_arm64.o: $(SRCDIR)/aes_arm64.c $(CC) $(CFLAGS) $(PIE) -O3 -march=armv8-a+crypto -c $< -aes_arm64.po: +aes_arm64.po: $(SRCDIR)/aes_arm64.c $(CC) $(CFLAGS) $(PIC) -O3 -march=armv8-a+crypto -c $< -o $@ -aes_arm32.o: +aes_arm32.o: $(SRCDIR)/aes_arm32.c $(CC) $(CFLAGS) $(PIE) -O3 -march=armv7-a -mfpu=crypto-neon-fp-armv8 -c $< -aes_arm32.po: +aes_arm32.po: $(SRCDIR)/aes_arm32.c $(CC) $(CFLAGS) $(PIC) -O3 -march=armv7-a -mfpu=crypto-neon-fp-armv8 -c $< -o $@ -aes_c.o: +aes_c.o: $(SRCDIR)/aes_c.c $(CC) $(CFLAGS) $(PIE) $(FULL_UNROLL) -O3 -c $< -aes_ossl.o: +aes_ossl.o: $(SRCDIR)/aes_ossl.c $(CC) $(CFLAGS) $(PIE) -O3 -c $< distclean: clean - rm -f *~ config.h config.h.in config.status config.log configure REL-ID + rm -f *~ config.h $(SRCDIR)/config.h.in config.status config.log $(SRCDIR)/configure REL-ID rm -rf autom4te.cache rm -f *.cmp *.lzo test rm -f dd_rescue-?.??.tar.bz2 @@ -496,10 +504,10 @@ echo "750c783e6ab0b503eaa86e310a5db738 *TEST" > HMACS.md5 $(VG) ./dd_rescue -L ./libddr_hash.so=md5:hmacpwd=Jefe:chknm= TEST /dev/null rm -f /tmp/dd_rescue CHECKSUMS.sha512 TEST HMACS.md5 - if ./calchmac.py sha1 pass dd_rescue; then make check_hmac; else echo "Sorry, no more HMAC test due to missing python-hashlib support"; true; fi - make check_fault - #make check_aes - make check_crypt + if ./calchmac.py sha1 pass dd_rescue; then $(MAKE) check_hmac; else echo "Sorry, no more HMAC test due to missing python-hashlib support"; true; fi + $(MAKE) check_fault + #$(MAKE) check_aes + $(MAKE) check_crypt # FIXME: This fails on filesystems without xattr support - disabled until we know how to handle this @@ -514,11 +522,11 @@ check_hmac: $(TARGETS) - FILES="*.c *.h *.po dd_rescue *.so"; \ + FILES="$(SRCDIR)/*.c $(SRCDIR)/*.h *.po dd_rescue *.so"; \ for alg in md5 sha1 sha256 sha384; do \ ./calchmac.py $$alg pass_$$alg $$FILES > HMACS.$$alg; \ done - for name in *.c *.h *.po dd_rescue *.so; do \ + for name in $(SRCDIR)/*.c $(SRCDIR)/*.h *.po dd_rescue *.so; do \ for alg in md5 sha1 sha256 sha384; do \ $(VG) ./dd_rescue -L ./libddr_hash.so=$$alg:hmacpwd=pass_$$alg:chknm= $$name /dev/null || exit 1; \ done \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dd_rescue-1.99.5/REL-ID new/dd_rescue-1.99.6/REL-ID --- old/dd_rescue-1.99.5/REL-ID 2016-12-29 17:54:05.726219070 +0100 +++ new/dd_rescue-1.99.6/REL-ID 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -DD_RESCUE_1_99_5 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dd_rescue-1.99.5/aes.c new/dd_rescue-1.99.6/aes.c --- old/dd_rescue-1.99.5/aes.c 2016-12-28 22:17:50.388765926 +0100 +++ new/dd_rescue-1.99.6/aes.c 2017-05-04 14:00:00.388996004 +0200 @@ -445,12 +445,15 @@ asm("":::"memory"); } -ciph_desc_t *findalg(ciph_desc_t* list, const char* nm) +ciph_desc_t *findalg(ciph_desc_t* list, const char* nm, const char probe) { ciph_desc_t* alg = list; while (alg->name) { - if (!strcmp(alg->name, nm)) - return alg; + if (!strcmp(alg->name, nm)) { + if (!probe || !alg->probe) + return alg; + return (alg->probe()? NULL: alg); + } alg += 1; } return NULL; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dd_rescue-1.99.5/aes.h new/dd_rescue-1.99.6/aes.h --- old/dd_rescue-1.99.5/aes.h 2015-08-27 14:28:45.684989062 +0200 +++ new/dd_rescue-1.99.6/aes.h 2017-05-04 13:34:10.303041101 +0200 @@ -61,6 +61,7 @@ const uchar* input, uchar* output, ssize_t len, ssize_t *olen); typedef void (Key_Release_fn)(uchar* rkeys, uint rounds); +typedef int (Probe_fn)(); typedef struct _ciph_desc { const char *name; @@ -72,6 +73,7 @@ Key_Setup_fn *enc_key_setup, *dec_key_setup; Crypt_IV_fn *encrypt, *decrypt; Key_Release_fn *release; + Probe_fn *probe; } ciph_desc_t; @@ -138,6 +140,6 @@ void fill_blk(const uchar *in, uchar bf[16], ssize_t len, uint pad); int dec_fix_olen_pad(ssize_t *olen, uint pad, const uchar *output); -ciph_desc_t *findalg(ciph_desc_t* list, const char* nm); +ciph_desc_t *findalg(ciph_desc_t* list, const char* nm, const char probe); #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dd_rescue-1.99.5/aesni.c new/dd_rescue-1.99.6/aesni.c --- old/dd_rescue-1.99.5/aesni.c 2016-01-03 00:15:39.652915749 +0100 +++ new/dd_rescue-1.99.6/aesni.c 2017-05-04 13:56:49.290001564 +0200 @@ -12,7 +12,12 @@ #include "secmem.h" #include <string.h> #include <wmmintrin.h> +#include "archdep.h" +static int probe_aes_ni() +{ + return !have_aesni; +} #ifdef DONTMASK #define MMCLEAR(xmmreg) xmmreg = _mm_setzero_si128() @@ -1307,87 +1312,87 @@ ciph_desc_t AESNI_Methods[] = {{"AES128-ECB" , 128, 10, 16, 11*16, &aes_stream_ecb, AESNI_128_EKey_Expansion_r, AESNI_128_DKey_Expansion_r, - AESNI_ECB_Encrypt, AESNI_ECB_Decrypt, AES_Gen_Release}, + AESNI_ECB_Encrypt, AESNI_ECB_Decrypt, AES_Gen_Release, probe_aes_ni}, {"AES128-CBC" , 128, 10, 16, 11*16, &aes_stream_cbc, AESNI_128_EKey_Expansion_r, AESNI_128_DKey_Expansion_r, - AESNI_CBC_Encrypt, AESNI_CBC_Decrypt, AES_Gen_Release}, + AESNI_CBC_Encrypt, AESNI_CBC_Decrypt, AES_Gen_Release, probe_aes_ni}, {"AES128-CTR" , 128, 10, 16, 11*16, &aesni_stream_ctr, AESNI_128_EKey_Expansion_r, AESNI_128_EKey_Expansion_r, - AESNI_CTR_Crypt, AESNI_CTR_Crypt, AES_Gen_Release}, + AESNI_CTR_Crypt, AESNI_CTR_Crypt, AES_Gen_Release, probe_aes_ni}, {"AES192-ECB" , 192, 12, 16, 13*16, &aes_stream_ecb, AESNI_192_EKey_Expansion_r, AESNI_192_DKey_Expansion_r, - AESNI_ECB_Encrypt, AESNI_ECB_Decrypt, AES_Gen_Release}, + AESNI_ECB_Encrypt, AESNI_ECB_Decrypt, AES_Gen_Release, probe_aes_ni}, {"AES192-CBC" , 192, 12, 16, 13*16, &aes_stream_cbc, AESNI_192_EKey_Expansion_r, AESNI_192_DKey_Expansion_r, - AESNI_CBC_Encrypt, AESNI_CBC_Decrypt, AES_Gen_Release}, + AESNI_CBC_Encrypt, AESNI_CBC_Decrypt, AES_Gen_Release, probe_aes_ni}, {"AES192-CTR" , 192, 12, 16, 13*16, &aesni_stream_ctr, AESNI_192_EKey_Expansion_r, AESNI_192_EKey_Expansion_r, - AESNI_CTR_Crypt, AESNI_CTR_Crypt, AES_Gen_Release}, + AESNI_CTR_Crypt, AESNI_CTR_Crypt, AES_Gen_Release, probe_aes_ni}, {"AES256-ECB" , 256, 14, 16, 15*16, &aes_stream_ecb, AESNI_256_EKey_Expansion_r, AESNI_256_DKey_Expansion_r, - AESNI_ECB_Encrypt, AESNI_ECB_Decrypt, AES_Gen_Release}, + AESNI_ECB_Encrypt, AESNI_ECB_Decrypt, AES_Gen_Release, probe_aes_ni}, {"AES256-CBC" , 256, 14, 16, 15*16, &aes_stream_cbc, AESNI_256_EKey_Expansion_r, AESNI_256_DKey_Expansion_r, - AESNI_CBC_Encrypt, AESNI_CBC_Decrypt, AES_Gen_Release}, + AESNI_CBC_Encrypt, AESNI_CBC_Decrypt, AES_Gen_Release, probe_aes_ni}, {"AES256-CTR" , 256, 14, 16, 15*16, &aesni_stream_ctr, AESNI_256_EKey_Expansion_r, AESNI_256_EKey_Expansion_r, - AESNI_CTR_Crypt, AESNI_CTR_Crypt, AES_Gen_Release}, + AESNI_CTR_Crypt, AESNI_CTR_Crypt, AES_Gen_Release, probe_aes_ni}, /* plus methods */ {"AES128+-ECB" , 128, 12, 16, 13*16, &aes_stream_ecb, AESNI_128_EKey_Expansion_r, AESNI_128_DKey_Expansion_r, - AESNI_ECB_Encrypt, AESNI_ECB_Decrypt, AES_Gen_Release}, + AESNI_ECB_Encrypt, AESNI_ECB_Decrypt, AES_Gen_Release, probe_aes_ni}, {"AES128+-CBC" , 128, 12, 16, 13*16, &aes_stream_cbc, AESNI_128_EKey_Expansion_r, AESNI_128_DKey_Expansion_r, - AESNI_CBC_Encrypt, AESNI_CBC_Decrypt, AES_Gen_Release}, + AESNI_CBC_Encrypt, AESNI_CBC_Decrypt, AES_Gen_Release, probe_aes_ni}, {"AES128+-CTR" , 128, 12, 16, 13*16, &aesni_stream_ctr, AESNI_128_EKey_Expansion_r, AESNI_128_EKey_Expansion_r, - AESNI_CTR_Crypt, AESNI_CTR_Crypt, AES_Gen_Release}, + AESNI_CTR_Crypt, AESNI_CTR_Crypt, AES_Gen_Release, probe_aes_ni}, {"AES192+-ECB" , 192, 15, 16, 16*16, &aes_stream_ecb, AESNI_192_EKey_Expansion_r, AESNI_192_DKey_Expansion_r, - AESNI_ECB_Encrypt, AESNI_ECB_Decrypt, AES_Gen_Release}, + AESNI_ECB_Encrypt, AESNI_ECB_Decrypt, AES_Gen_Release, probe_aes_ni}, {"AES192+-CBC" , 192, 15, 16, 16*16, &aes_stream_cbc, AESNI_192_EKey_Expansion_r, AESNI_192_DKey_Expansion_r, - AESNI_CBC_Encrypt, AESNI_CBC_Decrypt, AES_Gen_Release}, + AESNI_CBC_Encrypt, AESNI_CBC_Decrypt, AES_Gen_Release, probe_aes_ni}, {"AES192+-CTR" , 192, 15, 16, 16*16, &aesni_stream_ctr, AESNI_192_EKey_Expansion_r, AESNI_192_EKey_Expansion_r, - AESNI_CTR_Crypt, AESNI_CTR_Crypt, AES_Gen_Release}, + AESNI_CTR_Crypt, AESNI_CTR_Crypt, AES_Gen_Release, probe_aes_ni}, {"AES256+-ECB" , 256, 18, 16, 19*16, &aes_stream_ecb, AESNI_256_EKey_Expansion_r, AESNI_256_DKey_Expansion_r, - AESNI_ECB_Encrypt, AESNI_ECB_Decrypt, AES_Gen_Release}, + AESNI_ECB_Encrypt, AESNI_ECB_Decrypt, AES_Gen_Release, probe_aes_ni}, {"AES256+-CBC" , 256, 18, 16, 19*16, &aes_stream_cbc, AESNI_256_EKey_Expansion_r, AESNI_256_DKey_Expansion_r, - AESNI_CBC_Encrypt, AESNI_CBC_Decrypt, AES_Gen_Release}, + AESNI_CBC_Encrypt, AESNI_CBC_Decrypt, AES_Gen_Release, probe_aes_ni}, {"AES256+-CTR" , 256, 18, 16, 19*16, &aesni_stream_ctr, AESNI_256_EKey_Expansion_r, AESNI_256_EKey_Expansion_r, - AESNI_CTR_Crypt, AESNI_CTR_Crypt, AES_Gen_Release}, + AESNI_CTR_Crypt, AESNI_CTR_Crypt, AES_Gen_Release, probe_aes_ni}, /* x2 methods */ {"AES128x2-ECB", 128, 20, 16, 22*16, &aes_stream_ecb, AESNI_128_EKey_ExpansionX2_r, AESNI_128_DKey_ExpansionX2_r, - AESNI_ECB_EncryptX2, AESNI_ECB_DecryptX2, AES_Gen_Release}, + AESNI_ECB_EncryptX2, AESNI_ECB_DecryptX2, AES_Gen_Release, probe_aes_ni}, {"AES128x2-CBC", 128, 20, 16, 22*16, &aes_stream_cbc, AESNI_128_EKey_ExpansionX2_r, AESNI_128_DKey_ExpansionX2_r, - AESNI_CBC_EncryptX2, AESNI_CBC_DecryptX2, AES_Gen_Release}, + AESNI_CBC_EncryptX2, AESNI_CBC_DecryptX2, AES_Gen_Release, probe_aes_ni}, {"AES128x2-CTR", 128, 20, 16, 22*16, &aesni_stream_ctr, AESNI_128_EKey_ExpansionX2_r, AESNI_128_EKey_ExpansionX2_r, - AESNI_CTR_CryptX2, AESNI_CTR_CryptX2, AES_Gen_Release}, + AESNI_CTR_CryptX2, AESNI_CTR_CryptX2, AES_Gen_Release, probe_aes_ni}, {"AES192x2-ECB", 192, 24, 16, 26*16, &aes_stream_ecb, AESNI_192_EKey_ExpansionX2_r, AESNI_192_DKey_ExpansionX2_r, - AESNI_ECB_EncryptX2, AESNI_ECB_DecryptX2, AES_Gen_Release}, + AESNI_ECB_EncryptX2, AESNI_ECB_DecryptX2, AES_Gen_Release, probe_aes_ni}, {"AES192x2-CBC", 192, 24, 16, 26*16, &aes_stream_cbc, AESNI_192_EKey_ExpansionX2_r, AESNI_192_DKey_ExpansionX2_r, - AESNI_CBC_EncryptX2, AESNI_CBC_DecryptX2, AES_Gen_Release}, + AESNI_CBC_EncryptX2, AESNI_CBC_DecryptX2, AES_Gen_Release, probe_aes_ni}, {"AES192x2-CTR", 192, 24, 16, 26*16, &aesni_stream_ctr, AESNI_192_EKey_ExpansionX2_r, AESNI_192_EKey_ExpansionX2_r, - AESNI_CTR_CryptX2, AESNI_CTR_CryptX2, AES_Gen_Release}, + AESNI_CTR_CryptX2, AESNI_CTR_CryptX2, AES_Gen_Release, probe_aes_ni}, {"AES256x2-ECB", 256, 28, 16, 30*16, &aes_stream_ecb, AESNI_256_EKey_ExpansionX2_r, AESNI_256_DKey_ExpansionX2_r, - AESNI_ECB_EncryptX2, AESNI_ECB_DecryptX2, AES_Gen_Release}, + AESNI_ECB_EncryptX2, AESNI_ECB_DecryptX2, AES_Gen_Release, probe_aes_ni}, {"AES256x2-CBC", 256, 28, 16, 30*16, &aes_stream_cbc, AESNI_256_EKey_ExpansionX2_r, AESNI_256_DKey_ExpansionX2_r, - AESNI_CBC_EncryptX2, AESNI_CBC_DecryptX2, AES_Gen_Release}, + AESNI_CBC_EncryptX2, AESNI_CBC_DecryptX2, AES_Gen_Release, probe_aes_ni}, {"AES256x2-CTR", 256, 28, 16, 30*16, &aesni_stream_ctr, AESNI_256_EKey_ExpansionX2_r, AESNI_256_EKey_ExpansionX2_r, - AESNI_CTR_CryptX2, AESNI_CTR_CryptX2, AES_Gen_Release}, + AESNI_CTR_CryptX2, AESNI_CTR_CryptX2, AES_Gen_Release, probe_aes_ni}, {NULL, /* ... */} }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dd_rescue-1.99.5/checksum_file.c new/dd_rescue-1.99.6/checksum_file.c --- old/dd_rescue-1.99.5/checksum_file.c 2015-05-08 10:24:13.526965620 +0200 +++ new/dd_rescue-1.99.6/checksum_file.c 2017-06-23 13:06:37.633091540 +0200 @@ -54,7 +54,7 @@ #define MAX(a,b) ((a)<(b)? (b): (a)) /* file offset in the chksum file which has the chksum for nm, -1 = not found */ -off_t find_chks(FILE* f, const char* nm, char* res) +off_t find_chks(FILE* f, const char* nm, char* res, int wantedln) { char *lnbf = NULL; size_t lln = 0; @@ -78,8 +78,10 @@ fnm[last--] = 0; //printf("\"%s\" <-> \"%s\"/\"%s\"\n", fnm, nm, bnm); if (!strcmp(fnm, nm) || !strcmp(fnm, bnm)) { - if (res && fwh-lnbf <= 2*(int)sizeof(hash_t)) { - const int ln = MIN(128, fwh-lnbf); + if (wantedln && fwh-lnbf != wantedln) + continue; + if (res && fwh-lnbf <= 2*(int)sizeof(hash_t)+14) { + const int ln = MIN(142, fwh-lnbf); memcpy(res, lnbf, ln); res[ln] = 0; } else if (res) @@ -112,12 +114,12 @@ } /* get chksum */ -int get_chks(const char* cnm, const char* nm, char* chks) +int get_chks(const char* cnm, const char* nm, char* chks, int wantedln) { FILE *f = fopen_chks(cnm, "r", 0); if (!f) return -1; - off_t err = find_chks(f, nm, chks); + off_t err = find_chks(f, nm, chks, wantedln); if (f != stdin) fclose(f); return err < 0? err: 0; @@ -128,7 +130,7 @@ { FILE *f = fopen_chks(cnm, "r+", 0); int err = 0; - char oldchks[129]; + char oldchks[144]; char* bnm = basename(nm); if (!f) { errno = 0; @@ -138,7 +140,7 @@ fprintf(f, "%s *%s\n", chks, bnm); err = -errno; } else { - off_t pos = find_chks(f, nm, oldchks); + off_t pos = find_chks(f, nm, oldchks, strlen(chks)); if (pos == -ENOENT || strlen(chks) != strlen(oldchks)) { fclose(f); f = fopen_chks(cnm, "a", 0); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dd_rescue-1.99.5/checksum_file.h new/dd_rescue-1.99.6/checksum_file.h --- old/dd_rescue-1.99.5/checksum_file.h 2015-04-15 10:56:38.832315325 +0200 +++ new/dd_rescue-1.99.6/checksum_file.h 2017-06-23 13:06:52.576091105 +0200 @@ -4,7 +4,7 @@ //#include "ddr_plugin.h" //off_t find_chks(FILE* f, const char* nm, char* res); -int get_chks(const char* cnm, const char *nm, char *chks); +int get_chks(const char* cnm, const char *nm, char *chks, int wantedln); int upd_chks(const char* cnm, const char *nm, const char *chks, int mode); #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dd_rescue-1.99.5/configure.in new/dd_rescue-1.99.6/configure.in --- old/dd_rescue-1.99.5/configure.in 2016-12-29 17:48:17.134229212 +0100 +++ new/dd_rescue-1.99.6/configure.in 2017-08-25 12:30:29.208479955 +0200 @@ -43,8 +43,7 @@ dnl *************************************************************************** dnl Check for support of rep nop AC_MSG_CHECKING(whether asm rep nop is supported) -AC_TRY_LINK([ -],[ +AC_TRY_RUN([ int main() { int err = 0; asm volatile ("rep nop":::"memory"); @@ -56,6 +55,9 @@ [check whether asm rep nop works]) ],[ AC_MSG_RESULT(no) +],[ + AC_MSG_RESULT(no -- cross compiling) ]) AC_OUTPUT +dnl link (if needed) Makefile configure.in test_crypt.sh test_lzo_fuzz.sh diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dd_rescue-1.99.5/dd_rescue.1 new/dd_rescue-1.99.6/dd_rescue.1 --- old/dd_rescue-1.99.5/dd_rescue.1 2016-12-29 12:06:59.773519469 +0100 +++ new/dd_rescue-1.99.6/dd_rescue.1 2017-06-23 13:24:14.518269729 +0200 @@ -1,4 +1,4 @@ -.TH dd_rescue 1 "2016-12-29" "Kurt Garloff" "Data recovery and protection tool" +.TH dd_rescue 1 "2017-06-23" "Kurt Garloff" "Data recovery and protection tool" . .SH NAME dd_rescue \- Data recovery and protection tool @@ -594,6 +594,19 @@ but saves time by not accessing the (possibly large) file a second time. The hash plugin handles sparse writes and arbitrary offsets fine. .PP +.B multipart=CHUNKSIZE +tells ddr_hash to calculate multiple checksums for file chunks of CHUNKSIZE +each and then combine them into a combined checksum by creating a checksum +over the piece checksums. This is how the checksum for S3 multipart objects +is calculated (using the md5 hash); the output there is the combination +checksum with a dash and the number of parts appended. +.br +Note that this feature is new in 1.99.6 and does not yet handle situations +cleanly, where offsets plus block sizes do not happen to cleanly align +with the CHUNKSIZE. The implementation for this will be completed later. +Other features like the append/prepend/hmac pieces also don't work well with +multipart checksum calculation. +.PP ddr_hash also supports the parameter .B append=STRING which appends the given STRING to the output before computing the cryptographic @@ -980,6 +993,7 @@ 1.98 brought encryption and the fault injection framework, 1.99 support for ARMv8 crypto acceleration. 1.99.5 brought ratecontrol. +1.99.6 brought S3 style multipart checksums. .PP Some additional information can be found on .br diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dd_rescue-1.99.5/dd_rescue.c new/dd_rescue-1.99.6/dd_rescue.c --- old/dd_rescue-1.99.5/dd_rescue.c 2016-12-29 17:51:50.075223017 +0100 +++ new/dd_rescue-1.99.6/dd_rescue.c 2016-12-29 22:01:40.574184147 +0100 @@ -206,7 +206,7 @@ # include <sys/statvfs.h> #endif -#if defined(HAVE_REP_NOP) && (defined(__x86_64__) || defined(__i386__)) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)) +#if defined(HAVE_REP_NOP) && (defined(__x86_64__) || defined(__i386__)) # define cpu_relax() asm volatile ("rep nop":::"memory"); #else # define cpu_relax() while (0) {} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dd_rescue-1.99.5/find_nonzero.c new/dd_rescue-1.99.6/find_nonzero.c --- old/dd_rescue-1.99.5/find_nonzero.c 2016-12-28 22:17:50.445765923 +0100 +++ new/dd_rescue-1.99.6/find_nonzero.c 2017-08-25 09:32:40.610098836 +0200 @@ -137,8 +137,8 @@ #define TEST_SIMD2(a,b,c,d) TESTC(a,b,c*2,d) #define TEST2_SIMD2(a,b,c,d) TEST2C(a,b,c*2,d) #else -#define TEST_SIMD2(a,b,c,d) if (have_simd) { TESTC(a,b,c*2,d); } -#define TEST2_SIMD2(a,b,c,d) if (have_simd) { TEST2C(a,b,c*2,d); } +#define TEST_SIMD2(a,b,c,d) if (have_sse2) { TESTC(a,b,c*2,d); } +#define TEST2_SIMD2(a,b,c,d) if (have_sse2) { TEST2C(a,b,c*2,d); } #endif #else #define TEST_SIMD2(a,b,c,d) do {} while (0) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dd_rescue-1.99.5/libddr_crypt.c new/dd_rescue-1.99.6/libddr_crypt.c --- old/dd_rescue-1.99.5/libddr_crypt.c 2016-12-28 23:07:56.047400981 +0100 +++ new/dd_rescue-1.99.6/libddr_crypt.c 2017-06-23 13:12:11.070290784 +0200 @@ -148,7 +148,7 @@ int set_alg(crypt_state* state, const char* algnm) { - ciph_desc_t *alg = findalg(state->engine, algnm); + ciph_desc_t *alg = findalg(state->engine, algnm, 0); if (state->alg) { if (alg) FPLOG(FATAL, "alg already set to, can't override with %s\n", @@ -399,7 +399,7 @@ /* 1st: Set engine: Default: aesni/aes_c: Done */ /* 2nd: Set alg: Already done if set explicitly */ if (!err && !state->alg) - state->alg = findalg(state->engine, "AES192-CTR"); + state->alg = findalg(state->engine, "AES192-CTR", 0); if (!state->alg) return -1; @@ -956,7 +956,7 @@ #endif if (!state->sgen && !state->sset && state->saltf) { char* sfnm = keyfnm(saltnm, encnm); - int off = get_chks(sfnm, encnm, state->sec->charbuf1); + int off = get_chks(sfnm, encnm, state->sec->charbuf1, 0); /* Failure is NOT fatal */ if (off >= 0) { err += parse_hex(state->sec->salt, state->sec->charbuf1, 8); @@ -1067,7 +1067,7 @@ if (!state->kset && state->keyf) { /* (d) Read from keyfile */ char* kfnm = keyfnm(keynm, encnm); - int off = get_chks(kfnm, encnm, state->sec->charbuf1); + int off = get_chks(kfnm, encnm, state->sec->charbuf1, 0); free(kfnm); /* Fatal if not successful */ if (off < 0) { @@ -1149,7 +1149,7 @@ if (!state->iset && state->ivf) { /* Read IV from ivsfile */ char* ivnm = keyfnm(ivsnm, encnm); - int off = get_chks(ivsnm, encnm, state->sec->charbuf1); + int off = get_chks(ivsnm, encnm, state->sec->charbuf1, 0); free(ivnm); if (off < 0) { FPLOG(FATAL, "Can't read IV for %s from IVS file!\n", encnm); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dd_rescue-1.99.5/libddr_hash.c new/dd_rescue-1.99.6/libddr_hash.c --- old/dd_rescue-1.99.5/libddr_hash.c 2015-05-26 10:52:40.635546686 +0200 +++ new/dd_rescue-1.99.6/libddr_hash.c 2017-08-25 09:51:38.170686244 +0200 @@ -66,6 +66,13 @@ const char* chkfnm; const opt_t *opts; unsigned char* hmacpwd; +#ifndef NO_S3_MP + /* multipart s3 style checksum */ + loff_t multisz; + unsigned char *mpbuf; + int mpbufsz; + int mpbufseg; +#endif int hmacpln; char xfallback; #if 1 //def HAVE_ATTR_XATTR_H @@ -78,13 +85,38 @@ " It supports unaligned blocks (arbitrary offsets) and holes(sparse writing).\n" " Parameters: output:outfd=FNO:outnm=FILE:check:chknm=FILE:debug:[alg[o[rithm]=]ALG\n" "\t:append=STR:prepend=STR:hmacpwd=STR:hmacpwdfd=FNO:hmacpwdnm=FILE\n" - "\t:pbkdf2=ALG/PWD/SALT/ITER/LEN\n" + "\t:pbkdf2=ALG/PWD/SALT/ITER/LEN" +#ifndef NO_S3_MP + ":multipart=size" +#endif + "\n" #ifdef HAVE_ATTR_XATTR_H "\t:chk_xattr[=xattr_name]:set_xattr[=xattr_name]:fallb[ack][=FILE]\n" #endif " Use algorithm=help to get a list of supported hash algorithms\n"; +#ifndef NO_S3_MP +static loff_t readint(const char* const ptr) +{ + char *es; double res; + + res = strtod(ptr, &es); + switch (*es) { + case 'b': res *= 512; break; + case 'k': res *= 1024; break; + case 'M': res *= 1024*1024; break; + case 'G': res *= 1024*1024*1024; break; + case ' ': + case '\0': break; + default: + FPLOG(WARN, "suffix %c ignored!\n", *es); + } + return (loff_t)res; +} +#define ALLOC_CHUNK 16384 +#endif + hashalg_t *get_hashalg(hash_state *state, const char* nm) { unsigned int i; @@ -108,8 +140,12 @@ int hash_plug_init(void **stat, char* param, int seq, const opt_t *opt) { int err = 0; - hash_state *state = (hash_state*)malloc(sizeof(hash_state)); - *stat = (void*)state; + hash_state *state; /* = (hash_state*)malloc(sizeof(hash_state));*/ + if (posix_memalign(stat, 64, sizeof(hash_state))) { + FPLOG(FATAL, "No enough memory for hash state!\n"); + return -1; + } + state = (hash_state*)*stat; memset(state, 0, sizeof(hash_state)); state->seq = seq; state->opts = opt; @@ -159,6 +195,10 @@ state->chkf = 1; state->chkfnm=param+6; } else if (!strcmp(param, "check")) { state->chkf = 1; state->chkfnm="-"; } +#ifndef NO_S3_MP + else if (!memcmp(param, "multipart=", 10)) { + state->multisz = readint(param+10); } +#endif else if (!memcmp(param, "algo=", 5)) state->alg = get_hashalg(state, param+5); else if (!memcmp(param, "alg=", 4)) @@ -216,8 +256,7 @@ } if (!state->alg) { FPLOG(FATAL, "No hash algorithm specified\n"); - --err; - return err; + return --err; } #ifdef HAVE_ATTR_XATTR_H if ((state->chk_xattr || state->set_xattr) && !state->xattr_name) { @@ -301,7 +340,8 @@ memset(ibuf, 0, blen); asm("":::"memory"); } state->hash_pos = 0; - if (!ochg && state->seq != 0) + + if (!ochg && state->seq != 0 && strcmp(opt->oname, "/dev/null")) state->fname = opt->oname; else if (!ichg) state->fname = opt->iname; @@ -444,6 +484,30 @@ fst->opos - state->opts->init_opos; HASH_DEBUG(FPLOG(DEBUG, "block(%i/%i): towr=%i, eof=%i, pos=%" LL "i, hash_pos=%" LL "i, buflen=%i\n", state->seq, state->olnchg, *towr, eof, pos, state->hash_pos, state->buflen)); +#ifndef NO_S3_MP + if (state->multisz && ((!(state->hash_pos%state->multisz) && state->hash_pos && *towr) || (!*towr && state->mpbufseg))) { + /* TODO: Check if we have enough space and enlarge mpbuf if needed */ + const unsigned int hln = state->alg->hashln; + if ((1+state->mpbufseg)*hln > state->mpbufsz) { + state->mpbufsz += ALLOC_CHUNK; + state->mpbuf = realloc(state->mpbuf, state->mpbufsz); + assert(state->mpbuf); + } + /* Copy current hash into mpbuf and incr mpbufseg */ + unsigned long diff = state->hash_pos - (state->hash_pos-1)%state->multisz - 1; + state->hash_pos -= diff; + hash_last(state, pos-diff); + memcpy(state->mpbuf+state->mpbufseg*hln, &state->hash, hln); + state->mpbufseg++; + if (state->debug) { + char res[129]; + FPLOG(DEBUG, "Hash segment %i: %s (pos %" LL "i hash %li)\n", state->mpbufseg, state->alg->hash_hexout(res, &state->hash), pos, state->hash_pos); + } + /* Reset hash to zero ... */ + state->alg->hash_init(&state->hash); + state->hash_pos += diff; + } +#endif // Handle hole (sparse files) const loff_t holesz = pos - (state->hash_pos + state->buflen); assert(holesz >= 0 || (state->ilnchg && state->olnchg)); @@ -503,7 +567,7 @@ int check_chkf(hash_state *state, const char* res) { const char* name = state->opts->iname; - char cks[129]; + char cks[144]; if (state->ichg && !state->ochg) { name = state->opts->oname; if (!state->opts->quiet) @@ -512,7 +576,7 @@ FPLOG(WARN, "Can't read checksum in the middle of plugin chain (%s)\n", state->fname); return -ENOENT; } - int err = get_chks(state->chkfnm, name, cks); + int err = get_chks(state->chkfnm, name, cks, strlen(res)); if (err < 0) { FPLOG(WARN, "Can't find checksum in %s for %s\n", state->chkfnm, name); return -ENOENT; @@ -528,7 +592,7 @@ int write_chkf(hash_state *state, const char *res) { const char* name = state->opts->oname; - if (state->ochg && !state->ichg) { + if ((state->ochg || !strcmp(state->opts->oname, "/dev/null")) && !state->ichg) { name = state->opts->iname; if (!state->opts->quiet) FPLOG(INFO, "Write checksum to %s for input file %s\n", state->chkfnm, name); @@ -546,7 +610,7 @@ #ifdef HAVE_ATTR_XATTR_H int check_xattr(hash_state* state, const char* res) { - char xatstr[128]; + char xatstr[144]; strcpy(xatstr, "xattr"); const char* name = state->opts->iname; if (state->ichg && !state->ochg) { @@ -558,13 +622,13 @@ return -ENOENT; } /* Longest is 128byte hex for SHA512 (8x64byte numbers -> 8x16 digits) */ - char chksum[129]; - ssize_t itln = getxattr(name, state->xattr_name, chksum, 129); + char chksum[144]; + ssize_t itln = getxattr(name, state->xattr_name, chksum, 144); const int rln = strlen(res); if (itln <= 0) { if (state->xfallback) { - int err = get_chks(state->chkfnm, name, chksum); - snprintf(xatstr, 128, "chksum file %s", state->chkfnm); + int err = get_chks(state->chkfnm, name, chksum, rln); + snprintf(xatstr, 143, "chksum file %s", state->chkfnm); if (err < 0) { FPLOG(WARN, "no hash found in xattr nor %s for %s\n", xatstr, name); return -ENOENT; @@ -588,8 +652,8 @@ int write_xattr(hash_state* state, const char* res) { const char* name = state->opts->oname; - char xatstr[128]; - snprintf(xatstr, 128, "xattr %s", state->xattr_name); + char xatstr[144]; + snprintf(xatstr, 143, "xattr %s", state->xattr_name); if (state->ochg && !state->ichg) { name = state->opts->iname; if (!state->opts->quiet) @@ -602,7 +666,7 @@ if (setxattr(name, state->xattr_name, res, strlen(res), 0)) { if (state->xfallback) { int err = upd_chks(state->chkfnm, name, res, 0644); - snprintf(xatstr, 128, "chksum file %s", state->chkfnm); + snprintf(xatstr, 143, "chksum file %s", state->chkfnm); if (err) { FPLOG(WARN, "Failed writing to %s for %s: %s\n", xatstr, name, strerror(-err)); @@ -624,10 +688,19 @@ { int err = 0; hash_state *state = (hash_state*)*stat; - char res[129]; + char res[144]; const unsigned int hlen = state->alg->hashln; const unsigned int blen = state->alg->blksz; loff_t firstpos = (state->seq == 0? state->opts->init_ipos: state->opts->init_opos); +#ifndef NO_S3_MP + if (state->multisz && state->mpbufseg) { + const unsigned int hln = state->alg->hashln; + state->alg->hash_init(&state->hash); + state->alg->hash_calc(state->mpbuf, state->mpbufseg*hln, state->mpbufseg*hln, &state->hash); + state->alg->hash_hexout(res, &state->hash); + sprintf(res+strlen(res), "-%i", state->mpbufseg); + } else +#endif state->alg->hash_hexout(res, &state->hash); if (!state->opts->quiet) FPLOG(INFO, "%s %s (%" LL "i-%" LL "i): %s\n", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dd_rescue-1.99.5/test_aes.c new/dd_rescue-1.99.6/test_aes.c --- old/dd_rescue-1.99.5/test_aes.c 2015-09-05 00:04:46.393842759 +0200 +++ new/dd_rescue-1.99.6/test_aes.c 2017-08-25 12:45:55.975452971 +0200 @@ -48,6 +48,16 @@ #ifdef HAVE_AESNI #include "aesni.h" +int have_aesni = 1; +#if defined( __GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)) +static void detect_cpu_cap() +{ + have_aesni = !!__builtin_cpu_supports("avx"); +} +#else +# warn no runtime detection for aesni +static void detect_cpu_cap(); +#endif #endif #ifdef HAVE_AES_ARM64 @@ -210,7 +220,7 @@ #ifdef HAVE_OPENSSL_EVP_H #define TEST_OSSL(LN, EPAD, DPAD) \ - alg = findalg(AES_OSSL_Methods, testalg); \ + alg = findalg(AES_OSSL_Methods, testalg, 1); \ if (alg) \ ret += test_alg("OSSL ", alg, key, in, LN, EPAD, DPAD, rep) #else @@ -219,7 +229,7 @@ #ifdef HAVE_AESNI #define TEST_AESNI(LN, EPAD, DPAD) \ - alg = findalg(AESNI_Methods, testalg); \ + alg = findalg(AESNI_Methods, testalg, 1); \ if (alg) \ ret += test_alg("AESNI", alg, key, in, LN, EPAD, DPAD, rep) #else @@ -228,7 +238,7 @@ #ifdef HAVE_AES_ARM64 #define TEST_AES_ARM64(LN, EPAD, DPAD) \ - alg = findalg(AES_ARM8_Methods, testalg); \ + alg = findalg(AES_ARM8_Methods, testalg, 1); \ if (alg) \ ret += test_alg("ARM64", alg, key, in, LN, EPAD, DPAD, rep) #else @@ -239,7 +249,7 @@ #define TEST_ENGINES(LN, EPAD, DPAD) \ TEST_AESNI(LN, EPAD, DPAD); \ TEST_AES_ARM64(LN, EPAD, DPAD); \ - alg = findalg(AES_C_Methods, testalg); \ + alg = findalg(AES_C_Methods, testalg, 1); \ if (alg) \ ret += test_alg("AES_C", alg, key, in, LN, EPAD, DPAD, rep); \ TEST_OSSL(LN, EPAD, DPAD) @@ -252,6 +262,9 @@ unsigned char *key = (unsigned char*)"Test Key_123 is long enough even for AES-256"; //int dbg = 0; char* testalg; +#ifdef HAVE_AESNI + detect_cpu_cap(); +#endif crypto = secmem_init(); /* if (argc > 1 && !strcmp("-d", argv[1])) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dd_rescue-1.99.5/test_crypt.sh new/dd_rescue-1.99.6/test_crypt.sh --- old/dd_rescue-1.99.5/test_crypt.sh 2016-01-03 00:36:38.401879127 +0100 +++ new/dd_rescue-1.99.6/test_crypt.sh 2016-12-29 22:14:41.411161429 +0100 @@ -97,7 +97,7 @@ $VG ./dd_rescue -t -m 4096 urandom urandom.new || exit 1 # Ensure that we don't have 01 or 02 02 or ... at the end, # which would trip pad=asneeded -echo -n "a" | dd_rescue -S 4095 -m 1 - urandom.new +echo -n "a" | $VG ./dd_rescue -S 4095 -m 1 - urandom.new mv urandom.new urandom enc_dec_compare_keys urandom AES192-CBC "" pad=always "" "-qpt" enc_dec_compare_keys urandom AES192-CBC "" pad=asneeded "" "-qpt" ++++++ libddr_hash-round-down-static.diff ++++++ --- libddr_hash.c.orig 2017-08-25 09:51:38.170686244 +0200 +++ libddr_hash.c 2017-08-25 17:14:33.308431613 +0200 @@ -398,7 +398,7 @@ #error __WORDSIZE unknown #endif -inline int round_down(int val, const int gran) +static inline int round_down(int val, const int gran) { return val-val%gran; }