Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp3600060pxt; Tue, 10 Aug 2021 07:14:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzg7Lt16POCcIyyFi1LjqorvZEfeIbofZjB+GTJqTl1YLfo0FtPrzoYrgRewUHBBZP/lMU2 X-Received: by 2002:a17:907:7251:: with SMTP id ds17mr28264083ejc.43.1628604873568; Tue, 10 Aug 2021 07:14:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628604873; cv=none; d=google.com; s=arc-20160816; b=ysCWwk46PZqohWa74kCpGyUEvHaPy+hOmGDTVVuH3K/tkfquLFDaFR28r75cgvTqlO Yrtys5BlfAM70svopdt5HVaSBZbOV+4Xe2wYmxmQJ9ZiLM9yN+RRXpKlkGtyXYElReyu bxu6VkJxaVARAWQGKFFL0Xob+kpjnumbuLU8cjhe1tRwblfIYC0TYjT+6yyGfkf7fOD9 UOCXdvyY0VeDokcPX1XpVyWj5bmvGzv3Hkayztsh1yBJ2NZ0xN1qpx/WnX9PoglSZ0G2 qD7Mu1VxU5BR67k/sV7FLfhjGDC67GUemo0kkaAlFqDhdwy6/pf6EwSNrkz/Ren/Hqc1 9fIA== 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=fXSDZW0HceQ0uVUSB6Jl5YO/WIeeZVwZeGWjktfvU9Q=; b=delR2QW+OVKu4YcA1NQVun74f1iLpymQxGgRs+JW7OS9wfiLwA+oZ4mES0ghuoMZLr AZ4Ch49uz4DwEI35RBS2j2D+4yFvU3vFGMLH+9pCwmcAie5ilhl1sXosg5URzaL2vwEU LeHAq5yKCADwkL1xTUdRiQYlyw71oizeysu7G1NnMHHTR4BfJTxbl4i//mEYNDFKVs9h X0jfGF0I5wwuLS3fjliBcoXCafI57RAZferIFJ0luYyQtAVKacewuVtSzaxyMgucITPM 4npI076V2VvqlZwtg6df2xr+Z7PyZaJz+895IK2PPUHLqNTu1xEfPJljNLuloIQnpW7p wWcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=TkWD+Gzu; 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 p8si42677edj.482.2021.08.10.07.13.38; Tue, 10 Aug 2021 07:14:33 -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=TkWD+Gzu; 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 S239087AbhHJMnP (ORCPT + 99 others); Tue, 10 Aug 2021 08:43:15 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:40750 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239115AbhHJMnP (ORCPT ); Tue, 10 Aug 2021 08:43:15 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 187B021FF5; 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=fXSDZW0HceQ0uVUSB6Jl5YO/WIeeZVwZeGWjktfvU9Q=; b=TkWD+GzusfuYPHIOxRrKqycyqOKMHSOvZ7VoOCm6gwUy7b9F4S6lTbsEv/Oa8E7+L89Nkq Hc6ip1E6qphNs91C/7uYrtiBm1KMUPSQhA1eGy6EecTqiIrrzBFc5bkemR9jFy5XFyqbrE 89b5F7VKnNhaDT5EuCiFvaHErTQKcAw= 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=fXSDZW0HceQ0uVUSB6Jl5YO/WIeeZVwZeGWjktfvU9Q=; b=LJto9s/Skfztovq/Eyf6OvfaXuDPc7CO0C6fq4VI68W/dgYYeI62N5FiuChU/7d5jZA7yL KZpH4orKFp7VAGAw== Received: from adalid.arch.suse.de (adalid.arch.suse.de [10.161.8.13]) by relay2.suse.de (Postfix) with ESMTP id 944EFA3B85; Tue, 10 Aug 2021 12:42:50 +0000 (UTC) Received: by adalid.arch.suse.de (Postfix, from userid 16045) id 57B7D518C544; 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 02/13] crypto: add crypto_has_kpp() Date: Tue, 10 Aug 2021 14:42:19 +0200 Message-Id: <20210810124230.12161-3-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 key-agreement protocol primitive is supported. Signed-off-by: Hannes Reinecke --- crypto/kpp.c | 6 ++++++ include/crypto/kpp.h | 2 ++ 2 files changed, 8 insertions(+) diff --git a/crypto/kpp.c b/crypto/kpp.c index 313b2c699963..416e8a1a03ee 100644 --- a/crypto/kpp.c +++ b/crypto/kpp.c @@ -87,6 +87,12 @@ struct crypto_kpp *crypto_alloc_kpp(const char *alg_name, u32 type, u32 mask) } EXPORT_SYMBOL_GPL(crypto_alloc_kpp); +int crypto_has_kpp(const char *alg_name, u32 type, u32 mask) +{ + return crypto_type_has_alg(alg_name, &crypto_kpp_type, type, mask); +} +EXPORT_SYMBOL_GPL(crypto_has_kpp); + static void kpp_prepare_alg(struct kpp_alg *alg) { struct crypto_alg *base = &alg->base; diff --git a/include/crypto/kpp.h b/include/crypto/kpp.h index cccceadc164b..24d01e9877c1 100644 --- a/include/crypto/kpp.h +++ b/include/crypto/kpp.h @@ -104,6 +104,8 @@ struct kpp_alg { */ struct crypto_kpp *crypto_alloc_kpp(const char *alg_name, u32 type, u32 mask); +int crypto_has_kpp(const char *alg_name, u32 type, u32 mask); + static inline struct crypto_tfm *crypto_kpp_tfm(struct crypto_kpp *tfm) { return &tfm->base; -- 2.29.2