DPDK patches and discussions
 help / color / mirror / Atom feed
From: <kirankumark@marvell.com>
To: Ankur Dwivedi <adwivedi@marvell.com>,
	Anoob Joseph <anoobj@marvell.com>,
	Tejasree Kondoj <ktejasree@marvell.com>
Cc: <dev@dpdk.org>, Kiran Kumar K <kirankumark@marvell.com>
Subject: [dpdk-dev] [PATCH 2/3] crypto/cnxk: update asym ECDSA messages in sync with ucode
Date: Mon, 26 Jul 2021 10:18:52 +0530	[thread overview]
Message-ID: <20210726044853.2232433-2-kirankumark@marvell.com> (raw)
In-Reply-To: <20210726044853.2232433-1-kirankumark@marvell.com>

From: Kiran Kumar K <kirankumark@marvell.com>

Adding changes to asymmetric ECDSA messages to align with
the new ucode for cnxk device.

Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
---
 drivers/crypto/cnxk/cnxk_ae.h        | 24 ++++++++++++++++++++----
 drivers/crypto/cnxk/cnxk_cryptodev.h |  2 +-
 2 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/drivers/crypto/cnxk/cnxk_ae.h b/drivers/crypto/cnxk/cnxk_ae.h
index c752e62ea5..174a940ab8 100644
--- a/drivers/crypto/cnxk/cnxk_ae.h
+++ b/drivers/crypto/cnxk/cnxk_ae.h
@@ -439,7 +439,7 @@ cnxk_ae_ecdsa_sign_prep(struct rte_crypto_ecdsa_op_param *ecdsa,
 	 * Please note, private key, order cannot exceed prime
 	 * length i.e 3 * p_align.
 	 */
-	dlen = sizeof(fpm_table_iova) + k_align + m_align + p_align * 3;
+	dlen = sizeof(fpm_table_iova) + k_align + m_align + p_align * 5;
 
 	memset(dptr, 0, dlen);
 
@@ -461,12 +461,18 @@ cnxk_ae_ecdsa_sign_prep(struct rte_crypto_ecdsa_op_param *ecdsa,
 	memcpy(dptr, ecdsa->message.data, message_len);
 	dptr += m_align;
 
+	memcpy(dptr, ec_grp->consta.data, prime_len);
+	dptr += p_align;
+
+	memcpy(dptr, ec_grp->constb.data, prime_len);
+	dptr += p_align;
+
 	/* Setup opcodes */
 	w4.s.opcode_major = ROC_AE_MAJOR_OP_ECDSA;
 	w4.s.opcode_minor = ROC_AE_MINOR_OP_ECDSA_SIGN;
 
 	w4.s.param1 = curveid | (message_len << 8);
-	w4.s.param2 = k_len;
+	w4.s.param2 = (pkey_len << 8) | k_len;
 	w4.s.dlen = dlen;
 
 	inst->w4.u64 = w4.u64;
@@ -521,7 +527,7 @@ cnxk_ae_ecdsa_verify_prep(struct rte_crypto_ecdsa_op_param *ecdsa,
 	 * Please note sign, public key and order can not exceed prime length
 	 * i.e. 6 * p_align
 	 */
-	dlen = sizeof(fpm_table_iova) + m_align + (6 * p_align);
+	dlen = sizeof(fpm_table_iova) + m_align + (8 * p_align);
 
 	memset(dptr, 0, dlen);
 
@@ -549,6 +555,12 @@ cnxk_ae_ecdsa_verify_prep(struct rte_crypto_ecdsa_op_param *ecdsa,
 	memcpy(dptr + qy_offset, ecdsa->q.y.data, qy_len);
 	dptr += p_align;
 
+	memcpy(dptr, ec_grp->consta.data, prime_len);
+	dptr += p_align;
+
+	memcpy(dptr, ec_grp->constb.data, prime_len);
+	dptr += p_align;
+
 	/* Setup opcodes */
 	w4.s.opcode_major = ROC_AE_MAJOR_OP_ECDSA;
 	w4.s.opcode_minor = ROC_AE_MINOR_OP_ECDSA_VERIFY;
@@ -612,7 +624,7 @@ cnxk_ae_ecpm_prep(struct rte_crypto_ecpm_op_param *ecpm,
 	 * scalar length),
 	 * Please note point length is equivalent to prime of the curve
 	 */
-	dlen = 3 * p_align + scalar_align;
+	dlen = 5 * p_align + scalar_align;
 
 	x1_offset = prime_len - x1_len;
 	y1_offset = prime_len - y1_len;
@@ -628,6 +640,10 @@ cnxk_ae_ecpm_prep(struct rte_crypto_ecpm_op_param *ecpm,
 	dptr += scalar_align;
 	memcpy(dptr, ec_grp->prime.data, ec_grp->prime.length);
 	dptr += p_align;
+	memcpy(dptr, ec_grp->consta.data, ec_grp->consta.length);
+	dptr += p_align;
+	memcpy(dptr, ec_grp->constb.data, ec_grp->constb.length);
+	dptr += p_align;
 
 	/* Setup opcodes */
 	w4.s.opcode_major = ROC_AE_MAJOR_OP_ECC;
diff --git a/drivers/crypto/cnxk/cnxk_cryptodev.h b/drivers/crypto/cnxk/cnxk_cryptodev.h
index ff46d16e58..b3856f7eaa 100644
--- a/drivers/crypto/cnxk/cnxk_cryptodev.h
+++ b/drivers/crypto/cnxk/cnxk_cryptodev.h
@@ -13,7 +13,7 @@
 #define CNXK_CPT_MAX_CAPS	 34
 #define CNXK_SEC_CRYPTO_MAX_CAPS 4
 #define CNXK_SEC_MAX_CAPS	 3
-#define CNXK_AE_EC_ID_MAX	 5
+#define CNXK_AE_EC_ID_MAX	 8
 /**
  * Device private data
  */
-- 
2.25.1


  reply	other threads:[~2021-07-26  4:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-26  4:48 [dpdk-dev] [PATCH 1/3] common/cnxk: add const values to ec groups kirankumark
2021-07-26  4:48 ` kirankumark [this message]
2021-07-26  4:48 ` [dpdk-dev] [PATCH 3/3] common/cpt: update asym ECDSA messages in sync with ucode kirankumark
2021-07-27 17:34 ` [dpdk-dev] [EXT] [PATCH 1/3] common/cnxk: add const values to ec groups Akhil Goyal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210726044853.2232433-2-kirankumark@marvell.com \
    --to=kirankumark@marvell.com \
    --cc=adwivedi@marvell.com \
    --cc=anoobj@marvell.com \
    --cc=dev@dpdk.org \
    --cc=ktejasree@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).