summaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4/tcp.c')
-rw-r--r--net/ipv4/tcp.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 704adad8f07f..eefc61e3d0e4 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -2994,17 +2994,19 @@ void tcp_put_md5sig_pool(void)
2994EXPORT_SYMBOL(tcp_put_md5sig_pool); 2994EXPORT_SYMBOL(tcp_put_md5sig_pool);
2995 2995
2996int tcp_md5_hash_header(struct tcp_md5sig_pool *hp, 2996int tcp_md5_hash_header(struct tcp_md5sig_pool *hp,
2997 struct tcphdr *th) 2997 const struct tcphdr *th)
2998{ 2998{
2999 struct scatterlist sg; 2999 struct scatterlist sg;
3000 struct tcphdr hdr;
3000 int err; 3001 int err;
3001 3002
3002 __sum16 old_checksum = th->check; 3003 /* We are not allowed to change tcphdr, make a local copy */
3003 th->check = 0; 3004 memcpy(&hdr, th, sizeof(hdr));
3005 hdr.check = 0;
3006
3004 /* options aren't included in the hash */ 3007 /* options aren't included in the hash */
3005 sg_init_one(&sg, th, sizeof(struct tcphdr)); 3008 sg_init_one(&sg, &hdr, sizeof(hdr));
3006 err = crypto_hash_update(&hp->md5_desc, &sg, sizeof(struct tcphdr)); 3009 err = crypto_hash_update(&hp->md5_desc, &sg, sizeof(hdr));
3007 th->check = old_checksum;
3008 return err; 3010 return err;
3009} 3011}
3010EXPORT_SYMBOL(tcp_md5_hash_header); 3012EXPORT_SYMBOL(tcp_md5_hash_header);