diff options
author | Gary R Hook <gary.hook@amd.com> | 2017-02-08 14:07:06 -0500 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2017-02-15 00:20:19 -0500 |
commit | f7cc02b3c3a33a10dd5bb9e5dfd22e47e09503a2 (patch) | |
tree | 2e401428d09921330d1540a33289d54e4848f2a4 | |
parent | 9d12ba86f818aa9cfe9f01b750336aa441f2ffa2 (diff) |
crypto: ccp - Set the AES size field for all modes
Ensure that the size field is correctly populated for
all AES modes.
Signed-off-by: Gary R Hook <gary.hook@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r-- | drivers/crypto/ccp/ccp-dev-v5.c | 3 | ||||
-rw-r--r-- | drivers/crypto/ccp/ccp-dev.h | 1 | ||||
-rw-r--r-- | drivers/crypto/ccp/ccp-ops.c | 8 |
3 files changed, 10 insertions, 2 deletions
diff --git a/drivers/crypto/ccp/ccp-dev-v5.c b/drivers/crypto/ccp/ccp-dev-v5.c index 612898b4aaad..9c6ff8b813d9 100644 --- a/drivers/crypto/ccp/ccp-dev-v5.c +++ b/drivers/crypto/ccp/ccp-dev-v5.c | |||
@@ -284,8 +284,7 @@ static int ccp5_perform_aes(struct ccp_op *op) | |||
284 | CCP_AES_ENCRYPT(&function) = op->u.aes.action; | 284 | CCP_AES_ENCRYPT(&function) = op->u.aes.action; |
285 | CCP_AES_MODE(&function) = op->u.aes.mode; | 285 | CCP_AES_MODE(&function) = op->u.aes.mode; |
286 | CCP_AES_TYPE(&function) = op->u.aes.type; | 286 | CCP_AES_TYPE(&function) = op->u.aes.type; |
287 | if (op->u.aes.mode == CCP_AES_MODE_CFB) | 287 | CCP_AES_SIZE(&function) = op->u.aes.size; |
288 | CCP_AES_SIZE(&function) = 0x7f; | ||
289 | 288 | ||
290 | CCP5_CMD_FUNCTION(&desc) = function.raw; | 289 | CCP5_CMD_FUNCTION(&desc) = function.raw; |
291 | 290 | ||
diff --git a/drivers/crypto/ccp/ccp-dev.h b/drivers/crypto/ccp/ccp-dev.h index 649e5610a5ce..2b5c01fade05 100644 --- a/drivers/crypto/ccp/ccp-dev.h +++ b/drivers/crypto/ccp/ccp-dev.h | |||
@@ -467,6 +467,7 @@ struct ccp_aes_op { | |||
467 | enum ccp_aes_type type; | 467 | enum ccp_aes_type type; |
468 | enum ccp_aes_mode mode; | 468 | enum ccp_aes_mode mode; |
469 | enum ccp_aes_action action; | 469 | enum ccp_aes_action action; |
470 | unsigned int size; | ||
470 | }; | 471 | }; |
471 | 472 | ||
472 | struct ccp_xts_aes_op { | 473 | struct ccp_xts_aes_op { |
diff --git a/drivers/crypto/ccp/ccp-ops.c b/drivers/crypto/ccp/ccp-ops.c index 50fae4442801..6878160234b5 100644 --- a/drivers/crypto/ccp/ccp-ops.c +++ b/drivers/crypto/ccp/ccp-ops.c | |||
@@ -692,6 +692,14 @@ static int ccp_run_aes_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd) | |||
692 | goto e_ctx; | 692 | goto e_ctx; |
693 | } | 693 | } |
694 | } | 694 | } |
695 | switch (aes->mode) { | ||
696 | case CCP_AES_MODE_CFB: /* CFB128 only */ | ||
697 | case CCP_AES_MODE_CTR: | ||
698 | op.u.aes.size = AES_BLOCK_SIZE * BITS_PER_BYTE - 1; | ||
699 | break; | ||
700 | default: | ||
701 | op.u.aes.size = 0; | ||
702 | } | ||
695 | 703 | ||
696 | /* Prepare the input and output data workareas. For in-place | 704 | /* Prepare the input and output data workareas. For in-place |
697 | * operations we need to set the dma direction to BIDIRECTIONAL | 705 | * operations we need to set the dma direction to BIDIRECTIONAL |