diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2016-01-24 08:20:23 -0500 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2016-01-27 07:36:18 -0500 |
commit | cf80e0e47e0e7a8994dfadefec0e1395c622817a (patch) | |
tree | 65f0d15e1420f2a1567afea63b032ac7e55cb900 /net/ipv6/tcp_ipv6.c | |
parent | 5821c769706561da81e9fcec4a6ca6dbbb2f30cb (diff) |
tcp: Use ahash
This patch replaces uses of the long obsolete hash interface with
ahash.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Acked-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/tcp_ipv6.c')
-rw-r--r-- | net/ipv6/tcp_ipv6.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 006396e31cb0..bd5597227b18 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -66,7 +66,7 @@ | |||
66 | #include <linux/proc_fs.h> | 66 | #include <linux/proc_fs.h> |
67 | #include <linux/seq_file.h> | 67 | #include <linux/seq_file.h> |
68 | 68 | ||
69 | #include <linux/crypto.h> | 69 | #include <crypto/hash.h> |
70 | #include <linux/scatterlist.h> | 70 | #include <linux/scatterlist.h> |
71 | 71 | ||
72 | static void tcp_v6_send_reset(const struct sock *sk, struct sk_buff *skb); | 72 | static void tcp_v6_send_reset(const struct sock *sk, struct sk_buff *skb); |
@@ -540,7 +540,8 @@ static int tcp_v6_md5_hash_pseudoheader(struct tcp_md5sig_pool *hp, | |||
540 | bp->len = cpu_to_be32(nbytes); | 540 | bp->len = cpu_to_be32(nbytes); |
541 | 541 | ||
542 | sg_init_one(&sg, bp, sizeof(*bp)); | 542 | sg_init_one(&sg, bp, sizeof(*bp)); |
543 | return crypto_hash_update(&hp->md5_desc, &sg, sizeof(*bp)); | 543 | ahash_request_set_crypt(hp->md5_req, &sg, NULL, sizeof(*bp)); |
544 | return crypto_ahash_update(hp->md5_req); | ||
544 | } | 545 | } |
545 | 546 | ||
546 | static int tcp_v6_md5_hash_hdr(char *md5_hash, struct tcp_md5sig_key *key, | 547 | static int tcp_v6_md5_hash_hdr(char *md5_hash, struct tcp_md5sig_key *key, |
@@ -548,14 +549,14 @@ static int tcp_v6_md5_hash_hdr(char *md5_hash, struct tcp_md5sig_key *key, | |||
548 | const struct tcphdr *th) | 549 | const struct tcphdr *th) |
549 | { | 550 | { |
550 | struct tcp_md5sig_pool *hp; | 551 | struct tcp_md5sig_pool *hp; |
551 | struct hash_desc *desc; | 552 | struct ahash_request *req; |
552 | 553 | ||
553 | hp = tcp_get_md5sig_pool(); | 554 | hp = tcp_get_md5sig_pool(); |
554 | if (!hp) | 555 | if (!hp) |
555 | goto clear_hash_noput; | 556 | goto clear_hash_noput; |
556 | desc = &hp->md5_desc; | 557 | req = hp->md5_req; |
557 | 558 | ||
558 | if (crypto_hash_init(desc)) | 559 | if (crypto_ahash_init(req)) |
559 | goto clear_hash; | 560 | goto clear_hash; |
560 | if (tcp_v6_md5_hash_pseudoheader(hp, daddr, saddr, th->doff << 2)) | 561 | if (tcp_v6_md5_hash_pseudoheader(hp, daddr, saddr, th->doff << 2)) |
561 | goto clear_hash; | 562 | goto clear_hash; |
@@ -563,7 +564,8 @@ static int tcp_v6_md5_hash_hdr(char *md5_hash, struct tcp_md5sig_key *key, | |||
563 | goto clear_hash; | 564 | goto clear_hash; |
564 | if (tcp_md5_hash_key(hp, key)) | 565 | if (tcp_md5_hash_key(hp, key)) |
565 | goto clear_hash; | 566 | goto clear_hash; |
566 | if (crypto_hash_final(desc, md5_hash)) | 567 | ahash_request_set_crypt(req, NULL, md5_hash, 0); |
568 | if (crypto_ahash_final(req)) | ||
567 | goto clear_hash; | 569 | goto clear_hash; |
568 | 570 | ||
569 | tcp_put_md5sig_pool(); | 571 | tcp_put_md5sig_pool(); |
@@ -583,7 +585,7 @@ static int tcp_v6_md5_hash_skb(char *md5_hash, | |||
583 | { | 585 | { |
584 | const struct in6_addr *saddr, *daddr; | 586 | const struct in6_addr *saddr, *daddr; |
585 | struct tcp_md5sig_pool *hp; | 587 | struct tcp_md5sig_pool *hp; |
586 | struct hash_desc *desc; | 588 | struct ahash_request *req; |
587 | const struct tcphdr *th = tcp_hdr(skb); | 589 | const struct tcphdr *th = tcp_hdr(skb); |
588 | 590 | ||
589 | if (sk) { /* valid for establish/request sockets */ | 591 | if (sk) { /* valid for establish/request sockets */ |
@@ -598,9 +600,9 @@ static int tcp_v6_md5_hash_skb(char *md5_hash, | |||
598 | hp = tcp_get_md5sig_pool(); | 600 | hp = tcp_get_md5sig_pool(); |
599 | if (!hp) | 601 | if (!hp) |
600 | goto clear_hash_noput; | 602 | goto clear_hash_noput; |
601 | desc = &hp->md5_desc; | 603 | req = hp->md5_req; |
602 | 604 | ||
603 | if (crypto_hash_init(desc)) | 605 | if (crypto_ahash_init(req)) |
604 | goto clear_hash; | 606 | goto clear_hash; |
605 | 607 | ||
606 | if (tcp_v6_md5_hash_pseudoheader(hp, daddr, saddr, skb->len)) | 608 | if (tcp_v6_md5_hash_pseudoheader(hp, daddr, saddr, skb->len)) |
@@ -611,7 +613,8 @@ static int tcp_v6_md5_hash_skb(char *md5_hash, | |||
611 | goto clear_hash; | 613 | goto clear_hash; |
612 | if (tcp_md5_hash_key(hp, key)) | 614 | if (tcp_md5_hash_key(hp, key)) |
613 | goto clear_hash; | 615 | goto clear_hash; |
614 | if (crypto_hash_final(desc, md5_hash)) | 616 | ahash_request_set_crypt(req, NULL, md5_hash, 0); |
617 | if (crypto_ahash_final(req)) | ||
615 | goto clear_hash; | 618 | goto clear_hash; |
616 | 619 | ||
617 | tcp_put_md5sig_pool(); | 620 | tcp_put_md5sig_pool(); |