Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp383545iob; Wed, 18 May 2022 04:26:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzJ2cxCjZiMeesz62zK32cwRw1i1p7UqSM5Q9eWsVcF0V96Oc0/9CM38FLekpNAcOmda5Vk X-Received: by 2002:a17:90a:9109:b0:1cb:a814:8947 with SMTP id k9-20020a17090a910900b001cba8148947mr40872466pjo.52.1652873200555; Wed, 18 May 2022 04:26:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652873200; cv=none; d=google.com; s=arc-20160816; b=QMzSZ4HYkvOhpMGuYh6z8GJY73I605sZdd7qHoIW3HD03fluYSbmd7MfxK1nNV7P0W w4UN0vdQ94Y2sRjFcaZbzM8XHtumib1EFnLrxgI3TG4PK/YBpARImAJBYolU2M0BQ6Tt Ptyvvt0+euBVDs10W4WKrci2xcggAtaNagJ+oW+Dz0Il0EC9TaXoYtZMzRgOGrn9ELxW 4EicgSmaZIgv+eeZA80p6cZ8tHEXPnRvp2Kwoxk/hoHQqoC5r1qiFOUFaixLtzZ7kzJW VOtzqOMDodzu032BnEP4q21+EAYvwtrL1bo6M4kKegZW4xjGXX/GTe9eNF8DPcpQoV1y Puhg== 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=9B8sPMF28jSzwvV8lb9uEoWchTIWoNyC8tE+OdUet84=; b=ycJsFc5lUREwKOtafRkHK5Z45d/4+T7mt3YbDVGk2gSILm5LeMN9LebGexAl28g7tB RoiqmOPB7D4tBm/vKD9MDN44FABWdM7VA1LxZu6CVn8DqB5WgKYDK3DBwYLmpVD056TC 4XCEuyHKgCbp8M8NyADs0toDst1pTr7QVIvc8DyD6UOgMkKR2M1p++rtwytiqjy+W//w z9VqJdni05jHrum6KV/MgR16DljGrcfMEoeLr3ebhHM1Lo/a7uSJmjvS9KaVrEjWUR2H irHVdTDj0nSBuX7DrvtVb/JkcK5H6A84C+SMh5V3Z8z4PG5ZEQprM3BOOfnn/PcQZ+8a Cixg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=TogrF9ay; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1: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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id p24-20020a170902a41800b001586fbb2b6dsi2088951plq.566.2022.05.18.04.26.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 May 2022 04:26:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=TogrF9ay; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1: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: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5E17216F902; Wed, 18 May 2022 04:23:24 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235414AbiERLXP (ORCPT + 99 others); Wed, 18 May 2022 07:23:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235551AbiERLXC (ORCPT ); Wed, 18 May 2022 07:23:02 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7DE1A15A77E for ; Wed, 18 May 2022 04:23:00 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id E35F61F9AF; Wed, 18 May 2022 11:22:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1652872973; 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=9B8sPMF28jSzwvV8lb9uEoWchTIWoNyC8tE+OdUet84=; b=TogrF9ay7t/s54DVD50GArrahPOX88i3xpkGYr0ODCn+4g8ijAW64b5NA/9geS6GaCr6PZ 12EyKcLfbWC1waExfTX9USdWppkBvtx3fIn0T0M1AQC4ZOMbGfznhmwrPeFgjo3WVD9Dki QHxBqJZYfClz7T44d+ma3P01v5jOVAo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1652872973; 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=9B8sPMF28jSzwvV8lb9uEoWchTIWoNyC8tE+OdUet84=; b=yNjxED+yUUkCGSFt6jVETC0r/KWZ8OlisGPWsZYzNhbC4/10lGn2ETLVZYQegXZMD4muUG +1oxHu8JkuGnnMDQ== Received: from adalid.arch.suse.de (adalid.arch.suse.de [10.161.8.13]) by relay2.suse.de (Postfix) with ESMTP id D16642C153; Wed, 18 May 2022 11:22:52 +0000 (UTC) Received: by adalid.arch.suse.de (Postfix, from userid 16045) id 71C045194507; Wed, 18 May 2022 13:22:52 +0200 (CEST) From: Hannes Reinecke To: Christoph Hellwig Cc: Sagi Grimberg , Keith Busch , linux-nvme@lists.infradead.org, linux-crypto@vger.kernel.org, Hannes Reinecke , Herbert Xu , Chaitanya Kulkarni , Himanshu Madhani Subject: [PATCH 01/11] crypto: add crypto_has_shash() Date: Wed, 18 May 2022 13:22:24 +0200 Message-Id: <20220518112234.24264-2-hare@suse.de> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20220518112234.24264-1-hare@suse.de> References: <20220518112234.24264-1-hare@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Add helper function to determine if a given synchronous hash is supported. Cc: Herbert Xu Signed-off-by: Hannes Reinecke Reviewed-by: Sagi Grimberg Reviewed-by: Chaitanya Kulkarni Reviewed-by: Himanshu Madhani --- 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