xfrm: fix __xfrm_route_forward()
[linux-2.6.git] / net / xfrm / xfrm_algo.c
index faf54c6..58064d9 100644 (file)
@@ -125,6 +125,22 @@ static struct xfrm_algo_desc aead_list[] = {
                .sadb_alg_maxbits = 256
        }
 },
+{
+       .name = "rfc4543(gcm(aes))",
+
+       .uinfo = {
+               .aead = {
+                       .icv_truncbits = 128,
+               }
+       },
+
+       .desc = {
+               .sadb_alg_id = SADB_X_EALG_NULL_AES_GMAC,
+               .sadb_alg_ivlen = 8,
+               .sadb_alg_minbits = 128,
+               .sadb_alg_maxbits = 256
+       }
+},
 };
 
 static struct xfrm_algo_desc aalg_list[] = {
@@ -200,6 +216,40 @@ static struct xfrm_algo_desc aalg_list[] = {
        }
 },
 {
+       .name = "hmac(sha384)",
+
+       .uinfo = {
+               .auth = {
+                       .icv_truncbits = 192,
+                       .icv_fullbits = 384,
+               }
+       },
+
+       .desc = {
+               .sadb_alg_id = SADB_X_AALG_SHA2_384HMAC,
+               .sadb_alg_ivlen = 0,
+               .sadb_alg_minbits = 384,
+               .sadb_alg_maxbits = 384
+       }
+},
+{
+       .name = "hmac(sha512)",
+
+       .uinfo = {
+               .auth = {
+                       .icv_truncbits = 256,
+                       .icv_fullbits = 512,
+               }
+       },
+
+       .desc = {
+               .sadb_alg_id = SADB_X_AALG_SHA2_512HMAC,
+               .sadb_alg_ivlen = 0,
+               .sadb_alg_minbits = 512,
+               .sadb_alg_maxbits = 512
+       }
+},
+{
        .name = "hmac(rmd160)",
        .compat = "rmd160",
 
@@ -365,6 +415,7 @@ static struct xfrm_algo_desc ealg_list[] = {
 },
 {
        .name = "cbc(camellia)",
+       .compat = "camellia",
 
        .uinfo = {
                .encr = {
@@ -567,21 +618,21 @@ static int xfrm_alg_name_match(const struct xfrm_algo_desc *entry,
                        (entry->compat && !strcmp(name, entry->compat)));
 }
 
-struct xfrm_algo_desc *xfrm_aalg_get_byname(char *name, int probe)
+struct xfrm_algo_desc *xfrm_aalg_get_byname(const char *name, int probe)
 {
        return xfrm_find_algo(&xfrm_aalg_list, xfrm_alg_name_match, name,
                              probe);
 }
 EXPORT_SYMBOL_GPL(xfrm_aalg_get_byname);
 
-struct xfrm_algo_desc *xfrm_ealg_get_byname(char *name, int probe)
+struct xfrm_algo_desc *xfrm_ealg_get_byname(const char *name, int probe)
 {
        return xfrm_find_algo(&xfrm_ealg_list, xfrm_alg_name_match, name,
                              probe);
 }
 EXPORT_SYMBOL_GPL(xfrm_ealg_get_byname);
 
-struct xfrm_algo_desc *xfrm_calg_get_byname(char *name, int probe)
+struct xfrm_algo_desc *xfrm_calg_get_byname(const char *name, int probe)
 {
        return xfrm_find_algo(&xfrm_calg_list, xfrm_alg_name_match, name,
                              probe);
@@ -603,7 +654,7 @@ static int xfrm_aead_name_match(const struct xfrm_algo_desc *entry,
               !strcmp(name, entry->name);
 }
 
-struct xfrm_algo_desc *xfrm_aead_get_byname(char *name, int icv_len, int probe)
+struct xfrm_algo_desc *xfrm_aead_get_byname(const char *name, int icv_len, int probe)
 {
        struct xfrm_aead_name data = {
                .name = name,
@@ -689,84 +740,6 @@ int xfrm_count_enc_supported(void)
 }
 EXPORT_SYMBOL_GPL(xfrm_count_enc_supported);
 
-/* Move to common area: it is shared with AH. */
-
-int skb_icv_walk(const struct sk_buff *skb, struct hash_desc *desc,
-                int offset, int len, icv_update_fn_t icv_update)
-{
-       int start = skb_headlen(skb);
-       int i, copy = start - offset;
-       struct sk_buff *frag_iter;
-       struct scatterlist sg;
-       int err;
-
-       /* Checksum header. */
-       if (copy > 0) {
-               if (copy > len)
-                       copy = len;
-
-               sg_init_one(&sg, skb->data + offset, copy);
-
-               err = icv_update(desc, &sg, copy);
-               if (unlikely(err))
-                       return err;
-
-               if ((len -= copy) == 0)
-                       return 0;
-               offset += copy;
-       }
-
-       for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
-               int end;
-
-               WARN_ON(start > offset + len);
-
-               end = start + skb_shinfo(skb)->frags[i].size;
-               if ((copy = end - offset) > 0) {
-                       skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
-
-                       if (copy > len)
-                               copy = len;
-
-                       sg_init_table(&sg, 1);
-                       sg_set_page(&sg, frag->page, copy,
-                                   frag->page_offset + offset-start);
-
-                       err = icv_update(desc, &sg, copy);
-                       if (unlikely(err))
-                               return err;
-
-                       if (!(len -= copy))
-                               return 0;
-                       offset += copy;
-               }
-               start = end;
-       }
-
-       skb_walk_frags(skb, frag_iter) {
-               int end;
-
-               WARN_ON(start > offset + len);
-
-               end = start + frag_iter->len;
-               if ((copy = end - offset) > 0) {
-                       if (copy > len)
-                               copy = len;
-                       err = skb_icv_walk(frag_iter, desc, offset-start,
-                                          copy, icv_update);
-                       if (unlikely(err))
-                               return err;
-                       if ((len -= copy) == 0)
-                               return 0;
-                       offset += copy;
-               }
-               start = end;
-       }
-       BUG_ON(len);
-       return 0;
-}
-EXPORT_SYMBOL_GPL(skb_icv_walk);
-
 #if defined(CONFIG_INET_ESP) || defined(CONFIG_INET_ESP_MODULE) || defined(CONFIG_INET6_ESP) || defined(CONFIG_INET6_ESP_MODULE)
 
 void *pskb_put(struct sk_buff *skb, struct sk_buff *tail, int len)