Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp1199094pxv; Fri, 16 Jul 2021 04:05:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzWc3XhYvWgBhdTUYTXxHh2Bosl4rDPyVuDck8XB+h4tCPbccW6diMRT5zjsJzETl/IV4Op X-Received: by 2002:aa7:c804:: with SMTP id a4mr14001862edt.294.1626433524270; Fri, 16 Jul 2021 04:05:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626433524; cv=none; d=google.com; s=arc-20160816; b=mgIHg8grMk7QgEVNTvCZSUlUNGeXS1+xc0yeLJh2x+hz6Zn4fYggMcqkBn8WGVv1Ay VGtDNATbkUPn+3Z8510MwN7xm0keYb/Yy0/G5BfPXsP1AKROHmnWqYMdoH2GtEA1iojR dHZEIV0hAX4c51bO5dCCasX0rB5A1WZjiKzgQncBU07KS3PizcFQ3286YpbZxWIlOfDV 97jFHiYkZ99rOn9qbdKNOAb/78+9kVunZ09hJ8F3uTgdUzcYYbThb6j6eiZCYU6Xg2EA oX4g8hVgqIFcELYoXY4z7MhMI5ZVFltYN5ZPTSSJD7dloB5X6estdsGuooSH9OPyPPwz X6hg== 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=zrhwWEeGhqBzwG4fO6ATjJUgff+ThHnR+gJis2gc95M=; b=gRTaaaC/42MBErkNVW6eL0giCqA7ft82GDYBEJJg0z1JG6DA0zHai00xAAuTtfjOER pqcv3wShUjPMMvERFybAeRqYborBBC1Pp+Dad5DCZQlsIzx5kf9JCuPBd+rOF4YCBeY5 8rlUGvKdSzJX4yLeThfBdjkyzVUIym3XApiJNbNyVkNHdgBsNF1N0qYmzfgw0a1bjxiD Rn4G9RbylqwCLTTF4nBSLljMvZsqxd47ooLYsvfoVgTYKaA0YB74MsfIRCgs+s3KlFJa We8zDn0shsvHB5Udm8V99xEmiawQxhfq9k5Lg4U2g4+YDJc3Xzh23ZlSV1GcpAWPZgG1 sGsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b="VQmHpAj/"; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=vfz0mVwb; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z16si14489390edm.532.2021.07.16.04.04.59; Fri, 16 Jul 2021 04:05:24 -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="VQmHpAj/"; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=vfz0mVwb; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232088AbhGPLHu (ORCPT + 99 others); Fri, 16 Jul 2021 07:07:50 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:49488 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232048AbhGPLHi (ORCPT ); Fri, 16 Jul 2021 07:07:38 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 4CDF122BAA; Fri, 16 Jul 2021 11:04:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1626433482; 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=zrhwWEeGhqBzwG4fO6ATjJUgff+ThHnR+gJis2gc95M=; b=VQmHpAj/NbJ/Ezbp113kYFdj68/uPj6ZMrLRCMoHYdiVQDf04nR7jI/+Fj6zOcPI8mFUqs cp32JdQ48X1o6XeHDj3BiXh0AyaXJ1uyqxttzOXBLl/wGXfOGKMkmzzkoivhxe7NpVpl4u VBCXULpag/YpaTl4coSM/19wGZQOX3k= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1626433482; 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=zrhwWEeGhqBzwG4fO6ATjJUgff+ThHnR+gJis2gc95M=; b=vfz0mVwb5/+EeB1ZtVj5Q4DREYyNCKfp+ngAVjQh3EZaaHHJfQx3mqwFcXVVOqs0Mc/E/p UqHcsAAGaQZUaDDw== Received: from adalid.arch.suse.de (adalid.arch.suse.de [10.161.8.13]) by relay2.suse.de (Postfix) with ESMTP id AF85BA3BAF; Fri, 16 Jul 2021 11:04:41 +0000 (UTC) Received: by adalid.arch.suse.de (Postfix, from userid 16045) id 749105171606; Fri, 16 Jul 2021 13:04:41 +0200 (CEST) From: Hannes Reinecke To: Christoph Hellwig Cc: Sagi Grimberg , Keith Busch , linux-nvme@lists.infradead.org, Herbert Xu , "David S . Miller" , linux-crypto@vger.kernel.org, Hannes Reinecke Subject: [PATCH 01/11] crypto: add crypto_has_shash() Date: Fri, 16 Jul 2021 13:04:18 +0200 Message-Id: <20210716110428.9727-2-hare@suse.de> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210716110428.9727-1-hare@suse.de> References: <20210716110428.9727-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 --- 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