diff options
author | Harsh Jain <harsh@chelsio.com> | 2016-11-29 08:30:34 -0500 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2016-11-30 06:46:44 -0500 |
commit | 66bf093772040ae8b864d2cf953f2c73005f7815 (patch) | |
tree | f263ef833a13fb2976d9e91719c8c715b8d88846 | |
parent | 5102981212454998d549273ff9847f19e97a1794 (diff) |
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.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/crypto/chelsio/chcr_algo.h b/drivers/crypto/chelsio/chcr_algo.h index ec64fbcdeb49..199b0bb69b89 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, | |||
422 | { | 422 | { |
423 | u32 temp; | 423 | u32 temp; |
424 | u32 w_ring[MAX_NK]; | 424 | u32 w_ring[MAX_NK]; |
425 | int i, j, k = 0; | 425 | int i, j, k; |
426 | u8 nr, nk; | 426 | u8 nr, nk; |
427 | 427 | ||
428 | switch (keylength) { | 428 | switch (keylength) { |
@@ -460,6 +460,7 @@ static inline void get_aes_decrypt_key(unsigned char *dec_key, | |||
460 | temp = w_ring[i % nk]; | 460 | temp = w_ring[i % nk]; |
461 | i++; | 461 | i++; |
462 | } | 462 | } |
463 | i--; | ||
463 | for (k = 0, j = i % nk; k < nk; k++) { | 464 | for (k = 0, j = i % nk; k < nk; k++) { |
464 | *((u32 *)dec_key + k) = htonl(w_ring[j]); | 465 | *((u32 *)dec_key + k) = htonl(w_ring[j]); |
465 | j--; | 466 | j--; |