diff options
| author | Herbert Xu <herbert@gondor.apana.org.au> | 2016-07-12 01:17:47 -0400 |
|---|---|---|
| committer | Herbert Xu <herbert@gondor.apana.org.au> | 2016-07-18 05:35:44 -0400 |
| commit | 499a66e6b689b13d1a4108bec5d7dcdc829a27a8 (patch) | |
| tree | ed98f2e025b852471cb02386029ae6eaffd12eb9 /crypto | |
| parent | da721302a78807e5da2902677fbe116fe052068f (diff) | |
crypto: null - Remove default null blkcipher
The default null blkcipher is no longer used and can now be removed.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto')
| -rw-r--r-- | crypto/crypto_null.c | 49 |
1 files changed, 6 insertions, 43 deletions
diff --git a/crypto/crypto_null.c b/crypto/crypto_null.c index c3f683910d07..20ff2c746e0b 100644 --- a/crypto/crypto_null.c +++ b/crypto/crypto_null.c | |||
| @@ -26,10 +26,8 @@ | |||
| 26 | #include <linux/string.h> | 26 | #include <linux/string.h> |
| 27 | 27 | ||
| 28 | static DEFINE_MUTEX(crypto_default_null_skcipher_lock); | 28 | static DEFINE_MUTEX(crypto_default_null_skcipher_lock); |
| 29 | static struct crypto_blkcipher *crypto_default_null_skcipher; | 29 | static struct crypto_skcipher *crypto_default_null_skcipher; |
| 30 | static int crypto_default_null_skcipher_refcnt; | 30 | static int crypto_default_null_skcipher_refcnt; |
| 31 | static struct crypto_skcipher *crypto_default_null_skcipher2; | ||
| 32 | static int crypto_default_null_skcipher2_refcnt; | ||
| 33 | 31 | ||
| 34 | static int null_compress(struct crypto_tfm *tfm, const u8 *src, | 32 | static int null_compress(struct crypto_tfm *tfm, const u8 *src, |
| 35 | unsigned int slen, u8 *dst, unsigned int *dlen) | 33 | unsigned int slen, u8 *dst, unsigned int *dlen) |
| @@ -155,15 +153,16 @@ MODULE_ALIAS_CRYPTO("compress_null"); | |||
| 155 | MODULE_ALIAS_CRYPTO("digest_null"); | 153 | MODULE_ALIAS_CRYPTO("digest_null"); |
| 156 | MODULE_ALIAS_CRYPTO("cipher_null"); | 154 | MODULE_ALIAS_CRYPTO("cipher_null"); |
| 157 | 155 | ||
| 158 | struct crypto_blkcipher *crypto_get_default_null_skcipher(void) | 156 | struct crypto_skcipher *crypto_get_default_null_skcipher(void) |
| 159 | { | 157 | { |
| 160 | struct crypto_blkcipher *tfm; | 158 | struct crypto_skcipher *tfm; |
| 161 | 159 | ||
| 162 | mutex_lock(&crypto_default_null_skcipher_lock); | 160 | mutex_lock(&crypto_default_null_skcipher_lock); |
| 163 | tfm = crypto_default_null_skcipher; | 161 | tfm = crypto_default_null_skcipher; |
| 164 | 162 | ||
| 165 | if (!tfm) { | 163 | if (!tfm) { |
| 166 | tfm = crypto_alloc_blkcipher("ecb(cipher_null)", 0, 0); | 164 | tfm = crypto_alloc_skcipher("ecb(cipher_null)", |
| 165 | 0, CRYPTO_ALG_ASYNC); | ||
| 167 | if (IS_ERR(tfm)) | 166 | if (IS_ERR(tfm)) |
| 168 | goto unlock; | 167 | goto unlock; |
| 169 | 168 | ||
| @@ -183,49 +182,13 @@ void crypto_put_default_null_skcipher(void) | |||
| 183 | { | 182 | { |
| 184 | mutex_lock(&crypto_default_null_skcipher_lock); | 183 | mutex_lock(&crypto_default_null_skcipher_lock); |
| 185 | if (!--crypto_default_null_skcipher_refcnt) { | 184 | if (!--crypto_default_null_skcipher_refcnt) { |
| 186 | crypto_free_blkcipher(crypto_default_null_skcipher); | 185 | crypto_free_skcipher(crypto_default_null_skcipher); |
| 187 | crypto_default_null_skcipher = NULL; | 186 | crypto_default_null_skcipher = NULL; |
| 188 | } | 187 | } |
| 189 | mutex_unlock(&crypto_default_null_skcipher_lock); | 188 | mutex_unlock(&crypto_default_null_skcipher_lock); |
| 190 | } | 189 | } |
| 191 | EXPORT_SYMBOL_GPL(crypto_put_default_null_skcipher); | 190 | EXPORT_SYMBOL_GPL(crypto_put_default_null_skcipher); |
| 192 | 191 | ||
| 193 | struct crypto_skcipher *crypto_get_default_null_skcipher2(void) | ||
| 194 | { | ||
| 195 | struct crypto_skcipher *tfm; | ||
| 196 | |||
| 197 | mutex_lock(&crypto_default_null_skcipher_lock); | ||
| 198 | tfm = crypto_default_null_skcipher2; | ||
| 199 | |||
| 200 | if (!tfm) { | ||
| 201 | tfm = crypto_alloc_skcipher("ecb(cipher_null)", | ||
| 202 | 0, CRYPTO_ALG_ASYNC); | ||
| 203 | if (IS_ERR(tfm)) | ||
| 204 | goto unlock; | ||
| 205 | |||
| 206 | crypto_default_null_skcipher2 = tfm; | ||
| 207 | } | ||
| 208 | |||
| 209 | crypto_default_null_skcipher2_refcnt++; | ||
| 210 | |||
| 211 | unlock: | ||
| 212 | mutex_unlock(&crypto_default_null_skcipher_lock); | ||
| 213 | |||
| 214 | return tfm; | ||
| 215 | } | ||
| 216 | EXPORT_SYMBOL_GPL(crypto_get_default_null_skcipher2); | ||
| 217 | |||
| 218 | void crypto_put_default_null_skcipher2(void) | ||
| 219 | { | ||
| 220 | mutex_lock(&crypto_default_null_skcipher_lock); | ||
| 221 | if (!--crypto_default_null_skcipher2_refcnt) { | ||
| 222 | crypto_free_skcipher(crypto_default_null_skcipher2); | ||
| 223 | crypto_default_null_skcipher2 = NULL; | ||
| 224 | } | ||
| 225 | mutex_unlock(&crypto_default_null_skcipher_lock); | ||
| 226 | } | ||
| 227 | EXPORT_SYMBOL_GPL(crypto_put_default_null_skcipher2); | ||
| 228 | |||
| 229 | static int __init crypto_null_mod_init(void) | 192 | static int __init crypto_null_mod_init(void) |
| 230 | { | 193 | { |
| 231 | int ret = 0; | 194 | int ret = 0; |
