DPDK patches and discussions
 help / color / mirror / Atom feed
From: Akhil Goyal <gakhil@marvell.com>
To: Arkadiusz Kusztal <arkadiuszx.kusztal@intel.com>,
	"dev@dpdk.org" <dev@dpdk.org>,
	Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
Cc: "brian.dooley@intel.com" <brian.dooley@intel.com>,
	Anoob Joseph <anoobj@marvell.com>
Subject: RE: [EXTERNAL] [PATCH v2] cryptodev: add ec points to sm2 op
Date: Tue, 1 Oct 2024 07:57:48 +0000	[thread overview]
Message-ID: <CO6PR18MB4484E6EBB76404B559EF340AD8772@CO6PR18MB4484.namprd18.prod.outlook.com> (raw)
In-Reply-To: <20240929172912.87859-1-arkadiuszx.kusztal@intel.com>

> In the case when PMD cannot support the full process of the SM2,
> but elliptic curve computation only, additional fields
> are needed to handle such a case.
> 
> Points C1, kP therefore were added to the SM2 crypto operation struct.
> 
> Signed-off-by: Arkadiusz Kusztal <arkadiuszx.kusztal@intel.com>
> ---
>  lib/cryptodev/rte_crypto_asym.h | 119 ++++++++++++++++++++++++-------------
> ---
>  1 file changed, 71 insertions(+), 48 deletions(-)
> 
> diff --git a/lib/cryptodev/rte_crypto_asym.h b/lib/cryptodev/rte_crypto_asym.h
> index 39d3da3952..f59759062f 100644
> --- a/lib/cryptodev/rte_crypto_asym.h
> +++ b/lib/cryptodev/rte_crypto_asym.h
> @@ -600,40 +600,6 @@ struct rte_crypto_ecpm_op_param {
>  };
> 
>  /**
> - * Asymmetric crypto transform data
> - *
> - * Structure describing asym xforms.
> - */
> -struct rte_crypto_asym_xform {
> -	struct rte_crypto_asym_xform *next;
> -	/**< Pointer to next xform to set up xform chain.*/
> -	enum rte_crypto_asym_xform_type xform_type;
> -	/**< Asymmetric crypto transform */
> -
> -	union {
> -		struct rte_crypto_rsa_xform rsa;
> -		/**< RSA xform parameters */
> -
> -		struct rte_crypto_modex_xform modex;
> -		/**< Modular Exponentiation xform parameters */
> -
> -		struct rte_crypto_modinv_xform modinv;
> -		/**< Modular Multiplicative Inverse xform parameters */
> -
> -		struct rte_crypto_dh_xform dh;
> -		/**< DH xform parameters */
> -
> -		struct rte_crypto_dsa_xform dsa;
> -		/**< DSA xform parameters */
> -
> -		struct rte_crypto_ec_xform ec;
> -		/**< EC xform parameters, used by elliptic curve based
> -		 * operations.
> -		 */
> -	};
> -};

Above change seems unnecessary.


