aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@sunset.davemloft.net>2007-10-26 03:41:21 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-26 03:41:21 -0400
commitc7da57a183a255f53caa73b1f688a01b097fa5bc (patch)
treec043065fbe1229cdc348278df79b532fa1748820
parent0e0940d4bb9b19c0a45c844a83e1d25686aaf433 (diff)
[TCP]: Fix scatterlist handling in MD5 signature support.
Use sg_init_table() and sg_mark_end() as needed. Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/ipv4/tcp_ipv4.c5
-rw-r--r--net/ipv6/tcp_ipv6.c4
2 files changed, 9 insertions, 0 deletions
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 38cf73a56731..ad759f1c3777 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -1055,6 +1055,9 @@ static int tcp_v4_do_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key,
1055 bp->pad = 0; 1055 bp->pad = 0;
1056 bp->protocol = protocol; 1056 bp->protocol = protocol;
1057 bp->len = htons(tcplen); 1057 bp->len = htons(tcplen);
1058
1059 sg_init_table(sg, 4);
1060
1058 sg_set_buf(&sg[block++], bp, sizeof(*bp)); 1061 sg_set_buf(&sg[block++], bp, sizeof(*bp));
1059 nbytes += sizeof(*bp); 1062 nbytes += sizeof(*bp);
1060 1063
@@ -1080,6 +1083,8 @@ static int tcp_v4_do_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key,
1080 sg_set_buf(&sg[block++], key->key, key->keylen); 1083 sg_set_buf(&sg[block++], key->key, key->keylen);
1081 nbytes += key->keylen; 1084 nbytes += key->keylen;
1082 1085
1086 sg_mark_end(sg, block);
1087
1083 /* Now store the Hash into the packet */ 1088 /* Now store the Hash into the packet */
1084 err = crypto_hash_init(desc); 1089 err = crypto_hash_init(desc);
1085 if (err) 1090 if (err)
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 737b755342bd..32dc329762e9 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -757,6 +757,8 @@ static int tcp_v6_do_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key,
757 bp->len = htonl(tcplen); 757 bp->len = htonl(tcplen);
758 bp->protocol = htonl(protocol); 758 bp->protocol = htonl(protocol);
759 759
760 sg_init_table(sg, 4);
761
760 sg_set_buf(&sg[block++], bp, sizeof(*bp)); 762 sg_set_buf(&sg[block++], bp, sizeof(*bp));
761 nbytes += sizeof(*bp); 763 nbytes += sizeof(*bp);
762 764
@@ -778,6 +780,8 @@ static int tcp_v6_do_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key,
778 sg_set_buf(&sg[block++], key->key, key->keylen); 780 sg_set_buf(&sg[block++], key->key, key->keylen);
779 nbytes += key->keylen; 781 nbytes += key->keylen;
780 782
783 sg_mark_end(sg, block);
784
781 /* Now store the hash into the packet */ 785 /* Now store the hash into the packet */
782 err = crypto_hash_init(desc); 786 err = crypto_hash_init(desc);
783 if (err) { 787 if (err) {