Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp4610961pxb; Mon, 27 Sep 2021 23:06:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzuM2rg6Hz5ySjNAV8/Jzv4DyGIhO5YGXoGEz9V24dUcVmNU2AkkIGajD8eHYNC14QkL5lP X-Received: by 2002:a17:90b:4c05:: with SMTP id na5mr3574618pjb.49.1632809181551; Mon, 27 Sep 2021 23:06:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632809181; cv=none; d=google.com; s=arc-20160816; b=vMo70yDiYvp/zBBJv3apuVBFofCD0rI1BjX9LR8fx1zPqNNLTySYV88lqn+Y6O4kMw OtkgCuADlHHw+mguPmADjOR+jfIAkZKfLFJbsFGMmREuvmSUZz0ksFt7XJiWY0RwjyeP 8AKeRC8sXjOdzZkWBxPHBSF+AUMXjCNuTlwS9RsHSYRtpein+AZHNs5OvAPpde65xZdJ sEDAOidb0FQMGx9blG5AmOJvpg8YFxzD+kk98VzPulyF5UyNcEJZdPgZR6flpJGC/DIf v++yQPCjIzKd6PqkEMZ5kcjXeLB+kcUc2KVrh469obb/X76YRHrgowLady9Vz++5iJFz uUmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=yQAKV/G2LGNuS/sfJa5NmKXWu/SnHCyYvEbPF+KVioA=; b=YooJly/rbCJMcxTKL8GXk3aH0tdcwyRFCh2hNIIqfo/UR/Yym+/+E2K41L+7V8zjD1 P9dAr/+qhcErdwXU0F+YGjkYq4EYhgH5NzXywxpwZgHZEUSdIaZfDlt75l+jbmQg3L0g X/u9UJybNe+kgwoU+LZfPENru1oPnCtPeNjrwjJsarYHxXLf+Qg067HnLflyt62/crQ2 zcFuDLp2F/4/TSfh8DJp3Eupnm3o5rNvDt3BESNEoSb0+tkB/PY+8IcXJczlO1ntRcRU mHEgp0UdgNBuLR4JBtjqdUQG7Zp4CluFnAhPMv1Y9zQFV1ByPaLZ1RHaQPELB3iTyTpX 1i8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=fSmvwDix; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k15si3773045pll.26.2021.09.27.23.06.08; Mon, 27 Sep 2021 23:06:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=fSmvwDix; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239290AbhI1GGm (ORCPT + 99 others); Tue, 28 Sep 2021 02:06:42 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:51504 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239522AbhI1GFr (ORCPT ); Tue, 28 Sep 2021 02:05:47 -0400 Received: from relay1.suse.de (relay1.suse.de [149.44.160.133]) by smtp-out1.suse.de (Postfix) with ESMTP id C32F322240; Tue, 28 Sep 2021 06:04:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1632809047; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yQAKV/G2LGNuS/sfJa5NmKXWu/SnHCyYvEbPF+KVioA=; b=fSmvwDix5Ucf/4pDDfwfD4u5sPeXEYw2cInvHT7xFarKOrCGpMvgiuNqZPlato+rk3mN9k 3Q75DEK592PQoW0VV9gYgAhQf3GtwRAQpJMglJ+/SLv3XybJdTm+nksnBKpFGvROvB8jPT QsUg+d/zhcktAEA/k5pCIb9u6hdWZCM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1632809047; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yQAKV/G2LGNuS/sfJa5NmKXWu/SnHCyYvEbPF+KVioA=; b=xQh1fI5sI2OwkHZs12rA87/JdKZGdU2WkLhVntZr/EQIwl/tTALcfVErp2xQBIsE4MQ+mC 5KVQWleY0qBumvBw== Received: from adalid.arch.suse.de (adalid.arch.suse.de [10.161.8.13]) by relay1.suse.de (Postfix) with ESMTP id 7A6E325E61; Tue, 28 Sep 2021 06:04:06 +0000 (UTC) Received: by adalid.arch.suse.de (Postfix, from userid 16045) id 3F938518EE20; Tue, 28 Sep 2021 08:04:06 +0200 (CEST) From: Hannes Reinecke To: Sagi Grimberg Cc: Christoph Hellwig , Keith Busch , Herbert Xu , "David S . Miller" , linux-nvme@lists.infradead.org, linux-crypto@vger.kernel.org, Hannes Reinecke , Chaitanya Kulkarni Subject: [PATCH 01/12] crypto: add crypto_has_shash() Date: Tue, 28 Sep 2021 08:03:45 +0200 Message-Id: <20210928060356.27338-2-hare@suse.de> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210928060356.27338-1-hare@suse.de> References: <20210928060356.27338-1-hare@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Add helper function to determine if a given synchronous hash is supported. Signed-off-by: Hannes Reinecke Reviewed-by: Sagi Grimberg Reviewed-by: Chaitanya Kulkarni --- crypto/shash.c | 6 ++++++ include/crypto/hash.h | 2 ++ 2 files changed, 8 insertions(+) diff --git a/crypto/shash.c b/crypto/shash.c index 0a0a50cb694f..4c88e63b3350 100644 --- a/crypto/shash.c +++ b/crypto/shash.c @@ -521,6 +521,12 @@ struct crypto_shash *crypto_alloc_shash(const char *alg_name, u32 type, } EXPORT_SYMBOL_GPL(crypto_alloc_shash); +int crypto_has_shash(const char *alg_name, u32 type, u32 mask) +{ + return crypto_type_has_alg(alg_name, &crypto_shash_type, type, mask); +} +EXPORT_SYMBOL_GPL(crypto_has_shash); + static int shash_prepare_alg(struct shash_alg *alg) { struct crypto_alg *base = &alg->base; diff --git a/include/crypto/hash.h b/include/crypto/hash.h index f140e4643949..f5841992dc9b 100644 --- a/include/crypto/hash.h +++ b/include/crypto/hash.h @@ -718,6 +718,8 @@ static inline void ahash_request_set_crypt(struct ahash_request *req, struct crypto_shash *crypto_alloc_shash(const char *alg_name, u32 type, u32 mask); +int crypto_has_shash(const char *alg_name, u32 type, u32 mask); + static inline struct crypto_tfm *crypto_shash_tfm(struct crypto_shash *tfm) { return &tfm->base; -- 2.29.2