Skip to content

Commit

Permalink
crypto: chcr - Fix memory corruption
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Harsh Jain authored and Herbert Xu committed Nov 30, 2016
1 parent 5102981 commit 66bf093
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/crypto/chelsio/chcr_algo.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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--;
Expand Down

0 comments on commit 66bf093

Please sign in to comment.