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