summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarsh Jain <harsh@chelsio.com>2016-11-29 13:30:34 (GMT)
committerHerbert Xu <herbert@gondor.apana.org.au>2016-11-30 11:46:44 (GMT)
commit66bf093772040ae8b864d2cf953f2c73005f7815 (patch)
treef263ef833a13fb2976d9e91719c8c715b8d88846
parent5102981212454998d549273ff9847f19e97a1794 (diff)
downloadlinux-66bf093772040ae8b864d2cf953f2c73005f7815.tar.xz
crypto: chcr - Fix memory corruption
Fix memory corruption done by *((u32 *)dec_key + k) operation. Signed-off-by: Jitendra Lulla <JLULLA@chelsio.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r--drivers/crypto/chelsio/chcr_algo.h3
1 files changed, 2 insertions, 1 deletions
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--;