summaryrefslogtreecommitdiff
path: root/crypto/mcryptd.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2016-12-10 16:21:55 -0500
committerDavid S. Miller <davem@davemloft.net>2016-12-10 16:21:55 -0500
commit20269eddc75d2d592a3c182c51e53ed5d64a0650 (patch)
treee1a3359fb60bf1b220333dc007cd6e568cab990e /crypto/mcryptd.c
parent7540d192b40c8bd7b28557691c0ce2c2843dba63 (diff)
parent3e39d71f9e785538cfb91cd75e7f169bb2a34d5b (diff)
downloadlinux-crypto-20269eddc75d2d592a3c182c51e53ed5d64a0650.tar.gz
linux-crypto-20269eddc75d2d592a3c182c51e53ed5d64a0650.zip
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Diffstat (limited to 'crypto/mcryptd.c')
-rw-r--r--crypto/mcryptd.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/crypto/mcryptd.c b/crypto/mcryptd.c
index 94ee44ac..c207458d 100644
--- a/crypto/mcryptd.c
+++ b/crypto/mcryptd.c
@@ -254,18 +254,22 @@ out_free_inst:
goto out;
}
-static inline void mcryptd_check_internal(struct rtattr **tb, u32 *type,
+static inline bool mcryptd_check_internal(struct rtattr **tb, u32 *type,
u32 *mask)
{
struct crypto_attr_type *algt;
algt = crypto_get_attr_type(tb);
if (IS_ERR(algt))
- return;
- if ((algt->type & CRYPTO_ALG_INTERNAL))
- *type |= CRYPTO_ALG_INTERNAL;
- if ((algt->mask & CRYPTO_ALG_INTERNAL))
- *mask |= CRYPTO_ALG_INTERNAL;
+ return false;
+
+ *type |= algt->type & CRYPTO_ALG_INTERNAL;
+ *mask |= algt->mask & CRYPTO_ALG_INTERNAL;
+
+ if (*type & *mask & CRYPTO_ALG_INTERNAL)
+ return true;
+ else
+ return false;
}
static int mcryptd_hash_init_tfm(struct crypto_tfm *tfm)
@@ -492,7 +496,8 @@ static int mcryptd_create_hash(struct crypto_template *tmpl, struct rtattr **tb,
u32 mask = 0;
int err;
- mcryptd_check_internal(tb, &type, &mask);
+ if (!mcryptd_check_internal(tb, &type, &mask))
+ return -EINVAL;
halg = ahash_attr_alg(tb[1], type, mask);
if (IS_ERR(halg))