|
|
ac737d |
diff -rupN cryptsetup-2.0.3.old/lib/crypto_backend/crypto_cipher_kernel.c cryptsetup-2.0.3/lib/crypto_backend/crypto_cipher_kernel.c
|
|
|
ac737d |
--- cryptsetup-2.0.3.old/lib/crypto_backend/crypto_cipher_kernel.c 2018-04-17 09:20:35.000000000 +0200
|
|
|
ac737d |
+++ cryptsetup-2.0.3/lib/crypto_backend/crypto_cipher_kernel.c 2018-05-07 14:13:45.176124062 +0200
|
|
|
ac737d |
@@ -31,6 +31,7 @@
|
|
|
ac737d |
#ifdef ENABLE_AF_ALG
|
|
|
ac737d |
|
|
|
ac737d |
#include <linux/if_alg.h>
|
|
|
ac737d |
+#include <sys/utsname.h>
|
|
|
ac737d |
|
|
|
ac737d |
#ifndef AF_ALG
|
|
|
ac737d |
#define AF_ALG 38
|
|
|
ac737d |
@@ -44,6 +45,36 @@ struct crypt_cipher {
|
|
|
ac737d |
int opfd;
|
|
|
ac737d |
};
|
|
|
ac737d |
|
|
|
ac737d |
+
|
|
|
ac737d |
+static size_t pagesize(size_t defsize)
|
|
|
ac737d |
+{
|
|
|
ac737d |
+ long r = sysconf(_SC_PAGESIZE);
|
|
|
ac737d |
+ return r < 0 ? defsize : (size_t)r;
|
|
|
ac737d |
+}
|
|
|
ac737d |
+
|
|
|
ac737d |
+static int check_rh_kernel_version(void)
|
|
|
ac737d |
+{
|
|
|
ac737d |
+ unsigned maj, mid, min, rel;
|
|
|
ac737d |
+ static struct utsname uts = {{ 0 }};
|
|
|
ac737d |
+ size_t ps = pagesize(32768);
|
|
|
ac737d |
+
|
|
|
ac737d |
+ if (ps < 32768)
|
|
|
ac737d |
+ return 0;
|
|
|
ac737d |
+
|
|
|
ac737d |
+ if (!*uts.release && uname(&uts) < 0)
|
|
|
ac737d |
+ return -ENOTSUP;
|
|
|
ac737d |
+ /*
|
|
|
ac737d |
+ * RH kernels 3.10.0-185 and lower are affected by a crypto API kernel
|
|
|
ac737d |
+ * socket bug. The bug only manifests on archs with page size >= 32 KiB.
|
|
|
ac737d |
+ *
|
|
|
ac737d |
+ * For reference, see rhbz#1136075
|
|
|
ac737d |
+ */
|
|
|
ac737d |
+ if (sscanf(uts.release, "%u.%u.%u-%u", &maj, &mid, &min, &rel) == 4)
|
|
|
ac737d |
+ return (maj == 3 && mid == 10 && min == 0 && rel < 186) ? -ENOTSUP : 0;
|
|
|
ac737d |
+
|
|
|
ac737d |
+ return -ENOTSUP;
|
|
|
ac737d |
+}
|
|
|
ac737d |
+
|
|
|
ac737d |
/*
|
|
|
ac737d |
* ciphers
|
|
|
ac737d |
*
|
|
|
ac737d |
@@ -60,6 +91,9 @@ int crypt_cipher_init(struct crypt_ciphe
|
|
|
ac737d |
.salg_type = "skcipher",
|
|
|
ac737d |
};
|
|
|
ac737d |
|
|
|
ac737d |
+ if (check_rh_kernel_version())
|
|
|
ac737d |
+ return -ENOTSUP;
|
|
|
ac737d |
+
|
|
|
ac737d |
h = malloc(sizeof(*h));
|
|
|
ac737d |
if (!h)
|
|
|
ac737d |
return -ENOMEM;
|
|
|
ac737d |
Binary files cryptsetup-2.0.3.old/lib/crypto_backend/.crypto_cipher_kernel.c.rej.swp and cryptsetup-2.0.3/lib/crypto_backend/.crypto_cipher_kernel.c.rej.swp differ
|