[PATCH 33/40] crypto/octeontx: reduce rsa struct to only necessary fields
Arek Kusztal
arkadiuszx.kusztal at intel.com
Fri May 20 07:54:38 CEST 2022
- reduced rsa struct to only necessary fields.
This commit reflects changes to the asymmetric crypto API.
Signed-off-by: Arek Kusztal <arkadiuszx.kusztal at intel.com>
---
drivers/crypto/octeontx/otx_cryptodev_ops.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/drivers/crypto/octeontx/otx_cryptodev_ops.c b/drivers/crypto/octeontx/otx_cryptodev_ops.c
index 914b17decf..e2b94240e0 100644
--- a/drivers/crypto/octeontx/otx_cryptodev_ops.c
+++ b/drivers/crypto/octeontx/otx_cryptodev_ops.c
@@ -732,40 +732,40 @@ otx_cpt_asym_rsa_op(struct rte_crypto_op *cop, struct cpt_request_info *req,
switch (rsa->op_type) {
case RTE_CRYPTO_ASYM_OP_ENCRYPT:
- rsa->cipher.length = rsa_ctx->n.length;
- memcpy(rsa->cipher.data, req->rptr, rsa->cipher.length);
+ rsa->output.length = rsa_ctx->n.length;
+ memcpy(rsa->output.data, req->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;
+ rsa->output.length = rsa_ctx->n.length;
else {
/* Get length of decrypted output */
- rsa->message.length = rte_cpu_to_be_16
+ rsa->output.length = rte_cpu_to_be_16
(*((uint16_t *)req->rptr));
/* Offset data pointer by length fields */
req->rptr += 2;
}
- memcpy(rsa->message.data, req->rptr, rsa->message.length);
+ memcpy(rsa->output.data, req->rptr, rsa->output.length);
break;
case RTE_CRYPTO_ASYM_OP_SIGN:
- rsa->sign.length = rsa_ctx->n.length;
- memcpy(rsa->sign.data, req->rptr, rsa->sign.length);
+ rsa->output.length = rsa_ctx->n.length;
+ memcpy(rsa->output.data, req->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;
+ rsa->output.length = rsa_ctx->n.length;
else {
/* Get length of decrypted output */
- rsa->sign.length = rte_cpu_to_be_16
+ rsa->output.length = rte_cpu_to_be_16
(*((uint16_t *)req->rptr));
/* Offset data pointer by length fields */
req->rptr += 2;
}
- memcpy(rsa->sign.data, req->rptr, rsa->sign.length);
+ memcpy(rsa->output.data, req->rptr, rsa->output.length);
- if (memcmp(rsa->sign.data, rsa->message.data,
+ if (memcmp(rsa->output.data, rsa->message.data,
rsa->message.length)) {
CPT_LOG_DP_ERR("RSA verification failed");
cop->status = RTE_CRYPTO_OP_STATUS_ERROR;
--
2.13.6
More information about the dev
mailing list