Fix memory corruption done by  *((u32 *)dec_key + k)
 operation.

Signed-off-by: Jitendra Lulla <jlu...@chelsio.com>
---
 drivers/crypto/chelsio/chcr_algo.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/crypto/chelsio/chcr_algo.h 
b/drivers/crypto/chelsio/chcr_algo.h
index ec64fbc..199b0bb 100644
--- a/drivers/crypto/chelsio/chcr_algo.h
+++ b/drivers/crypto/chelsio/chcr_algo.h
@@ -422,7 +422,7 @@ static inline void get_aes_decrypt_key(unsigned char 
*dec_key,
 {
        u32 temp;
        u32 w_ring[MAX_NK];
-       int i, j, k = 0;
+       int i, j, k;
        u8  nr, nk;
 
        switch (keylength) {
@@ -460,6 +460,7 @@ static inline void get_aes_decrypt_key(unsigned char 
*dec_key,
                temp = w_ring[i % nk];
                i++;
        }
+       i--;
        for (k = 0, j = i % nk; k < nk; k++) {
                *((u32 *)dec_key + k) = htonl(w_ring[j]);
                j--;
-- 
1.8.2.3

--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to