diff mbox series

[34/40] crypto/cnxk: reduce rsa struct to only necessary fields

Message ID 20220520055445.40063-35-arkadiuszx.kusztal@intel.com (mailing list archive)
State Changes Requested
Delegated to: akhil goyal
Headers show
Series cryptodev: rsa, dh, ecdh changes | expand

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Kusztal, ArkadiuszX May 20, 2022, 5:54 a.m. UTC
- reduced rsa struct to only necessary fields.
This commit reflects changes to the asymmetric crypto API.

Signed-off-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
---
 drivers/crypto/cnxk/cnxk_ae.h | 36 ++++++++++++++++++------------------
 1 file changed, 18 insertions(+), 18 deletions(-)
diff mbox series

Patch

diff --git a/drivers/crypto/cnxk/cnxk_ae.h b/drivers/crypto/cnxk/cnxk_ae.h
index 0562f72270..ea6964dd37 100644
--- a/drivers/crypto/cnxk/cnxk_ae.h
+++ b/drivers/crypto/cnxk/cnxk_ae.h
@@ -380,19 +380,19 @@  cnxk_ae_enqueue_rsa_op(struct rte_crypto_op *op,
 
 	switch (rsa->op_type) {
 	case RTE_CRYPTO_ASYM_OP_VERIFY:
-		cnxk_ae_rsa_prep(op, meta_buf, &sess->rsa_ctx, &rsa->sign,
+		cnxk_ae_rsa_prep(op, meta_buf, &sess->rsa_ctx, &rsa->input,
 				 inst);
 		break;
 	case RTE_CRYPTO_ASYM_OP_ENCRYPT:
-		cnxk_ae_rsa_prep(op, meta_buf, &sess->rsa_ctx, &rsa->message,
+		cnxk_ae_rsa_prep(op, meta_buf, &sess->rsa_ctx, &rsa->input,
 				 inst);
 		break;
 	case RTE_CRYPTO_ASYM_OP_SIGN:
 		cnxk_ae_rsa_crt_prep(op, meta_buf, &sess->rsa_ctx,
-				     &rsa->message, inst);
+				     &rsa->input, inst);
 		break;
 	case RTE_CRYPTO_ASYM_OP_DECRYPT:
-		cnxk_ae_rsa_crt_prep(op, meta_buf, &sess->rsa_ctx, &rsa->cipher,
+		cnxk_ae_rsa_crt_prep(op, meta_buf, &sess->rsa_ctx, &rsa->input,
 				     inst);
 		break;
 	default:
@@ -671,44 +671,44 @@  cnxk_ae_dequeue_rsa_op(struct rte_crypto_op *cop, uint8_t *rptr,
 
 	switch (rsa->op_type) {
 	case RTE_CRYPTO_ASYM_OP_ENCRYPT:
-		rsa->cipher.length = rsa_ctx->n.length;
-		memcpy(rsa->cipher.data, rptr, rsa->cipher.length);
+		rsa->output.length = rsa_ctx->n.length;
+		memcpy(rsa->output.data, rptr, rsa->output.length);
 		break;
 	case RTE_CRYPTO_ASYM_OP_DECRYPT:
 		if (rsa->padding.type == RTE_CRYPTO_RSA_PADDING_NONE) {
-			rsa->message.length = rsa_ctx->n.length;
-			memcpy(rsa->message.data, rptr, rsa->message.length);
+			rsa->output.length = rsa_ctx->n.length;
+			memcpy(rsa->output.data, rptr, rsa->output.length);
 		} else {
 			/* Get length of decrypted output */
-			rsa->message.length =
+			rsa->output.length =
 				rte_cpu_to_be_16(*((uint16_t *)rptr));
 			/*
 			 * Offset output data pointer by length field
 			 * (2 bytes) and copy decrypted data.
 			 */
-			memcpy(rsa->message.data, rptr + 2,
-			       rsa->message.length);
+			memcpy(rsa->output.data, rptr + 2,
+			       rsa->output.length);
 		}
 		break;
 	case RTE_CRYPTO_ASYM_OP_SIGN:
-		rsa->sign.length = rsa_ctx->n.length;
-		memcpy(rsa->sign.data, rptr, rsa->sign.length);
+		rsa->input.length = rsa_ctx->n.length;
+		memcpy(rsa->output.data, rptr, rsa->output.length);
 		break;
 	case RTE_CRYPTO_ASYM_OP_VERIFY:
 		if (rsa->padding.type == RTE_CRYPTO_RSA_PADDING_NONE) {
-			rsa->sign.length = rsa_ctx->n.length;
-			memcpy(rsa->sign.data, rptr, rsa->sign.length);
+			rsa->output.length = rsa_ctx->n.length;
+			memcpy(rsa->output.data, rptr, rsa->output.length);
 		} else {
 			/* Get length of signed output */
-			rsa->sign.length =
+			rsa->output.length =
 				rte_cpu_to_be_16(*((uint16_t *)rptr));
 			/*
 			 * Offset output data pointer by length field
 			 * (2 bytes) and copy signed data.
 			 */
-			memcpy(rsa->sign.data, rptr + 2, rsa->sign.length);
+			memcpy(rsa->output.data, rptr + 2, rsa->output.length);
 		}
-		if (memcmp(rsa->sign.data, rsa->message.data,
+		if (memcmp(rsa->output.data, rsa->message.data,
 			   rsa->message.length)) {
 			cop->status = RTE_CRYPTO_OP_STATUS_ERROR;
 		}