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

crypto: drop mask=CRYPTO_ALG_ASYNC from 'cipher' tfm allocations

'cipher' algorithms (single block ciphers) are always synchronous, so
passing CRYPTO_ALG_ASYNC in the mask to crypto_alloc_cipher() has no
effect. Many users therefore already don't pass it, but some still do.
This inconsistency can cause confusion, especially since the way the
'mask' argument works is somewhat counterintuitive.

Thus, just remove the unneeded CRYPTO_ALG_ASYNC flags.

This patch shouldn't change any actual behavior.

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
1ad0f160 d4165590

+19 -22
+1 -1
arch/s390/crypto/aes_s390.c
··· 137 137 struct s390_aes_ctx *sctx = crypto_tfm_ctx(tfm); 138 138 139 139 sctx->fallback.cip = crypto_alloc_cipher(name, 0, 140 - CRYPTO_ALG_ASYNC | CRYPTO_ALG_NEED_FALLBACK); 140 + CRYPTO_ALG_NEED_FALLBACK); 141 141 142 142 if (IS_ERR(sctx->fallback.cip)) { 143 143 pr_err("Allocating AES fallback algorithm %s failed\n",
+1 -2
drivers/crypto/amcc/crypto4xx_alg.c
··· 520 520 uint8_t src[16] = { 0 }; 521 521 int rc = 0; 522 522 523 - aes_tfm = crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC | 524 - CRYPTO_ALG_NEED_FALLBACK); 523 + aes_tfm = crypto_alloc_cipher("aes", 0, CRYPTO_ALG_NEED_FALLBACK); 525 524 if (IS_ERR(aes_tfm)) { 526 525 rc = PTR_ERR(aes_tfm); 527 526 pr_warn("could not load aes cipher driver: %d\n", rc);
+1 -3
drivers/crypto/ccp/ccp-crypto-aes-cmac.c
··· 346 346 347 347 crypto_ahash_set_reqsize(ahash, sizeof(struct ccp_aes_cmac_req_ctx)); 348 348 349 - cipher_tfm = crypto_alloc_cipher("aes", 0, 350 - CRYPTO_ALG_ASYNC | 351 - CRYPTO_ALG_NEED_FALLBACK); 349 + cipher_tfm = crypto_alloc_cipher("aes", 0, CRYPTO_ALG_NEED_FALLBACK); 352 350 if (IS_ERR(cipher_tfm)) { 353 351 pr_warn("could not load aes cipher driver\n"); 354 352 return PTR_ERR(cipher_tfm);
+1 -1
drivers/crypto/geode-aes.c
··· 261 261 struct geode_aes_op *op = crypto_tfm_ctx(tfm); 262 262 263 263 op->fallback.cip = crypto_alloc_cipher(name, 0, 264 - CRYPTO_ALG_ASYNC | CRYPTO_ALG_NEED_FALLBACK); 264 + CRYPTO_ALG_NEED_FALLBACK); 265 265 266 266 if (IS_ERR(op->fallback.cip)) { 267 267 printk(KERN_ERR "Error allocating fallback algo %s\n", name);
+1 -1
drivers/md/dm-crypt.c
··· 377 377 int err; 378 378 379 379 /* Setup the essiv_tfm with the given salt */ 380 - essiv_tfm = crypto_alloc_cipher(cc->cipher, 0, CRYPTO_ALG_ASYNC); 380 + essiv_tfm = crypto_alloc_cipher(cc->cipher, 0, 0); 381 381 if (IS_ERR(essiv_tfm)) { 382 382 ti->error = "Error allocating crypto tfm for ESSIV"; 383 383 return essiv_tfm;
+1 -1
drivers/net/wireless/cisco/airo.c
··· 1359 1359 int i; 1360 1360 1361 1361 if (ai->tfm == NULL) 1362 - ai->tfm = crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC); 1362 + ai->tfm = crypto_alloc_cipher("aes", 0, 0); 1363 1363 1364 1364 if (IS_ERR(ai->tfm)) { 1365 1365 airo_print_err(ai->dev->name, "failed to load transform for AES");
+1 -1
drivers/staging/rtl8192e/rtllib_crypt_ccmp.c
··· 67 67 goto fail; 68 68 priv->key_idx = key_idx; 69 69 70 - priv->tfm = (void *)crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC); 70 + priv->tfm = (void *)crypto_alloc_cipher("aes", 0, 0); 71 71 if (IS_ERR(priv->tfm)) { 72 72 pr_debug("Could not allocate crypto API aes\n"); 73 73 priv->tfm = NULL;
+1 -1
drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c
··· 71 71 goto fail; 72 72 priv->key_idx = key_idx; 73 73 74 - priv->tfm = (void *)crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC); 74 + priv->tfm = (void *)crypto_alloc_cipher("aes", 0, 0); 75 75 if (IS_ERR(priv->tfm)) { 76 76 pr_debug("ieee80211_crypt_ccmp: could not allocate crypto API aes\n"); 77 77 priv->tfm = NULL;
+1 -1
drivers/usb/wusbcore/crypto.c
··· 316 316 goto error_setkey_cbc; 317 317 } 318 318 319 - tfm_aes = crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC); 319 + tfm_aes = crypto_alloc_cipher("aes", 0, 0); 320 320 if (IS_ERR(tfm_aes)) { 321 321 result = PTR_ERR(tfm_aes); 322 322 printk(KERN_ERR "E: can't load AES: %d\n", (int)result);
+3 -3
net/bluetooth/smp.c
··· 1390 1390 if (!smp) 1391 1391 return NULL; 1392 1392 1393 - smp->tfm_aes = crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC); 1393 + smp->tfm_aes = crypto_alloc_cipher("aes", 0, 0); 1394 1394 if (IS_ERR(smp->tfm_aes)) { 1395 1395 BT_ERR("Unable to create AES crypto context"); 1396 1396 goto zfree_smp; ··· 3233 3233 if (!smp) 3234 3234 return ERR_PTR(-ENOMEM); 3235 3235 3236 - tfm_aes = crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC); 3236 + tfm_aes = crypto_alloc_cipher("aes", 0, 0); 3237 3237 if (IS_ERR(tfm_aes)) { 3238 3238 BT_ERR("Unable to create AES crypto context"); 3239 3239 kzfree(smp); ··· 3906 3906 struct crypto_kpp *tfm_ecdh; 3907 3907 int err; 3908 3908 3909 - tfm_aes = crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC); 3909 + tfm_aes = crypto_alloc_cipher("aes", 0, 0); 3910 3910 if (IS_ERR(tfm_aes)) { 3911 3911 BT_ERR("Unable to create AES crypto context"); 3912 3912 return PTR_ERR(tfm_aes);
+2 -2
net/mac80211/wep.c
··· 30 30 /* start WEP IV from a random value */ 31 31 get_random_bytes(&local->wep_iv, IEEE80211_WEP_IV_LEN); 32 32 33 - local->wep_tx_tfm = crypto_alloc_cipher("arc4", 0, CRYPTO_ALG_ASYNC); 33 + local->wep_tx_tfm = crypto_alloc_cipher("arc4", 0, 0); 34 34 if (IS_ERR(local->wep_tx_tfm)) { 35 35 local->wep_rx_tfm = ERR_PTR(-EINVAL); 36 36 return PTR_ERR(local->wep_tx_tfm); 37 37 } 38 38 39 - local->wep_rx_tfm = crypto_alloc_cipher("arc4", 0, CRYPTO_ALG_ASYNC); 39 + local->wep_rx_tfm = crypto_alloc_cipher("arc4", 0, 0); 40 40 if (IS_ERR(local->wep_rx_tfm)) { 41 41 crypto_free_cipher(local->wep_tx_tfm); 42 42 local->wep_tx_tfm = ERR_PTR(-EINVAL);
+1 -1
net/wireless/lib80211_crypt_ccmp.c
··· 75 75 goto fail; 76 76 priv->key_idx = key_idx; 77 77 78 - priv->tfm = crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC); 78 + priv->tfm = crypto_alloc_cipher("aes", 0, 0); 79 79 if (IS_ERR(priv->tfm)) { 80 80 priv->tfm = NULL; 81 81 goto fail;
+2 -2
net/wireless/lib80211_crypt_tkip.c
··· 99 99 100 100 priv->key_idx = key_idx; 101 101 102 - priv->tx_tfm_arc4 = crypto_alloc_cipher("arc4", 0, CRYPTO_ALG_ASYNC); 102 + priv->tx_tfm_arc4 = crypto_alloc_cipher("arc4", 0, 0); 103 103 if (IS_ERR(priv->tx_tfm_arc4)) { 104 104 priv->tx_tfm_arc4 = NULL; 105 105 goto fail; ··· 111 111 goto fail; 112 112 } 113 113 114 - priv->rx_tfm_arc4 = crypto_alloc_cipher("arc4", 0, CRYPTO_ALG_ASYNC); 114 + priv->rx_tfm_arc4 = crypto_alloc_cipher("arc4", 0, 0); 115 115 if (IS_ERR(priv->rx_tfm_arc4)) { 116 116 priv->rx_tfm_arc4 = NULL; 117 117 goto fail;
+2 -2
net/wireless/lib80211_crypt_wep.c
··· 48 48 goto fail; 49 49 priv->key_idx = keyidx; 50 50 51 - priv->tx_tfm = crypto_alloc_cipher("arc4", 0, CRYPTO_ALG_ASYNC); 51 + priv->tx_tfm = crypto_alloc_cipher("arc4", 0, 0); 52 52 if (IS_ERR(priv->tx_tfm)) { 53 53 priv->tx_tfm = NULL; 54 54 goto fail; 55 55 } 56 56 57 - priv->rx_tfm = crypto_alloc_cipher("arc4", 0, CRYPTO_ALG_ASYNC); 57 + priv->rx_tfm = crypto_alloc_cipher("arc4", 0, 0); 58 58 if (IS_ERR(priv->rx_tfm)) { 59 59 priv->rx_tfm = NULL; 60 60 goto fail;