diff options
Diffstat (limited to 'crypto/blkcipher.c')
-rw-r--r-- | crypto/blkcipher.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/crypto/blkcipher.c b/crypto/blkcipher.c index f6c67f9d4e5c..180d91451476 100644 --- a/crypto/blkcipher.c +++ b/crypto/blkcipher.c | |||
@@ -433,9 +433,8 @@ static unsigned int crypto_blkcipher_ctxsize(struct crypto_alg *alg, u32 type, | |||
433 | struct blkcipher_alg *cipher = &alg->cra_blkcipher; | 433 | struct blkcipher_alg *cipher = &alg->cra_blkcipher; |
434 | unsigned int len = alg->cra_ctxsize; | 434 | unsigned int len = alg->cra_ctxsize; |
435 | 435 | ||
436 | type ^= CRYPTO_ALG_ASYNC; | 436 | if ((mask & CRYPTO_ALG_TYPE_MASK) == CRYPTO_ALG_TYPE_MASK && |
437 | mask &= CRYPTO_ALG_ASYNC; | 437 | cipher->ivsize) { |
438 | if ((type & mask) && cipher->ivsize) { | ||
439 | len = ALIGN(len, (unsigned long)alg->cra_alignmask + 1); | 438 | len = ALIGN(len, (unsigned long)alg->cra_alignmask + 1); |
440 | len += cipher->ivsize; | 439 | len += cipher->ivsize; |
441 | } | 440 | } |
@@ -482,9 +481,7 @@ static int crypto_init_blkcipher_ops(struct crypto_tfm *tfm, u32 type, u32 mask) | |||
482 | if (alg->ivsize > PAGE_SIZE / 8) | 481 | if (alg->ivsize > PAGE_SIZE / 8) |
483 | return -EINVAL; | 482 | return -EINVAL; |
484 | 483 | ||
485 | type ^= CRYPTO_ALG_ASYNC; | 484 | if ((mask & CRYPTO_ALG_TYPE_MASK) == CRYPTO_ALG_TYPE_MASK) |
486 | mask &= CRYPTO_ALG_ASYNC; | ||
487 | if (type & mask) | ||
488 | return crypto_init_blkcipher_ops_sync(tfm); | 485 | return crypto_init_blkcipher_ops_sync(tfm); |
489 | else | 486 | else |
490 | return crypto_init_blkcipher_ops_async(tfm); | 487 | return crypto_init_blkcipher_ops_async(tfm); |