From: Eric Biggers <ebiggers@kernel.org>
To: linux-crypto@vger.kernel.org
Subject: [PATCH 1/5] crypto: unify the crypto_has_skcipher*() functions
Date: Fri, 25 Oct 2019 12:41:09 -0700 [thread overview]
Message-ID: <20191025194113.217451-2-ebiggers@kernel.org> (raw)
In-Reply-To: <20191025194113.217451-1-ebiggers@kernel.org>
From: Eric Biggers <ebiggers@google.com>
crypto_has_skcipher() and crypto_has_skcipher2() do the same thing: they
check for the availability of an algorithm of type skcipher, blkcipher,
or ablkcipher, which also meets any non-type constraints the caller
specified. And they have exactly the same prototype.
Therefore, eliminate the redundancy by removing crypto_has_skcipher()
and renaming crypto_has_skcipher2() to crypto_has_skcipher().
Signed-off-by: Eric Biggers <ebiggers@google.com>
---
crypto/skcipher.c | 4 ++--
include/crypto/skcipher.h | 19 +------------------
2 files changed, 3 insertions(+), 20 deletions(-)
diff --git a/crypto/skcipher.c b/crypto/skcipher.c
index 22753c1c7202..233678d07816 100644
--- a/crypto/skcipher.c
+++ b/crypto/skcipher.c
@@ -1017,12 +1017,12 @@ struct crypto_sync_skcipher *crypto_alloc_sync_skcipher(
}
EXPORT_SYMBOL_GPL(crypto_alloc_sync_skcipher);
-int crypto_has_skcipher2(const char *alg_name, u32 type, u32 mask)
+int crypto_has_skcipher(const char *alg_name, u32 type, u32 mask)
{
return crypto_type_has_alg(alg_name, &crypto_skcipher_type2,
type, mask);
}
-EXPORT_SYMBOL_GPL(crypto_has_skcipher2);
+EXPORT_SYMBOL_GPL(crypto_has_skcipher);
static int skcipher_prepare_alg(struct skcipher_alg *alg)
{
diff --git a/include/crypto/skcipher.h b/include/crypto/skcipher.h
index aada87916918..e34993f5d190 100644
--- a/include/crypto/skcipher.h
+++ b/include/crypto/skcipher.h
@@ -218,30 +218,13 @@ static inline void crypto_free_sync_skcipher(struct crypto_sync_skcipher *tfm)
* crypto_has_skcipher() - Search for the availability of an skcipher.
* @alg_name: is the cra_name / name or cra_driver_name / driver name of the
* skcipher
- * @type: specifies the type of the cipher
- * @mask: specifies the mask for the cipher
- *
- * Return: true when the skcipher is known to the kernel crypto API; false
- * otherwise
- */
-static inline int crypto_has_skcipher(const char *alg_name, u32 type,
- u32 mask)
-{
- return crypto_has_alg(alg_name, crypto_skcipher_type(type),
- crypto_skcipher_mask(mask));
-}
-
-/**
- * crypto_has_skcipher2() - Search for the availability of an skcipher.
- * @alg_name: is the cra_name / name or cra_driver_name / driver name of the
- * skcipher
* @type: specifies the type of the skcipher
* @mask: specifies the mask for the skcipher
*
* Return: true when the skcipher is known to the kernel crypto API; false
* otherwise
*/
-int crypto_has_skcipher2(const char *alg_name, u32 type, u32 mask);
+int crypto_has_skcipher(const char *alg_name, u32 type, u32 mask);
static inline const char *crypto_skcipher_driver_name(
struct crypto_skcipher *tfm)
--
2.23.0
next prev parent reply other threads:[~2019-10-25 19:45 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-25 19:41 [PATCH 0/5] crypto: remove blkcipher Eric Biggers
2019-10-25 19:41 ` Eric Biggers [this message]
2019-10-25 19:41 ` [PATCH 2/5] crypto: remove crypto_has_ablkcipher() Eric Biggers
2019-10-25 19:41 ` [PATCH 3/5] crypto: rename crypto_skcipher_type2 to crypto_skcipher_type Eric Biggers
2019-10-25 19:41 ` [PATCH 4/5] crypto: remove the "blkcipher" algorithm type Eric Biggers
2019-10-25 19:41 ` [PATCH 5/5] crypto: rename the crypto_blkcipher module and kconfig option Eric Biggers
2019-10-26 15:32 ` [PATCH 0/5] crypto: remove blkcipher Ard Biesheuvel
2019-10-26 16:19 ` Eric Biggers
2019-10-26 16:22 ` Ard Biesheuvel
2019-11-01 6:12 ` Herbert Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191025194113.217451-2-ebiggers@kernel.org \
--to=ebiggers@kernel.org \
--cc=linux-crypto@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).