From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 9D273A0471
	for <public@inbox.dpdk.org>; Fri, 19 Jul 2019 07:10:52 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id C34DC2BA8;
	Fri, 19 Jul 2019 07:10:51 +0200 (CEST)
Received: from mga01.intel.com (mga01.intel.com [192.55.52.88])
 by dpdk.org (Postfix) with ESMTP id 2833F231E
 for <dev@dpdk.org>; Fri, 19 Jul 2019 07:10:49 +0200 (CEST)
X-Amp-Result: SKIPPED(no attachment in message)
X-Amp-File-Uploaded: False
Received: from fmsmga004.fm.intel.com ([10.253.24.48])
 by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 18 Jul 2019 22:10:49 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.64,280,1559545200"; d="scan'208";a="191827007"
Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201])
 by fmsmga004.fm.intel.com with ESMTP; 18 Jul 2019 22:10:49 -0700
Received: from fmsmsx162.amr.corp.intel.com (10.18.125.71) by
 FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS)
 id 14.3.439.0; Thu, 18 Jul 2019 22:10:48 -0700
Received: from hasmsx108.ger.corp.intel.com (10.184.198.18) by
 fmsmsx162.amr.corp.intel.com (10.18.125.71) with Microsoft SMTP Server (TLS)
 id 14.3.439.0; Thu, 18 Jul 2019 22:10:48 -0700
Received: from HASMSX109.ger.corp.intel.com ([169.254.3.134]) by
 hasmsx108.ger.corp.intel.com ([169.254.9.15]) with mapi id 14.03.0439.000;
 Fri, 19 Jul 2019 08:10:45 +0300
From: "Kusztal, ArkadiuszX" <arkadiuszx.kusztal@intel.com>
To: Shally Verma <shallyv@marvell.com>, "dev@dpdk.org" <dev@dpdk.org>
CC: "akhil.goyal@nxp.com" <akhil.goyal@nxp.com>, "Trahe, Fiona"
 <fiona.trahe@intel.com>, "Nowak, DamianX" <damianx.nowak@intel.com>, "Sunila
 Sahu" <ssahu@marvell.com>, Ayuj Verma <ayverma@marvell.com>, "Kanaka Durga
 Kotamarthy" <kkotamarthy@marvell.com>
Thread-Topic: [EXT] [PATCH v5 2/7] cryptodev: add cipher field to RSA op
Thread-Index: AQHVPYNlqSGC/6ySgUuHp6o8SIi6TabRK44AgAA2pqA=
Date: Fri, 19 Jul 2019 05:10:45 +0000
Message-ID: <06EE24DD0B19E248B53F6DC8657831551B281435@hasmsx109.ger.corp.intel.com>
References: <20190718160943.10724-1-arkadiuszx.kusztal@intel.com>
 <20190718160943.10724-3-arkadiuszx.kusztal@intel.com>
 <BN6PR1801MB2052CFEC225C8B257F642551ADCB0@BN6PR1801MB2052.namprd18.prod.outlook.com>
In-Reply-To: <BN6PR1801MB2052CFEC225C8B257F642551ADCB0@BN6PR1801MB2052.namprd18.prod.outlook.com>
Accept-Language: pl-PL, en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
dlp-product: dlpe-windows
dlp-version: 11.0.600.7
dlp-reaction: no-action
x-originating-ip: [10.184.70.11]
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
Subject: Re: [dpdk-dev] [EXT] [PATCH v5 2/7] cryptodev: add cipher field to
	RSA op
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

> > ----------------------------------------------------------------------
> > Asymmetric nature of RSA algorithm suggest to use additional field for
> > output. In place operations still can be done by setting cipher and
> > message pointers with the same memory address.
> >
> > Signed-off-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
> > ---
> >  lib/librte_cryptodev/rte_crypto_asym.h | 43
> > ++++++++++++++++++++++++++++------
> >  1 file changed, 36 insertions(+), 7 deletions(-)
> >
> > diff --git a/lib/librte_cryptodev/rte_crypto_asym.h
> > b/lib/librte_cryptodev/rte_crypto_asym.h
> > index 02ec304..1d4ec80 100644
> > --- a/lib/librte_cryptodev/rte_crypto_asym.h
> > +++ b/lib/librte_cryptodev/rte_crypto_asym.h
> > @@ -395,21 +395,50 @@ struct rte_crypto_rsa_op_param {
> >
> >  	rte_crypto_param message;
> >  	/**<
> > -	 * Pointer to data
> > +	 * Pointer to input data
> >  	 * - to be encrypted for RSA public encrypt.
> > -	 * - to be decrypted for RSA private decrypt.
> >  	 * - to be signed for RSA sign generation.
> >  	 * - to be authenticated for RSA sign verification.
> > +	 *
> > +	 * Pointer to output data
> > +	 * - for RSA private decrypt.
> > +	 * In this case the underlying array should have been
> > +	 * allocated with enough memory to hold plaintext output
> > +	 * (i.e. must be at least RSA key size). The message.length
> > +	 * field should be 0 and will be overwritten by the PMD
> > +	 * with the decrypted length.
> > +	 *
> > +	 * All data is in Octet-string network byte order format.
> > +	 */
> As per Fiona feedback in another email, for PMD it does not matter what
> output buffer length is set to. All matters if it should be allocated lar=
ge
> enough as per description in spec.
> Given that, there is no need to mention specifically, that length should =
be set
> to 0. App can leave it to anything as PMD don't care. It does not and sho=
uld
> not check for any valid params here.
> Ditto is my feedback on cipher.length description below. There is no need=
 to
> mention, it should be set to 0 specifically
>=20
> If we agree, this change can be taken as part of next patch set. Current =
one
> can still go on.

I agree with Shally that it could be anything to work, but on the other han=
d I agree with Pablo and Fiona comment on future extensions and ABI breakag=
e. Especially on so early level of API development. When we change this fie=
ld in future that it can be random (which is possible) it will not break an=
ything, but it would not work in the opposite direction.

>=20
> Thanks
> Shally
>=20
>=20
>=20
> > +
> > +	rte_crypto_param cipher;
> > +	/**<
> > +	 * Pointer to input data
> > +	 * - to be decrypted for RSA private decrypt.
> > +	 *
> > +	 * Pointer to output data
> > +	 * - for RSA public encrypt.
> > +	 * In this case the underlying array should have been allocated
> > +	 * with enough memory to hold ciphertext output (i.e. must be
> > +	 * at least RSA key size). The cipher.length field should
> > +	 * be 0 and will be overwritten by the PMD with the encrypted
> > length.
> > +	 *
> > +	 * All data is in Octet-string network byte order format.
> >  	 */
> >
> >  	rte_crypto_param sign;
> >  	/**<
> > -	 * Pointer to RSA signature data. If operation is RSA
> > -	 * sign @ref RTE_CRYPTO_ASYM_OP_SIGN, buffer will be
> > -	 * over-written with generated signature.
> > +	 * Pointer to input data
> > +	 * - to be verified for RSA public decrypt.
> > +	 *
> > +	 * Pointer to output data
> > +	 * - for RSA private encrypt.
> > +	 * In this case the underlying array should have been allocated
> > +	 * with enough memory to hold signature output (i.e. must be
> > +	 * at least RSA key size). The sign.length field should
> > +	 * be 0 and will be overwritten by the PMD with the signature length.
> >  	 *
> > -	 * Length of the signature data will be equal to the
> > -	 * RSA modulus length.
> > +	 * All data is in Octet-string network byte order format.
> >  	 */
> >
> >  	enum rte_crypto_rsa_padding_type pad;
> > --
> > 2.1.0