diff options
-rw-r--r-- | net/ipv4/tcp.c | 20 |
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 |