aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/crypto.h
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2014-11-20 17:05:53 -0800
committerHerbert Xu <herbert@gondor.apana.org.au>2014-11-24 22:43:57 +0800
commit5d26a105b5a73e5635eae0629b42fa0a90e07b7b (patch)
treee1be190c7b5dfc70c57b41f8ecb896dfda7d1e16 /include/linux/crypto.h
parentcrypto: user - Allow get request with empty driver name (diff)
downloadlinux-dev-5d26a105b5a73e5635eae0629b42fa0a90e07b7b.tar.xz
linux-dev-5d26a105b5a73e5635eae0629b42fa0a90e07b7b.zip
crypto: prefix module autoloading with "crypto-"
This prefixes all crypto module loading with "crypto-" so we never run the risk of exposing module auto-loading to userspace via a crypto API, as demonstrated by Mathias Krause: https://lkml.org/lkml/2013/3/4/70 Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'include/linux/crypto.h')
-rw-r--r--include/linux/crypto.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index 208a63290b23..9c8776d0ada8 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -26,6 +26,19 @@
#include <linux/uaccess.h>
/*
+ * Autoloaded crypto modules should only use a prefixed name to avoid allowing
+ * arbitrary modules to be loaded. Loading from userspace may still need the
+ * unprefixed names, so retains those aliases as well.
+ * This uses __MODULE_INFO directly instead of MODULE_ALIAS because pre-4.3
+ * gcc (e.g. avr32 toolchain) uses __LINE__ for uniqueness, and this macro
+ * expands twice on the same line. Instead, use a separate base name for the
+ * alias.
+ */
+#define MODULE_ALIAS_CRYPTO(name) \
+ __MODULE_INFO(alias, alias_userspace, name); \
+ __MODULE_INFO(alias, alias_crypto, "crypto-" name)
+
+/*
* Algorithm masks and types.
*/
#define CRYPTO_ALG_TYPE_MASK 0x0000000f