crypto/cnxk: return decrypted data for RSA verify
PATCH 1/1 crypto/cnxk: return decrypted data for RSA verify
For RSA verify operations with RTE_CRYPTO_RSA_PADDING_NONE, the driver cannot determine which padding algorithm the application is using. As per the API specification in rte_crypto_asym.h, when RTE_CRYPTO_RSA_PADDING_NONE and RTE_CRYPTO_ASYM_OP_VERIFY are selected, the decrypted signature should be returned to the application in the cipher output buffer.
--- .mailmap | 1 + drivers/crypto/cnxk/cnxk_ae.h | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-)
.mailmap +1 -0
@@ -496,6 +496,7 @@ Ganghui Zeng <[email protected]> Gao Feng <[email protected]> Gaoxiang Liu <[email protected]> Gargi Sau <[email protected]> +Garvit Varshney <[email protected]> Gary Mussar <[email protected]> Gaurav Singh <[email protected]> Gautam Dawar <[email protected]>
drivers/crypto/cnxk/cnxk_ae.h +4 -3
@@ -1591,9 +1591,10 @@ cnxk_ae_dequeue_rsa_op(struct rte_crypto_op *cop, uint8_t *rptr,break ;case RTE_CRYPTO_ASYM_OP_VERIFY :if (rsa_ctx->padding.type ==RTE_CRYPTO_RSA_PADDING_NONE ) { - rsa->sign.length = rsa_ctx->n.length; -if (memcmp (rptr, rsa->message.data, rsa->message.length)) - cop->status =RTE_CRYPTO_OP_STATUS_ERROR ; +/* Application compares decrypted data with message for SW padding schemes +*/ + rsa->cipher.length = rsa_ctx->n.length; +memcpy (rsa->cipher.data, rptr, rsa->cipher.length); }else {/* Get length of signed output */ rsa->sign.length =rte_cpu_to_be_16 (*((uint16_t *)rptr));
Signature · 1 line
2.25.1
Quoted 11 lines
Subject: [PATCH]
crypto/cnxk: return decrypted data for RSA verifyFor RSA verify operations with
RTE_CRYPTO_RSA_PADDING_NONE, the driver cannot determine which padding algorithm the application is using. As per the API specification inrte_crypto_asym.h, whenRTE_CRYPTO_RSA_PADDING_NONEandRTE_CRYPTO_ASYM_OP_VERIFYare selected,
the decrypted signature should be returned to the application in the cipher output buffer.
Quoted 1 line
Fixes dfd038b97ec3 ("crypto/cnxk: refactor RSA verification")
Quoted 2 lines
Signed-off-by Garvit Varshney <[email protected]>
Applied to dpdk-next-crypto