Commit c7da57a1 authored by David S. Miller's avatar David S. Miller

[TCP]: Fix scatterlist handling in MD5 signature support.

Use sg_init_table() and sg_mark_end() as needed.
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0e0940d4
...@@ -1055,6 +1055,9 @@ static int tcp_v4_do_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key, ...@@ -1055,6 +1055,9 @@ static int tcp_v4_do_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key,
bp->pad = 0; bp->pad = 0;
bp->protocol = protocol; bp->protocol = protocol;
bp->len = htons(tcplen); bp->len = htons(tcplen);
sg_init_table(sg, 4);
sg_set_buf(&sg[block++], bp, sizeof(*bp)); sg_set_buf(&sg[block++], bp, sizeof(*bp));
nbytes += sizeof(*bp); nbytes += sizeof(*bp);
...@@ -1080,6 +1083,8 @@ static int tcp_v4_do_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key, ...@@ -1080,6 +1083,8 @@ static int tcp_v4_do_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key,
sg_set_buf(&sg[block++], key->key, key->keylen); sg_set_buf(&sg[block++], key->key, key->keylen);
nbytes += key->keylen; nbytes += key->keylen;
sg_mark_end(sg, block);
/* Now store the Hash into the packet */ /* Now store the Hash into the packet */
err = crypto_hash_init(desc); err = crypto_hash_init(desc);
if (err) if (err)
......
...@@ -757,6 +757,8 @@ static int tcp_v6_do_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key, ...@@ -757,6 +757,8 @@ static int tcp_v6_do_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key,
bp->len = htonl(tcplen); bp->len = htonl(tcplen);
bp->protocol = htonl(protocol); bp->protocol = htonl(protocol);
sg_init_table(sg, 4);
sg_set_buf(&sg[block++], bp, sizeof(*bp)); sg_set_buf(&sg[block++], bp, sizeof(*bp));
nbytes += sizeof(*bp); nbytes += sizeof(*bp);
...@@ -778,6 +780,8 @@ static int tcp_v6_do_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key, ...@@ -778,6 +780,8 @@ static int tcp_v6_do_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key,
sg_set_buf(&sg[block++], key->key, key->keylen); sg_set_buf(&sg[block++], key->key, key->keylen);
nbytes += key->keylen; nbytes += key->keylen;
sg_mark_end(sg, block);
/* Now store the hash into the packet */ /* Now store the hash into the packet */
err = crypto_hash_init(desc); err = crypto_hash_init(desc);
if (err) { if (err) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment