Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964857AbdCJJdU (ORCPT ); Fri, 10 Mar 2017 04:33:20 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:42544 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935583AbdCJJdR (ORCPT ); Fri, 10 Mar 2017 04:33:17 -0500 From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marcelo Cerri , Herbert Xu Subject: [PATCH 4.10 096/167] crypto: api - Add crypto_requires_off helper Date: Fri, 10 Mar 2017 10:08:59 +0100 Message-Id: <20170310084002.135981777@linuxfoundation.org> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20170310083956.767605269@linuxfoundation.org> References: <20170310083956.767605269@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1275 Lines: 42 4.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Herbert Xu commit 016df0abc56ec06d0c63c5318ef53e40738dea8b upstream. This patch adds crypto_requires_off which is an extension of crypto_requires_sync for similar bits such as NEED_FALLBACK. Suggested-by: Marcelo Cerri Signed-off-by: Herbert Xu Signed-off-by: Greg Kroah-Hartman --- include/crypto/algapi.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) --- a/include/crypto/algapi.h +++ b/include/crypto/algapi.h @@ -344,13 +344,18 @@ static inline struct crypto_alg *crypto_ return crypto_attr_alg(tb[1], type, mask); } +static inline int crypto_requires_off(u32 type, u32 mask, u32 off) +{ + return (type ^ off) & mask & off; +} + /* * Returns CRYPTO_ALG_ASYNC if type/mask requires the use of sync algorithms. * Otherwise returns zero. */ static inline int crypto_requires_sync(u32 type, u32 mask) { - return (type ^ CRYPTO_ALG_ASYNC) & mask & CRYPTO_ALG_ASYNC; + return crypto_requires_off(type, mask, CRYPTO_ALG_ASYNC); } noinline unsigned long __crypto_memneq(const void *a, const void *b, size_t size);