summaryrefslogtreecommitdiff
path: root/net/ipv4
diff options
context:
space:
mode:
authorAndré Fabian Silva Delgado <emulatorman@parabola.nu>2016-06-14 04:51:44 -0300
committerAndré Fabian Silva Delgado <emulatorman@parabola.nu>2016-06-14 04:51:44 -0300
commit68f052d01b53b858897d80beb0095920abe5868e (patch)
treeb8de945b6e56d56d00c9c55cbf0ca90c7450973c /net/ipv4
parentd635711daa98be86d4c7fd01499c34f566b54ccb (diff)
Fix function 'tcp_stealth_integrity' in net/ipv4/tcp.cpck-4.6.2-gnu
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/tcp.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 32c9d8c25..29bb8a5b9 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -2312,25 +2312,30 @@ static int tcp_repair_options_est(struct tcp_sock *tp,
int tcp_stealth_integrity(__be16 *hash, u8 *secret, u8 *payload, int len)
{
struct scatterlist sg[2];
- struct crypto_hash *tfm;
- struct hash_desc desc;
+ struct crypto_ahash *tfm;
+ struct ahash_request *req;
__be16 h[MD5_DIGEST_WORDS * 2];
int i;
int err = 0;
- tfm = crypto_alloc_hash("md5", 0, CRYPTO_ALG_ASYNC);
+ tfm = crypto_alloc_ahash("md5", 0, CRYPTO_ALG_ASYNC);
if (IS_ERR(tfm)) {
err = -PTR_ERR(tfm);
goto out;
}
- desc.tfm = tfm;
- desc.flags = 0;
+ req = ahash_request_alloc(tfm, GFP_ATOMIC);
+ if (!req)
+ err = -EFAULT;
+ goto out;
sg_init_table(sg, 2);
sg_set_buf(&sg[0], secret, MD5_MESSAGE_BYTES);
sg_set_buf(&sg[1], payload, len);
- if (crypto_hash_digest(&desc, sg, MD5_MESSAGE_BYTES + len, (u8 *)h)) {
+ ahash_request_set_callback(req, 0, NULL, NULL);
+ ahash_request_set_crypt(req, sg, (u8 *)h, MD5_MESSAGE_BYTES + len);
+
+ if (crypto_ahash_digest(req)) {
err = -EFAULT;
goto out;
}
@@ -2340,7 +2345,8 @@ int tcp_stealth_integrity(__be16 *hash, u8 *secret, u8 *payload, int len)
*hash ^= be16_to_cpu(h[i]);
out:
- crypto_free_hash(tfm);
+ ahash_request_free(req);
+ crypto_free_ahash(tfm);
return err;
}
#endif