diff mbox

crypto/cryptod: use crypto_skcipher_type() for getting skcipher type

Message ID 1448473708-9609-1-git-send-email-kuleshovmail@gmail.com (mailing list archive)
State Accepted
Delegated to: Herbert Xu
Headers show

Commit Message

Alexander Kuleshov Nov. 25, 2015, 5:48 p.m. UTC
The <linux/crypto.h> provides inline function - crypto_skcipher_type().
Let's use it in the cryptd_alloc_ablkcipher() instead of direct calculation.

Signed-off-by: Alexander Kuleshov <kuleshovmail@gmail.com>
---
 crypto/cryptd.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Herbert Xu Nov. 27, 2015, 1:26 p.m. UTC | #1
On Wed, Nov 25, 2015 at 11:48:28PM +0600, Alexander Kuleshov wrote:
> The <linux/crypto.h> provides inline function - crypto_skcipher_type().
> Let's use it in the cryptd_alloc_ablkcipher() instead of direct calculation.
> 
> Signed-off-by: Alexander Kuleshov <kuleshovmail@gmail.com>

Applied.
diff mbox

Patch

diff --git a/crypto/cryptd.c b/crypto/cryptd.c
index c81861b..c4af8aa 100644
--- a/crypto/cryptd.c
+++ b/crypto/cryptd.c
@@ -887,8 +887,7 @@  struct cryptd_ablkcipher *cryptd_alloc_ablkcipher(const char *alg_name,
 	if (snprintf(cryptd_alg_name, CRYPTO_MAX_ALG_NAME,
 		     "cryptd(%s)", alg_name) >= CRYPTO_MAX_ALG_NAME)
 		return ERR_PTR(-EINVAL);
-	type &= ~(CRYPTO_ALG_TYPE_MASK | CRYPTO_ALG_GENIV);
-	type |= CRYPTO_ALG_TYPE_BLKCIPHER;
+	type = crypto_skcipher_type(type);
 	mask &= ~CRYPTO_ALG_TYPE_MASK;
 	mask |= (CRYPTO_ALG_GENIV | CRYPTO_ALG_TYPE_BLKCIPHER_MASK);
 	tfm = crypto_alloc_base(cryptd_alg_name, type, mask);