[19/26] ipsec: Use skcipher and ahash when probing algorithms
diff mbox series

Message ID E1aNKZT-0008Ew-7q@gondolin.me.apana.org.au
State New, archived
Headers show
Series
  • crypto: Use skcipher and ahash/shash where possible
Related show

Commit Message

Herbert Xu Jan. 24, 2016, 1:19 p.m. UTC
This patch removes the last reference to hash and ablkcipher from
IPsec and replaces them with ahash and skcipher respectively.  For
skcipher there is currently no difference at all, while for ahash
the current code is actually buggy and would prevent asynchronous
algorithms from being discovered.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
---

 net/xfrm/xfrm_algo.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

kernel test robot Jan. 24, 2016, 1:42 p.m. UTC | #1
Hi Herbert,

[auto build test ERROR on net/master]
[also build test ERROR on v4.4 next-20160122]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url:    https://github.com/0day-ci/linux/commits/Herbert-Xu/crypto-Use-skcipher-and-ahash-shash-where-possible/20160124-212323
config: x86_64-randconfig-x014-201604 (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

   net/xfrm/xfrm_algo.c: In function 'xfrm_probe_algs':
>> net/xfrm/xfrm_algo.c:787:12: error: implicit declaration of function 'crypto_has_ahash' [-Werror=implicit-function-declaration]
      status = crypto_has_ahash(aalg_list[i].name, 0, 0);
               ^
   cc1: some warnings being treated as errors

vim +/crypto_has_ahash +787 net/xfrm/xfrm_algo.c

   781	{
   782		int i, status;
   783	
   784		BUG_ON(in_softirq());
   785	
   786		for (i = 0; i < aalg_entries(); i++) {
 > 787			status = crypto_has_ahash(aalg_list[i].name, 0, 0);
   788			if (aalg_list[i].available != status)
   789				aalg_list[i].available = status;
   790		}

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
David Miller Jan. 25, 2016, 6:02 a.m. UTC | #2
From: Herbert Xu <herbert@gondor.apana.org.au>
Date: Sun, 24 Jan 2016 21:19:11 +0800

> This patch removes the last reference to hash and ablkcipher from
> IPsec and replaces them with ahash and skcipher respectively.  For
> skcipher there is currently no difference at all, while for ahash
> the current code is actually buggy and would prevent asynchronous
> algorithms from being discovered.
> 
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Acked-by: David S. Miller <davem@davemloft.net>

Patch
diff mbox series

diff --git a/net/xfrm/xfrm_algo.c b/net/xfrm/xfrm_algo.c
index f07224d..250e567 100644
--- a/net/xfrm/xfrm_algo.c
+++ b/net/xfrm/xfrm_algo.c
@@ -9,6 +9,8 @@ 
  * any later version.
  */
 
+#include <crypto/hash.h>
+#include <crypto/skcipher.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/pfkeyv2.h>
@@ -782,14 +784,13 @@  void xfrm_probe_algs(void)
 	BUG_ON(in_softirq());
 
 	for (i = 0; i < aalg_entries(); i++) {
-		status = crypto_has_hash(aalg_list[i].name, 0,
-					 CRYPTO_ALG_ASYNC);
+		status = crypto_has_ahash(aalg_list[i].name, 0, 0);
 		if (aalg_list[i].available != status)
 			aalg_list[i].available = status;
 	}
 
 	for (i = 0; i < ealg_entries(); i++) {
-		status = crypto_has_ablkcipher(ealg_list[i].name, 0, 0);
+		status = crypto_has_skcipher(ealg_list[i].name, 0, 0);
 		if (ealg_list[i].available != status)
 			ealg_list[i].available = status;
 	}