Fix AFALG kernel and headers mismatch problem
authorMatt Caswell <matt@openssl.org>
Wed, 13 Apr 2016 22:26:56 +0000 (23:26 +0100)
committerMatt Caswell <matt@openssl.org>
Thu, 14 Apr 2016 09:09:31 +0000 (10:09 +0100)
During Configure we attempt to check the kernel version of this platform
to see whether we can compile the AFALG engine. If the kernel version
looks recent enough then we enable AFALG. However when we compile
e_afalg.c we check the version of the linux headers. If there is a
mismatch between the linux headers and the currently running kernel then
we don't compile the AFLAG engine and continue. This was causing a link
error.

Reviewed-by: Richard Levitte <levitte@openssl.org>
engines/afalg/e_afalg.c
test/afalgtest.c

index 830e88b3024a16fea903ac395fb194759ebd76e8..d8599a165b60e23d1702b90c5789f2f873476349 100644 (file)
@@ -69,6 +69,9 @@
 #if LINUX_VERSION_CODE <= KERNEL_VERSION(K_MAJ, K_MIN1, K_MIN2)
 # warning "AFALG ENGINE requires Kernel Headers >= 4.1.0"
 # warning "Skipping Compilation of AFALG engine"
+void engine_load_afalg_int(void)
+{
+}
 #else
 
 # include <linux/if_alg.h>
index 16916b3fd7003a40380aa52e182ff0b4187c1438..80aa1e7550dadd0c609cb8c960d5ae24cc3431da 100644 (file)
 #include <stdio.h>
 #include <openssl/opensslconf.h>
 
+#ifndef OPENSSL_NO_AFALGENG
+# include <linux/version.h>
+# define K_MAJ   4
+# define K_MIN1  1
+# define K_MIN2  0
+# if LINUX_VERSION_CODE <= KERNEL_VERSION(K_MAJ, K_MIN1, K_MIN2)
+/*
+ * If we get here then it looks like there is a mismatch between the linux
+ * headers and the actual kernel version, so we have tried to compile with
+ * afalg support, but then skipped it in e_afalg.c. As far as this test is
+ * concerned we behave as if we had been configured without support
+ */
+#  define OPENSSL_NO_AFALGENG
+# endif
+#endif
+
 #ifndef OPENSSL_NO_AFALGENG
 #include <string.h>
 #include <openssl/engine.h>