Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

crypto: null - remove the default null skcipher

crypto_get_default_null_skcipher() and
crypto_put_default_null_skcipher() are no longer used, so remove them.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Eric Biggers and committed by
Herbert Xu
c10f66b0 0c08c729

-56
-53
crypto/crypto_null.c
··· 17 17 #include <crypto/internal/skcipher.h> 18 18 #include <linux/init.h> 19 19 #include <linux/module.h> 20 - #include <linux/spinlock.h> 21 20 #include <linux/string.h> 22 - 23 - static DEFINE_SPINLOCK(crypto_default_null_skcipher_lock); 24 - static struct crypto_sync_skcipher *crypto_default_null_skcipher; 25 - static int crypto_default_null_skcipher_refcnt; 26 21 27 22 static int null_init(struct shash_desc *desc) 28 23 { ··· 123 128 124 129 MODULE_ALIAS_CRYPTO("digest_null"); 125 130 MODULE_ALIAS_CRYPTO("cipher_null"); 126 - 127 - struct crypto_sync_skcipher *crypto_get_default_null_skcipher(void) 128 - { 129 - struct crypto_sync_skcipher *ntfm = NULL; 130 - struct crypto_sync_skcipher *tfm; 131 - 132 - spin_lock_bh(&crypto_default_null_skcipher_lock); 133 - tfm = crypto_default_null_skcipher; 134 - 135 - if (!tfm) { 136 - spin_unlock_bh(&crypto_default_null_skcipher_lock); 137 - 138 - ntfm = crypto_alloc_sync_skcipher("ecb(cipher_null)", 0, 0); 139 - if (IS_ERR(ntfm)) 140 - return ntfm; 141 - 142 - spin_lock_bh(&crypto_default_null_skcipher_lock); 143 - tfm = crypto_default_null_skcipher; 144 - if (!tfm) { 145 - tfm = ntfm; 146 - ntfm = NULL; 147 - crypto_default_null_skcipher = tfm; 148 - } 149 - } 150 - 151 - crypto_default_null_skcipher_refcnt++; 152 - spin_unlock_bh(&crypto_default_null_skcipher_lock); 153 - 154 - crypto_free_sync_skcipher(ntfm); 155 - 156 - return tfm; 157 - } 158 - EXPORT_SYMBOL_GPL(crypto_get_default_null_skcipher); 159 - 160 - void crypto_put_default_null_skcipher(void) 161 - { 162 - struct crypto_sync_skcipher *tfm = NULL; 163 - 164 - spin_lock_bh(&crypto_default_null_skcipher_lock); 165 - if (!--crypto_default_null_skcipher_refcnt) { 166 - tfm = crypto_default_null_skcipher; 167 - crypto_default_null_skcipher = NULL; 168 - } 169 - spin_unlock_bh(&crypto_default_null_skcipher_lock); 170 - 171 - crypto_free_sync_skcipher(tfm); 172 - } 173 - EXPORT_SYMBOL_GPL(crypto_put_default_null_skcipher); 174 131 175 132 static int __init crypto_null_mod_init(void) 176 133 {
-3
include/crypto/null.h
··· 9 9 #define NULL_DIGEST_SIZE 0 10 10 #define NULL_IV_SIZE 0 11 11 12 - struct crypto_sync_skcipher *crypto_get_default_null_skcipher(void); 13 - void crypto_put_default_null_skcipher(void); 14 - 15 12 #endif