]> err.no Git - linux-2.6/commitdiff
[IPSEC]: Add compatibility algorithm name support
authorHerbert Xu <herbert@gondor.apana.org.au>
Sat, 12 Aug 2006 22:50:00 +0000 (08:50 +1000)
committerHerbert Xu <herbert@gondor.apana.org.au>
Thu, 21 Sep 2006 01:46:14 +0000 (11:46 +1000)
This patch adds a compatibility name field for each IPsec algorithm.  This
is needed when parameterised algorithms are used.  For example, "md5" will
become "hmac(md5)", and "aes" will become "cbc(aes)".

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
include/net/xfrm.h
net/xfrm/xfrm_algo.c
net/xfrm/xfrm_user.c

index 10396b4bde14752c1fb69fdef3546641c097eabf..e9114e41affce0e56b544483035c7845f8e46738 100644 (file)
@@ -854,6 +854,7 @@ struct xfrm_algo_comp_info {
 
 struct xfrm_algo_desc {
        char *name;
+       char *compat;
        u8 available:1;
        union {
                struct xfrm_algo_auth_info auth;
index 04e1aea58bc947b8bbef38a5bb39246228aa7910..b68974b387416c31e00b986e397e50b01e722b97 100644 (file)
@@ -359,7 +359,8 @@ static struct xfrm_algo_desc *xfrm_get_byname(struct xfrm_algo_desc *list,
                return NULL;
 
        for (i = 0; i < entries; i++) {
-               if (strcmp(name, list[i].name))
+               if (strcmp(name, list[i].name) &&
+                   (!list[i].compat || strcmp(name, list[i].compat)))
                        continue;
 
                if (list[i].available)
index 7d18ca03c80d385a24da56cd1599e74755ca1384..fa79ddc4239e071c2d524c76285631c26005e65e 100644 (file)
@@ -213,6 +213,7 @@ static int attach_one_algo(struct xfrm_algo **algpp, u8 *props,
                return -ENOMEM;
 
        memcpy(p, ualg, len);
+       strcpy(p->alg_name, algo->name);
        *algpp = p;
        return 0;
 }