> -
> -/**
>   * SM2 operation params.
>   */
>  struct rte_crypto_sm2_op_param {
> @@ -658,20 +624,43 @@ struct rte_crypto_sm2_op_param {
>  	 * will be overwritten by the PMD with the decrypted length.
>  	 */
> 
> -	rte_crypto_param cipher;
> -	/**<
> -	 * Pointer to input data
> -	 * - to be decrypted for SM2 private decrypt.
> -	 *
> -	 * Pointer to output data
> -	 * - for SM2 public encrypt.
> -	 * In this case the underlying array should have been allocated
> -	 * with enough memory to hold ciphertext output (at least X bytes
> -	 * for prime field curve of N bytes and for message M bytes,
> -	 * where X = (C1 || C2 || C3) and computed based on SM2 RFC as
> -	 * C1 (1 + N + N), C2 = M, C3 = N. The cipher.length field will
> -	 * be overwritten by the PMD with the encrypted length.
> -	 */
> +	union {
> +		rte_crypto_param cipher;
> +		/**<
> +		 * Pointer to input data
> +		 * - to be decrypted for SM2 private decrypt.
> +		 *
> +		 * Pointer to output data
> +		 * - for SM2 public encrypt.
> +		 * In this case the underlying array should have been allocated
> +		 * with enough memory to hold ciphertext output (at least X
> bytes
> +		 * for prime field curve of N bytes and for message M bytes,
> +		 * where X = (C1 || C2 || C3) and computed based on SM2 RFC
> as
> +		 * C1 (1 + N + N), C2 = M, C3 = N. The cipher.length field will
> +		 * be overwritten by the PMD with the encrypted length.
> +		 */
> +		struct {
> +			struct rte_crypto_ec_point C1;
> +			/**<
> +			 * This field is used only when PMD does not support the
> full
> +			 * process of the SM2 encryption/decryption, but the
> elliptic
> +			 * curve part only.
> +			 *
> +			 * In the case of encryption, it is an output - point C1 =
> (x1,y1).
> +			 * In the case of decryption, if is an input - point C1 =
> (x1,y1)
> +			 *
> +			 */
> +			struct rte_crypto_ec_point kP;
> +			/**<
> +			 * This field is used only when PMD does not support the
> full
> +			 * process of the SM2 encryption/decryption, but the
> elliptic
> +			 * curve part only.
> +			 *
> +			 * It is an output in the encryption case, it is a point
> +			 * [k]P = (x2,y2)
> +			 */
> +		};
> +	};
> 
>  	rte_crypto_uint id;
>  	/**< The SM2 id used by signer and verifier. */
> @@ -698,6 +687,40 @@ struct rte_crypto_sm2_op_param {
>  };
> 
>  /**
> + * Asymmetric crypto transform data
> + *
> + * Structure describing asym xforms.
> + */
> +struct rte_crypto_asym_xform {
> +	struct rte_crypto_asym_xform *next;
> +	/**< Pointer to next xform to set up xform chain.*/
> +	enum rte_crypto_asym_xform_type xform_type;
> +	/**< Asymmetric crypto transform */
> +
> +	union {
> +		struct rte_crypto_rsa_xform rsa;
> +		/**< RSA xform parameters */
> +
> +		struct rte_crypto_modex_xform modex;
> +		/**< Modular Exponentiation xform parameters */
> +
> +		struct rte_crypto_modinv_xform modinv;
> +		/**< Modular Multiplicative Inverse xform parameters */
> +
> +		struct rte_crypto_dh_xform dh;
> +		/**< DH xform parameters */
> +
> +		struct rte_crypto_dsa_xform dsa;
> +		/**< DSA xform parameters */
> +
> +		struct rte_crypto_ec_xform ec;
> +		/**< EC xform parameters, used by elliptic curve based
> +		 * operations.
> +		 */
> +	};
> +};
> +
> +/**
>   * Asymmetric Cryptographic Operation.
>   *
>   * Structure describing asymmetric crypto operation params.
> --
> 2.13.6


      reply	other threads:[~2024-10-01  7:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-29 18:59 [PATCH 1/3] " Arkadiusz Kusztal
2024-01-29 18:59 ` [PATCH 2/3] crypto/qat: add sm2 encryption/decryption function Arkadiusz Kusztal
2024-01-29 18:59 ` [PATCH 3/3] app/test: add test sm2 C1/Kp test cases Arkadiusz Kusztal
2024-02-01  8:07 ` [EXT] [PATCH 1/3] cryptodev: add ec points to sm2 op Akhil Goyal
2024-02-01 13:25   ` Kusztal, ArkadiuszX
2024-09-24 16:30     ` Akhil Goyal
2024-09-29 17:29 ` [PATCH v2] " Arkadiusz Kusztal
2024-10-01  7:57   ` Akhil Goyal [this message]

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=CO6PR18MB4484E6EBB76404B559EF340AD8772@CO6PR18MB4484.namprd18.prod.outlook.com \
    --to=gakhil@marvell.com \
    --cc=anoobj@marvell.com \
    --cc=arkadiuszx.kusztal@intel.com \
    --cc=brian.dooley@intel.com \
    --cc=dev@dpdk.org \
    --cc=gmuthukrishn@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).