]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
crypto: null - remove the default null skcipher
authorEric Biggers <ebiggers@google.com>
Mon, 5 May 2025 19:10:43 +0000 (12:10 -0700)
committerHerbert Xu <herbert@gondor.apana.org.au>
Mon, 12 May 2025 05:32:53 +0000 (13:32 +0800)
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>
crypto/crypto_null.c
include/crypto/null.h

index 5822753b0995c116ea2657a42d652312592ef7ad..48c71b925f37544deae32681fdcdf8565f309db2 100644 (file)
 #include <crypto/internal/skcipher.h>
 #include <linux/init.h>
 #include <linux/module.h>
-#include <linux/spinlock.h>
 #include <linux/string.h>
 
-static DEFINE_SPINLOCK(crypto_default_null_skcipher_lock);
-static struct crypto_sync_skcipher *crypto_default_null_skcipher;
-static int crypto_default_null_skcipher_refcnt;
-
 static int null_init(struct shash_desc *desc)
 {
        return 0;
@@ -129,54 +124,6 @@ static struct crypto_alg cipher_null = {
 MODULE_ALIAS_CRYPTO("digest_null");
 MODULE_ALIAS_CRYPTO("cipher_null");
 
-struct crypto_sync_skcipher *crypto_get_default_null_skcipher(void)
-{
-       struct crypto_sync_skcipher *ntfm = NULL;
-       struct crypto_sync_skcipher *tfm;
-
-       spin_lock_bh(&crypto_default_null_skcipher_lock);
-       tfm = crypto_default_null_skcipher;
-
-       if (!tfm) {
-               spin_unlock_bh(&crypto_default_null_skcipher_lock);
-
-               ntfm = crypto_alloc_sync_skcipher("ecb(cipher_null)", 0, 0);
-               if (IS_ERR(ntfm))
-                       return ntfm;
-
-               spin_lock_bh(&crypto_default_null_skcipher_lock);
-               tfm = crypto_default_null_skcipher;
-               if (!tfm) {
-                       tfm = ntfm;
-                       ntfm = NULL;
-                       crypto_default_null_skcipher = tfm;
-               }
-       }
-
-       crypto_default_null_skcipher_refcnt++;
-       spin_unlock_bh(&crypto_default_null_skcipher_lock);
-
-       crypto_free_sync_skcipher(ntfm);
-
-       return tfm;
-}
-EXPORT_SYMBOL_GPL(crypto_get_default_null_skcipher);
-
-void crypto_put_default_null_skcipher(void)
-{
-       struct crypto_sync_skcipher *tfm = NULL;
-
-       spin_lock_bh(&crypto_default_null_skcipher_lock);
-       if (!--crypto_default_null_skcipher_refcnt) {
-               tfm = crypto_default_null_skcipher;
-               crypto_default_null_skcipher = NULL;
-       }
-       spin_unlock_bh(&crypto_default_null_skcipher_lock);
-
-       crypto_free_sync_skcipher(tfm);
-}
-EXPORT_SYMBOL_GPL(crypto_put_default_null_skcipher);
-
 static int __init crypto_null_mod_init(void)
 {
        int ret = 0;
index 0ef577cc00e3f921a6a6c786cfe05bd87f22278c..1c66abf9de3b2be2312628883ad84b56e516d99a 100644 (file)
@@ -9,7 +9,4 @@
 #define NULL_DIGEST_SIZE       0
 #define NULL_IV_SIZE           0
 
-struct crypto_sync_skcipher *crypto_get_default_null_skcipher(void);
-void crypto_put_default_null_skcipher(void);
-
 #endif