Accepting request 606677 from home:garloff:branches:Base:System

- ddr_1998-sysrandom.diff: Use getrandom() decl from sys/random.h.
- ddr_1998-testhole.diff: Ensure we have a hole before testing hole
  encryption (fixes bsc#1092758).
- ddr_1998-ossl11-warn.diff: Avoid warn from memcpy to openssl-1.1
  to EVPCTX* internals.

OBS-URL: https://build.opensuse.org/request/show/606677
OBS-URL: https://build.opensuse.org/package/show/Base:System/dd_rescue?expand=0&rev=42
This commit is contained in:
Kurt Garloff 2018-05-13 13:58:48 +00:00 committed by Git OBS Bridge
parent 71d6014956
commit 31a010fa6a
5 changed files with 143 additions and 2 deletions

View File

@ -1,3 +1,12 @@
-------------------------------------------------------------------
Sat May 12 12:06:29 CEST 2018 - kurt@garloff.de
- ddr_1998-sysrandom.diff: Use getrandom() decl from sys/random.h.
- ddr_1998-testhole.diff: Ensure we have a hole before testing hole
encryption (fixes bsc#1092758).
- ddr_1998-ossl11-warn.diff: Avoid warn from memcpy to openssl-1.1
to EVPCTX* internals.
-------------------------------------------------------------------
Tue Apr 17 15:46:16 CEST 2018 - kurt@garloff.de

View File

@ -20,7 +20,7 @@ Name: dd_rescue
Version: 1.99.8
Release: 0
Summary: Data copying in the presence of I/O Errors
License: GPL-2.0 or GPL-3.0
License: GPL-2.0-only OR GPL-3.0-only
Group: System/Base
Url: http://www.garloff.de/kurt/linux/ddrescue/
Source0: http://garloff.de/kurt/linux/ddrescue/%{name}-%{version}.tar.bz2
@ -29,6 +29,9 @@ Source2: %{name}.keyring
Source99: %{name}.changes
Patch1: ddr_1998-alg-caseindep.diff
Patch2: ddr_1998-check-nofail-noxattr.diff
Patch3: ddr_1998-sysrandom.diff
Patch4: ddr_1998-testhole.diff
Patch5: ddr_1998-ossl11-warn.diff
BuildRequires: autoconf
BuildRequires: libattr-devel
%if 0%{?is_opensuse}
@ -117,6 +120,9 @@ data to the decompressor; the plugin is still young and might expose bugs.
%setup -q
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
# Remove build time references so build-compare can do its work
FAKE_BUILDTIME=$(LC_ALL=C date -u -r %{SOURCE99} '+%%H:%%M')
FAKE_BUILDDATE=$(LC_ALL=C date -u -r %{SOURCE99} '+%%b %%e %%Y')
@ -137,7 +143,7 @@ mkdir %{buildroot}/bin
ln -sf %{_bindir}/dd_rescue %{buildroot}/bin
%check
make %{?_smp_mflags} check
make %{?_smp_mflags} RPM_OPT_FLAGS="%{optflags}" check
%files
%defattr(-,root,root,-)

62
ddr_1998-ossl11-warn.diff Normal file
View File

@ -0,0 +1,62 @@
commit fb27151be814b0bfbe05f81754f754c7ff8b14d7
Author: Kurt Garloff <kurt@garloff.de>
Date: Sat May 12 09:57:23 2018 +0000
Avoid compiler warnings.
diff --git a/aes_ossl11.c b/aes_ossl11.c
index b10f157..66cfbd4 100644
--- a/aes_ossl11.c
+++ b/aes_ossl11.c
@@ -101,8 +101,8 @@ int AES_OSSL_##BITCHAIN##_Encrypt(const unsigned char* ctx, unsigned int rounds,
EVP_CIPHER_CTX **evpctx = (EVP_CIPHER_CTX**)ctx; \
EVP_CIPHER_CTX_set_padding(evpctx[0], DOPAD? pad: 0); \
if (IV) { \
- memcpy(EVP_CIPHER_CTX_original_iv(evpctx[0]), iv, 16); \
- memcpy(EVP_CIPHER_CTX_iv_noconst(evpctx[0]), iv, 16); \
+ memcpy((void*)EVP_CIPHER_CTX_original_iv(evpctx[0]), iv, 16); \
+ memcpy((void*)EVP_CIPHER_CTX_iv_noconst(evpctx[0]), iv, 16); \
} \
if (DOPAD && !pad && (len&15)) { \
ores = EVP_EncryptUpdate(evpctx[0], out, &olen, in, len-(len&15)); \
@@ -143,8 +143,8 @@ int AES_OSSL_##BITCHAIN##_Decrypt(const unsigned char* ctx, unsigned int rounds,
EVP_CIPHER_CTX **evpctx = (EVP_CIPHER_CTX**)ctx; \
EVP_CIPHER_CTX_set_padding(evpctx[0], DOPAD && pad != PAD_ASNEEDED?pad:0); \
if (IV) { \
- memcpy(EVP_CIPHER_CTX_original_iv(evpctx[0]), iv, 16); \
- memcpy(EVP_CIPHER_CTX_iv_noconst(evpctx[0]), iv, 16); \
+ memcpy((void*)EVP_CIPHER_CTX_original_iv(evpctx[0]), iv, 16); \
+ memcpy((void*)EVP_CIPHER_CTX_iv_noconst(evpctx[0]), iv, 16); \
} \
if (DOPAD && pad == PAD_ASNEEDED) { \
int olen1; \
@@ -310,10 +310,10 @@ int AES_OSSL_##BITCHAIN##_EncryptX2(const unsigned char* ctx, unsigned int roun
EVP_CIPHER_CTX_set_padding(evpctx[0], pad); \
EVP_CIPHER_CTX_set_padding(evpctx[1], 0); \
if (IV) { \
- memcpy(EVP_CIPHER_CTX_original_iv(evpctx[0]), iv, 16); \
- memcpy(EVP_CIPHER_CTX_iv_noconst(evpctx[0]), iv, 16); \
- memcpy(EVP_CIPHER_CTX_original_iv(evpctx[1]), iv, 16); \
- memcpy(EVP_CIPHER_CTX_iv_noconst(evpctx[1]), iv, 16); \
+ memcpy((void*)EVP_CIPHER_CTX_original_iv(evpctx[0]), iv, 16); \
+ memcpy((void*)EVP_CIPHER_CTX_iv_noconst(evpctx[0]), iv, 16); \
+ memcpy((void*)EVP_CIPHER_CTX_original_iv(evpctx[1]), iv, 16); \
+ memcpy((void*)EVP_CIPHER_CTX_iv_noconst(evpctx[1]), iv, 16); \
} \
if (!pad && (len&15)) { \
ores = EVP_EncryptUpdate(evpctx[0], out, &olen, in, len-(len&15)); \
@@ -353,10 +353,10 @@ int AES_OSSL_##BITCHAIN##_DecryptX2(const unsigned char* ctx, unsigned int roun
EVP_CIPHER_CTX_set_padding(evpctx[1], 0); \
EVP_CIPHER_CTX_set_padding(evpctx[0], pad==PAD_ASNEEDED? 0: pad); \
if (IV) { \
- memcpy(EVP_CIPHER_CTX_original_iv(evpctx[1]), iv, 16); \
- memcpy(EVP_CIPHER_CTX_iv_noconst(evpctx[1]), iv, 16); \
- memcpy(EVP_CIPHER_CTX_original_iv(evpctx[0]), iv, 16); \
- memcpy(EVP_CIPHER_CTX_iv_noconst(evpctx[0]), iv, 16); \
+ memcpy((void*)EVP_CIPHER_CTX_original_iv(evpctx[1]), iv, 16); \
+ memcpy((void*)EVP_CIPHER_CTX_iv_noconst(evpctx[1]), iv, 16); \
+ memcpy((void*)EVP_CIPHER_CTX_original_iv(evpctx[0]), iv, 16); \
+ memcpy((void*)EVP_CIPHER_CTX_iv_noconst(evpctx[0]), iv, 16); \
} \
ores = EVP_DecryptUpdate(evpctx[1], out, &olen, in, rlen); \
assert(ores); \

33
ddr_1998-sysrandom.diff Normal file
View File

@ -0,0 +1,33 @@
commit f31f00876bd7a1b6a64580138d5208f01dfa81ab
Author: Kurt Garloff <kurt@garloff.de>
Date: Sat May 12 09:34:22 2018 +0000
Use sys/random.h for getrandom() decl if present.
diff --git a/configure.in b/configure.in
index af1ef75..d9b6950 100644
--- a/configure.in
+++ b/configure.in
@@ -6,7 +6,7 @@ AC_C_INLINE
AC_HEADER_STDC
#AC_PROG_INSTALL
#CFLAGS="$CFLAGS -DHAVE_CONFIG_H"
-AC_CHECK_HEADERS([fallocate.h dlfcn.h unistd.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 malloc.h sched.h sys/statvfs.h])
+AC_CHECK_HEADERS([fallocate.h dlfcn.h unistd.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])
AC_CHECK_FUNCS([ffs ffsl basename fallocate64 splice getopt_long open64 pread pread64 lseek64 stat64 posix_fadvise posix_fadvise64 __builtin_prefetch htobe64 feof_unlocked getline getentropy getrandom posix_memalign valloc sched_yield fstatvfs __builtin_cpu_supports])
AC_CHECK_LIB(dl,dlsym)
AC_CHECK_LIB(fallocate,linux_fallocate64)
diff --git a/random.c b/random.c
index e558bed..9b2304c 100644
--- a/random.c
+++ b/random.c
@@ -22,6 +22,9 @@ typedef unsigned int __u32;
#ifdef HAVE_LINUX_RANDOM_H
#include <linux/random.h>
#endif
+#ifdef HAVE_SYS_RANDOM_H
+#include <sys/random.h>
+#endif
static void msleep(unsigned int msecs)
{

31
ddr_1998-testhole.diff Normal file
View File

@ -0,0 +1,31 @@
commit 7f2ff6434586083747bc5d046e0207886025e684
Author: Kurt Garloff <kurt@garloff.de>
Date: Sat May 12 09:54:45 2018 +0000
Fix test case by ensuring there is a hole ...
diff --git a/test_crypt.sh b/test_crypt.sh
index 47f1fc9..62cf853 100755
--- a/test_crypt.sh
+++ b/test_crypt.sh
@@ -52,13 +52,20 @@ rm dd_rescue2
# Holes (all), skiphole
echo "*** Holes ***"
+# Produce file that consists of dd_rescue + hole + dd_rescue
./dd_rescue -qpt dd_rescue dd_rescue3
./dd_rescue -qS 512k dd_rescue dd_rescue3
+# Ensure there is a hole even if dd_rescue is long
+./dd_rescue -qS 384k -m 128k /dev/zero dd_rescue3
+# Test without and with skiphole
enc_dec_compare_keys dd_rescue3 AES192-CTR keygen:ivgen "" "" "-qpt"
enc_dec_compare_keys dd_rescue3 AES192-CTR keygen:ivgen skiphole "" "-qpt"
+# Store 384k-512k in cmp3
./dd_rescue -qt -s 384k -m 128k -S 0 dd_rescue3.cmp dd_rescue3.cmp3
+# Should be 128k of zeroes
./dd_rescue -qm 128k /dev/zero dd_rescue3.cmp2
cmp dd_rescue3.cmp2 dd_rescue3.cmp3 || exit 4
+# Repeat test with reverse
enc_dec_compare_keys dd_rescue3 AES192-CTR keygen:ivgen "" "" "-qptr"
enc_dec_compare_keys dd_rescue3 AES192-CTR keygen:ivgen skiphole "" "-qptr"
./dd_rescue -qt -s 384k -m 128k -S 0 dd_rescue3.cmp dd_rescue3.cmp3