diff options
Diffstat (limited to 'crypto/mcryptd.c')
-rw-r--r-- | crypto/mcryptd.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/crypto/mcryptd.c b/crypto/mcryptd.c index 94ee44acd465..c207458d6299 100644 --- a/crypto/mcryptd.c +++ b/crypto/mcryptd.c | |||
@@ -254,18 +254,22 @@ out_free_inst: | |||
254 | goto out; | 254 | goto out; |
255 | } | 255 | } |
256 | 256 | ||
257 | static inline void mcryptd_check_internal(struct rtattr **tb, u32 *type, | 257 | static inline bool mcryptd_check_internal(struct rtattr **tb, u32 *type, |
258 | u32 *mask) | 258 | u32 *mask) |
259 | { | 259 | { |
260 | struct crypto_attr_type *algt; | 260 | struct crypto_attr_type *algt; |
261 | 261 | ||
262 | algt = crypto_get_attr_type(tb); | 262 | algt = crypto_get_attr_type(tb); |
263 | if (IS_ERR(algt)) | 263 | if (IS_ERR(algt)) |
264 | return; | 264 | return false; |
265 | if ((algt->type & CRYPTO_ALG_INTERNAL)) | 265 | |
266 | *type |= CRYPTO_ALG_INTERNAL; | 266 | *type |= algt->type & CRYPTO_ALG_INTERNAL; |
267 | if ((algt->mask & CRYPTO_ALG_INTERNAL)) | 267 | *mask |= algt->mask & CRYPTO_ALG_INTERNAL; |
268 | *mask |= CRYPTO_ALG_INTERNAL; | 268 | |
269 | if (*type & *mask & CRYPTO_ALG_INTERNAL) | ||
270 | return true; | ||
271 | else | ||
272 | return false; | ||
269 | } | 273 | } |
270 | 274 | ||
271 | static int mcryptd_hash_init_tfm(struct crypto_tfm *tfm) | 275 | 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, | |||
492 | u32 mask = 0; | 496 | u32 mask = 0; |
493 | int err; | 497 | int err; |
494 | 498 | ||
495 | mcryptd_check_internal(tb, &type, &mask); | 499 | if (!mcryptd_check_internal(tb, &type, &mask)) |
500 | return -EINVAL; | ||
496 | 501 | ||
497 | halg = ahash_attr_alg(tb[1], type, mask); | 502 | halg = ahash_attr_alg(tb[1], type, mask); |
498 | if (IS_ERR(halg)) | 503 | if (IS_ERR(halg)) |