linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* crypto/api.c: crypto_alg_available(): flags param not used.
@ 2005-01-20 12:48 Kausty
  2005-01-20 14:54 ` James Morris
  0 siblings, 1 reply; 4+ messages in thread
From: Kausty @ 2005-01-20 12:48 UTC (permalink / raw)
  To: linux-kernel

hi
A small observation. In crypto/api.c in linux-2.6.8.1

The function:
int crypto_alg_available(const char *name, u32 flags)

has a flags param which does not seem to be used.

though it does not matter much but has this been fixed in later releases?
xfrm functions in ipsec do call this function but always with flags as 0.

Thanks and regards
kausty

(sorry... not subscribed to this list, pls CC if any valuable info)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: crypto/api.c: crypto_alg_available(): flags param not used.
  2005-01-20 12:48 crypto/api.c: crypto_alg_available(): flags param not used Kausty
@ 2005-01-20 14:54 ` James Morris
  2005-10-31  5:46   ` [2.6 patch] crypto/api.c: remove the second argument of crypto_alg_available() Adrian Bunk
  0 siblings, 1 reply; 4+ messages in thread
From: James Morris @ 2005-01-20 14:54 UTC (permalink / raw)
  To: Kausty; +Cc: linux-kernel

On Thu, 20 Jan 2005, Kausty wrote:

> hi
> A small observation. In crypto/api.c in linux-2.6.8.1
> 
> The function:
> int crypto_alg_available(const char *name, u32 flags)
> 
> has a flags param which does not seem to be used.
> 
> though it does not matter much but has this been fixed in later releases?
> xfrm functions in ipsec do call this function but always with flags as 0.
> 
> Thanks and regards
> kausty

IIRC, this was to allow future code to specify preferences for the type of
algorithm driver (e.g. hardware), but has not been used.  This is an
example of why it's a bad idea to add infrastructure which isn't being
used at the time.


- James
-- 
James Morris
<jmorris@redhat.com>



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [2.6 patch] crypto/api.c: remove the second argument of crypto_alg_available()
  2005-01-20 14:54 ` James Morris
@ 2005-10-31  5:46   ` Adrian Bunk
  2005-10-31 11:58     ` Herbert Xu
  0 siblings, 1 reply; 4+ messages in thread
From: Adrian Bunk @ 2005-10-31  5:46 UTC (permalink / raw)
  To: James Morris; +Cc: Kausty, linux-kernel, herbert, davem, linux-crypto

On Thu, Jan 20, 2005 at 09:54:28AM -0500, James Morris wrote:
> On Thu, 20 Jan 2005, Kausty wrote:
> 
> > hi
> > A small observation. In crypto/api.c in linux-2.6.8.1
> > 
> > The function:
> > int crypto_alg_available(const char *name, u32 flags)
> > 
> > has a flags param which does not seem to be used.
> > 
> > though it does not matter much but has this been fixed in later releases?
> > xfrm functions in ipsec do call this function but always with flags as 0.
> > 
> > Thanks and regards
> > kausty
> 
> IIRC, this was to allow future code to specify preferences for the type of
> algorithm driver (e.g. hardware), but has not been used.  This is an
> example of why it's a bad idea to add infrastructure which isn't being
> used at the time.

Since it's still unused, a patch to remove this second argument is 
below.

> - James

cu
Adrian


<--  snip  -->


The second argument of crypto_alg_available() was not used and is 
therefore removed in this patch.


Signed-off-by: Adrian Bunk <bunk@stusta.de>

---

 crypto/api.c           |    2 +-
 crypto/tcrypt.c        |    2 +-
 drivers/net/ppp_mppe.c |    4 ++--
 include/linux/crypto.h |    4 ++--
 net/xfrm/xfrm_algo.c   |    8 ++++----
 5 files changed, 10 insertions(+), 10 deletions(-)

--- linux-2.6.14-rc5-mm1-full/include/linux/crypto.h.old	2005-10-31 06:23:42.000000000 +0100
+++ linux-2.6.14-rc5-mm1-full/include/linux/crypto.h	2005-10-31 06:23:56.000000000 +0100
@@ -152,9 +152,9 @@
  * Algorithm query interface.
  */
 #ifdef CONFIG_CRYPTO
-int crypto_alg_available(const char *name, u32 flags);
+int crypto_alg_available(const char *name);
 #else
-static inline int crypto_alg_available(const char *name, u32 flags)
+static inline int crypto_alg_available(const char *name)
 {
 	return 0;
 }
