Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f7cc02b3 authored by Gary R Hook's avatar Gary R Hook Committed by Herbert Xu
Browse files

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: default avatarGary R Hook <gary.hook@amd.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 9d12ba86
Loading
Loading
Loading
Loading
+1 −2
Original line number Original line Diff line number Diff line
@@ -284,8 +284,7 @@ static int ccp5_perform_aes(struct ccp_op *op)
	CCP_AES_ENCRYPT(&function) = op->u.aes.action;
	CCP_AES_ENCRYPT(&function) = op->u.aes.action;
	CCP_AES_MODE(&function) = op->u.aes.mode;
	CCP_AES_MODE(&function) = op->u.aes.mode;
	CCP_AES_TYPE(&function) = op->u.aes.type;
	CCP_AES_TYPE(&function) = op->u.aes.type;
	if (op->u.aes.mode == CCP_AES_MODE_CFB)
	CCP_AES_SIZE(&function) = op->u.aes.size;
		CCP_AES_SIZE(&function) = 0x7f;


	CCP5_CMD_FUNCTION(&desc) = function.raw;
	CCP5_CMD_FUNCTION(&desc) = function.raw;


+1 −0
Original line number Original line Diff line number Diff line
@@ -467,6 +467,7 @@ struct ccp_aes_op {
	enum ccp_aes_type type;
	enum ccp_aes_type type;
	enum ccp_aes_mode mode;
	enum ccp_aes_mode mode;
	enum ccp_aes_action action;
	enum ccp_aes_action action;
	unsigned int size;
};
};


struct ccp_xts_aes_op {
struct ccp_xts_aes_op {
+8 −0
Original line number Original line Diff line number Diff line
@@ -692,6 +692,14 @@ static int ccp_run_aes_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd)
			goto e_ctx;
			goto e_ctx;
		}
		}
	}
	}
	switch (aes->mode) {
	case CCP_AES_MODE_CFB: /* CFB128 only */
	case CCP_AES_MODE_CTR:
		op.u.aes.size = AES_BLOCK_SIZE * BITS_PER_BYTE - 1;
		break;
	default:
		op.u.aes.size = 0;
	}


	/* Prepare the input and output data workareas. For in-place
	/* Prepare the input and output data workareas. For in-place
	 * operations we need to set the dma direction to BIDIRECTIONAL
	 * operations we need to set the dma direction to BIDIRECTIONAL