Skip to content

Commit 016df0a

Browse files
committed
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: [email protected] #4.10 Suggested-by: Marcelo Cerri <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent c884b36 commit 016df0a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

include/crypto/algapi.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,13 +360,18 @@ static inline struct crypto_alg *crypto_get_attr_alg(struct rtattr **tb,
360360
return crypto_attr_alg(tb[1], type, mask);
361361
}
362362

363+
static inline int crypto_requires_off(u32 type, u32 mask, u32 off)
364+
{
365+
return (type ^ off) & mask & off;
366+
}
367+
363368
/*
364369
* Returns CRYPTO_ALG_ASYNC if type/mask requires the use of sync algorithms.
365370
* Otherwise returns zero.
366371
*/
367372
static inline int crypto_requires_sync(u32 type, u32 mask)
368373
{
369-
return (type ^ CRYPTO_ALG_ASYNC) & mask & CRYPTO_ALG_ASYNC;
374+
return crypto_requires_off(type, mask, CRYPTO_ALG_ASYNC);
370375
}
371376

372377
noinline unsigned long __crypto_memneq(const void *a, const void *b, size_t size);

0 commit comments

Comments
 (0)