Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp3600013pxt; Tue, 10 Aug 2021 07:14:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxiggmflv8CioKs+SgAKTBIL1odBnVcl8EldPV+n7MsEe7rGJ6Nts/YwqlfOgIOXDkDxXax X-Received: by 2002:a7b:c309:: with SMTP id k9mr23481969wmj.48.1628604870224; Tue, 10 Aug 2021 07:14:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628604870; cv=none; d=google.com; s=arc-20160816; b=EJmdfqwnAKo99caB4k+j3k1DMKrCn2G3fJwG7RGmN8LwurQLd/o0htaNUvWplgw5Hj CzcdfAgZNASeHBf9HtpD5x0FoChzBIDDzvEDqmmctZZbozdz4R45AjfGczOS5vpq/nXq 8wkhpQyf7miAQyGCGkKj86L01D/VkhZH4vnxxe03pN10jvNIpGFsS+iXwFv+xn2eZ/z6 LQftVXZPFfLnP9sRt01d5lpo1O3Z7xnHqbuc54hsVoeZqKp+s2hPiOhQZzMu0BzPUeP/ lNIhwHHLe/h/PAHkmW9BQEtmZ5FZtButGBAzCyksk3T3gdUSqTmsP1dUfSVuyODF2TZa z6MQ== 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=h4kRwneFcaTJF4lFtn4IhGUb2A23SFEyqotd5MnVr59lGih7XEQIZTxWhzEkXDwGGM dhog/QoDaL0W4AoKsA5QR0r0NtqD0eGkzct7tVokd+UzEoVormsdDG25CQ+uQ6rY20YW IaElqbkdqtZ8gjIJ2PNs8AE4qkUa4bKpkHEaw33hx+uQXYk3tA2x+uq88jqtfxZmyy6b Lm3gWO+aJ0VZgZKctBqCThSYVejabO+ZQ03v6QYGyp2aip6myz6EpV2LaGNZsDKke4n2 tfSysJUWM1TTdHNjL9wCE3xSywUr72AYabMO12R7rFs4mNfRz8dGiXi16l6j1gaWjM37 JBgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=yxIPTQ8B; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=c1Vm88cQ; 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 v10si5244356edr.564.2021.08.10.07.14.05; Tue, 10 Aug 2021 07:14:30 -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=yxIPTQ8B; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=c1Vm88cQ; 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 S240728AbhHJMnP (ORCPT + 99 others); Tue, 10 Aug 2021 08:43:15 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:43618 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239087AbhHJMnP (ORCPT ); Tue, 10 Aug 2021 08:43:15 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 19401200AE; Tue, 10 Aug 2021 12:42:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1628599372; 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=yxIPTQ8BhCO9PRyFK4yOHK/grPX91BMKnConxNCMejtQKLoDidxlWhNYYCfo+e9n8s28Ks 60uwFkLeh+f5LtbPvucy7Q+oQfEwPLnf/hwzUXeCGix0pY9jGjBQT+LTwelh3U6Bxqgqz5 /5NTV0yWmjTDgjrtA/vhPtV5GEGkAyg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1628599372; 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=c1Vm88cQXKcvAGAuw5PTfUDYfqVe8rro2hftSFHTiC3zK6cV8kSgC6SwQ16+XSMQx2Psck kl1Ga2ObVSZeAGCw== Received: from adalid.arch.suse.de (adalid.arch.suse.de [10.161.8.13]) by relay2.suse.de (Postfix) with ESMTP id 94600A3B88; Tue, 10 Aug 2021 12:42:50 +0000 (UTC) Received: by adalid.arch.suse.de (Postfix, from userid 16045) id 544EA518C542; Tue, 10 Aug 2021 14:42:50 +0200 (CEST) From: Hannes Reinecke To: Christoph Hellwig Cc: Sagi Grimberg , Keith Busch , Herbert Xu , "David S . Miller" , linux-nvme@lists.infradead.org, linux-crypto@vger.kernel.org, Hannes Reinecke Subject: [PATCH 01/13] crypto: add crypto_has_shash() Date: Tue, 10 Aug 2021 14:42:18 +0200 Message-Id: <20210810124230.12161-2-hare@suse.de> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210810124230.12161-1-hare@suse.de> References: <20210810124230.12161-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