Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3881040rdb; Thu, 14 Sep 2023 05:47:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFEkTCpuOyIGryi3c+V2aDZ7hUFx7sX9hI3w2/323pYWIoWW1sglk51p2p8bk9uDvLLwPqn X-Received: by 2002:a05:6a20:4289:b0:13e:9dba:ea43 with SMTP id o9-20020a056a20428900b0013e9dbaea43mr2427882pzj.2.1694695671263; Thu, 14 Sep 2023 05:47:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694695671; cv=none; d=google.com; s=arc-20160816; b=pO9Yo5bN2H8mba+RcnQDlfSkXM2D+FUdYir+TKYq9VpnJS+EMPhBKsowK6MsEDx9el NevavuRNFTQTxXBLn8CQCetDz2Q6qmAmao4Sh/LOv+NuAJddn03zQ/toogZmheICy6o0 9U0Sfz/YGNgTo+8tarIWGZpnNLGRgkei0udx7z7Hr0nkypwvkdtND0KXV5PSNIAFFFGu PcYxCHay2/uUGS9UajQUyTuBsqtWj0gUjFR26SB6oqLnyY7vpLP3+Ej3y51q94eEZ/yQ mo1zRtK59ZfEVNshKyWU8jWyKFAvf/VEC1k5kseKLNc2t6Xt33AUZQ/IKaw39M5lTNxc vw3w== 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:sender :dkim-signature; bh=r/EigJm6/HUiXf1GCjkqew1cMCZsb5UD7SJBMzmN1lY=; fh=4tfMtIlwPZI19DAizsta/+tnqD+bc5RGCYEvvk+baVs=; b=y2WJM0J7afS35Umb6JI5MvZPNT1Rr/bZyuJGTwu2zLXvlxMplcaq0OyZg3n+6geuFg LMzaib+52ntqIeAys/MyMs81a/Ff+7aM7h75z6OVSSd66I03RwoZ2I12k8FW2nmJ/EV5 OUuvlnK54opKEnyjVpqem3IYEmm1Pa8+JMajyLvRmXsrg4ecl22vfpAy3R8DEeRy0OJ9 dsoF89xC/BJ2Y9vYgkTluYTcb9T88CA2F7UdHxcM0NEK5gA5uYw4qFYzQWM5wjMbYIpa kZIae3V3iwX3JDI0EIXrcq1jhCtUvAtHO+h8MPctPyfh1wrmOdbCTjsqcB0TlZjvN+5H SxKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=HrseTqmV; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id d26-20020a63735a000000b0057745d87b4csi1419471pgn.526.2023.09.14.05.47.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 05:47:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=HrseTqmV; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 094D1801E6B7; Thu, 14 Sep 2023 01:28:47 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236361AbjINI2o (ORCPT + 99 others); Thu, 14 Sep 2023 04:28:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236441AbjINI2e (ORCPT ); Thu, 14 Sep 2023 04:28:34 -0400 Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C400C1FF9 for ; Thu, 14 Sep 2023 01:28:30 -0700 (PDT) Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-1bf1935f6c2so5467605ad.1 for ; Thu, 14 Sep 2023 01:28:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694680110; x=1695284910; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=r/EigJm6/HUiXf1GCjkqew1cMCZsb5UD7SJBMzmN1lY=; b=HrseTqmVbQHnGFiT7quB71kwp1p7PPgraeEMf3kxPHOvxUgIO3l88p27l8VuuJbQG4 yMWEvU9g25eUKqGbhMKdEUK8sg4AHSGmUPzu6lWzAIy6zjeEiHY09DFXPA08PwB6fs56 Ia7RpHFzbau+g8E+DAJRP6bYm3Tq60uDZow/tNzEIRqoxbwFQzvZgFnbhq3aPVXyzW0X bXyZnc14LFxX/y5UPRBYBvx0qPdYGY5TjiCJgS6sgaOipFoo4a61TIcB10jk7wEYIpQy 2Mnv8uM70+t+qWvd0CsyfqmxfNQQ6eMsRcjROVKCuWnJ1iUjnsFOkZKsw/SDt/qfSQv4 22bQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694680110; x=1695284910; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=r/EigJm6/HUiXf1GCjkqew1cMCZsb5UD7SJBMzmN1lY=; b=QANEtdpcB+nk6tccNtiXTyEwYUXA2zsV9+8RhZtVDZpUxFSwCxKAiojzKxm5EMbiOP LESbK/TC0Rhqm3TwbpPvJ9yCusyPbYRjeKrKXiOx/8E/NtyqzkN7j+sTr2uPNjyuySVJ pWpPbo1T9DhX7OCbMmhUL1z/TKpk/n4pHFReOojQqgvpz9P1acN7cv6RlTiDFn3Om1SU /ASODwa0pBVTqZh6FvP++ZXLoSibzcYkti+9hoR8ikOqkmZsaQ52SJyYiv3SLGVxdlOr QOunz9AOp1nlTaQwb9oXCH3zMoh6mj9n9fqH5ZeZe8aFZ+g8PK7joHF2wIoCKUq5kejS tS0Q== X-Gm-Message-State: AOJu0Yy64dEXyeajpObaHAvo/O+rK5eovmM2JO1XBE7MzNLbutugIGaA vp/CoRvOTP5bjILVIVGEfLGL5WNjW9Q= X-Received: by 2002:a17:902:ec88:b0:1c3:22a9:8643 with SMTP id x8-20020a170902ec8800b001c322a98643mr1479822plg.31.1694680109964; Thu, 14 Sep 2023 01:28:29 -0700 (PDT) Received: from loth.rohan.me.apana.org.au ([2404:c804:1b2a:5507:c00a:8aff:fe00:b003]) by smtp.gmail.com with ESMTPSA id b13-20020a170902d50d00b001bba3a4888bsm976242plg.102.2023.09.14.01.28.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 01:28:29 -0700 (PDT) Sender: Herbert Xu From: Herbert Xu To: Linux Crypto Mailing List Cc: Ard Biesheuvel Subject: [PATCH 1/8] crypto: aead - Add crypto_has_aead Date: Thu, 14 Sep 2023 16:28:21 +0800 Message-Id: <20230914082828.895403-2-herbert@gondor.apana.org.au> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230914082828.895403-1-herbert@gondor.apana.org.au> References: <20230914082828.895403-1-herbert@gondor.apana.org.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Thu, 14 Sep 2023 01:28:47 -0700 (PDT) X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Add the helper crypto_has_aead. This is meant to replace the existing use of crypto_has_alg to locate AEAD algorithms. Signed-off-by: Herbert Xu --- crypto/aead.c | 6 ++++++ include/crypto/aead.h | 12 ++++++++++++ 2 files changed, 18 insertions(+) diff --git a/crypto/aead.c b/crypto/aead.c index d5ba204ebdbf..54906633566a 100644 --- a/crypto/aead.c +++ b/crypto/aead.c @@ -269,6 +269,12 @@ struct crypto_aead *crypto_alloc_aead(const char *alg_name, u32 type, u32 mask) } EXPORT_SYMBOL_GPL(crypto_alloc_aead); +int crypto_has_aead(const char *alg_name, u32 type, u32 mask) +{ + return crypto_type_has_alg(alg_name, &crypto_aead_type, type, mask); +} +EXPORT_SYMBOL_GPL(crypto_has_aead); + static int aead_prepare_alg(struct aead_alg *alg) { struct crypto_istat_aead *istat = aead_get_stat(alg); diff --git a/include/crypto/aead.h b/include/crypto/aead.h index 35e45b854a6f..51382befbe37 100644 --- a/include/crypto/aead.h +++ b/include/crypto/aead.h @@ -217,6 +217,18 @@ static inline void crypto_free_aead(struct crypto_aead *tfm) crypto_destroy_tfm(tfm, crypto_aead_tfm(tfm)); } +/** + * crypto_has_aead() - Search for the availability of an aead. + * @alg_name: is the cra_name / name or cra_driver_name / driver name of the + * aead + * @type: specifies the type of the aead + * @mask: specifies the mask for the aead + * + * Return: true when the aead is known to the kernel crypto API; false + * otherwise + */ +int crypto_has_aead(const char *alg_name, u32 type, u32 mask); + static inline const char *crypto_aead_driver_name(struct crypto_aead *tfm) { return crypto_tfm_alg_driver_name(crypto_aead_tfm(tfm)); -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt