From: Vlad Yasevich <vladislav.yasevich@hp.com>
Date: Fri, 26 Oct 2007 01:46:26 +0000 (-0700)
Subject: [CRYPTO]: Fix hmac_digest from the SG breakage.
X-Git-Tag: firefly_0821_release~24598^2~24
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=41fb285430e9cb57da624d838afef7b2fc67e276;p=firefly-linux-kernel-4.4.55.git

[CRYPTO]: Fix hmac_digest from the SG breakage.

Crypto now uses SG helper functions.  Fix hmac_digest to use those
functions correctly and fix the oops associated with it.

Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
---

diff --git a/crypto/hmac.c b/crypto/hmac.c
index 6691981bda11..e3f5c0f3e2f7 100644
--- a/crypto/hmac.c
+++ b/crypto/hmac.c
@@ -158,9 +158,11 @@ static int hmac_digest(struct hash_desc *pdesc, struct scatterlist *sg,
 	desc.tfm = ctx->child;
 	desc.flags = pdesc->flags & CRYPTO_TFM_REQ_MAY_SLEEP;
 
+	sg_init_table(sg1, 2);
 	sg_set_buf(sg1, ipad, bs);
+	sg_set_page(&sg1[1], (void *) sg, 0, 0);
 
-	sg_set_page(&sg[1], (void *) sg, 0, 0);
+	sg_init_table(sg2, 1);
 	sg_set_buf(sg2, opad, bs + ds);
 
 	err = crypto_hash_digest(&desc, sg1, nbytes + bs, digest);