Skip to content

Commit 1ad0f16

Browse files
ebiggersherbertx
authored andcommitted
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>
1 parent d416559 commit 1ad0f16

14 files changed

Lines changed: 19 additions & 22 deletions

File tree

‎arch/s390/crypto/aes_s390.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ static int fallback_init_cip(struct crypto_tfm *tfm)
137137
struct s390_aes_ctx *sctx = crypto_tfm_ctx(tfm);
138138

139139
sctx->fallback.cip = crypto_alloc_cipher(name, 0,
140-
CRYPTO_ALG_ASYNC | CRYPTO_ALG_NEED_FALLBACK);
140+
CRYPTO_ALG_NEED_FALLBACK);
141141

142142
if (IS_ERR(sctx->fallback.cip)) {
143143
pr_err("Allocating AES fallback algorithm %s failed\n",

‎drivers/crypto/amcc/crypto4xx_alg.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -520,8 +520,7 @@ static int crypto4xx_compute_gcm_hash_key_sw(__le32 *hash_start, const u8 *key,
520520
uint8_t src[16] = { 0 };
521521
int rc = 0;
522522

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);
525524
if (IS_ERR(aes_tfm)) {
526525
rc = PTR_ERR(aes_tfm);
527526
pr_warn("could not load aes cipher driver: %d\n", rc);

‎drivers/crypto/ccp/ccp-crypto-aes-cmac.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -346,9 +346,7 @@ static int ccp_aes_cmac_cra_init(struct crypto_tfm *tfm)
346346

347347
crypto_ahash_set_reqsize(ahash, sizeof(struct ccp_aes_cmac_req_ctx));
348348

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);
352350
if (IS_ERR(cipher_tfm)) {
353351
pr_warn("could not load aes cipher driver\n");
354352
return PTR_ERR(cipher_tfm);

‎drivers/crypto/geode-aes.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ static int fallback_init_cip(struct crypto_tfm *tfm)
261261
struct geode_aes_op *op = crypto_tfm_ctx(tfm);
262262

263263
op->fallback.cip = crypto_alloc_cipher(name, 0,
264-
CRYPTO_ALG_ASYNC | CRYPTO_ALG_NEED_FALLBACK);
264+
CRYPTO_ALG_NEED_FALLBACK);
265265

266266
if (IS_ERR(op->fallback.cip)) {
267267
printk(KERN_ERR "Error allocating fallback algo %s\n", name);

‎drivers/md/dm-crypt.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ static struct crypto_cipher *alloc_essiv_cipher(struct crypt_config *cc,
377377
int err;
378378

379379
/* 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);
381381
if (IS_ERR(essiv_tfm)) {
382382
ti->error = "Error allocating crypto tfm for ESSIV";
383383
return essiv_tfm;

‎drivers/net/wireless/cisco/airo.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1359,7 +1359,7 @@ static int micsetup(struct airo_info *ai) {
13591359
int i;
13601360

13611361
if (ai->tfm == NULL)
1362-
ai->tfm = crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
1362+
ai->tfm = crypto_alloc_cipher("aes", 0, 0);
13631363

13641364
if (IS_ERR(ai->tfm)) {
13651365
airo_print_err(ai->dev->name, "failed to load transform for AES");

‎drivers/staging/rtl8192e/rtllib_crypt_ccmp.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ static void *rtllib_ccmp_init(int key_idx)
6767
goto fail;
6868
priv->key_idx = key_idx;
6969

70-
priv->tfm = (void *)crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
70+
priv->tfm = (void *)crypto_alloc_cipher("aes", 0, 0);
7171
if (IS_ERR(priv->tfm)) {
7272
pr_debug("Could not allocate crypto API aes\n");
7373
priv->tfm = NULL;

‎drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ static void *ieee80211_ccmp_init(int key_idx)
7171
goto fail;
7272
priv->key_idx = key_idx;
7373

74-
priv->tfm = (void *)crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
74+
priv->tfm = (void *)crypto_alloc_cipher("aes", 0, 0);
7575
if (IS_ERR(priv->tfm)) {
7676
pr_debug("ieee80211_crypt_ccmp: could not allocate crypto API aes\n");
7777
priv->tfm = NULL;

‎drivers/usb/wusbcore/crypto.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ ssize_t wusb_prf(void *out, size_t out_size,
316316
goto error_setkey_cbc;
317317
}
318318

319-
tfm_aes = crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
319+
tfm_aes = crypto_alloc_cipher("aes", 0, 0);
320320
if (IS_ERR(tfm_aes)) {
321321
result = PTR_ERR(tfm_aes);
322322
printk(KERN_ERR "E: can't load AES: %d\n", (int)result);

‎net/bluetooth/smp.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1390,7 +1390,7 @@ static struct smp_chan *smp_chan_create(struct l2cap_conn *conn)
13901390
if (!smp)
13911391
return NULL;
13921392

1393-
smp->tfm_aes = crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
1393+
smp->tfm_aes = crypto_alloc_cipher("aes", 0, 0);
13941394
if (IS_ERR(smp->tfm_aes)) {
13951395
BT_ERR("Unable to create AES crypto context");
13961396
goto zfree_smp;
@@ -3233,7 +3233,7 @@ static struct l2cap_chan *smp_add_cid(struct hci_dev *hdev, u16 cid)
32333233
if (!smp)
32343234
return ERR_PTR(-ENOMEM);
32353235

3236-
tfm_aes = crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
3236+
tfm_aes = crypto_alloc_cipher("aes", 0, 0);
32373237
if (IS_ERR(tfm_aes)) {
32383238
BT_ERR("Unable to create AES crypto context");
32393239
kzfree(smp);
@@ -3906,7 +3906,7 @@ int __init bt_selftest_smp(void)
39063906
struct crypto_kpp *tfm_ecdh;
39073907
int err;
39083908

3909-
tfm_aes = crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
3909+
tfm_aes = crypto_alloc_cipher("aes", 0, 0);
39103910
if (IS_ERR(tfm_aes)) {
39113911
BT_ERR("Unable to create AES crypto context");
39123912
return PTR_ERR(tfm_aes);

0 commit comments

Comments
 (0)