Commit 9f213efc authored by Kees Cook's avatar Kees Cook Committed by Luis Henriques

crypto: include crypto- module prefix in template

commit 4943ba16 upstream.

This adds the module loading prefix "crypto-" to the template lookup
as well.

For example, attempting to load 'vfat(blowfish)' via AF_ALG now correctly
includes the "crypto-" prefix at every level, correctly rejecting "vfat":

	net-pf-38
	algif-hash
	crypto-vfat(blowfish)
	crypto-vfat(blowfish)-all
	crypto-vfat
Reported-by: default avatarMathias Krause <minipli@googlemail.com>
Signed-off-by: default avatarKees Cook <keescook@chromium.org>
Acked-by: default avatarMathias Krause <minipli@googlemail.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
[ luis: backported to 3.16: dropped changes to:
  - crypto/mcryptd.c ]
Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
parent 6359ca00
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/crypto.h>
#include <asm/i387.h> #include <asm/i387.h>
struct crypto_fpu_ctx { struct crypto_fpu_ctx {
...@@ -159,3 +160,5 @@ void __exit crypto_fpu_exit(void) ...@@ -159,3 +160,5 @@ void __exit crypto_fpu_exit(void)
{ {
crypto_unregister_template(&crypto_fpu_tmpl); crypto_unregister_template(&crypto_fpu_tmpl);
} }
MODULE_ALIAS_CRYPTO("fpu");
...@@ -495,8 +495,8 @@ static struct crypto_template *__crypto_lookup_template(const char *name) ...@@ -495,8 +495,8 @@ static struct crypto_template *__crypto_lookup_template(const char *name)
struct crypto_template *crypto_lookup_template(const char *name) struct crypto_template *crypto_lookup_template(const char *name)
{ {
return try_then_request_module(__crypto_lookup_template(name), "%s", return try_then_request_module(__crypto_lookup_template(name),
name); "crypto-%s", name);
} }
EXPORT_SYMBOL_GPL(crypto_lookup_template); EXPORT_SYMBOL_GPL(crypto_lookup_template);
......
...@@ -721,3 +721,4 @@ module_exit(crypto_authenc_module_exit); ...@@ -721,3 +721,4 @@ module_exit(crypto_authenc_module_exit);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Simple AEAD wrapper for IPsec"); MODULE_DESCRIPTION("Simple AEAD wrapper for IPsec");
MODULE_ALIAS_CRYPTO("authenc");
...@@ -814,3 +814,4 @@ module_exit(crypto_authenc_esn_module_exit); ...@@ -814,3 +814,4 @@ module_exit(crypto_authenc_esn_module_exit);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_AUTHOR("Steffen Klassert <steffen.klassert@secunet.com>"); MODULE_AUTHOR("Steffen Klassert <steffen.klassert@secunet.com>");
MODULE_DESCRIPTION("AEAD wrapper for IPsec with extended sequence numbers"); MODULE_DESCRIPTION("AEAD wrapper for IPsec with extended sequence numbers");
MODULE_ALIAS_CRYPTO("authencesn");
...@@ -289,3 +289,4 @@ module_exit(crypto_cbc_module_exit); ...@@ -289,3 +289,4 @@ module_exit(crypto_cbc_module_exit);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("CBC block cipher algorithm"); MODULE_DESCRIPTION("CBC block cipher algorithm");
MODULE_ALIAS_CRYPTO("cbc");
...@@ -881,3 +881,4 @@ MODULE_LICENSE("GPL"); ...@@ -881,3 +881,4 @@ MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Counter with CBC MAC"); MODULE_DESCRIPTION("Counter with CBC MAC");
MODULE_ALIAS_CRYPTO("ccm_base"); MODULE_ALIAS_CRYPTO("ccm_base");
MODULE_ALIAS_CRYPTO("rfc4309"); MODULE_ALIAS_CRYPTO("rfc4309");
MODULE_ALIAS_CRYPTO("ccm");
...@@ -359,3 +359,4 @@ module_exit(chainiv_module_exit); ...@@ -359,3 +359,4 @@ module_exit(chainiv_module_exit);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Chain IV Generator"); MODULE_DESCRIPTION("Chain IV Generator");
MODULE_ALIAS_CRYPTO("chainiv");
...@@ -313,3 +313,4 @@ module_exit(crypto_cmac_module_exit); ...@@ -313,3 +313,4 @@ module_exit(crypto_cmac_module_exit);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("CMAC keyed hash algorithm"); MODULE_DESCRIPTION("CMAC keyed hash algorithm");
MODULE_ALIAS_CRYPTO("cmac");
...@@ -955,3 +955,4 @@ module_exit(cryptd_exit); ...@@ -955,3 +955,4 @@ module_exit(cryptd_exit);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Software async crypto daemon"); MODULE_DESCRIPTION("Software async crypto daemon");
MODULE_ALIAS_CRYPTO("cryptd");
...@@ -467,3 +467,4 @@ module_exit(crypto_ctr_module_exit); ...@@ -467,3 +467,4 @@ module_exit(crypto_ctr_module_exit);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("CTR Counter block mode"); MODULE_DESCRIPTION("CTR Counter block mode");
MODULE_ALIAS_CRYPTO("rfc3686"); MODULE_ALIAS_CRYPTO("rfc3686");
MODULE_ALIAS_CRYPTO("ctr");
...@@ -350,3 +350,4 @@ module_exit(crypto_cts_module_exit); ...@@ -350,3 +350,4 @@ module_exit(crypto_cts_module_exit);
MODULE_LICENSE("Dual BSD/GPL"); MODULE_LICENSE("Dual BSD/GPL");
MODULE_DESCRIPTION("CTS-CBC CipherText Stealing for CBC"); MODULE_DESCRIPTION("CTS-CBC CipherText Stealing for CBC");
MODULE_ALIAS_CRYPTO("cts");
...@@ -185,3 +185,4 @@ module_exit(crypto_ecb_module_exit); ...@@ -185,3 +185,4 @@ module_exit(crypto_ecb_module_exit);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("ECB block cipher algorithm"); MODULE_DESCRIPTION("ECB block cipher algorithm");
MODULE_ALIAS_CRYPTO("ecb");
...@@ -267,3 +267,4 @@ module_exit(eseqiv_module_exit); ...@@ -267,3 +267,4 @@ module_exit(eseqiv_module_exit);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Encrypted Sequence Number IV Generator"); MODULE_DESCRIPTION("Encrypted Sequence Number IV Generator");
MODULE_ALIAS_CRYPTO("eseqiv");
...@@ -1444,3 +1444,4 @@ MODULE_AUTHOR("Mikko Herranen <mh1@iki.fi>"); ...@@ -1444,3 +1444,4 @@ MODULE_AUTHOR("Mikko Herranen <mh1@iki.fi>");
MODULE_ALIAS_CRYPTO("gcm_base"); MODULE_ALIAS_CRYPTO("gcm_base");
MODULE_ALIAS_CRYPTO("rfc4106"); MODULE_ALIAS_CRYPTO("rfc4106");
MODULE_ALIAS_CRYPTO("rfc4543"); MODULE_ALIAS_CRYPTO("rfc4543");
MODULE_ALIAS_CRYPTO("gcm");
...@@ -271,3 +271,4 @@ module_exit(hmac_module_exit); ...@@ -271,3 +271,4 @@ module_exit(hmac_module_exit);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("HMAC hash algorithm"); MODULE_DESCRIPTION("HMAC hash algorithm");
MODULE_ALIAS_CRYPTO("hmac");
...@@ -400,3 +400,4 @@ module_exit(crypto_module_exit); ...@@ -400,3 +400,4 @@ module_exit(crypto_module_exit);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("LRW block cipher mode"); MODULE_DESCRIPTION("LRW block cipher mode");
MODULE_ALIAS_CRYPTO("lrw");
...@@ -295,3 +295,4 @@ module_exit(crypto_pcbc_module_exit); ...@@ -295,3 +295,4 @@ module_exit(crypto_pcbc_module_exit);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("PCBC block cipher algorithm"); MODULE_DESCRIPTION("PCBC block cipher algorithm");
MODULE_ALIAS_CRYPTO("pcbc");
...@@ -565,3 +565,4 @@ module_exit(pcrypt_exit); ...@@ -565,3 +565,4 @@ module_exit(pcrypt_exit);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_AUTHOR("Steffen Klassert <steffen.klassert@secunet.com>"); MODULE_AUTHOR("Steffen Klassert <steffen.klassert@secunet.com>");
MODULE_DESCRIPTION("Parallel crypto wrapper"); MODULE_DESCRIPTION("Parallel crypto wrapper");
MODULE_ALIAS_CRYPTO("pcrypt");
...@@ -362,3 +362,4 @@ module_exit(seqiv_module_exit); ...@@ -362,3 +362,4 @@ module_exit(seqiv_module_exit);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Sequence Number IV Generator"); MODULE_DESCRIPTION("Sequence Number IV Generator");
MODULE_ALIAS_CRYPTO("seqiv");
...@@ -713,3 +713,4 @@ module_exit(vmac_module_exit); ...@@ -713,3 +713,4 @@ module_exit(vmac_module_exit);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("VMAC hash algorithm"); MODULE_DESCRIPTION("VMAC hash algorithm");
MODULE_ALIAS_CRYPTO("vmac");
...@@ -286,3 +286,4 @@ module_exit(crypto_xcbc_module_exit); ...@@ -286,3 +286,4 @@ module_exit(crypto_xcbc_module_exit);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("XCBC keyed hash algorithm"); MODULE_DESCRIPTION("XCBC keyed hash algorithm");
MODULE_ALIAS_CRYPTO("xcbc");
...@@ -362,3 +362,4 @@ module_exit(crypto_module_exit); ...@@ -362,3 +362,4 @@ module_exit(crypto_module_exit);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("XTS block cipher mode"); MODULE_DESCRIPTION("XTS block cipher mode");
MODULE_ALIAS_CRYPTO("xts");
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment