diff options
| author | Herbert Xu <herbert@gondor.apana.org.au> | 2017-02-25 23:22:35 -0500 |
|---|---|---|
| committer | Herbert Xu <herbert@gondor.apana.org.au> | 2017-02-27 05:09:39 -0500 |
| commit | 016df0abc56ec06d0c63c5318ef53e40738dea8b (patch) | |
| tree | 2a9cfc6dcf8a20dc989e66b5d81d31834386f87a /include | |
| parent | c884b36816c131906038cdac4773f6c84a5bf3ee (diff) | |
crypto: api - Add crypto_requires_off helper
This patch adds crypto_requires_off which is an extension of
crypto_requires_sync for similar bits such as NEED_FALLBACK.
Cc: stable@vger.kernel.org #4.10
Suggested-by: Marcelo Cerri <marcelo.cerri@canonical.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'include')
| -rw-r--r-- | include/crypto/algapi.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/include/crypto/algapi.h b/include/crypto/algapi.h index ebe4ded0c55d..436c4c2683c7 100644 --- a/include/crypto/algapi.h +++ b/include/crypto/algapi.h | |||
| @@ -360,13 +360,18 @@ static inline struct crypto_alg *crypto_get_attr_alg(struct rtattr **tb, | |||
| 360 | return crypto_attr_alg(tb[1], type, mask); | 360 | return crypto_attr_alg(tb[1], type, mask); |
| 361 | } | 361 | } |
| 362 | 362 | ||
| 363 | static inline int crypto_requires_off(u32 type, u32 mask, u32 off) | ||
| 364 | { | ||
| 365 | return (type ^ off) & mask & off; | ||
| 366 | } | ||
| 367 | |||
| 363 | /* | 368 | /* |
| 364 | * Returns CRYPTO_ALG_ASYNC if type/mask requires the use of sync algorithms. | 369 | * Returns CRYPTO_ALG_ASYNC if type/mask requires the use of sync algorithms. |
| 365 | * Otherwise returns zero. | 370 | * Otherwise returns zero. |
| 366 | */ | 371 | */ |
| 367 | static inline int crypto_requires_sync(u32 type, u32 mask) | 372 | static inline int crypto_requires_sync(u32 type, u32 mask) |
| 368 | { | 373 | { |
| 369 | return (type ^ CRYPTO_ALG_ASYNC) & mask & CRYPTO_ALG_ASYNC; | 374 | return crypto_requires_off(type, mask, CRYPTO_ALG_ASYNC); |
| 370 | } | 375 | } |
| 371 | 376 | ||
| 372 | noinline unsigned long __crypto_memneq(const void *a, const void *b, size_t size); | 377 | noinline unsigned long __crypto_memneq(const void *a, const void *b, size_t size); |