--- linux-2.6.14-rc5-mm1-full/crypto/api.c.old	2005-10-31 06:24:05.000000000 +0100
+++ linux-2.6.14-rc5-mm1-full/crypto/api.c	2005-10-31 06:24:12.000000000 +0100
@@ -300,7 +300,7 @@
 	return ret;
 }
 
-int crypto_alg_available(const char *name, u32 flags)
+int crypto_alg_available(const char *name)
 {
 	int ret = 0;
 	struct crypto_alg *alg = crypto_alg_mod_lookup(name);
--- linux-2.6.14-rc5-mm1-full/crypto/tcrypt.c.old	2005-10-31 06:24:20.000000000 +0100
+++ linux-2.6.14-rc5-mm1-full/crypto/tcrypt.c	2005-10-31 06:24:26.000000000 +0100
@@ -753,7 +753,7 @@
 
 	while (*name) {
 		printk("alg %s ", *name);
-		printk((crypto_alg_available(*name, 0)) ?
+		printk((crypto_alg_available(*name)) ?
 			"found\n" : "not found\n");
 		name++;
 	}
--- linux-2.6.14-rc5-mm1-full/drivers/net/ppp_mppe.c.old	2005-10-31 06:24:35.000000000 +0100
+++ linux-2.6.14-rc5-mm1-full/drivers/net/ppp_mppe.c	2005-10-31 06:24:41.000000000 +0100
@@ -695,8 +695,8 @@
 static int __init ppp_mppe_init(void)
 {
 	int answer;
-	if (!(crypto_alg_available("arc4", 0) &&
-	      crypto_alg_available("sha1", 0)))
+	if (!(crypto_alg_available("arc4") &&
+	      crypto_alg_available("sha1")))
 		return -ENODEV;
 
 	sha_pad = kmalloc(sizeof(struct sha_pad), GFP_KERNEL);
--- linux-2.6.14-rc5-mm1-full/net/xfrm/xfrm_algo.c.old	2005-10-31 06:24:51.000000000 +0100
+++ linux-2.6.14-rc5-mm1-full/net/xfrm/xfrm_algo.c	2005-10-31 06:25:06.000000000 +0100
@@ -369,7 +369,7 @@
 		if (!probe)
 			break;
 
-		status = crypto_alg_available(name, 0);
+		status = crypto_alg_available(name);
 		if (!status)
 			break;
 
@@ -428,19 +428,19 @@
 	BUG_ON(in_softirq());
 
 	for (i = 0; i < aalg_entries(); i++) {
-		status = crypto_alg_available(aalg_list[i].name, 0);
+		status = crypto_alg_available(aalg_list[i].name);
 		if (aalg_list[i].available != status)
 			aalg_list[i].available = status;
 	}
 	
 	for (i = 0; i < ealg_entries(); i++) {
-		status = crypto_alg_available(ealg_list[i].name, 0);
+		status = crypto_alg_available(ealg_list[i].name);
 		if (ealg_list[i].available != status)
 			ealg_list[i].available = status;
 	}
 	
 	for (i = 0; i < calg_entries(); i++) {
-		status = crypto_alg_available(calg_list[i].name, 0);
+		status = crypto_alg_available(calg_list[i].name);
 		if (calg_list[i].available != status)
 			calg_list[i].available = status;
 	}


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [2.6 patch] crypto/api.c: remove the second argument of crypto_alg_available()
  2005-10-31  5:46   ` [2.6 patch] crypto/api.c: remove the second argument of crypto_alg_available() Adrian Bunk
@ 2005-10-31 11:58     ` Herbert Xu
  0 siblings, 0 replies; 4+ messages in thread
From: Herbert Xu @ 2005-10-31 11:58 UTC (permalink / raw)
  To: Adrian Bunk; +Cc: James Morris, Kausty, linux-kernel, davem, linux-crypto

On Mon, Oct 31, 2005 at 06:46:42AM +0100, Adrian Bunk wrote:
>
> > IIRC, this was to allow future code to specify preferences for the type of
> > algorithm driver (e.g. hardware), but has not been used.  This is an
> > example of why it's a bad idea to add infrastructure which isn't being
> > used at the time.
> 
> Since it's still unused, a patch to remove this second argument is 
> below.

I'll be using this field very soon to indicate that the caller intends
to find synchronous algorithms only as opposed to either synchronous or
asynchronous.  So I'd like to keep it for now.

Thanks,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-10-31 12:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-20 12:48 crypto/api.c: crypto_alg_available(): flags param not used Kausty
2005-01-20 14:54 ` James Morris
2005-10-31  5:46   ` [2.6 patch] crypto/api.c: remove the second argument of crypto_alg_available() Adrian Bunk
2005-10-31 11:58     ` Herbert Xu

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).